@import url('../styles.css');

/* Mobile score */
.mobile-score {
    display: none;
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 1002;
    background: rgba(36,36,36,0.85);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-weight: bold;
}

/* Layout */
.responsive-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    box-sizing: border-box;
}
.game-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}
.info-side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 280px;
    max-width: 400px;
    background: rgba(36,36,36,0.85);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    padding: 2rem;
}
.info-side h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.info-side p { font-size: 1.1rem; margin-bottom: 1.5rem; color: var(--text-muted); }
.buttons-panel { display: flex; gap: 1rem; margin-top: 1.5rem; }
.score-panel { display: flex; gap: 1.5rem; font-size: 1.2rem; margin-bottom: 1.5rem; color: var(--text-muted); flex-wrap: wrap; }

@media (max-width: 900px) {
    .responsive-layout { flex-direction: column; align-items: center; gap: 1.5rem; padding: 1rem 0.5rem; }
    .info-side { max-width: 100vw; width: 100%; align-items: center; text-align: center; }
    .info-side h1 { font-size: 1.7rem; }
    .game-side { width: 100%; justify-content: center; }
}

body { background: var(--grad-bg); color: #fff; min-height: 100vh; margin: 0; }

/* ---- Simon board ---- */
.simon-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    padding: 12px;
    background: #0f0f1a;
    border-radius: 50%;
    width: 340px;
    height: 340px;
    box-sizing: border-box;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.6),
        inset 0 2px 8px rgba(255,255,255,0.04);
    position: relative;
}

/* ---- Simon buttons ---- */
.simon-btn {
    position: relative;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    opacity: 0.42;
    transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s, filter 0.18s;
    outline: none;
    overflow: hidden;
}

/* Radial gradient for depth */
#btn-green {
    background: radial-gradient(circle at 38% 35%, #54e07a 0%, #00c853 45%, #007a30 100%);
}
#btn-red {
    background: radial-gradient(circle at 38% 35%, #ff6b6b 0%, #d50000 45%, #7a0000 100%);
}
#btn-yellow {
    background: radial-gradient(circle at 38% 35%, #ffe566 0%, #ffd600 45%, #a08000 100%);
}
#btn-blue {
    background: radial-gradient(circle at 38% 35%, #6ba8ff 0%, #2962ff 45%, #00198a 100%);
}

/* Lit (Simon showing) */
.simon-btn.lit {
    opacity: 1;
    transform: scale(1.06);
}
#btn-green.lit  { box-shadow: 0 0 28px 8px #00c853, inset 0 0 18px rgba(255,255,255,0.15); filter: brightness(2); }
#btn-red.lit    { box-shadow: 0 0 28px 8px #d50000, inset 0 0 18px rgba(255,255,255,0.15); filter: brightness(2); }
#btn-yellow.lit { box-shadow: 0 0 28px 8px #ffd600, inset 0 0 18px rgba(255,255,255,0.15); filter: brightness(2); }
#btn-blue.lit   { box-shadow: 0 0 28px 8px #2962ff, inset 0 0 18px rgba(255,255,255,0.15); filter: brightness(2); }

/* Pressed (player input) */
.simon-btn.pressed {
    opacity: 1;
    transform: scale(0.93);
}
#btn-green.pressed  { box-shadow: 0 0 20px 6px #00c853; filter: brightness(1.8); }
#btn-red.pressed    { box-shadow: 0 0 20px 6px #d50000; filter: brightness(1.8); }
#btn-yellow.pressed { box-shadow: 0 0 20px 6px #ffd600; filter: brightness(1.8); }
#btn-blue.pressed   { box-shadow: 0 0 20px 6px #2962ff; filter: brightness(1.8); }

/* Musical note label on buttons */
.btn-note {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.05rem;
    font-weight: 900;
    color: rgba(255,255,255,0.0);
    pointer-events: none;
    transition: color 0.1s;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    letter-spacing: 0.02em;
}

.simon-btn.lit .btn-note,
.simon-btn.pressed .btn-note {
    color: rgba(255,255,255,0.88);
}

/* ---- Fail animation ---- */
@keyframes shake {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-8px); }
    30%  { transform: translateX(8px); }
    45%  { transform: translateX(-6px); }
    60%  { transform: translateX(6px); }
    75%  { transform: translateX(-3px); }
    90%  { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

@keyframes failFlash {
    0%,100% { filter: brightness(1); }
    25%,75% { filter: brightness(2.5) saturate(0) sepia(1) hue-rotate(-30deg); }
}

.simon-board.fail-shake {
    animation: shake 0.35s ease;
}

.simon-btn.fail-flash {
    animation: failFlash 0.4s ease 2;
}

/* ---- Level badge ---- */
@keyframes levelIn {
    0%   { opacity: 0; transform: translateY(-18px) scale(0.85); }
    60%  { opacity: 1; transform: translateY(4px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.level-badge {
    display: inline-block;
    background: var(--grad-primary);
    color: #111;
    font-size: 0.82rem;
    font-weight: 900;
    border-radius: 20px;
    padding: 0.25rem 0.85rem;
    margin-left: 0.4rem;
    vertical-align: middle;
    animation: levelIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ---- Speed mode label ---- */
.speed-mode {
    font-size: 0.82rem;
    font-style: italic;
    color: #8fd3f4;
    min-height: 1.2em;
    margin-top: -0.5rem;
    margin-bottom: 0.8rem;
}

/* ---- Status ---- */
#status {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
    min-height: 1.5em;
    transition: color 0.2s;
}

#status.error {
    color: #ff5252;
    font-weight: bold;
}

/* ---- Score animated ---- */
.score-animated {
    display: inline-block;
    transition: transform 0.15s ease;
}
.score-animated.bump {
    transform: scale(1.35);
}

/* ---- Buttons ---- */
#startBtn, #restartBtn {
    background: var(--grad-primary);
    color: #222; border: none; border-radius: 8px;
    padding: 0.9rem 2rem; font-size: 1.1rem; font-weight: bold;
    cursor: pointer; margin: 0 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.2s, transform 0.2s;
}
#startBtn:hover, #restartBtn:hover { opacity: 0.9; transform: scale(1.05); }
#playAgainBtn {
    background: #8fd3f4; color: #222; border: none; border-radius: 8px;
    padding: 1rem 2.2rem; font-size: 1.2rem; font-weight: bold;
    cursor: pointer; transition: background 0.2s; margin-top: 1rem;
}
#playAgainBtn:hover { background: #5ec2e6; }

.popup {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(24,24,24,0.95); display: flex;
    align-items: center; justify-content: center; z-index: 1000;
}
.popup-content {
    background: #242424; padding: 2.5rem 3rem; border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4); text-align: center;
    min-width: 280px; max-width: 90vw;
}
.popup-content h2 { margin-top: 0; color: #8fd3f4; font-size: 2rem; }
.popup-content p { font-size: 1.5rem; margin: 1.5rem 0; }
