:root {
    --bg: #102048;
    --panel: #0b1836;
    --ink: #f0ece2;
    --line: #384e80;
    --accent: #e6be5a;
    --font-medieval: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
}

.brand-medieval {
    font-family: var(--font-medieval);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
    text-shadow: 0 1px 0 #4a3510, 0 2px 8px rgba(0, 0, 0, 0.45);
}

html, body {
    height: 100%;
    overscroll-behavior: none;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
}

#app, .page {
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar, .toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 4px 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.version {
    margin-left: auto;
    color: #b0c4de;
    font-size: 12px;
}

.stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.game {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.canvas-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: auto;
}

.canvas-wrap.fill canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
}

button, select {
    background: #1c3470;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 4px 10px;
    font: inherit;
    cursor: pointer;
}

button:hover, select:hover {
    background: #264590;
}

button.active {
    background: var(--accent);
    color: #1b2a20;
    border-color: var(--accent);
}

label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

label.slider {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

input[type=range] {
    width: 120px;
}

.status {
    opacity: .85;
}

#blazor-error-ui {
    background: #fff3b0;
    color: #222;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

.dragon-designer { padding: 24px; max-width: 1280px; margin: auto; }
.dragon-design-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.dragon-preview { background: #18243b; border: 1px solid #537194; border-radius: 16px; text-align: center; color: #fff; position: sticky; top: 16px; }
.dragon-preview canvas { width: 100%; height: auto; }
.dragon-features fieldset { border: 1px solid #537194; border-radius: 10px; margin: 0 0 12px; padding: 12px; }
.dragon-features legend { padding: 0 8px; font-weight: bold; }
.dragon-color-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #888; vertical-align: middle; }
.dragon-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.dragon-swatch { width: 36px; height: 36px; border: 2px solid #888; border-radius: 8px; cursor: pointer; color: #fff; text-shadow: 0 1px 3px #000, 0 0 3px #000; font-size: 22px; padding: 0; }
.dragon-swatch[aria-pressed="true"] { outline: 3px solid #00dfff; outline-offset: 2px; }
.dragon-swatch:focus-visible { outline: 3px solid #ff1493; outline-offset: 2px; }
@media (max-width: 760px) { .dragon-design-layout { grid-template-columns: 1fr; } .dragon-preview { position: static; } .dragon-designer { padding: 12px; } }

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* SonikDragonMob: phone-first layout */
.caught { color: #ff5555; font-size: 14px; }
.hunt-timer { font-size: 14px; }
.hint { margin: 1px 10px; font-size: 12px; line-height: 1.2; opacity: .85; }
.timesup { margin: 4px 10px; color: #ffcf69; font-size: 18px; }
.toolbar { flex-wrap: wrap; gap: 2px 5px; padding: 2px 8px; padding-top: max(2px, env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
.toolbar button, .toolbar summary, .toolbar select { font-size: 12px; min-height: 22px; padding: 0 8px; line-height: 1.1; }
.toolbar button { flex: 0 0 auto; white-space: nowrap; }
/* Settings button lives in the top header line, far right (the page is the positioning context). */
.page { position: relative; }
.topbar { padding: 2px 130px 2px 10px; min-height: 26px; gap: 2px 10px; font-size: 13px; line-height: 1.2; }
.topright { position: absolute; top: 3px; right: max(8px, env(safe-area-inset-right)); z-index: 20; display: flex; align-items: center; gap: 6px; }
.settings { position: relative; flex: 0 0 auto; }
/* API availability badge, just before Settings: green = up, red = down/no answer within 2s, grey = still checking. */
.apistatus { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; line-height: 1.1; color: #fff; background: #6b7280; border: 1px solid var(--line); }
.apistatus.up { background: #1f9d4c; }
.apistatus.down { background: #d13438; }
.pickers { margin-left: auto; display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; }
.pickers select { max-width: 96px; padding: 0 4px; }
.settings summary { cursor: pointer; display: inline-flex; align-items: center; background: #1c3470; border: 1px solid var(--line); border-radius: 4px; list-style: none; white-space: nowrap; }
.settings summary::-webkit-details-marker { display: none; }
.settings-panel { position: absolute; right: 0; top: calc(100% + 3px); width: min(100vw, 460px); box-sizing: border-box; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px 14px; padding: 10px; background: var(--panel); border-bottom: 1px solid var(--line); max-height: 60vh; overflow-y: auto; }
.settings-panel input[type=range] { width: 100%; min-width: 140px; }
.settings-panel label.slider { flex: 1 1 140px; }
.statusline { flex-basis: 100%; display: flex; gap: 2px 12px; align-items: baseline; line-height: 1.15; }
.canvas-wrap { overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
@media (max-width: 760px) {
    html, body { font-size: 13px; }
    .caught, .hunt-timer { font-size: 13px; }
    /* Keep Play/Pause, New Hunt, Scatter and both pickers on one line: shrink size and text with the screen width. */
    .toolbar { gap: 2px 3px; padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
    .toolbar button, .toolbar select { font-size: clamp(10px, 3vw, 12px); padding: 0 clamp(3px, 1.2vw, 6px); min-height: 22px; }
    .toolbar button { flex: 0 1 auto; min-width: 0; }
    .pickers { flex: 1 1 0; min-width: 0; justify-content: flex-end; gap: 3px; }
    .pickers select { flex: 1 1 0; min-width: 0; max-width: 90px; padding: 0 2px; }
    .hint { font-size: 11px; margin: 1px 8px; }
}
@media (max-height: 480px) and (orientation: landscape) {
    .hint { display: none; }
}

/* Sign-on and player bar */
.player { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.linklike { background: none; border: 0; color: #8fc4ff; text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.signon-page { position: relative; min-height: 100%; min-height: 100dvh; overflow: hidden; background: #0b1836; display: flex; align-items: center; justify-content: center; }
.signon-showcase { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #0b1836; }
.signon-showcase::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.signon-showcase--mobile::after {
    background: linear-gradient(180deg, rgba(11, 24, 54, 0) 0%, rgba(11, 24, 54, 0.45) 42%, rgba(11, 24, 54, 0.92) 100%);
}
.signon-showcase--desktop::after {
    background: radial-gradient(ellipse at center, rgba(11, 24, 54, 0.15) 35%, rgba(11, 24, 54, 0.82) 100%);
}
.signon-showcase img { display: block; margin: 0 auto; opacity: 1; transition: opacity 0.35s ease; }
.signon-showcase--mobile { display: flex; align-items: stretch; justify-content: center; }
.signon-showcase--mobile img { width: min(100%, 480px); height: 100%; object-fit: cover; object-position: center top; }
.signon-showcase--desktop img { width: auto; height: auto; max-width: min(100%, 1024px); max-height: 100%; object-fit: contain; object-position: center center; }
.signon-showcase--desktop { display: flex; align-items: center; justify-content: center; }
.signon-showcase-fade img { opacity: 0.12; }
.signon-page:has(.signon-showcase) .signon {
    position: absolute;
    z-index: 1;
    left: 50%;
    margin: 0;
    gap: 6px;
    box-sizing: border-box;
    overflow-y: auto;
    text-align: center;
    align-items: stretch;
}
@media (max-width: 760px) {
    .signon-page:has(.signon-showcase) .signon {
        bottom: 0;
        top: auto;
        transform: translateX(-50%);
        width: min(320px, 92vw);
        max-height: 36dvh;
        padding: 8px 10px calc(6px + env(safe-area-inset-bottom, 0px));
        background: transparent;
    }
}
@media (min-width: 761px) {
    .signon-page:has(.signon-showcase) .signon {
        top: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(360px, 38vw);
        max-height: min(480px, 88vh);
        padding: 14px 18px;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}
.signon-page:has(.signon-showcase) .signon h1.brand-medieval {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    text-align: center;
    letter-spacing: 0.1em;
}
.topbar .brand-medieval { font-size: 1.05rem; line-height: 1.2; }
.signon-page:has(.signon-showcase) .signon > p {
    margin: 0;
    font-size: 12px;
    line-height: 1.25;
    text-align: center;
}
.signon-page:has(.signon-showcase) .signon-tabs { gap: 4px; }
.signon-page:has(.signon-showcase) .signon-tabs button { min-height: 32px; padding: 0 6px; font-size: 13px; }
.signon-page:has(.signon-showcase) .signon-form { gap: 5px; }
.signon-page:has(.signon-showcase) .signon-form label { gap: 2px; font-size: 12px; text-align: left; }
.signon-page:has(.signon-showcase) .signon-form input { min-height: 34px; font-size: 16px; padding: 2px 6px; }
.signon-page:has(.signon-showcase) .signon-form button,
.signon-page:has(.signon-showcase) .signon-guest button { min-height: 36px; padding: 0 8px; font-size: 13px; }
.signon-page:has(.signon-showcase) .signon-guest { gap: 4px; padding-top: 6px; margin-top: 2px; }
.signon-page:has(.signon-showcase) .signon-guest small { font-size: 11px; line-height: 1.2; text-align: center; }
.signon-page:has(.signon-showcase) .signon-error { font-size: 12px; min-height: 0; }
.signon-page:has(.signon-showcase) .signon-form label { text-align: left; }
.signon { max-width: 420px; margin: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 12px; }
.signon-tabs { display: flex; gap: 6px; }
.signon-tabs button { flex: 1; min-height: 40px; }
.signon-tabs button[aria-selected="true"] { outline: 2px solid #8fc4ff; }
.signon-form { display: flex; flex-direction: column; gap: 10px; }
.signon-form label { display: flex; flex-direction: column; gap: 4px; }
.signon-form input { min-height: 40px; font-size: 16px; padding: 4px 8px; }
.signon-form button, .signon-guest button { min-height: 44px; }
.signon-error { color: #ff8a8a; min-height: 1.2em; margin: 0; }
.signon-guest { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }

.player a, .timesup a, .signon a { color: #8fc4ff; }

/* How to Play overlay: first game only, 3 seconds, never blocks the pointer. */
.howto { position: absolute; z-index: 5; left: 50%; top: 22%; transform: translateX(-50%); width: min(90%, 420px); box-sizing: border-box; padding: 14px 18px; text-align: center; background: rgba(12, 24, 50, .9); border: 1px solid var(--line); border-radius: 10px; color: #fff; pointer-events: none; }
.howto h2 { margin: 0 0 6px; font-size: 20px; }
.howto p { margin: 0; font-size: 15px; line-height: 1.4; }
