/* ============================================================
   Data-driven play theme (Phase 42)
   One template for every look. Driven entirely by the inline
   :root variables play.php injects per story:
     --bg  --text  --accent  --font  --font-heading  --base-size
   Every bespoke shade (surfaces, glows, button text, scrollbar)
   is DERIVED from those few values with color-mix() — small data,
   still hand-tuned in feel. Structure mirrors the legacy
   themes/*_theme.css files so the play markup is unchanged.
   ============================================================ */

:root {
    /* Derived shades — recomputed from the injected core values */
    --surface:      color-mix(in srgb, var(--bg), var(--text) 10%);
    --surface-2:    color-mix(in srgb, var(--bg), var(--text) 18%);
    --text-muted:   color-mix(in srgb, var(--text), var(--bg) 45%);
    --heading-col:  color-mix(in srgb, var(--accent), var(--text) 45%);
    --accent-soft:  color-mix(in srgb, var(--accent), transparent 70%);
    --accent-hi:    color-mix(in srgb, var(--accent), white 15%);
    --on-accent:    var(--bg);              /* dark page bg reads well on a bright accent */
    --border-col:   color-mix(in srgb, var(--bg), var(--text) 22%);
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: var(--base-size);
    margin: 0;
}

.banner { padding: 8px 0; text-align: center; margin-bottom: 2rem; }
.banner h2 {
    font-family: var(--font-heading);
    color: var(--accent);
    margin: 0;
    font-size: 1.9rem;
    letter-spacing: 0.15em;
    font-weight: 600;
}

header { position: relative; }
header img {
    max-width: 100%;
    border-radius: 20px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.9), inset 0 0 40px rgba(0,0,0,0.7);
    object-fit: cover;
}
header h1 {
    font-family: var(--font-heading);
    letter-spacing: 0.06em;
    font-size: 2.2rem;
    margin-bottom: 0;
    color: var(--heading-col);
}

.content { flex: 1; }
.content p { font-size: 1.5rem; line-height: 2rem; }
.content h1 {
    text-align: center;
    font-size: 32px;
    font-family: var(--font-heading);
    color: var(--heading-col);
}

.choices { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.choice a {
    display: inline-block;
    width: 360px;
    padding: .35rem .525rem;
    background: var(--accent);
    color: var(--on-accent);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.02em;
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}
.choice a:hover {
    background: var(--accent-hi);
    box-shadow: 0 0 20px var(--accent-soft),
                0 0 40px var(--accent-soft),
                inset 0 0 15px color-mix(in srgb, var(--accent), transparent 80%);
    transform: translateY(-2px) scale(1.02);
}

.hint { margin-top: 1rem; position: relative; display: inline-block; }
.hint:hover .hint-text { visibility: visible; opacity: 1; }
.hint-icon {
    cursor: help;
    background: var(--surface-2);
    color: var(--accent);
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 16px;
}
.hint-text {
    visibility: hidden; opacity: 0;
    width: 300px;
    background-color: var(--surface);
    color: var(--text);
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute; z-index: 1;
    top: 125%; left: 50%; transform: translateX(-50%);
    transition: opacity 0.3s;
    font-style: italic; font-size: 1rem;
    border: 1px solid var(--border-col);
}
.hint-text::after {
    content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    border-width: 5px; border-style: solid;
    border-color: transparent transparent var(--surface) transparent;
}

.prompt-info { position: absolute; bottom: 10px; right: 10px; display: inline-block; }
.prompt-icon {
    cursor: help;
    background: var(--accent);
    color: var(--on-accent);
    width: 28px; height: 28px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 16px;
}
.prompt-text {
    visibility: hidden; opacity: 0;
    width: 350px;
    background-color: var(--surface-2);
    color: var(--text);
    text-align: left; border-radius: 6px; padding: 12px;
    position: absolute; z-index: 1;
    bottom: 125%; right: 0;
    transition: opacity 0.3s;
    font-size: 13px;
}
.prompt-info:hover .prompt-text { visibility: visible; opacity: 1; }
.prompt-text::after {
    content: ""; position: absolute; top: 100%; right: 14px;
    border-width: 5px; border-style: solid;
    border-color: var(--surface-2) transparent transparent transparent;
}
.prompt-text a { color: var(--accent-hi); text-decoration: underline; }

.back-link { display: inline-block; margin-top: 1rem; color: var(--accent); font-size: 0.9rem; text-decoration: none; }
.back-link:hover { color: var(--accent-hi); }

footer { margin-top: 2rem; color: var(--text-muted); font-size: 1.1rem; }

/* Layout: Image Top — text centering (structure handled by play_layout.css) */
.layout-image_top .content { text-align: center; }
.layout-image_top .content p { margin: 0; }
.layout-image_top .content h1 { margin: 0; }
.layout-image_top .choices { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin: 0; }
.layout-image_top .choice a { width: auto; min-width: 180px; max-width: 320px; }
.layout-image_top .choices .hint { flex-basis: 100%; display: flex; justify-content: center; margin-top: 0.5rem; }
.layout-image_top .choices > a { flex-basis: 100%; text-align: center; margin-top: 0.25rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hi); }
html { scrollbar-width: thin; scrollbar-color: var(--accent) var(--surface); }

@media (max-width: 900px) {
    .content h1 { font-size: 1.8rem; }
    .content p { font-size: 1.4rem; line-height: 1.8rem; }
    .banner h2 { font-size: 1.4rem; }
    .choices { width: 100%; }
    .choice a { width: 90vw; max-width: 360px; display: block; margin-left: auto; margin-right: auto; }
    .layout-image_top .choices { flex-direction: column; }
    .layout-image_top .choice a { width: 90vw; max-width: 360px; min-width: unset; }
}
