/* ============================================================
 * IDID Pushback — Flappy Dodo
 * Responsive layout: desktop = side panels + canvas, mobile = canvas only
 * Canvas target size: 384 × 720 (Phaser.Scale.FIT)
 * ============================================================ */

* {
    box-sizing: border-box;
}

/* ============================================================
 * Password Gate
 * ============================================================ */
#password-gate {
    position: fixed;
    /* explicit 4-property — `inset: 0` shorthand 은 Samsung Internet 14.0+
       (2021-04) 부터 지원. 구형 갤럭시 단말 대응을 위해 호환 안전한 형태로 유지. */
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.gate-box {
    text-align: center;
    padding: 48px 40px;
    background: rgba(8, 20, 32, 0.85);
    border: 1px solid rgba(61, 221, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.gate-title {
    margin: 0;
    font-size: 56px;
    letter-spacing: 10px;
    background: linear-gradient(90deg, #3DDDFF, #FFFFFF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 900;
}

.gate-subtitle {
    margin: 4px 0 32px;
    font-size: 14px;
    letter-spacing: 6px;
    color: #FFFFFF;
    opacity: 0.85;
}

#gate-input {
    display: block;
    width: 240px;
    margin: 0 auto 16px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: monospace;
    letter-spacing: 4px;
    text-align: center;
    color: #FFFFFF;
    background: rgba(61, 221, 255, 0.08);
    border: 1px solid rgba(61, 221, 255, 0.4);
    border-radius: 8px;
    outline: none;
}

#gate-input:focus {
    border-color: #3DDDFF;
    box-shadow: 0 0 12px rgba(61, 221, 255, 0.3);
}

#gate-btn {
    display: block;
    width: 240px;
    margin: 0 auto;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #081420;
    background: linear-gradient(90deg, #3DDDFF, #7FF6FF);
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#gate-btn:hover {
    opacity: 0.9;
}

/* ============================================================
 * Mode Select (PUSHBACK / NEW ALBUM)
 * Tone-matched to the gate: dark navy box, cyan glow accents.
 * ============================================================ */
#mode-select {
    position: fixed;
    /* explicit 4-property — `inset: 0` shorthand 호환 이슈 회피 (구형 Samsung Internet 등). */
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.65);
}

