:root
{
    --bg:#0b0f14;
    --text:#e8eef6;
    --muted:#a7b4c6;
    --accent:#4da3ff;
    --bad:#ff5c7a;
    --good:#42d392;
    --line:#223045;
    --radius:14px;
    --shadow: 0 10px 30px rgba(0,0,0,.35);

    --pad: 14px;
    --hPad: 16px;
    --title: 16px;
    --textSize: 16px;

    --bgBase: #0b0f14;
    --bgGlow1: rgba(77,163,255,.10);
    --bgGlow2: rgba(66,211,146,.08);

    --headerBg: rgba(17,24,38,.85);

    --cardTop: rgba(17,24,38,.92);
    --cardBot: rgba(15,22,34,.86);

    --surface1: rgba(0,0,0,.18);
    --surface2: rgba(0,0,0,.12);
    --surface3: rgba(0,0,0,.16);

    --borderSoft: rgba(255,255,255,.08);
    --borderSoft2: rgba(255,255,255,.10);

    --btnTop: rgba(255,255,255,.07);
    --btnBot: rgba(0,0,0,.22);
    --btnBorder: rgba(255,255,255,.14);
    --btnHoverBorder: rgba(77,163,255,.55);
    --btnShadow: 0 10px 22px rgba(0,0,0,.28);

    --btnSecondaryBg: rgba(0,0,0,.10);

    --pillBg: rgba(0,0,0,.12);
    --pillBorder: rgba(255,255,255,.10);

    --focusRing: 0 0 0 3px rgba(77,163,255,.28);

    color-scheme: light dark;

    --noticeBg: rgba(77,163,255,.10);
    --noticeBorder: rgba(77,163,255,.22);
    --noticeText: var(--text);

    --noticeNeutralBg: rgba(0,0,0,.12);
    --noticeNeutralBorder: rgba(255,255,255,.10);

    --noticeWarnBg: rgba(255,92,122,.08);
    --noticeWarnBorder: rgba(255,92,122,.22);
    --noticeWarnText: var(--text);
}

html[data-theme="light"]
{
    --bgBase: #f6f8fc;
    --text: #0b1220;
    --muted: #4a5a73;

    --line: rgba(15, 25, 45, .14);

    --headerBg: rgba(255,255,255,.85);

    --cardTop: rgba(255,255,255,.92);
    --cardBot: rgba(245,248,255,.92);

    --surface1: rgba(255,255,255,.70);
    --surface2: rgba(255,255,255,.55);
    --surface3: rgba(255,255,255,.45);

    --borderSoft: rgba(15, 25, 45, .10);
    --borderSoft2: rgba(15, 25, 45, .14);

    --shadow: 0 10px 30px rgba(0,0,0,.12);

    --bgGlow1: rgba(77,163,255,.10);
    --bgGlow2: rgba(66,211,146,.10);

    --btnTop: rgba(255,255,255,.95);
    --btnBot: rgba(235,240,250,.92);
    --btnBorder: rgba(15,25,45,.16);
    --btnHoverBorder: rgba(15,25,45,.30);
    --btnShadow: 0 10px 22px rgba(0,0,0,.10);

    --btnSecondaryBg: rgba(15,25,45,.06);

    --pillBg: rgba(15,25,45,.06);
    --pillBorder: rgba(15,25,45,.12);

    --focusRing: 0 0 0 3px rgba(77,163,255,.22);

    --noticeBg: rgba(15,25,45,.04);
    --noticeBorder: rgba(15,25,45,.14);
    --noticeText: #0b1220;

    --noticeNeutralBg: rgba(15,25,45,.03);
    --noticeNeutralBorder: rgba(15,25,45,.12);

    --noticeWarnBg: rgba(255,92,122,.10);
    --noticeWarnBorder: rgba(255,92,122,.25);
    --noticeWarnText: #0b1220;
}

@media (max-width: 980px)
{
    :root
    {
        --pad: 12px;
        --hPad: 12px;
        --title: 16px;
        --textSize: 16px;
    }
}

@media (max-width: 520px)
{
    :root
    {
        --pad: 10px;
        --hPad: 10px;
        --title: 15px;
        --textSize: 16px;
    }
}

