/* Seagullion pixel UI theme (07 §4, §9, §10). Shares the palette with client/src/hud/theme.css. */

@font-face {
  font-family: "Silkscreen";
  src: url("../fonts/Silkscreen-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("../fonts/Silkscreen-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("../fonts/VT323-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #0d1b2a;
  --night: #1b263b;
  --panel: rgba(13, 27, 42, 0.90);
  --line: #415a77;
  --mist: #8ecae6;
  --foam: #f1faee;
  --muted: #a3b1c6;
  --sun: #ffd166;
  --beak: #f4a261;
  --coral: #ef476f;
  --teal: #2ec4b6;

  --tier-splat: #5c677d;
  --tier-breadcrumb: #c8b6a6;
  --tier-showoff: #f4a261;
  --tier-flock: #8ecae6;
  --tier-updraft: #2ec4b6;
  --tier-jetstream: #b388ff;
  --tier-seagullion: #ffd166;

  --rarity-common: #c8b6a6;
  --rarity-rare: #8ecae6;
  --rarity-epic: #b388ff;
  --rarity-legendary: #ffd166;

  --notch: polygon(2px 0, calc(100% - 2px) 0, calc(100% - 2px) 2px, 100% 2px, 100% calc(100% - 2px),
                   calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 2px calc(100% - 2px),
                   0 calc(100% - 2px), 0 2px, 2px 2px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--ink);
  background-image:
    linear-gradient(180deg, rgba(23, 63, 115, 0.55) 0%, rgba(13, 27, 42, 0) 60%);
  background-attachment: fixed;
  color: var(--foam);
  font-family: "VT323", ui-monospace, monospace;
  font-size: 22px;
  line-height: 1.25;
}

img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

a { color: var(--mist); }
a:hover, a:focus-visible { color: var(--sun); }

:focus-visible { outline: 2px dashed var(--sun); outline-offset: 2px; }

h1, h2, h3, h4, .label, .btn, button, label, th, .nav a, .tabs a {
  font-family: "Silkscreen", "VT323", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 400;
}

h1 { font-size: 28px; margin: .4em 0; }
h2 { font-size: 20px; margin: .6em 0 .4em; color: var(--mist); }
h3 { font-size: 16px; margin: .6em 0 .3em; color: var(--muted); }

.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Logo ---------- */
.logo {
  font-family: "Silkscreen", monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--foam);
  text-shadow: -1px 0 var(--coral), 1px 0 #48cae4, 2px 2px 0 var(--ink);
  text-decoration: none;
}
.logo.big { font-size: clamp(30px, 8vw, 56px); display: block; text-align: center; margin: 24px 0 8px; }
@media (prefers-reduced-motion: no-preference) {
  .logo.big { animation: logo-jitter 4s steps(1) infinite; }
}
@keyframes logo-jitter {
  0%, 92%, 100% { transform: translate(0, 0); }
  94% { transform: translate(1px, 0); }
  96% { transform: translate(-1px, 1px); }
}

/* ---------- Layout ---------- */
.site-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}
.site-header .logo { font-size: 20px; }
.nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; flex: 1; }
.nav a { color: var(--foam); text-decoration: none; font-size: 13px; }
.nav a:hover, .nav a:focus-visible { color: var(--sun); }
.nav .spacer { flex: 1; }
.nav form { display: inline; margin: 0; }
.nav .linklike { background: none; border: 0; padding: 0; color: var(--foam); font-size: 13px; cursor: pointer; clip-path: none; box-shadow: none; }
.nav .linklike:hover { color: var(--sun); }

main.container { max-width: 960px; margin: 0 auto; padding: 16px; }
main.container.wide { max-width: 1200px; }

.site-footer { text-align: center; color: var(--muted); font-size: 18px; padding: 24px 16px 40px; }