.mode-select-box {
    text-align: center;
    padding: 40px 36px;
    background: rgba(8, 20, 32, 0.92);
    border: 1px solid rgba(61, 221, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    min-width: 320px;
}

.mode-select__brand {
    margin: 0;
    font-size: 40px;
    letter-spacing: 8px;
    background: linear-gradient(90deg, #3DDDFF, #FFFFFF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 900;
}

.mode-select__brand-sub {
    margin: 2px 0 24px;
    font-size: 12px;
    letter-spacing: 5px;
    color: #FFFFFF;
    opacity: 0.75;
}

.mode-select__title {
    margin: 0 0 20px;
    font-size: 13px;
    letter-spacing: 4px;
    color: rgba(127, 246, 255, 0.7);
    font-weight: 600;
}

.mode-select__btn {
    display: block;
    width: 240px;
    margin: 0 auto 12px;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #081420;
    background: linear-gradient(90deg, #3DDDFF, #7FF6FF);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}

.mode-select__btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.mode-select__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.mode-select__btn--accent {
    background: linear-gradient(90deg, #80D8FF, #4FC3F7);
    box-shadow: 0 0 14px rgba(128, 216, 255, 0.4);
}

.mode-select__hint {
    margin: 20px 0 0;
    padding: 0;
    list-style: none;
    font-size: 11px;
    line-height: 1.6;
    color: rgba(180, 230, 255, 0.7);
}

.mode-select__note {
    margin: 12px 0 0;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
}

.gate-error {
    margin: 16px 0 0;
    font-size: 13px;
    color: #ff6b6b;
    min-height: 18px;
}

/* ============================================================
 * Game Info Screen
 * ============================================================ */
#game-info {
    position: fixed;
    /* explicit 4-property — `inset: 0` shorthand 호환 이슈 회피. */
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9998;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Samsung Internet (Galaxy) 스크롤 이슈 대응.
       - overscroll-behavior-y: contain — pull-to-refresh / 스크롤 체인이
         body 로 전파되어 위로 스크롤이 막히는 버그 차단 (iOS Safari 미발생).
       - touch-action: pan-y — 세로 pan 만 허용. 일부 Samsung Internet 버전에서
         `auto` 일 때 첫 pointerdown 의 fullscreen 트리거와 충돌해 스크롤이
         block 되는 케이스 회피. */
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.info-container {
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 32px 64px;
    text-align: center;
}

.info-title {
    margin: 0;
    font-size: 52px;
    letter-spacing: 12px;
    background: linear-gradient(90deg, #3DDDFF, #FFFFFF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 900;
}

.info-subtitle {
    margin: 4px 0 12px;
    font-size: 14px;
    letter-spacing: 5px;
    color: #FFFFFF;
    opacity: 0.8;
    font-weight: 400;
}

.info-desc {
    margin: 0 0 36px;
    font-size: 13px;
    color: rgba(180, 230, 255, 0.6);
    line-height: 1.5;
}

/* ----- Feature comparison table ----- */
.info-card {
    background: rgba(8, 20, 32, 0.55);
    border: 1px solid rgba(61, 221, 255, 0.18);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}

.info-card__title {
    margin: 0;
    padding: 14px 20px 10px;
    font-size: 11px;
    letter-spacing: 3px;
    color: rgba(127, 246, 255, 0.75);
    font-weight: 700;
    text-transform: uppercase;
    text-align: left;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.6;
}

.info-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 12px;
    letter-spacing: 2px;
    color: #7FF6FF;
    font-weight: 700;
    background: rgba(61, 221, 255, 0.08);
    border-bottom: 1px solid rgba(61, 221, 255, 0.2);
}

.info-table th:not(:last-child) {
    border-right: 1px solid rgba(61, 221, 255, 0.1);
}

.info-table td {
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(61, 221, 255, 0.07);
}

.info-table td:not(:last-child) {
    border-right: 1px solid rgba(61, 221, 255, 0.07);
}

.info-table tbody tr:hover {
    background: rgba(61, 221, 255, 0.04);
}

.info-table tbody tr:last-child td {
    border-bottom: none;
}

.info-table__pending td {
    opacity: 0.3;
    font-style: italic;
}

/* ----- 2-column grid (gameplay / roadmap) ----- */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    text-align: left;
    margin-top: 16px;
    align-items: stretch;
}

.info-grid .info-card {
    height: 100%;
}

.info-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-card--list {
    padding: 16px 20px;
    text-align: left;
}

.info-play-list {
    margin: 0;
    padding: 0 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.55;
}

.info-play-list ul {
    margin: 3px 0 0;
    padding: 0 0 0 16px;
}

.info-play-list--dim {
    color: rgba(255, 255, 255, 0.85);
}

/* ----- Bottom grid: request checklist + bg image ----- */
.info-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 16px;
    margin-top: 16px;
    align-items: stretch;
}

.info-bottom-grid .info-bg-section {
    display: flex;
    align-items: center;
}

.info-bottom-grid .info-card {
    height: 100%;
}

.info-req-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
}

.info-req-list__group {
    font-weight: 700;
    color: rgba(180, 230, 255, 0.9);
    margin-top: 10px;
}

.info-req-list__group:first-child {
    margin-top: 0;
}

.info-req-list__group ul {
    list-style: disc;
    margin: 2px 0 0;
    padding: 0 0 0 20px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
}

.info-bg-section {
    text-align: left;
}

.info-bg-preview {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(61, 221, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ----- Start button ----- */
#info-start-btn {
    display: inline-block;
    margin-top: 32px;
    padding: 16px 56px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 6px;
    color: #081420;
    background: linear-gradient(90deg, #3DDDFF, #7FF6FF);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 4px 20px rgba(61, 221, 255, 0.3);
}

#info-start-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.87);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(ellipse at top, #0a1e2e 0%, #081420 50%, #02060c 100%);
    overflow: hidden;
    /* Defense in depth — body 자체도 overscroll chain 차단.
       Samsung Internet 의 fixed container + overflow sibling 버그 (Galaxy S10
       + Browser 16 documented) 에서 inner #game-info 스크롤이 body 로 누설되며
       위로 스크롤이 막히는 케이스 회피. iOS Safari 는 무시. */
    overscroll-behavior: none;
}

#app {
    width: 100%;
    /* 100dvh 는 Samsung Internet 21.0+ (2023-05) 부터 지원.
       100vh fallback 으로 구버전 대응 — 신버전은 cascade로 100dvh 사용. */
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 16px;
}

#game-container {
    flex: 0 0 auto;
    width: 384px;
    height: 720px;
    max-width: 100%;
    /* 100dvh fallback — Samsung Internet < 21.0 대응. */
    max-height: 100vh;
    max-height: 100dvh;
    background-color: #091928;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    overflow: hidden;
}

#game-container canvas {
    display: block;
    margin: 0 auto;
}

