/* Contestant Portal — dusk palette. Light mode is a pale dawn, dark mode is the night after. */
:root {
  --bg: #f4f2fa; --card: #ffffff; --field: #f8f6fc; --text: #1c1631; --muted: #665f80; --line: #e3ddf0;
  --accent: #c2410c; --accent-hover: #9a3412; --accent-ink: #ffffff; --link: #b13b0b;
  --ok: #15803d; --err: #c62828;
  --shadow: 0 1px 2px rgb(28 22 49 / .05), 0 10px 30px -18px rgb(28 22 49 / .25);
  --display: "Pixelify Sans", "Schibsted Grotesk", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15112a; --card: #1f1938; --field: #19142f; --text: #f1ecff; --muted: #a69dc8; --line: #322a54;
    --accent: #ff8a3d; --accent-hover: #ffa262; --accent-ink: #1e1206; --link: #ffb07a;
    --ok: #4ade80; --err: #ff7a7a;
    --shadow: 0 1px 2px rgb(0 0 0 / .25), 0 14px 34px -20px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 "Schibsted Grotesk", system-ui, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 2.25rem 0 .75rem; }
.display { font-family: var(--display); font-weight: 600; letter-spacing: .01em; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; }
.fine { font-size: .8rem; color: var(--muted); margin: 1.25rem 0 0; }

/* ---- top bar: sits on the horizon line ---- */
.topbar { position: relative; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 24px; min-height: 60px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand-name { font-weight: 700; font-size: 1rem; }

nav { display: flex; gap: 20px; align-items: center; }
nav form { margin: 0; }
nav a, button.link { color: var(--muted); text-decoration: none; font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; padding: 0; }
nav a:hover, button.link:hover { color: var(--text); }
nav a[aria-current] { color: var(--text); }

/* ---- page frame ---- */
main { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 36px 16px 72px; }
main.wide { max-width: 1120px; }
main.center { display: grid; place-items: center; padding-top: 48px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 11px 20px; font: 650 15px "Schibsted Grotesk", system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--field); }
.btn.discord { width: 100%; background: #5865f2; color: #fff; }
.btn.discord:hover { background: #4752c4; }

/* ---- profile ---- */
.hero { padding: 0; overflow: hidden; }
.hero-body { display: flex; align-items: center; gap: 22px; padding: 24px; }
.avatar { border-radius: 50%; flex: none; }
.profile-info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.profile-info h1 { font-size: 2rem; overflow-wrap: anywhere; }
.hero-mc { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--field); }
.hero-mc .muted { margin-right: 2px; }

/* Minecraft accounts: square, pixel-crisp heads next to the name */
.mc { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }

.head { image-rendering: pixelated; image-rendering: crisp-edges; border-radius: 3px; flex: none; background: var(--field);
  box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
.mc-list { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mc-list .mc { font-weight: 500; }
.link-cta { display: inline-flex; align-items: center; gap: 10px; }

.role { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--role, var(--muted)) 45%, transparent);
  background: color-mix(in srgb, var(--role, var(--muted)) 14%, var(--card));
  color: color-mix(in srgb, var(--role, var(--muted)) 72%, var(--text)); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.role.inline { padding: 1px 8px; font-size: .78rem; }
.swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--role, var(--muted)); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- form ---- */
.form { display: grid; gap: 20px; }
.form label { display: grid; gap: 3px; }
.form label span { font-weight: 650; }
.form small { color: var(--muted); }
.form input { margin-top: 6px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font: inherit; width: 100%; transition: border-color .12s, box-shadow .12s; }
.form input:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.form .btn { justify-self: start; }
.form input.invalid { border-color: var(--err); }
.field { display: grid; gap: 4px; }
.field-title { font-weight: 600; }
.field small { color: var(--muted); }
.field-msg { min-height: 1.2em; font-size: .8rem; }
.field-msg:empty { display: none; }
.field-msg.error { color: var(--err); }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 18px; border: 1px solid var(--line); background: var(--card); }
.flash.ok { border-color: var(--ok); color: var(--ok); }
.flash.error { border-color: var(--err); color: var(--err); }

