/* =========================================================
   THE SHITSHOW GAMES — Glasgow 2026 (inoffiziell)
   Palette:  midnight navy field · saltire blue · parchment
             tangerine (Shitshow) · thistle purple (Clusterfuck) · games gold
   Type:     Anton (scoreboard/display) + Space Grotesk (UI)
   ========================================================= */

:root {
    --midnight:      #0a1a30;
    --midnight-2:    #0c2039;
    --slate:         #123253;
    --slate-line:    #1d4571;
    --saltire:       #2a7de1;
    --saltire-deep:  #0b4e9c;
    --parchment:     #f3ecdb;
    --parchment-dim: #9fb0c6;
    --gold:          #d8b45a;
    --shit:          #ec6a34;
    --shit-deep:     #b0431a;
    --cluster:       #a274cf;
    --cluster-deep:  #6c3fa1;

    --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 50% -10%, #123763 0%, transparent 60%),
        linear-gradient(180deg, var(--midnight-2) 0%, var(--midnight) 100%);
    color: var(--parchment);
    font-family: "Space Grotesk", system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* faint saltire watermark behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(45deg, transparent calc(50% - 26px), rgba(42,125,225,.06) calc(50% - 26px) calc(50% + 26px), transparent calc(50% + 26px)),
        linear-gradient(-45deg, transparent calc(50% - 26px), rgba(42,125,225,.06) calc(50% - 26px) calc(50% + 26px), transparent calc(50% + 26px));
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ---------- Tartan trim ---------- */
.tartan {
    background-color: #0b2440;
    background-image:
        repeating-linear-gradient(90deg,
            transparent 0 20px,
            rgba(255,255,255,.09) 20px 23px,
            transparent 23px 44px,
            rgba(0,0,0,.34) 44px 58px,
            rgba(216,180,90,.55) 58px 61px,
            rgba(0,0,0,.34) 61px 75px,
            transparent 75px 96px),
        repeating-linear-gradient(0deg,
            transparent 0 20px,
            rgba(255,255,255,.09) 20px 23px,
            transparent 23px 44px,
            rgba(0,0,0,.34) 44px 58px,
            rgba(216,180,90,.55) 58px 61px,
            rgba(0,0,0,.34) 61px 75px,
            transparent 75px 96px),
        repeating-linear-gradient(0deg, rgba(24,104,74,.5) 0 96px, rgba(24,104,74,.5) 0 96px);
}

.tartan-strip {
    width: 100%;
    height: 40px;
    /* weiche Kante zur Inhaltsseite: Band taucht aus dem Navy auf, statt hart anzuschlagen */
    -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 40%, transparent 100%);
}
.tartan-strip--bottom {
    margin-top: 44px;
    -webkit-mask-image: linear-gradient(to top, #000 40%, transparent 100%);
            mask-image: linear-gradient(to top, #000 40%, transparent 100%);
}

/* ---------- Masthead ---------- */
.masthead {
    text-align: center;
    padding: 40px 20px 10px;
    max-width: 900px;
}

.badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 18px;
}
.badge-ring {
    font-family: "Anton", sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-size: .82rem;
    color: var(--midnight);
    background: var(--gold);
    padding: 5px 16px 4px;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(216,180,90,.25);
}
.badge-sub {
    font-size: .68rem;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--parchment-dim);
}

.title {
    font-family: "Anton", sans-serif;
    font-weight: 400;
    font-size: clamp(2.6rem, 9vw, 5.4rem);
    line-height: .92;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: .01em;
    background: linear-gradient(180deg, #ffffff 0%, var(--saltire) 130%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 0 rgba(0,0,0,.15);
}

.tagline {
    margin: 12px 0 0;
    color: var(--parchment-dim);
    font-size: 1rem;
    letter-spacing: .02em;
}

/* ---------- Arena ---------- */
.arena {
    width: 100%;
    max-width: 900px;
    padding: 26px 20px 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
}

.lane {
    --accent: var(--saltire);
    --accent-deep: var(--saltire-deep);
    flex: 1 1 0;
    background: linear-gradient(180deg, var(--slate) 0%, var(--midnight-2) 100%);
    border: 1px solid var(--slate-line);
    border-top: 4px solid var(--accent);
    border-radius: 16px;
    padding: 22px 20px 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 20px 40px -24px rgba(0,0,0,.9);
}
.lane--shit    { --accent: var(--shit);    --accent-deep: var(--shit-deep); }
.lane--cluster { --accent: var(--cluster); --accent-deep: var(--cluster-deep); }

.lane-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.lane-icon { font-size: 1.5rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.lane-name {
    font-family: "Anton", sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 1.5rem;
    margin: 0;
    color: var(--parchment);
}

/* scoreboard panel */
.board {
    width: 100%;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(42,125,225,.10), transparent 70%),
        #06101f;
    border: 1px solid #0a2038;
    border-radius: 12px;
    padding: 18px 10px 12px;
    box-shadow: inset 0 6px 22px rgba(0,0,0,.7);
    display: flex;
    justify-content: center;
}
.score {
    font-family: "Anton", sans-serif;
    font-size: clamp(3.6rem, 14vw, 6.2rem);
    line-height: 1;
    color: var(--accent);
    text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent);
    font-variant-numeric: tabular-nums;
    transition: transform .18s var(--ease);
}
.score.bump { transform: scale(1.16); }