/* ----- PC side panels (shared) ----- */
.pc-panel {
    flex: 0 0 280px;
    max-width: 320px;
    height: 720px;
    padding: 24px 20px;
    color: #b4e6ff;
    background: linear-gradient(180deg, rgba(61, 221, 255, 0.08) 0%, rgba(8, 20, 32, 0.5) 100%);
    border: 1px solid rgba(61, 221, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(15, 143, 191, 0.12);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ----- Left panel: brand + album art ----- */
.pc-brand {
    text-align: center;
}

.pc-brand__title {
    margin: 0;
    font-size: 48px;
    letter-spacing: 8px;
    background: linear-gradient(90deg, #3DDDFF, #FFFFFF);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 900;
}

.pc-brand__subtitle {
    margin: 4px 0 0;
    font-size: 14px;
    letter-spacing: 6px;
    color: #FFFFFF;
    opacity: 0.85;
}

.pc-brand__tagline {
    margin: 0;
    text-align: center;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(180, 230, 255, 0.55);
}

.pc-album-art {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    background: linear-gradient(135deg, #3DDDFF 0%, #0F8FBF 50%, #FFFFFF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.pc-album-art__inner {
    width: 80%;
    aspect-ratio: 1 / 1;
    background: rgba(8, 20, 32, 0.65);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-album-art__label {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #FFFFFF;
    text-shadow: 0 0 12px rgba(127, 246, 255, 0.5);
}

/* Album cover image (when injected via pcPanel.ts) */
.pc-album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* ----- Left panel: album info + now playing ----- */
.pc-album-info {
    margin-top: 12px;
    text-align: center;
    color: rgba(180, 230, 255, 0.85);
    font-family: monospace;
}
.pc-album-info__track {
    font-size: 16px;
    font-weight: bold;
    color: #FFFFFF;
    margin: 4px 0;
}
.pc-album-info__artist {
    font-size: 13px;
    color: #7FF6FF;
    margin: 2px 0;
}
.pc-album-info__album {
    font-size: 11px;
    color: rgba(180, 230, 255, 0.6);
    margin: 2px 0;
    text-align: center;
}

.pc-track-info__brand {
    color: #80D8FF;
    font-weight: bold;
}

.pc-now-playing {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(127, 246, 255, 0.45);
    transition: color 0.3s;
}
.pc-now-playing.is-active {
    color: #7FF6FF;
}
.pc-now-playing__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3DDDFF;
    opacity: 0.3;
}
.pc-now-playing.is-active .pc-now-playing__dot {
    opacity: 1;
    animation: pcPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(61, 221, 255, 0.6);
}
@keyframes pcPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* ----- Synced lyrics ----- */
.pc-lyrics {
    margin-top: 10px;
    min-height: 56px;
    text-align: center;
    font-family: monospace;
}
.pc-lyrics__current {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 0 6px rgba(127, 246, 255, 0.5);
    transition: opacity 0.25s ease;
    margin: 0 0 4px 0;
    min-height: 18px;
    line-height: 1.3;
}
.pc-lyrics__next {
    font-size: 11px;
    color: rgba(180, 230, 255, 0.45);
    transition: opacity 0.25s ease;
    margin: 0;
    min-height: 14px;
    line-height: 1.3;
}

/* ----- Right panel: stats blocks ----- */
.pc-stat-block {
    background: rgba(8, 20, 32, 0.5);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(127, 246, 255, 0.15);
}

.pc-stat-block__title {
    margin: 0 0 8px;
    font-size: 11px;
    letter-spacing: 3px;
    color: rgba(127, 246, 255, 0.75);
    font-weight: 700;
    text-transform: uppercase;
}

.pc-stat-block__value {
    margin: 0;
    font-family: "Courier New", monospace;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 12px rgba(61, 221, 255, 0.45);
}

.pc-stat-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pc-stat-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
}

.pc-stat-list__label {
    color: rgba(180, 230, 255, 0.6);
    letter-spacing: 1px;
}

.pc-stat-list__value {
    font-family: "Courier New", monospace;
    color: #7FF6FF;
    font-weight: 600;
}

/* ============================================================
 * Mobile (< 768px): hide side panels, fullscreen canvas
 * ============================================================ */
@media (max-width: 767px) {
    #app {
        gap: 0;
        padding: 0;
        flex-direction: column;
    }

    .pc-panel {
        display: none;
    }

    #game-container {
        width: 100%;
        /* 100dvh fallback — Samsung Internet < 21.0 대응. 모바일 분기에서 가장 중요:
           이 값이 무시되면 게임 컨테이너 높이가 0 → 게임 자체가 안 보임. */
        height: 100vh;
        height: 100dvh;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .info-container {
        padding: 24px 12px 40px;
    }

    .info-title {
        font-size: 36px;
        letter-spacing: 8px;
    }

    .info-subtitle {
        font-size: 12px;
        letter-spacing: 3px;
    }

    .info-table th,
    .info-table td {
        padding: 8px 12px;
        font-size: 12px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
 * Desktop (>= 768px): explicit row layout (already default,
 * but kept here for clarity & future overrides)
 * ============================================================ */
@media (min-width: 768px) {
    #app {
        flex-direction: row;
    }
}
