/* --- ОБЩИЕ СТИЛИ И ШРИФТЫ --- */
@font-face {
    font-family: 'Cofo Sans';
    src: url('/assets/fonts/cofo-sans-regular.woff') format('woff');
}
body {
    margin: 0;
    font-family: 'Cofo Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    overflow: hidden;
    height: 100vh;
    -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }

/* --- УПРАВЛЕНИЕ ЭКРАНАМИ И РАЗМЫТИЕМ --- */
#background-screens {
    width: 100%; height: 100%;
    transition: filter 0.5s ease-out, transform 0.5s ease-out;
}
#background-screens.blurred {
    filter: blur(8px) brightness(0.7);
    transform: scale(0.98);
    pointer-events: none;
}
.screen {
    width: 100%; height: 100%; display: none;
    flex-direction: column; justify-content: center; align-items: center;
    padding: 20px;
}
.screen.active { display: flex; }
.modal-screen {
    position: fixed; top: 0; left: 0; z-index: 100;
    width: 100%; height: 100%; background-color: rgba(0,0,0,0.5);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-screen.active { opacity: 1; pointer-events: auto; }

/* --- ОБЩИЙ ВЕРХНИЙ БАР --- */
#top-bar-container {
    position: fixed; top: 20px; width: 100%;
    z-index: 10; padding: 0 20px;
    display: flex; justify-content: space-between;
}
.back-btn { background: none; border: none; font-size: 32px; color: #555; cursor: pointer; padding: 5px; }
.icon-btn { background: none; border: none; cursor: pointer; width: 44px; height: 44px; background-size: contain; background-repeat: no-repeat; background-position: center; }
#music-toggle-btn.on { background-image: url('/assets/images/icons/music_on.svg'); }
#music-toggle-btn.off { background-image: url('/assets/images/icons/music_off.svg'); }
#settings-btn { background-image: url('/assets/images/icons/settings.svg'); }

/* --- СТАРТОВЫЙ ЭКРАН --- */
#start-screen {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    text-align: center; justify-content: center;
}
#start-screen h1 {
    font-size: 48px; color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    margin-top: -10vh;
}
.main-menu { display: flex; flex-direction: column; gap: 20px; }
#start-screen button {
    padding: 15px 40px; font-size: 20px; font-family: 'Cofo Sans';
    border-radius: 50px; cursor: pointer; transition: all 0.2s;
}
#play-btn { background: white; color: #ff9a9e; border: none; padding: 20px 60px; font-size: 24px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
#play-btn:active { transform: scale(0.95); }
#goals-btn, #memories-btn { border: 2px solid white; background: transparent; color: white; }
#goals-btn:active, #memories-btn:active { background-color: rgba(255,255,255,0.2); transform: scale(0.95); }

