@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@400;600&display=swap');

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 10%, rgba(34, 197, 94, 0.16), transparent 34%),
        radial-gradient(circle at 88% 15%, rgba(59, 130, 246, 0.18), transparent 30%),
        linear-gradient(165deg, #11131e 0%, #191a2a 55%, #10121b 100%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-attachment: fixed;
    color: #eef2ff;
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

.g5-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 12px;
    padding: 14px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    backdrop-filter: blur(3px);
}

.g5-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.65rem;
    letter-spacing: 0.06em;
    color: #fef08a;
    text-shadow: 0 0 16px rgba(250, 204, 21, 0.35);
}

.g5-balance {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    justify-self: center;
    font-size: 1.25rem;
    color: #bbf7d0;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
    white-space: nowrap;
}

.g5-balance strong { color: #4ade80; }

.g5-coin-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    position: relative;
    display: inline-block;
    background: radial-gradient(circle at 30% 30%, #fff0a8 0%, #ffd84a 35%, #f2b11c 70%, #c57f00 100%);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.g5-coin-icon::after {
    content: 'G';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.95rem;
    color: #5c3a00;
}

.g5-nav {
    display: flex;
    gap: 10px;
}

.g5-nav-btn,
button.g5-nav-btn,
.g5-btn {
    font-family: 'Oswald', sans-serif;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}

.g5-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 20px 44px;
}

.g5-hidden { display: none !important; }

.g5-warn {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fcd34d;
    padding: 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.g5-shell { margin-top: 4px; }

.g5-shell.g5-game-blocked {
    display: none !important;
}

.g5-top-row {
    display: grid;
    grid-template-columns: 195px 1fr;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 10px;
}

.g5-image-box {
    width: 195px;
    aspect-ratio: 9 / 16;
    height: auto;
    margin: 0;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
    display: block;
    position: relative;
    flex-shrink: 0;
}

.g5-character-photo {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    background: #0f0f13;
}

.g5-text-panel {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.24);
    min-height: calc(195px * 16 / 9);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.g5-source-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px 2px;
    flex-shrink: 0;
}

.g5-source {
    font-size: calc(1.02rem + 2px);
    color: #e2e8f0;
    margin-bottom: 0;
}

.g5-tts-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.g5-tts-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.g5-tts-btn:hover {
    transform: scale(1.12);
}

.g5-tts-controls .tts-play {
    background: #22c55e;
    color: #fff;
}

.g5-tts-controls .tts-pause {
    background: #f59e0b;
    color: #fff;
}

.g5-tts-controls .tts-stop {
    background: #ef4444;
    color: #fff;
}

.g5-tts-controls .tts-speed {
    background: #444;
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}

.g5-tts-speed {
    min-width: 34px;
    text-align: center;
    color: #aaa;
    font-size: 0.95rem;
}

.g5-tts-free {
    margin-left: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(56, 214, 123, 0.55);
    background: rgba(17, 53, 38, 0.85);
    color: #b8ffd8;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.g5-tts-free::before {
    content: 'Free listens: ';
    font-weight: 600;
    color: #8fd9ad;
}

.g5-tts-free.is-empty {
    border-color: rgba(232, 168, 56, 0.65);
    background: rgba(58, 46, 18, 0.9);
    color: #ffe8b8;
}

.g5-tts-free.is-empty::before {
    color: #e8c06a;
}

.g5-slots {
    min-height: 180px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
    padding: 12px 8px 8px;
    flex: 1 1 auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(5, 7, 15, 0.5);
    margin-top: 4px;
    margin-bottom: 8px;
}

.g5-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    min-height: 56px;
    border-radius: 8px;
    border: 1px dashed #6e7ec6;
    background: #0e1323;
    color: #a8b7ea;
    font-weight: 700;
    padding: 6px 12px;
    font-size: 1.55rem;
    line-height: 1.15;
}

.g5-slot.g5-slot--punct {
    min-width: 56px;
    padding: 6px 10px;
}

.g5-slot.is-filled {
    border-style: solid;
    border-color: #35d17d;
    background: #113526;
    color: #d8ffe8;
}

.g5-slot.g5-slot--revealed-correct {
    border-color: #35d17d;
    background: #113526;
    color: #d8ffe8;
}

.g5-slot.g5-slot--revealed-wrong {
    border-color: #e34a4a;
    background: #3a1520;
    color: #ffc9c9;
    box-shadow: 0 0 12px rgba(227, 74, 74, 0.35);
}

.g5-slot.g5-slot--revealed-missing {
    border-color: #e8a838;
    background: #3a2e12;
    color: #ffe8b8;
    box-shadow: 0 0 12px rgba(232, 168, 56, 0.35);
}

.g5-options {
    min-height: 120px;
    display: grid;
    grid-template-columns: repeat(5, minmax(96px, 1fr));
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(5, 7, 15, 0.55);
    margin-bottom: 12px;
}

.g5-options.g5-options--answer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.g5-answer-label {
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #86efac;
}

.g5-answer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.g5-answer-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid #35d17d;
    background: #113526;
    color: #d8ffe8;
    font-weight: 700;
    font-size: 1.32rem;
    line-height: 1.15;
}

.g5-answer-chip.g5-answer-chip--punct {
    min-width: 44px;
    padding: 6px 10px;
}

.g5-option {
    user-select: none;
    cursor: grab;
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 10px;
    padding: 6px 8px;
    background: rgba(27, 42, 87, 0.9);
    color: #e8efff;
    font-weight: 700;
    font-size: 1.32rem;
    text-align: center;
    min-height: 40px;
    display: grid;
    place-items: center;
}

.g5-option:active { cursor: grabbing; }

.g5-timer-wrap {
    height: 6px;
    border-radius: 999px;
    background: #20253c;
    overflow: hidden;
    border: 1px solid #3e4b7e;
    margin-bottom: 14px;
}

.g5-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #38d67b 0%, #f1d450 62%, #e34a4a 100%);
    transform-origin: left center;
}

.g5-timer-bar.is-critical {
    animation: g5shake 0.22s infinite;
}

@keyframes g5shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-1px); }
    50% { transform: translateX(1px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.g5-actions {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    justify-items: end;
}

.g5-btn {
    font-size: 1.35rem;
    padding: 12px 22px;
    border-radius: 10px;
    color: #e5e7eb;
}

.g5-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.g5-win-text {
    text-align: center;
    font-size: 1.25rem;
    color: #86efac;
    min-height: 24px;
    justify-self: center;
}

.g5-win-text.g5-error {
    color: #fca5a5;
}

.g5-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.g5-modal.g5-hidden {
    display: none !important;
}

.g5-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.g5-modal-box {
    position: relative;
    max-width: min(780px, calc(100vw - 40px));
    width: 100%;
    padding: 26px 30px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.35);
    background: #1a1a22;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.g5-modal-title {
    margin: 0 0 14px;
    font-size: 1.35rem;
    color: #f3f4f6;
}

.g5-modal-text {
    margin: 0 0 18px;
    color: #d1d5db;
}

.g5-instructions-list {
    margin: 0 0 12px;
    padding-left: 1.2em;
}

.g5-instructions-list li {
    margin-bottom: 0.35em;
}

.g5-modal-note {
    margin: 0;
    color: #fde68a;
}

.g5-prompt-hint {
    color: #cbd5e1;
    font-weight: 500;
}