/* ---- login / no access ---- */
.login { max-width: 400px; width: 100%; padding: 0; overflow: hidden; text-align: center; }
.login-body { padding: 34px 30px 30px; }
.login h1 { font-size: 1.75rem; letter-spacing: -.01em; margin-bottom: .4rem; }
.login .btn { margin-top: 1.5rem; }
.login .muted { max-width: 30ch; margin: 0 auto; }

/* ---- admin ---- */
.tabs { display: flex; gap: 2px; box-shadow: inset 0 -1px var(--line); margin-bottom: 28px; overflow-x: auto; overflow-y: hidden; }
.tabs a { display: flex; align-items: center; gap: 9px; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-weight: 500; font-size: .85rem; color: var(--muted); }
.admin-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head h1 { font-size: 2rem; }

.team { padding: 0; margin-bottom: 16px; overflow: hidden; }
.team-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.team-head .muted { margin-left: auto; }
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; background: var(--field); white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--field) 70%, transparent); }
tr:last-child td { border-bottom: 0; }
td a { overflow-wrap: break-word; }
.team table th:first-child { width: 26%; }
.member { display: flex; gap: 12px; align-items: flex-start; }
.member img { border-radius: 50%; flex: none; }
.member strong { font-weight: 650; }
.member .muted { line-height: 1.4; }
.pending { display: inline-block; margin-top: 4px; padding: 0 7px; border-radius: 999px; border: 1px dashed var(--line); font-size: .75rem; color: var(--muted); }
.empty { color: var(--muted); }

