/* =========================================================================
   Surprise Weekend 2026 - Scorebord
   Mobile-first. "Sulfuurbaden Tbilisi": donker petrolblauw met turquoise
   (de koepels), koper (de daken) en zwavelgeel (de bronnen) als accenten.
   ========================================================================= */

:root {
    --bg:            #0a1a1e;
    --bg-glow:       #0e3a42;
    --surface:       #12282e;
    --surface-high:  #1a373f;
    --line:          #244349;

    --text:          #eef6f6;
    --text-soft:     #a7c5c7;
    --text-dim:      #6c8a8d;

    --turquoise:       #2dd4c5;
    --turquoise-deep:  #1a9c92;
    --copper:          #d98a4f;
    --copper-bright:   #e79f61;
    --copper-deep:     #a85f2c;
    --sulfur:          #e0b84c;
    --silver:          #c3d2d4;
    --bronze:          #b97a4a;
    --green:           #46c08a;
    --red:             #ef6459;

    /* De Dragers van de Kronieken: rood, groen, blauw; los van de
       semantische --red/--green hierboven, zodat een team-kleur nooit
       verward wordt met een plus/min-punt in de historie. */
    --dragers-red:     #dd4b3e;
    --dragers-green:   #3fae6a;
    --dragers-blue:    #4c7fe0;

    --radius:        16px;
    --radius-sm:     10px;
    --tap:           48px;

    --shadow:        0 10px 30px rgb(0 0 0 / 45%);

    --safe-top:      env(safe-area-inset-top, 0px);
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(120% 60% at 50% 0%, var(--bg-glow) 0%, transparent 60%),
        var(--bg);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Formuliervelden blijven gewoon selecteerbaar/bewerkbaar. */
input, textarea, select, [contenteditable] {
    user-select: text;
    -webkit-user-select: text;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- Hero ---------- */

.hero {
    padding: calc(var(--safe-top) + 32px) 20px 24px;
    text-align: center;
}

.hero__lustrum {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 8px 20px;
    border: 1px solid var(--sulfur);
    border-radius: 999px;
    background: linear-gradient(135deg, rgb(224 184 76 / 24%), rgb(217 138 79 / 16%));
    font-size: clamp(1rem, 4.5vw, 1.3rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--sulfur);
}

.hero__kicker {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--turquoise);
}

.hero__year {
    margin: 2px 0 4px;
    font-size: clamp(3.2rem, 18vw, 5rem);
    line-height: 0.95;
    background: linear-gradient(180deg, #fff3e6 0%, var(--copper-bright) 50%, var(--copper-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero__theme {
    margin: 2px 0 12px;
    font-size: clamp(1.15rem, 5.2vw, 1.7rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--text-soft);
}

.hero__location {
    margin: 0;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* ---------- Layout ---------- */

.page {
    width: min(680px, 100%);
    margin: 0 auto;
    padding: 0 14px 8px;
}

/* ---------- Legende ---------- */

.legend {
    margin: 4px 0 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.legend__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 0 14px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--turquoise);
    cursor: pointer;
    list-style: none;
}

.legend__summary::-webkit-details-marker { display: none; }

.legend__summary::before {
    content: '▸';
    flex: none;
    font-size: 1.3rem;
    color: var(--text-dim);
    transition: transform 0.15s ease;
}

.legend[open] .legend__summary::before {
    transform: rotate(90deg);
}

.legend__text {
    margin: 0;
    padding: 0 16px 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-soft);
}

.legend__link {
    color: var(--turquoise);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- Het Geheime Kronieken-ei ---------- */

.egg {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 10px 0 4px;
    padding: 14px 16px;
    border: 1px solid var(--sulfur);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgb(224 184 76 / 14%), transparent);
}

.egg__icon {
    flex: none;
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgb(224 184 76 / 40%));
}

.egg__title {
    margin: 0 0 2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sulfur);
}

.egg__status {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-soft);
}

.egg__status strong { color: var(--text); }

.egg--solved {
    background: linear-gradient(135deg, rgb(224 184 76 / 22%), rgb(45 212 197 / 10%));
    box-shadow: 0 0 0 1px rgb(224 184 76 / 30%) inset;
}

.egg-admin {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 22px;
}

.egg-admin .btn { flex: 1 1 auto; }

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 22px 4px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.section-title__meta {
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: none;
    color: var(--text-dim);
}

/* ---------- Scorebord ---------- */