/* --- МОДАЛЬНЫЕ ОКНА (ОБЩЕЕ) --- */
.modal-content {
    background: white; padding: 30px; border-radius: 20px;
    width: 90vw; max-width: 450px; text-align: center;
    animation: zoomIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: 90vh; overflow-y: auto;
}
@keyframes zoomIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- ИГРОВОЙ ЭКРАН --- */
#game-screen { background: none; }
.card-container { width: 90vw; max-width: 400px; height: 60vh; max-height: 500px; position: relative; }
.card {
    position: absolute; width: 100%; height: 100%;
    background-size: cover; background-position: center; border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); display: flex; justify-content: center;
    align-items: center; padding: 30px; font-size: 26px; text-align: center;
    line-height: 1.4; user-select: none;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.6s;
}
.card.easy { background-image: url('/assets/images/card_easy.png'); }
.card.medium { background-image: url('/assets/images/card_medium.png'); }
.card.hard { background-image: url('/assets/images/card_hard.png'); }
@keyframes card-enter { from { opacity: 0; transform: translateY(50px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
.card.enter { animation: card-enter 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.card.exit-like { transform: translateX(150%) rotate(30deg); opacity: 0; }
.card.exit-dislike { transform: translateX(-150%) rotate(-30deg); opacity: 0; }
.card.exit-favorite { transform: translateY(-150%) rotate(5deg); opacity: 0; }
.action-buttons { display: flex; justify-content: space-evenly; align-items: center; width: 100%; max-width: 450px; margin-top: 50px; }
.action-btn { background: white; border-radius: 50%; border: 1px solid #eee; box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center; transition: transform 0.2s; }
.action-btn:active { transform: scale(0.9); }
.action-btn.small { width: 60px; height: 60px; }
.action-btn img { width: 50%; height: 50%; pointer-events: none; }

/* --- ТАЙМЕР --- */
.timer-container { width: 80px; height: 80px; position: relative; margin-bottom: 40px; }
.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-svg circle { fill: none; stroke-width: 10; }
.timer-track { stroke: #eee; }
.timer-progress { stroke: #ff9a9e; stroke-dasharray: 283; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
#timer-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 32px; font-weight: bold; color: #333; }

/* --- ЭКРАНЫ ЦЕЛЕЙ И ВОСПОМИНАНИЙ --- */
#goals-screen, #memories-screen { justify-content: flex-start; padding-top: 80px; }
.goals-container, .memories-container { width: 90vw; max-width: 500px; height: 100%; overflow-y: auto; padding-bottom: 20px; }
#goals-screen { background-color: #f9f9f9; }
#goals-list { list-style: none; padding: 0; margin: 0; }
#goals-list li { display: flex; align-items: center; background: white; padding: 15px; border-radius: 10px; margin-bottom: 10px; font-size: 18px; transition: all 0.3s; }
#goals-list li.completed { opacity: 0.6; }
#goals-list li span { flex-grow: 1; transition: text-decoration 0.3s; }
#goals-list li.completed span { text-decoration: line-through; }
#goals-list li input[type="checkbox"] { width: 22px; height: 22px; margin-right: 15px; }
.add-goal-form { display: flex; margin-top: 20px; }
#new-goal-input { flex-grow: 1; border: 2px solid #ddd; border-radius: 10px 0 0 10px; padding: 15px; font-size: 16px; }
#add-goal-btn { border: none; background: #3498db; color: white; font-size: 30px; padding: 0 20px; border-radius: 0 10px 10px 0; cursor: pointer; }

#memories-screen { background-color: #fdf5e6; }
#show-add-memory-form-btn { padding: 15px 30px; font-size: 18px; background: #ff9a9e; color: white; border: none; border-radius: 50px; cursor: pointer; margin-bottom: 20px; }
#memories-list { list-style: none; padding: 0; width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.memory-plaque { background: white; padding: 15px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); cursor: pointer; text-align: center; transition: transform 0.2s; }
.memory-plaque:hover { transform: translateY(-5px); }
.plaque-date { font-weight: bold; font-size: 16px; display: block; }
.plaque-title { font-size: 14px; color: #666; }
#add-memory-modal .modal-content input, #add-memory-modal .modal-content textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; margin-bottom: 10px; font-size: 16px; font-family: 'Cofo Sans', sans-serif; }
input[type="file"] { display: none; }
.file-label { display: block; background: #eee; text-align: center; padding: 12px; border-radius: 8px; cursor: pointer; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: 8px; border: none; font-size: 16px; cursor: pointer; }
#save-memory-btn { background: #ff9a9e; color: white; }

/* --- POLAROID --- */
#view-memory-modal { background-color: rgba(0,0,0,0.7); }
.polaroid-container { text-align: center; }
.polaroid-frame {
    background: white; padding: 15px 15px 60px 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: rotate(-3deg); transition: transform 0.3s; position: relative;
}
.polaroid-frame:hover { transform: rotate(0deg) scale(1.05); }
.polaroid-frame img { display: block; width: 100%; max-width: 70vw; max-height: 60vh; object-fit: contain; }
#view-memory-title { position: absolute; bottom: 15px; left: 15px; right: 15px; font-size: 18px; font-weight: bold; text-align: center; }
.memory-full-text { color: white; margin-top: 30px; max-width: 80vw; line-height: 1.6; }
#close-view-memory-btn { margin-top: 20px; padding: 10px 30px; background: white; border: none; border-radius: 30px; font-size: 16px; cursor: pointer; }
.polaroid-frame::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%); pointer-events: none; }