.hint {
    min-height: 1.2em;
    margin: 12px 0 18px;
    font-size: .82rem;
    letter-spacing: .04em;
    color: var(--parchment-dim);
    text-align: center;
}

/* tactile press button */
.tap {
    position: relative;
    width: 100%;
    border: none;
    cursor: pointer;
    border-radius: 14px;
    padding: 18px 16px 20px;
    color: #fff;
    font-family: "Anton", sans-serif;
    letter-spacing: .03em;
    text-transform: uppercase;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
    box-shadow:
        0 8px 0 0 var(--accent-deep),
        0 16px 26px -10px rgba(0,0,0,.7);
    transition: transform .06s ease, box-shadow .06s ease, filter .2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.tap:hover { filter: brightness(1.06); }
.tap:active,
.tap.press {
    transform: translateY(6px);
    box-shadow: 0 2px 0 0 var(--accent-deep), 0 8px 16px -10px rgba(0,0,0,.7);
}
.tap-plus { font-size: 1.05rem; opacity: .85; }
.tap-word { font-size: 1.7rem; line-height: 1; }

/* locked visual state */
body.is-locked .tap { filter: grayscale(.55) brightness(.8); }
body.is-locked .tap::after {
    content: "🔒";
    position: absolute;
    top: 8px; right: 12px;
    font-size: 1rem;
    -webkit-text-fill-color: initial;
}

/* versus divider */
.versus {
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Anton", sans-serif;
    font-size: 1.4rem;
    color: var(--gold);
    letter-spacing: .1em;
    text-transform: uppercase;
    flex: 0 0 auto;
}
.versus span {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--midnight);
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 4px rgba(216,180,90,.12);
}

/* ---------- lock banner ---------- */
.lock-banner {
    margin: 24px 20px 0;
    max-width: 900px;
    width: calc(100% - 40px);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    justify-content: center;
    background: rgba(236,106,52,.10);
    border: 1px solid rgba(236,106,52,.4);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: .9rem;
    color: var(--parchment);
}
body.is-unlocked .lock-banner { display: none; }

.link-btn {
    background: none;
    border: none;
    color: var(--gold);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- footer ---------- */
.footer {
    margin-top: 30px;
    text-align: center;
    padding: 0 20px;
}
.foot-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ghost-btn {
    background: transparent;
    border: 1px solid var(--slate-line);
    color: var(--parchment-dim);
    font: inherit;
    font-size: .82rem;
    letter-spacing: .03em;
    padding: 9px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.ghost-btn:hover { color: var(--parchment); border-color: var(--gold); }
.ghost-btn--master:hover { border-color: var(--shit); color: var(--shit); }
.credit { color: var(--parchment-dim); font-size: .78rem; letter-spacing: .02em; }

/* ---------- modals ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(4,10,20,.72);
    backdrop-filter: blur(3px);
    animation: fade .18s ease;
}
.modal[hidden] { display: none; }
.modal-card {
    width: min(400px, 100%);
    background: linear-gradient(180deg, var(--slate), var(--midnight-2));
    border: 1px solid var(--slate-line);
    border-top: 4px solid var(--gold);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 30px 60px -20px rgba(0,0,0,.9);
}
.modal-card h3 {
    font-family: "Anton", sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 6px;
    font-size: 1.5rem;
}
.modal-text { margin: 0 0 16px; color: var(--parchment-dim); font-size: .9rem; }
.field {
    width: 100%;
    background: #06101f;
    border: 1px solid var(--slate-line);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--parchment);
    font: inherit;
    letter-spacing: .1em;
}
.field:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.modal-error { color: var(--shit); font-size: .82rem; margin: 8px 0 0; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}
.solid-btn {
    background: linear-gradient(180deg, var(--saltire), var(--saltire-deep));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.solid-btn:hover { filter: brightness(1.08); }
.solid-btn--danger { background: linear-gradient(180deg, var(--shit), var(--shit-deep)); }

/* ---------- FX layer ---------- */
.fx {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 40;
}
/* laufende Figur: outer bewegt sich quer, inner wackelt, emoji zeigt/rollt */
.fx-figure {
    position: fixed;
    left: 0;
    z-index: 41;
    will-change: transform;
    pointer-events: none;
}
.fx-figure-bob { display: inline-block; will-change: transform; }
.fx-emoji {
    display: inline-block;
    line-height: 1;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,.5));
}
.fx-emoji.face-right { transform: scaleX(-1); }