/* ---- timezone picker ---- */
.narrow { max-width: 680px; margin: 0 auto; }
.tz-card { margin-top: 32px; padding: 22px; width: min(1440px, calc(100vw - 32px)); position: relative; left: 50%; transform: translateX(-50%); }
.tz-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tz-title { margin: 0 0 2px; }
.tz-head .muted { margin: 0; }
.tz-summary { margin: 0; }
.map-wrap { position: relative; }
.world { display: block; width: 100%; height: auto; background: var(--field); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; user-select: none; touch-action: pan-y; }
.world.zoomed { cursor: grab; touch-action: none; }
.world.dragging { cursor: grabbing; }
.regions path { fill: color-mix(in srgb, var(--text) 13%, var(--field)); stroke: var(--field); stroke-width: .6px; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill .08s; }
.regions path.hover-offset, .zones circle.hover-offset { fill: color-mix(in srgb, var(--text) 24%, var(--field)); }
.regions path.selected-offset, .zones circle.selected-offset { fill: color-mix(in srgb, var(--accent) 32%, var(--field)); }
.regions path.hover, .zones circle.hover { fill: color-mix(in srgb, var(--text) 50%, var(--field)); }
.regions path.selected, .zones circle.selected { fill: var(--accent); }
.zones circle { display: none; fill: color-mix(in srgb, var(--text) 40%, var(--field)); r: calc(2.2px / var(--zoom, 1)); }
.zones circle.island, .zones circle.selected { display: block; }
.map-tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 4px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: .8rem; font-weight: 500; white-space: nowrap; pointer-events: none; }
.map-controls { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.map-controls button { width: 32px; height: 32px; border: 0; background: none; color: var(--text); font: 600 16px "Schibsted Grotesk", system-ui, sans-serif; cursor: pointer; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover { background: var(--field); }
.map-hint { margin: 6px 0 0; }
.hint-touch { display: none; }
.tz-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tz-row select { flex: 0 1 420px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); font: inherit; }
.tz-row .btn { padding: 9px 14px; font-size: .9rem; }
.tz-card .field-msg { display: block; margin-top: 8px; }
.tz-card .field-msg:empty { display: none; }

/* ---- footer & policy ---- */
.site-footer { display: flex; justify-content: center; gap: 18px; padding: 0 16px 32px; color: var(--muted); font-size: .85rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.prose { padding: 36px 40px; line-height: 1.7; }
.prose h1 { font-family: var(--display); font-weight: 600; font-size: 2rem; padding-bottom: 14px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.prose h2 { margin: 30px 0 8px; }
.prose p, .prose li { max-width: 72ch; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose .last-updated { margin-top: 30px; }

/* Phones: the page links (for admins) get a row of their own. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 0; padding: 10px 16px; }
  .topbar:has(nav a) { padding-bottom: 0; }
  .topbar nav:has(a) { order: 3; flex-basis: calc(100% + 32px); margin: 8px -16px 0; padding: 0 16px; gap: 22px; border-top: 1px solid var(--line); }
  .topbar nav:has(a) a, .topbar nav:has(a) button.link { padding: 11px 0; white-space: nowrap; box-shadow: inset 0 -2px transparent; }
  .topbar nav:has(a) a[aria-current] { box-shadow: inset 0 -2px var(--accent); }
  .topbar nav:has(a) form { margin-left: auto; }
  /* Directory: each person is a card rather than a row of a wide table. */
  .team table, .team tbody, .team tr, .team td { display: block; }
  .team thead { display: none; }
  .team tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .team tr:last-child { border-bottom: 0; }
  .team td { position: relative; padding: 0 0 0 94px; margin-top: 8px; border: 0; overflow-wrap: anywhere; }
  .team td::before { content: attr(data-label); position: absolute; left: 0; top: 0; color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.9; }
  .team td:first-child { margin: 0 0 4px; padding: 0; }
  .team td:first-child::before { content: none; }
  .team tbody tr:hover td { background: none; }
  /* 16px, or iOS zooms in on the field when it's tapped. */
  .form input, .tz-row select { font-size: 16px; }
  .tz-row select { flex-basis: 100%; }
  .tz-card { padding: 18px 16px; }
}
@media (pointer: coarse) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
  .map-controls button { width: 40px; height: 40px; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 16px; }
  .hero-body { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px 18px; }
  .avatar { width: 84px; height: 84px; }
  .profile-info h1, .admin-head h1, .login h1 { font-size: 1.6rem; }
  .hero-mc { padding: 12px 18px; }
  .prose { padding: 24px 18px; }
  th, td { padding: 10px 14px; }
}

/* Admin: click-to-copy */
.copy { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: copy; }
.copy:hover { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: .875rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.busy, .toast.done { display: flex; align-items: center; gap: 8px; }
.toast.busy::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--bg) 35%, transparent); border-top-color: var(--bg); animation: toast-spin .7s linear infinite; }
.toast.done::before { content: ""; width: 10px; height: 5px; margin: -3px 1px 0; border: solid var(--bg); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .toast.busy::before { animation: none; } }
/* Phones: at the top, where the on-screen keyboard can't cover it. */
@media (max-width: 640px) {
  .toast { top: calc(env(safe-area-inset-top) + 12px); bottom: auto; transform: translate(-50%, -8px); }
}

/* ---- Minecraft linking ---- */
.link-card { display: grid; gap: 18px; }
.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding-left: 34px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: var(--field); border: 1px solid var(--line); font-size: .8rem; font-weight: 650; }
.address { padding: 0 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--text); font: 650 .92em "Schibsted Grotesk", system-ui, sans-serif; cursor: copy; }
.address:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.link-fields { display: grid; grid-template-columns: 1fr 150px auto; gap: 12px; align-items: end; }
.link-fields .btn { padding-block: 12px; white-space: nowrap; }
.link-fields .btn:disabled { opacity: .6; cursor: progress; }
.link-form .field-msg { display: block; margin-top: 10px; }
.link-form .field-msg:empty { display: none; }

/* ---- directory: socials ---- */
.socials { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.socials dt { color: var(--muted); font-size: .82rem; line-height: 1.75; }
.socials dd { margin: 0; overflow-wrap: anywhere; }
.row-note { display: block; margin-top: 2px; }

@media (max-width: 560px) {
  .link-fields { grid-template-columns: 1fr; }
  .link-fields .btn { width: 100%; }
}