*
{
    box-sizing:border-box;
}

html,
body,
.card,
.content,
.btn,
.toggle,
.volCtl,
.pill,
.settingsRow,
.choice
{
    transition:
        background-color .18s ease,
        color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
}

body
{
    margin:0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
    background:
        radial-gradient(1200px 600px at 30% 10%, var(--bgGlow1), transparent 60%),
        radial-gradient(900px 500px at 80% 40%, var(--bgGlow2), transparent 60%),
        var(--bgBase);
    color:var(--text);
    min-height:100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    display:flex;
    flex-direction:column;
    /* Safe area padding for notched devices */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

header
{
    display:flex; gap:10px; align-items:center; justify-content:space-between;
    padding:12px var(--hPad);
    border-bottom:1px solid var(--line);
    background: var(--headerBg);
    backdrop-filter: blur(10px);
    position:sticky; top:0; z-index:10;
}

header .left
{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}

.brand
{
    display:flex;
    align-items:center;
    gap:10px;
    font-weight:800;
    letter-spacing:.2px;
    white-space:nowrap
}

.brand .dot
{
    width:10px;
    height:10px;
    border-radius:999px;
    background:var(--accent);
    box-shadow:0 0 0 6px rgba(77,163,255,.18)
}

.coverThumb
{
    width:38px;
    height:46px;
    border-radius:10px;
    object-fit:cover;
    border:1px solid var(--borderSoft);
    display:none;
    flex:0 0 auto;
}

.pill
{
    font-size:12px;
    color:var(--muted);
    padding:6px 10px;
    border:1px solid var(--pillBorder);
    border-radius:999px;
    background: var(--pillBg);
    white-space:nowrap;
    max-width: 44vw;
    overflow:hidden;
    text-overflow:ellipsis;
}

.row
{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    align-items:center;
}

@media (max-width: 720px)
{
    header
    {
        flex-direction:column;
        align-items:stretch;
        gap:10px;
    }

    header .left
    {
        justify-content:space-between;
        width:100%;
    }

    header .row
    {
        width:100%;
        flex-wrap:nowrap;
        overflow-x:auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom:6px;
    }

    header .row::-webkit-scrollbar
    {
        height:6px;
    }

    header .row::-webkit-scrollbar-thumb
    {
        background: rgba(255,255,255,.15);
        border-radius:999px;
    }
}

@media (max-width: 480px)
{
    header
    {
        padding: 10px var(--hPad);
        gap: 8px;
    }

    header .row
    {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: visible;
    }

    header .row .btn
    {
        font-size: 13px;
        padding: 10px 8px;
        text-align: center;
        justify-content: center;
    }

    header .row .btn:first-child
    {
        grid-column: 1 / -1;
    }

    .brand
    {
        font-size: 14px;
    }

    .brand .dot
    {
        width: 8px;
        height: 8px;
    }
}

main
{
    padding: var(--pad);
    max-width: 1400px;
    width:100%;
    margin:0 auto;
    flex:1;
    display:flex;
    /* Better mobile scrolling */
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px)
{
    main
    {
        padding: 8px;
    }
}

.card
{
    width:100%;
    background: linear-gradient(180deg, var(--cardTop), var(--cardBot));
    border:1px solid var(--borderSoft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow:hidden;
}

.card .hd
{
    padding:12px 14px;
    border-bottom:1px solid var(--borderSoft);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

.card .hd h2
{
    margin:0;
    font-size:14px;
    color: var(--text);
}

.btn
{
    appearance:none;
    border:1px solid var(--btnBorder);
    background: linear-gradient(180deg, var(--btnTop), var(--btnBot));
    color: var(--text);
    padding:10px 12px;
    border-radius: 12px;
    cursor:pointer;
    font-weight:800;
    transition: transform .08s ease, border-color .15s ease, filter .15s ease, box-shadow .15s ease;
    user-select:none;
    white-space:nowrap;
    box-shadow: var(--btnShadow);
}

.btn:hover
{
    border-color: var(--btnHoverBorder);
    filter: brightness(1.03);
}

.btn:active
{
    transform: translateY(1px);
    filter: brightness(0.98);
}

.btn.secondary
{
    background: var(--btnSecondaryBg);
    font-weight:750;
    box-shadow:none;
}

.btn.good
{
    border-color: rgba(66,211,146,.35);
}

.btn:disabled
{
    opacity:.45;
    cursor:not-allowed;
    box-shadow:none;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse)
{
    .btn
    {
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:hover
    {
        filter: none;
        border-color: var(--btnBorder);
    }

    .btn:active
    {
        filter: brightness(0.95);
        transform: scale(0.98);
    }

    .toggle
    {
        min-height: 40px;
        -webkit-tap-highlight-color: transparent;
    }

    .choice:hover
    {
        filter: none;
        border-color: var(--borderSoft2);
    }

    .choice:active
    {
        filter: brightness(0.98);
        transform: scale(0.99);
    }
}

.btn.pauseOn
{
    border-color: rgba(255,255,255,.28);
    background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.14));
}

.btn:focus-visible,
.toggle:focus-visible,
.choice:focus-visible,
.textInput:focus-visible
{
    outline: none;
    box-shadow: var(--focusRing);
}

.toggle, .volCtl
{
    display:flex;
    gap:8px; align-items:center;
    padding:8px 10px;
    border-radius: 999px;
    border:1px solid var(--borderSoft2);
    background: var(--surface2);
    color: var(--muted);
    font-size:12px;
    user-select:none;
    white-space:nowrap;
}

.toggle
{
    cursor:pointer;
}

.toggle input
{
    accent-color: var(--accent);
}

.volCtl
{
    cursor:default;
}

.volCtl .lbl
{
    white-space:nowrap;
}

.volCtl input[type="range"]
{
    width:140px;
    accent-color: var(--accent);
}

.volCtl .pct
{
    min-width: 42px;
    text-align:right;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 520px)
{
    .volCtl input[type="range"]
    {
        width: 46vw;
        max-width: 200px;
    }

    .volCtl .pct
    {
        min-width: 38px;
    }
}

.sceneWrap
{
    padding:14px;
    min-height: 520px;
    display:flex;
    flex-direction:column;
    gap:12px;
    position:relative;
}

@media (max-width: 520px)
{
    .sceneWrap
    {
        padding:12px;
        min-height: 520px;
    }
}

.sceneTop
{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
}

.sceneTitle
{
    display:flex;
    flex-direction:column;
    gap:4px;
    min-width:0;
}

.sceneTitle .t
{
    font-weight:900;
    font-size: var(--title);
    line-height:1.15;
    word-break: break-word;
}

.sceneTitle .s
{
    color:var(--muted);
    font-size:12px;
    word-break: break-word;
}

.progress
{
    display:flex; align-items:center; gap:10px;
    padding:8px 10px;
    border:1px solid var(--pillBorder);
    border-radius: 999px;
    background: var(--pillBg);
    font-size:12px;
    color:var(--muted);
    flex:0 0 auto;
}

.bar
{
    width:120px; height:8px; border-radius:999px;
    background: rgba(255,255,255,.10);
    overflow:hidden;
}

html[data-theme="light"] .bar
{
    background: rgba(15,25,45,.10);
}

.bar > i
{
    display:block; height:100%; width:0%;
    background: linear-gradient(90deg, rgba(77,163,255,.9), rgba(66,211,146,.9));
    border-radius:999px;
    transition: width .25s ease;
}

@media (max-width: 520px)
{
    .progress
    {
        width:100%;
        justify-content:space-between;
    }

    .bar
    {
        flex:1;
        width:auto;
    }
}

.content
{
    background: var(--surface1);
    border:1px solid var(--borderSoft);
    border-radius: 16px;
    padding:14px;
    flex:1;
    overflow:auto;
}

@media (max-width: 520px)
{
    .content
    {
        padding:12px;
    }
}

.textBlock
{
    white-space:pre-wrap;
    line-height:1.55;
    font-size: var(--textSize);
    color: var(--text);
}

.muted
{
    color:var(--muted);
    font-size:12px;
}

.imgBlock
{
    width:100%;
    max-height: min(520px, 60vh);
    object-fit: contain;
    background: rgba(0,0,0,.25);
    border-radius: 14px;
    border:1px solid var(--borderSoft);
}

@media (max-width: 480px)
{
    .imgBlock
    {
        max-height: min(320px, 50vh);
        border-radius: 12px;
    }
}

/* Landscape mode on small devices */
@media (max-height: 480px) and (orientation: landscape)
{
    .sceneWrap
    {
        min-height: auto;
    }

    .imgBlock
    {
        max-height: 40vh;
    }

    video
    {
        max-height: 45vh;
    }
}

html[data-theme="light"] .imgBlock
{
    background: rgba(15,25,45,.04);
}

.aboutCoverWrap
{
    display:none;
    align-items:center;
    justify-content:center;
}

.aboutCoverImg
{
    width:100%;
    max-height: 260px;
    object-fit: contain;
    background: rgba(0,0,0,.25);
    border-radius: 14px;
    border:1px solid var(--borderSoft);
}

@media (max-width: 480px)
{
    .aboutCoverImg
    {
        max-height: 180px;
        border-radius: 12px;
    }
}

html[data-theme="light"] .aboutCoverImg
{
    background: rgba(15,25,45,.04);
}

video, audio
{
    width:100%;
    border-radius: 14px;
    border:1px solid var(--borderSoft);
    background: rgba(0,0,0,.25);
    max-height: 60vh;
}

html[data-theme="light"] video,
html[data-theme="light"] audio
{
    background: rgba(15,25,45,.04);
}

@media (max-width: 480px)
{
    video, audio
    {
        border-radius: 12px;
        max-height: 50vh;
    }
}

.choices
{
    display:grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap:10px;
}

@media (max-width: 740px)
{
    .choices
    {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px)
{
    .choices
    {
        gap: 8px;
    }

    .choice
    {
        padding: 14px 12px;
        min-height: 64px;
        font-size: 15px;
        -webkit-tap-highlight-color: transparent;
    }

    .choice .badge
    {
        font-size: 10px;
        padding: 3px 6px;
    }
}

.choice
{
    text-align:left;
    padding:12px;
    border-radius: 14px;
    border:1px solid var(--borderSoft2);
    background: var(--surface2);
    cursor:pointer;
    transition: border-color .15s ease, transform .08s ease, filter .15s ease;
    display:flex;
    flex-direction:column;
    gap:10px;
    min-height: 72px;
}

.choice:hover
{
    border-color: var(--btnHoverBorder);
    filter: brightness(1.02);
}

.choice:active
{
    transform: translateY(1px);
}

.choice[aria-disabled="true"]
{
    opacity:.6;
    cursor:not-allowed;
}

/* Visual feedback on the selected choice */

.choice
{
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.choice.picked.is-correct
{
    background-color: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.55);
}

.choice.picked.is-wrong
{
    background-color: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
}

/* Small bonus: "pressed" feel */

.choice.picked
{
    transform: translateY(1px);
}

/* =========================
   Feedback input (question/hangman)
   ========================= */

.textInput.picked.is-correct
{
    background-color: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.55);
}

.textInput.picked.is-wrong
{
    background-color: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
}

.inputRow.picked.is-correct .textInput
{
    background-color: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.55);
}

.inputRow.picked.is-wrong .textInput
{
    background-color: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
}

.badge
{
    align-self:flex-start;
    font-size:11px;
    color:var(--muted);
    padding:4px 8px;
    border:1px solid var(--borderSoft2);
    border-radius:999px;
    background: var(--surface3);
}

.footerActions
{
    display:flex;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
    padding-top:6px;
}

@media (max-width: 520px)
{
    .footerActions
    {
        display:grid;
        grid-template-columns: 1fr;
        gap:10px;
    }

    .footerActions .btn
    {
        width:100%;
    }
}

.notice
{
    padding:10px 12px;
    border-radius: 14px;
    background: var(--noticeBg);
    border: 1px solid var(--noticeBorder);
    color: var(--text);
    font-size:13px;
    line-height:1.35;
}

.notice.neutral
{
    background: var(--noticeNeutralBg);
    border-color: var(--noticeNeutralBorder);
}

.notice.warn
{
    background: var(--noticeWarnBg);
    border-color: var(--noticeWarnBorder);
    color: var(--noticeWarnText);
}

.pauseOverlay
{
    position:absolute; inset:0;
    display:none;
    align-items:center; justify-content:center;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
    border-radius: var(--radius);
    z-index: 50;
    padding: 14px;
}

.paused .pauseOverlay
{
    display:flex;
}

.pausePanel
{
    width:min(520px, 92%);
    background: linear-gradient(180deg, var(--cardTop), var(--cardBot));
    border:1px solid var(--borderSoft2);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 14px;
    display:flex;
    flex-direction:column;
    gap:10px;
    text-align:center;
}

.pausePanel h3
{
    margin:0;
    font-size:16px;
}

.pausePanel p
{
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.4;
}

@media (max-width: 480px)
{
    .pausePanel
    {
        width: min(340px, 96%);
        padding: 12px;
    }

    .pausePanel h3
    {
        font-size: 15px;
    }

    .pausePanel p
    {
        font-size: 12px;
    }
}

.modal
{
    position:fixed; inset:0;
    display:none;
    z-index: 60;
    align-items:stretch;
    justify-content:flex-end;
}

.modal.open
{
    display:flex;
}

.modal .backdrop
{
    position:absolute; inset:0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(6px);
}

.modal .panel
{
    position:relative;
    width: min(560px, 100%);
    height: 100%;
    background: linear-gradient(180deg, var(--cardTop), var(--cardBot));
    border-left:1px solid var(--borderSoft2);
    box-shadow: var(--shadow);
    display:flex;
    flex-direction:column;
    transform: translateX(10px);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
}

.modal.open .panel
{
    transform: translateX(0);
    opacity: 1;
}

.modal .panelHd
{
    padding:12px 14px;
    border-bottom:1px solid var(--borderSoft);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

.modal .panelHd .title
{
    font-weight:900;
    color: var(--text);
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}

.modal .panelHd .title span
{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.modal .panelBd
{
    padding:14px;
    overflow:auto;
    display:flex;
    flex-direction:column;
    gap:12px;
}

@media (max-width: 740px)
{
    .modal
    {
        justify-content:center;
        align-items:flex-end;
    }

    .modal .panel
    {
        width: min(720px, 100%);
        height: min(88vh, 720px);
        border-left:none;
        border-top:1px solid var(--borderSoft2);
        border-radius: 18px 18px 0 0;
    }
}

@media (max-width: 480px)
{
    .modal .panel
    {
        width: 100%;
        height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    .modal .panelHd
    {
        padding: 10px 12px;
    }

    .modal .panelBd
    {
        padding: 12px;
        gap: 10px;
    }
}

.kv
{
    display:grid;
    grid-template-columns: 150px 1fr;
    gap:8px 10px;
    font-size:13px;
}

@media (max-width: 520px)
{
    .kv
    {
        grid-template-columns: 120px 1fr;
        font-size:12px;
    }
}

@media (max-width: 380px)
{
    .kv
    {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }

    .kv .k
    {
        font-weight: 600;
    }

    .kv .v
    {
        padding-bottom: 8px;
        border-bottom: 1px solid var(--borderSoft);
    }

    .kv .v:last-child
    {
        border-bottom: none;
        padding-bottom: 0;
    }
}

.kv .k
{
    color:var(--muted);
}

.kv .v
{
    color:var(--text);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* Display the full description (multi-line) of the EGF game */

.kv #kvDesc
{
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.descBox
{
    border:1px solid var(--borderSoft2);
    border-radius: 14px;
    background: var(--surface2);
    padding:10px 12px;
    color: var(--text);
    white-space:pre-wrap;
    line-height:1.45;
    font-size: 14px;
}

details.debug
{
    border:1px solid var(--borderSoft2);
    border-radius: 14px;
    background: var(--surface2);
    padding:10px 12px;
}

details.debug summary
{
    cursor:pointer;
    color: var(--muted);
    font-weight:800;
    list-style:none;
}

details.debug summary::-webkit-details-marker
{
    display:none;
}

details.debug .inner
{
    margin-top:10px;
}

.settingsGrid
{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.settingsRow
{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
    justify-content:space-between;
    padding:10px 10px;
    border-radius: 14px;
    border:1px solid var(--borderSoft2);
    background: var(--surface2);
}

.settingsRow .left
{
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width: 160px;
}

.settingsRow .left .name
{
    font-weight:900;
}

.settingsRow .left .hint
{
    font-size:12px;
    color:var(--muted);
}

.settingsRow .right
{
    display:flex;
    gap:10px;
    align-items:center;
    flex-wrap:wrap;
    justify-content:flex-end;
}

.settingsRow input[type="range"]
{
    width: min(280px, 60vw);
    accent-color: var(--accent);
}

.settingsRow .pct
{
    min-width: 44px;
    text-align:right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 480px)
{
    .settingsRow
    {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .settingsRow .left
    {
        min-width: auto;
        width: 100%;
    }

    .settingsRow .right
    {
        width: 100%;
        justify-content: flex-start;
    }

    .settingsRow input[type="range"]
    {
        width: 100%;
        max-width: none;
    }

    .settingsRow .toggle
    {
        width: auto;
    }

    .settingsGrid
    {
        gap: 8px;
    }
}

.srOnly
{
    position:absolute !important;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0;
}

.hangman
{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

.hangman .right
{
    flex:1;
    min-width:240px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

.hangman .word
{
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
}

.hangman .used
{
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 480px)
{
    .hangman
    {
        flex-direction: column;
        gap: 10px;
    }

    .hangman .right
    {
        min-width: auto;
        width: 100%;
    }

    .hangman .word
    {
        font-size: 18px;
        text-align: center;
        word-break: break-all;
    }

    .hangman .used
    {
        text-align: center;
    }
}

.inputRow
{
    display:flex;
    gap:10px;
    align-items:center;
}

.textInput
{
    flex:1;
    padding:10px 12px;
    border-radius: 14px;
    border:1px solid var(--borderSoft2);
    background: var(--surface2);
    color: var(--text);
    font-size:16px;
    /* Prevent iOS zoom on focus */
    -webkit-text-size-adjust: 100%;
}

@media (max-width: 480px)
{
    .textInput
    {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
    }

    .inputRow
    {
        flex-direction: column;
        gap: 8px;
    }

    .inputRow .btn
    {
        width: 100%;
    }
}

#scoreModal .progress
{
    width:100%;
    justify-content:space-between;
}

#scoreModal .bar
{
    flex:1;
    width:auto;
}

.card .hd
{
    flex-wrap: wrap;
    align-items: flex-start;
}

.card .hd .sceneTitle
{
  flex: 1 1 260px;
  min-width: 0;
}

#sceneName
{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    word-break: normal;
    overflow-wrap: anywhere;
}

#sceneSub
{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    word-break: normal;
    overflow-wrap: anywhere;
}

#rolePill
{
    flex: 0 0 auto;
}

@media (max-width: 520px)
{
    .card .hd
    {
        gap: 8px;
    }

    #rolePill
    {
        width: 100%;
        justify-content: space-between;
    }
}

.hidden
{
    display: none !important;
}

/* Score modal: gradient % text (no bar) */

.progressPct
{
  font-weight: 900;
  letter-spacing: .2px;
  display: inline-block;
  
  /* the gradient is injected in JS via background-image */

  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* =========================
   BOOKSHELF STYLES
   ========================= */

.bookshelf-view
{
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bookshelf-header
{
    text-align: center;
    padding: 20px 0 0;
}

.bookshelf-title
{
    margin: 0;
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), var(--good));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bookshelf-subtitle
{
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.bookshelf-actions
{
    display: flex;
    justify-content: center;
    gap: 12px;
}

.bookshelf-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 10px;
}

@media (max-width: 480px)
{
    .bookshelf-grid
    {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
        padding: 6px;
    }

    .bookshelf-header
    {
        padding: 12px 0 0;
    }

    .bookshelf-title
    {
        font-size: 22px;
    }

    .bookshelf-subtitle
    {
        font-size: 13px;
    }
}

/* Empty state */
.bookshelf-empty
{
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    background: var(--surface1);
    border: 2px dashed var(--borderSoft2);
    border-radius: var(--radius);
    gap: 12px;
}

.bookshelf-empty .empty-icon
{
    font-size: 56px;
    opacity: 0.6;
}

.bookshelf-empty h3
{
    margin: 0;
    font-size: 18px;
    color: var(--text);
}

.bookshelf-empty p
{
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

@media (max-width: 480px)
{
    .bookshelf-empty
    {
        padding: 40px 16px;
    }

    .bookshelf-empty .empty-icon
    {
        font-size: 44px;
    }

    .bookshelf-empty h3
    {
        font-size: 16px;
    }

    .bookshelf-empty p
    {
        font-size: 13px;
    }
}

/* Book card */
.book-card
{
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--cardTop), var(--cardBot));
    border: 1px solid var(--borderSoft);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}

.book-card:hover
{
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--btnHoverBorder);
}

.book-card:active
{
    transform: translateY(-2px);
}

.book-cover
{
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: var(--surface2);
    border-bottom: 1px solid var(--borderSoft);
}

.book-cover-placeholder
{
    width: 100%;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface1), var(--surface2));
    border-bottom: 1px solid var(--borderSoft);
    font-size: 48px;
    opacity: 0.5;
}

.book-info
{
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.book-title
{
    font-weight: 800;
    font-size: 13px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.book-creator
{
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Book card context button */
.book-menu-btn
{
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-card:hover .book-menu-btn
{
    opacity: 1;
}

.book-menu-btn:hover
{
    background: rgba(0, 0, 0, 0.8);
}

/* Touch devices: always show menu button */
@media (hover: none) and (pointer: coarse)
{
    .book-menu-btn
    {
        opacity: 1;
    }

    .book-card:hover
    {
        transform: none;
    }

    .book-card:active
    {
        transform: scale(0.98);
    }
}

/* Context menu */
.context-menu
{
    position: fixed;
    z-index: 100;
    background: linear-gradient(180deg, var(--cardTop), var(--cardBot));
    border: 1px solid var(--borderSoft2);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
    min-width: 160px;
}

.context-item
{
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.context-item:hover
{
    background: var(--surface2);
}

.context-item:active
{
    background: var(--surface3);
}

/* Game player view adjustments */
.game-player
{
    display: none;
}

.game-player.active
{
    display: block;
}

.player-nav
{
    flex: 0 0 auto;
    margin-right: 10px;
}

/* About actions */
.about-actions
{
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.about-actions .btn
{
    flex: 1;
}

@media (max-width: 480px)
{
    .book-info
    {
        padding: 8px;
    }

    .book-title
    {
        font-size: 12px;
    }

    .book-creator
    {
        font-size: 10px;
    }

    .book-cover-placeholder
    {
        font-size: 36px;
    }

    .player-nav
    {
        margin-right: 8px;
    }

    .player-nav .btn
    {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ============================
   MOBILE BOTTOM NAVIGATION BAR
   ============================ */

.mobile-bottom-nav
{
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--headerBg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--borderSoft);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.mobile-bottom-nav .nav-item
{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item:not(:disabled):hover,
.mobile-bottom-nav .nav-item:not(:disabled):active
{
    color: var(--accent);
}

.mobile-bottom-nav .nav-item:active
{
    transform: scale(0.92);
}

.mobile-bottom-nav .nav-item:disabled
{
    opacity: 0.4;
    cursor: not-allowed;
}

.mobile-bottom-nav .nav-icon
{
    font-size: 22px;
    line-height: 1;
}

.mobile-bottom-nav .nav-label
{
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* When mobile nav is visible, add padding to main content */
body.has-mobile-nav main
{
    padding-bottom: 80px;
}

/* Hide desktop controls on mobile app */
body.is-mobile-app .desktop-controls
{
    display: none !important;
}

/* Show mobile nav only in mobile app context */
body:not(.is-mobile-app) .mobile-bottom-nav
{
    display: none !important;
}

/* Pause state styling for mobile nav */
.mobile-bottom-nav .nav-item.pauseOn
{
    color: var(--accent);
}

.mobile-bottom-nav .nav-item.pauseOn .nav-icon::after
{
    content: "";
    display: block;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    margin: 2px auto 0;
}