/* Sprechblase über der Figur */
.fx-bubble {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translate(-50%, -6px);
    background: var(--parchment);
    color: #17233a;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    font-size: .9rem;
    letter-spacing: .01em;
    white-space: nowrap;
    padding: 7px 13px;
    border-radius: 12px;
    box-shadow: 0 8px 18px -8px rgba(0,0,0,.7);
    opacity: 0;
}
.fx-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: var(--parchment);
    margin-top: -1px;
}

/* offizielle "Wetterwarnung" oben */
.fx-warning {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -120%);
    z-index: 46;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, #f0a92c, #d4881a);
    color: #201400;
    border: 1px solid #ffd27a;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 10px 20px 11px;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.8);
    max-width: min(92vw, 560px);
}
.fx-warning .fx-warning-icon { font-size: 1.3rem; }
.fx-warning .fx-warning-title {
    font-family: "Anton", sans-serif;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: .9rem;
}
.fx-warning .fx-warning-text { font-size: .82rem; font-weight: 500; }

/* Regentropfen (Gewitterwolke übers Scoreboard) */
.fx-rain {
    position: fixed;
    z-index: 41;
    font-size: 1rem;
    pointer-events: none;
}

/* kurzes Flackern eines Scoreboards */
.score.flicker { animation: flicker .9s steps(2, jump-none) 3; }
@keyframes flicker { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.fx-banner {
    position: fixed;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%) scale(.6);
    z-index: 45;
    font-family: "Anton", sans-serif;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: .04em;
    font-size: clamp(2.2rem, 9vw, 5rem);
    color: var(--gold);
    text-shadow: 0 0 30px rgba(216,180,90,.6), 0 6px 0 rgba(0,0,0,.3);
    opacity: 0;
    animation: banner 2.6s var(--ease) forwards;
}
.fx-firework {
    position: fixed;
    width: 6px; height: 6px;
    border-radius: 50%;
    z-index: 42;
}

.shake { animation: shake .5s ease; }
.flash { animation: flash .5s ease; }

/* toasts */
.toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: min(92vw, 460px);
}
.toast {
    background: linear-gradient(180deg, var(--slate), var(--midnight-2));
    border: 1px solid var(--gold);
    border-radius: 999px;
    padding: 10px 20px;
    font-size: .92rem;
    letter-spacing: .02em;
    box-shadow: 0 12px 30px -12px rgba(0,0,0,.8);
    animation: toastIn .3s var(--ease), toastOut .4s ease forwards;
    animation-delay: 0s, 2.4s;
    text-align: center;
}

/* ---------- animations ---------- */
@keyframes fade   { from { opacity: 0; } }
@keyframes fall   { to { transform: translateY(118vh) rotate(540deg); } }
@keyframes stroll { to { transform: translateX(140vw); } }
@keyframes banner {
    0%   { opacity: 0; transform: translate(-50%,-50%) scale(.6); }
    18%  { opacity: 1; transform: translate(-50%,-50%) scale(1.05); }
    82%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%,-50%) scale(1.1); }
}
@keyframes shake {
    0%,100% { transform: translate(0,0); }
    20% { transform: translate(-8px, 4px) rotate(-.4deg); }
    40% { transform: translate(7px, -5px) rotate(.4deg); }
    60% { transform: translate(-6px, 5px); }
    80% { transform: translate(6px, -3px); }
}
@keyframes flash {
    0%,100% { background-color: transparent; }
    30% { background-color: rgba(216,180,90,.18); }
}
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-8px); } }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
    .arena { flex-direction: column; gap: 16px; }
    .versus { transform: rotate(90deg); margin: -4px 0; }
    .masthead { padding-top: 28px; }
}

/* ---------- a11y ---------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .score.bump { transform: none; }
}