/* ---------- Panels & buttons ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--mist);
  box-shadow: inset 0 0 0 2px var(--night);
  clip-path: var(--notch);
  padding: 16px;
  margin: 12px 0;
}
.panel.tight { padding: 10px; }

.btn, button, input[type=submit] {
  display: inline-block;
  font-size: 14px;
  color: var(--foam);
  background: var(--panel);
  border: 2px solid var(--mist);
  box-shadow: inset 0 0 0 2px var(--night);
  clip-path: var(--notch);
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover, button:hover, .btn:focus-visible, button:focus-visible { border-color: var(--sun); color: var(--foam); }
.btn:active, button:active { transform: translateY(2px); }
.btn:disabled, button:disabled, .btn.disabled {
  border-color: var(--line); color: var(--muted); cursor: not-allowed; transform: none;
}
.btn.primary { border-color: var(--sun); }
.btn.big { font-size: 18px; padding: 16px 22px; display: block; width: 100%; }
.btn.danger { border-color: var(--coral); }
.btn.small { font-size: 11px; padding: 6px 10px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12px; margin: 10px 0 4px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%;
  font-family: "VT323", monospace;
  font-size: 22px;
  color: var(--foam);
  background: var(--ink);
  border: 2px solid var(--line);
  padding: 6px 10px;
  border-radius: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--mist); outline: none; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--sun); vertical-align: middle; }
.form-row { margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline-form > * { flex: 1 1 160px; }
.inline-form > .btn, .inline-form > button { flex: 0 0 auto; }

.validation-summary-errors, .field-validation-error, .text-danger { color: var(--coral); font-size: 20px; }
.validation-summary-valid { display: none; }
.alert { border: 2px solid var(--line); padding: 8px 12px; margin: 8px 0; }
.alert-success, .alert.success { border-color: var(--teal); }
.alert-danger, .alert.danger { border-color: var(--coral); }
.alert-warning, .alert.warning { border-color: var(--sun); }

/* Minimal compatibility for the default Identity UI pages (Bootstrap class names). */
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > [class*="col-"] { flex: 1 1 280px; }
.form-floating { margin-bottom: 12px; display: flex; flex-direction: column-reverse; }
.form-floating > label { margin: 0 0 4px; }
.form-control, .form-select { width: 100%; }
.form-check { margin: 8px 0; }
.form-check-label { display: inline; text-transform: none; font-family: "VT323", monospace; font-size: 20px; }
.btn-primary { border-color: var(--sun); }
.btn-danger { border-color: var(--coral); }
.w-100 { width: 100%; }
.nav-pills { display: flex; flex-direction: column; gap: 6px; list-style: none; padding: 0; }
.nav-pills .nav-link { display: block; font-family: "Silkscreen", monospace; text-transform: uppercase; font-size: 12px; padding: 6px 8px; border: 2px solid var(--line); text-decoration: none; color: var(--foam); }
.nav-pills .nav-link.active { border-color: var(--sun); }
hr { border: 0; border-top: 2px solid var(--line); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 20px; }
th { font-size: 11px; text-align: left; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
td { padding: 6px 8px; border-bottom: 1px solid rgba(65, 90, 119, 0.5); vertical-align: middle; }
tr.you td { background: rgba(255, 209, 102, 0.12); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.tabs a, .tabs button {
  font-size: 12px; text-decoration: none; color: var(--foam);
  border: 2px solid var(--line); padding: 6px 10px; background: var(--ink); clip-path: var(--notch);
}
.tabs a.active, .tabs button.active { border-color: var(--sun); color: var(--sun); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: "Silkscreen", monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 6px; border: 2px solid currentColor; color: var(--muted); white-space: nowrap;
}
.badge img { width: 16px; height: 16px; }
.tier-badge { display: inline-flex; align-items: center; gap: 4px; }
.tier-badge img { width: 24px; height: 24px; }

/* ---------- Home ---------- */
.hero { text-align: center; }
.hero .tagline { color: var(--muted); margin: 0 0 16px; }
.daily-cta { max-width: 420px; margin: 0 auto 18px; }
.daily-cta .done { color: var(--teal); }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mode-card { display: flex; flex-direction: column; gap: 8px; }
.mode-card h3, .mode-card h2.mode-title { color: var(--sun); margin: 0; font-size: 14px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 20px; flex: 1; }
.mode-card .options { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Game page ---------- */
body.game-page { overflow: hidden; background-image: none; }
body.game-page .site-header, body.game-page .site-footer { display: none; }
#game-shell { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#game-frame { position: relative; }
#game-root canvas { display: block; image-rendering: pixelated; }
#hud-root { position: absolute; inset: 0; pointer-events: none; }

/* ---------- Cookie notice ---------- */
.cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 40; max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.cookie-notice p { margin: 0; flex: 1; font-size: 19px; }

/* ---------- Retro screen effects (07 §9) ---------- */
body.retro::before, body.retro::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
}
body.retro::before {
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(5,10,20,.8) 100%);
}
body.retro::after {
  opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
  background-size: 140px 140px;
}

body.game-page .cookie-notice { display: none !important; }

/* ---------- Locker (06 §6.4) ---------- */
.locker { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 720px) { .locker { grid-template-columns: minmax(0, 1fr); } }
.locker-preview-panel { text-align: center; }
.locker-preview { display: inline-block; line-height: 0; border: 2px solid var(--line); }
.locker-preview canvas { image-rendering: pixelated; }
.locker .small { font-size: 18px; }
.tabs button[aria-selected="true"] { border-color: var(--sun); color: var(--sun); }
.tabs .new-dot { color: var(--sun); font-size: 9px; }
.locker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.locker-card {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  min-height: 132px; padding: 10px 6px 8px; border-color: var(--line); text-transform: none;
}
.locker-card .icon { image-rendering: pixelated; min-height: 24px; margin: 4px 0; }
.locker-card .name { font-family: "Silkscreen", monospace; font-size: 11px; text-transform: uppercase; }
.locker-card .meta { font-family: "VT323", monospace; font-size: 18px; color: var(--muted); }
.locker-card.rarity-common { border-color: var(--rarity-common); }
.locker-card.rarity-rare { border-color: var(--rarity-rare); }
.locker-card.rarity-epic { border-color: var(--rarity-epic); }
.locker-card.rarity-legendary { border-color: var(--rarity-legendary); animation: legendary-shimmer 1.6s steps(4) infinite; }
.locker-card.equipped { box-shadow: inset 0 0 0 2px var(--night), inset 0 0 0 4px var(--sun); }
.locker-card.locked { opacity: .55; filter: grayscale(1); cursor: not-allowed; }
.locker-card.locked:active { transform: none; }
.locker-card.empty { justify-content: center; border-style: dashed; }
.locker-card .tag {
  position: absolute; top: 4px; font-family: "Silkscreen", monospace; font-size: 8px; text-transform: uppercase; padding: 1px 4px;
}
.locker-card .tag-equipped { right: 4px; background: var(--sun); color: var(--ink); }
.locker-card .tag-new { left: 4px; background: var(--coral); color: var(--foam); }
.locker-status { min-height: 1.4em; margin: 10px 0 0; color: var(--muted); }
.locker-status.error { color: var(--coral); }
@keyframes legendary-shimmer {
  0% { border-color: #ffd166; }
  25% { border-color: #fff1c2; }
  50% { border-color: #ffd166; }
  75% { border-color: #f4a261; }
}

/* ---------- Season rewards modal (06 §5) ---------- */
.rewards-modal { max-width: 420px; width: calc(100% - 32px); color: var(--foam); }
.rewards-modal::backdrop { background: rgba(13, 27, 42, 0.75); }
.rewards-modal h2 { color: var(--sun); margin-top: 0; }
.rewards-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.rewards-list li { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; border: 2px solid var(--line); padding: 6px; }
.rewards-list li img { grid-row: 1 / 3; justify-self: center; image-rendering: pixelated; }
.rewards-list .name { font-family: "Silkscreen", monospace; font-size: 12px; text-transform: uppercase; }
.rewards-list .meta { color: var(--muted); font-size: 18px; }
.rewards-list .rarity-common { border-color: var(--rarity-common); }
.rewards-list .rarity-rare { border-color: var(--rarity-rare); }
.rewards-list .rarity-epic { border-color: var(--rarity-epic); }
.rewards-list .rarity-legendary { border-color: var(--rarity-legendary); }
.rewards-modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

@media (prefers-reduced-motion: reduce) {
  .locker-card.rarity-legendary { animation: none; }
}

/* ---------- Admin (08 §4): plain tables and forms ---------- */
.admin-nav { margin-bottom: 4px; }
.admin-answers td { vertical-align: top; }
.admin-answers tr.inactive td, tr.inactive td { opacity: .55; }
.admin-answers input.narrow { width: 90px; font-size: 18px; padding: 2px 6px; }
.admin-answers .aliases { min-width: 260px; }
.alias-chip { display: inline-flex; align-items: center; gap: 2px; margin: 0 6px 4px 0; border: 1px solid var(--line); padding: 0 4px; font-size: 18px; }
.alias-add { display: flex; gap: 4px; align-items: center; margin-top: 4px; }
.alias-add input[type=text] { font-size: 18px; padding: 2px 6px; width: 140px; }
label.inline { display: inline-flex; gap: 4px; align-items: center; margin: 0; font-size: 10px; }
.linklike { background: none; border: 0; box-shadow: none; clip-path: none; padding: 0 4px; color: var(--mist); cursor: pointer; font-size: inherit; }
.tier-counts { display: flex; flex-wrap: wrap; gap: 12px; }
.report-group { border-top: 2px solid var(--line); padding: 10px 0; }
.report-actions { display: grid; gap: 8px; }
.daily-day { border-top: 2px solid var(--line); padding: 6px 0; }
.daily-prompts li { margin: 4px 0; }
.pixel-icon { image-rendering: pixelated; max-width: 64px; }

/* In-game "Reduce motion" setting (07 §9) also applies to Razor pages. */
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }

/* ---------- Ranked page (E56) ---------- */
.ranked-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
@media (max-width: 760px) { .ranked-top { grid-template-columns: minmax(0, 1fr); } }
.ranked-current { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 22px; }
.ranked-current .badge { font-size: 16px; }
.ranked-rating strong { font-size: 28px; color: var(--sun); }
.rank-progress { height: 14px; border: 2px solid var(--line); background: var(--night); margin: 4px 0 10px; }
.rank-progress .fill { height: 100%; background: var(--sun); }
.rank-progress-labels { display: flex; justify-content: space-between; font-size: 18px; color: var(--muted); margin-top: 12px; }
.ranked-distances { list-style: none; padding: 0; margin: 8px 0; }
.ranked-distances li { margin: 6px 0; padding-left: 22px; position: relative; }
.ranked-distances li::before { position: absolute; left: 0; }
.ranked-distances .up::before { content: "▲"; color: var(--teal); }
.ranked-distances .down::before { content: "▼"; color: var(--coral); }
.ranked-distances strong { color: var(--foam); }
.ranked-rules { padding-left: 20px; margin: 0; }
.ranked-rules li { margin: 8px 0; }
.reward { display: inline-flex; align-items: center; gap: 10px; }
.reward img { width: 32px; height: 32px; border: 2px solid var(--line); background: var(--night); }
.secured { color: var(--teal); white-space: nowrap; }

/* ---------- Friends & friendly battles (E57) ---------- */
.nav-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 1px 5px; font-size: 10px; line-height: 14px; text-align: center; color: var(--ink); background: var(--sun); }
.friends-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
@media (max-width: 760px) { .friends-top { grid-template-columns: minmax(0, 1fr); } }
.friends-invites { border-color: var(--sun); margin-bottom: 16px; }
.friend-list { list-style: none; padding: 0; margin: 0; }
.friend-list li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(65, 90, 119, 0.5); }
.friend-actions { display: flex; gap: 8px; align-items: center; }
.friend-actions form { margin: 0; }
.presence { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border: 2px solid var(--ink); background: var(--muted); vertical-align: middle; }
.presence.online { background: var(--teal); }
.presence.busy { background: var(--sun); }

/* Battle invite notifications (client/src/social.ts): bottom-right corner, above the game. */
.invite-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px)); }
.invite-toast { padding: 12px 14px; border-color: var(--sun); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.invite-toast p { margin: 0 0 10px; font-size: 20px; }
.invite-toast .actions { display: flex; gap: 8px; }

/* ---------- Play menu (E58): three compact cards ---------- */
.play-intro { margin: 0 0 14px; }
.play-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.play-card { display: flex; flex-direction: column; gap: 10px; }
.play-card .mode-title { color: var(--sun); margin: 0; font-size: 14px; }
.play-card p { margin: 0; color: var(--muted); font-size: 20px; }
.play-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 4px 0 0; }
.play-actions .btn { margin: 0; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--foam); cursor: pointer; }
.play-links { font-size: 18px; }
.run-tag { display: inline-block; margin-left: 8px; padding: 0 6px; font-family: "Silkscreen", monospace; font-size: 9px; line-height: 16px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.run-tag.rapid { border-color: var(--sun); color: var(--sun); }
.bracket-tabs a { font-size: 14px; padding: 8px 16px; }
.solo-rank { white-space: nowrap; }