.board__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.board__loading,
.board__empty {
    padding: 28px 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--text-dim);
    text-align: center;
}

.team-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    animation: row-in 0.35s ease both;
}

@keyframes row-in {
    from { opacity: 0; transform: translateY(6px); }
}

.team-card__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-card__rank {
    flex: none;
    width: 26px;
    font-size: 1.05rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.team-card__swatch {
    flex: none;
    width: 8px;
    height: 34px;
    border-radius: 999px;
}

/* Positionele fallback-kleuren (id-volgorde), gebruikt als de teamnaam geen
   kleur bevat. */
.team-swatch--0 { background: var(--copper-bright); }
.team-swatch--1 { background: var(--turquoise); }
.team-swatch--2 { background: var(--sulfur); }

/* De Dragers: kleur volgt de naam ("Rode/Groene/Blauwe Dragers"). */
.team-swatch--red   { background: var(--dragers-red); }
.team-swatch--green { background: var(--dragers-green); }
.team-swatch--blue  { background: var(--dragers-blue); }

.team-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.team-card__name {
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-card__crown-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.team-card__score {
    flex: none;
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.team-card__score span {
    margin-left: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* Mobiel (default): foto's op één rij, 3 gelijke kolommen; spellen-tags
   eronder gestapeld, want naast elkaar past de breedte niet. Vanaf tablet-
   breedte (zie media query onderaan) weer leden links, tags rechts. */

.team-card__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 14px 0 0;
}

.team-card__members {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.team-card__empty {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.team-card__games {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.game-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    background: rgb(255 255 255 / 5%);
    font-size: 0.78rem;
    color: var(--text-soft);
}

.game-chip__points {
    flex: none;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.game-chip__points--plus  { color: var(--green); }
.game-chip__points--minus { color: var(--red); }

.member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 76px;
}

.member__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(150deg, var(--surface-high), #204048);
    border: 2px solid var(--line);
    display: grid;
    place-items: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-soft);
}

.member__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.member__name {
    max-width: 76px;
    font-size: 0.75rem;
    line-height: 1.15;
    color: var(--text-soft);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Podium: nummer 1 het grootst, daarna 2 en 3. */

.team-card--1 {
    padding: 20px 18px;
    border-color: var(--turquoise-deep);
    background:
        linear-gradient(135deg, rgb(45 212 197 / 16%), rgb(217 138 79 / 14%)),
        var(--surface-high);
    box-shadow: var(--shadow), 0 0 0 1px rgb(45 212 197 / 22%) inset;
}

.team-card--1 .team-card__name   { font-size: 1.3rem; }
.team-card--1 .team-card__score  { font-size: 2.1rem; color: var(--turquoise); }
.team-card--1 .team-card__rank   { color: var(--turquoise); font-size: 1.3rem; }
.team-card--1 .member__avatar    { width: 76px; height: 76px; }

.team-card--2 { border-color: #3a545a; }
.team-card--2 .team-card__rank  { color: var(--silver); }
.team-card--2 .team-card__score { font-size: 1.7rem; }

.team-card--3 { border-color: var(--copper-deep); }
.team-card--3 .team-card__rank  { color: var(--bronze); }
.team-card--3 .team-card__score { font-size: 1.6rem; }

.crown {
    flex: none;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #2a1a05;
    background: var(--sulfur);
}

/* ---------- Historie ---------- */

.history__list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.history__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgb(255 255 255 / 3%);
    font-size: 0.92rem;
}

.history__points {
    flex: none;
    min-width: 34px;
    padding-top: 1px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.history__points--plus  { color: var(--green); }
.history__points--minus { color: var(--red); }

/* Wie en wat/wanneer elk op hun eigen regel: op smalle schermen past dat
   niet naast elkaar, en de tijd mag nooit halverwege afgeknipt worden. */
.history__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history__who {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history__what {
    color: var(--text-dim);
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history__empty { color: var(--text-dim); font-size: 0.9rem; padding: 4px; }

/* ---------- Footer ---------- */

.page-footer {
    padding: 26px 16px calc(var(--safe-bottom) + 34px);
    text-align: center;
}

.page-footer__note {
    margin: 10px 0 0;
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* ---------- Knoppen ---------- */

.btn {
    min-height: var(--tap);
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-high);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn--primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--copper-bright), var(--copper-deep));
    color: #fff;
}

.btn--ghost { background: transparent; color: var(--text-soft); }
.btn--danger { border-color: #6d3320; background: transparent; color: var(--red); }

.btn--block { display: block; width: 100%; }

.btn--icon {
    min-height: 40px;
    min-width: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ---------- Sheets (login + admin) ---------- */

.sheet[hidden] {
    display: none;
}

.sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgb(8 3 7 / 72%);
    backdrop-filter: blur(4px);
    animation: fade-in 0.2s ease both;
}

@keyframes fade-in { from { opacity: 0; } }

.sheet__panel {
    width: min(560px, 100%);
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: var(--bg);
    box-shadow: var(--shadow);
    animation: sheet-up 0.26s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes sheet-up { from { transform: translateY(18px); opacity: 0; } }

.sheet--full .sheet__panel { height: 92dvh; }

.sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--line);
}

.sheet__title { font-size: 1.1rem; }

.sheet__close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-high);
    color: var(--text-soft);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.sheet__body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 18px calc(var(--safe-bottom) + 26px);
}

/* ---------- Formulieren ---------- */

.form { display: grid; gap: 14px; }
.form__title { margin-top: 8px; font-size: 0.95rem; color: var(--text-soft); }

.field { display: grid; gap: 6px; }

.field__label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.field__input {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 1rem; /* voorkomt inzoomen op iOS */
}

.field__input:focus-visible {
    outline: 2px solid var(--copper-bright);
    outline-offset: 1px;
}

textarea.field__input { resize: vertical; line-height: 1.5; }

.hint { margin: 0; font-size: 0.85rem; color: var(--text-dim); }

.alert {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgb(239 91 107 / 14%);
    color: #ffc6cc;
    font-size: 0.88rem;
}

/* ---------- Tabs ---------- */

.tabs {
    display: flex;
    gap: 4px;
    margin: 0 -18px 16px;
    padding: 4px 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--surface);
}

.tabs::-webkit-scrollbar { display: none; }

.tabs__tab {
    flex: none;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.tabs__tab.is-active { background: var(--copper-deep); color: #fff; }

.tabpanel { display: none; }
.tabpanel.is-active { display: block; }

/* ---------- Ronde invoeren ---------- */

.round-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.round-row {
    display: grid;
    grid-template-columns: 1fr 96px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.round-row__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.round-row__input {
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

/* ---------- Snel punten ---------- */

.quick-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.quick-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.quick-row__label { display: grid; }
.quick-row__name { font-weight: 700; }
.quick-row__score { font-size: 0.8rem; color: var(--text-dim); }

.quick-row__buttons { display: flex; gap: 6px; }

/* ---------- Spelersbeheer ---------- */

.player-admin { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 18px 0; }

.player-admin__row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--surface);
}

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

.player-admin__bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 62px;
}

.player-admin__avatar {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--surface-high);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-soft);
}

.player-admin__avatar img { width: 100%; height: 100%; object-fit: cover; }

.player-admin__name {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 600;
}

.player-admin__name:focus-visible {
    border-color: var(--line);
    background: var(--bg);
    outline: none;
}

.player-admin__team {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
}

.danger {
    margin: 22px 0;
    padding: 14px;
    border: 1px solid #6d3320;
    border-radius: var(--radius);
}

.danger__title { margin-bottom: 10px; font-size: 0.9rem; color: var(--red); }

/* ---------- Historie in admin ---------- */

.log-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }

.log-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.9rem;
}

.log-item__meta { color: var(--text-dim); font-size: 0.78rem; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-bottom) + 22px);
    z-index: 100;
    transform: translateX(-50%);
    max-width: min(420px, calc(100vw - 32px));
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--surface-high);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    animation: toast-in 0.22s ease both;
}

.toast--error { border-color: #8a4b2a; color: #ffc6cc; }

@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Groter scherm ---------- */

@media (min-width: 720px) {
    .hero { padding-top: 56px; }
    .page { padding-inline: 0; }
    .sheet { align-items: center; padding: 20px; }
    .sheet__panel { border-radius: 22px; border-bottom: 1px solid var(--line); }
    .sheet--full .sheet__panel { height: min(80dvh, 760px); }

    /* Nu past leden-links/tags-rechts wél naast elkaar. */
    .team-card__body {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .team-card__members {
        display: flex;
        flex: none;
        flex-wrap: wrap;
        justify-items: initial;
    }

    .team-card__games {
        flex: 1;
        align-items: flex-end;
    }

    .game-chip { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
