/* Big Ring web: black background, thin white line art, cyan accent used sparingly,
   cool blue-grey frames (same palette as the game's premium sci-fi instrument UI). */
:root {
  --bg: #000;
  --text: #fff;
  --text-2: rgb(153, 166, 179);
  --cyan: rgb(92, 219, 255);
  --cyan-soft: rgba(92, 219, 255, 0.35);
  --frame: rgba(148, 173, 199, 0.75);
  --frame-faint: rgba(148, 173, 199, 0.22);
  --danger: rgb(255, 120, 110);
  --ok: rgb(120, 230, 160);
  --sans: "Avenir", "Avenir Next", "Mulish", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint colour clouds behind everything (the game's BackgroundGlow). */
body::before, body::after {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  pointer-events: none;
  filter: blur(40px);
}
body::before {
  background:
    radial-gradient(38% 30% at 25% 30%, rgba(92, 219, 255, 0.10), transparent 70%),
    radial-gradient(35% 32% at 78% 70%, rgba(110, 80, 220, 0.10), transparent 70%);
  animation: drift 38s ease-in-out infinite alternate;
}
body::after {
  background:
    radial-gradient(40% 28% at 70% 22%, rgba(40, 90, 200, 0.11), transparent 70%),
    radial-gradient(30% 30% at 20% 80%, rgba(40, 190, 170, 0.08), transparent 70%);
  animation: drift 52s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

a { color: inherit; }

/* --- Header --- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: 0.32em; font-size: 15px; }
.brand svg { width: 34px; height: 34px; overflow: visible; }
.brand-ring { fill: none; stroke: #fff; stroke-width: 1.5; filter: drop-shadow(0 0 4px var(--cyan-soft)); }
.brand-arc { fill: none; stroke: var(--cyan); stroke-width: 2.5; stroke-linecap: round; }
nav { display: flex; align-items: center; gap: 20px; font-size: 12px; letter-spacing: 0.2em; flex-wrap: wrap; justify-content: flex-end; }
nav a { color: var(--text-2); text-decoration: none; transition: color 0.2s; }
nav a:hover { color: var(--text); }
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.live { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

main { max-width: 880px; margin: 0 auto; padding: 8px 16px 64px; }

/* --- Panels --- */

.panel {
  border: 1px solid var(--frame);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 32px;
}
.panel.narrow { max-width: 420px; margin: 8vh auto 0; }
.eyebrow { color: var(--text-2); font-size: 11px; letter-spacing: 0.3em; margin: 0 0 10px; }
h1 { font-weight: 300; font-size: 30px; letter-spacing: 0.12em; margin: 0 0 8px; }
p.lead { color: var(--text-2); margin: 0 0 28px; line-height: 1.55; }

/* --- Forms --- */

form { display: flex; flex-direction: column; gap: 18px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 11px; letter-spacing: 0.25em; color: var(--text-2); }
input[type=email], input[type=password], input[type=text] {
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--frame-faint);
  border-radius: 999px;
  padding: 13px 20px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(92, 219, 255, 0.15); }
button, .button {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--cyan);
  background: transparent;
  border: 1px solid var(--cyan);
  border-radius: 999px;
  padding: 14px 20px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 0 18px rgba(92, 219, 255, 0.12), inset 0 0 12px rgba(92, 219, 255, 0.06);
  transition: background 0.2s, box-shadow 0.2s;
}
button:hover, .button:hover { background: rgba(92, 219, 255, 0.08); box-shadow: 0 0 26px rgba(92, 219, 255, 0.25); }
.links { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 12px; letter-spacing: 0.15em; }
.links a { color: var(--text-2); text-decoration: none; }
.links a:hover { color: var(--text); }
.error:not(:empty) { color: var(--danger); font-size: 14px; margin: 0 0 18px; }
.message:not(:empty) { color: var(--ok); font-size: 14px; margin: 0 0 18px; line-height: 1.5; }
.hidden { display: none !important; }

/* --- Highscores --- */

.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.board-head .count { color: var(--text-2); font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; }
.board { list-style: none; margin: 0; padding: 0; }
.tabs { display: flex; margin-bottom: 10px; border-bottom: 1px solid var(--frame-faint); }
.tab { flex: 1; text-align: center; padding: 10px 6px 12px; color: var(--text-2); text-decoration: none; font-size: 13px; letter-spacing: 0.15em; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s; }
.tab:hover { color: var(--text); }
.tab.selected { color: var(--text); border-bottom-color: var(--cyan); }
.tabs.sub { margin-top: -6px; }
.tabs.sub .tab { font-size: 11px; padding: 8px 4px 9px; }
.row {
  display: grid;
  grid-template-columns: 44px 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--frame-faint);
}
.row:last-child { border-bottom: none; }
.rank { font-family: var(--mono); color: var(--text-2); font-size: 15px; text-align: right; }
.dial { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.dial span { display: block; aspect-ratio: 1; min-width: 5px; border: 1px solid #fff; border-radius: 50%; }
.name { min-width: 0; }
.name strong { display: block; font-weight: 400; letter-spacing: 0.08em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name small { display: block; color: var(--text-2); font-size: 11px; letter-spacing: 0.18em; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size { font-family: var(--mono); font-size: 15px; text-align: right; white-space: nowrap; }
.row.top .rank { color: var(--text); }
.row.me { background: linear-gradient(90deg, rgba(92, 219, 255, 0.10), transparent 80%); border-radius: 10px; }
.row.me .rank, .row.me .name strong, .row.me .size { color: var(--cyan); }
.row.me .dial span { border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan-soft); }
.you { font-size: 10px; letter-spacing: 0.2em; border: 1px solid var(--cyan); border-radius: 999px; padding: 1px 7px; margin-left: 8px; vertical-align: 2px; }
.footer-note { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--frame-faint); color: var(--text-2); font-size: 13px; letter-spacing: 0.12em; text-align: center; }
.footer-note:empty { display: none; }
.footer-note b { color: var(--cyan); font-weight: 400; font-family: var(--mono); }
.empty { color: var(--text-2); text-align: center; padding: 40px 0; letter-spacing: 0.15em; }
.get-app { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.get-app .button { display: inline-flex; align-items: center; gap: 12px; }
.get-app svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }

@media (max-width: 560px) {
  .panel { padding: 22px 16px; border-radius: 14px; }
  h1 { font-size: 24px; }
  .row { grid-template-columns: 30px 30px 1fr auto; gap: 10px; }
  .dial { width: 30px; height: 30px; }
  .size { font-size: 13px; }
  header { padding: 16px; }
  .brand span { display: none; }
  .get-app .button { letter-spacing: 0.18em; padding: 14px 18px; }
  .tab { font-size: 11px; letter-spacing: 0.06em; padding: 10px 2px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none; }
}

/* --- Clickable rows and the info box (the game's ReferenceInfo) --- */

[hidden] { display: none !important; }
.row.open { cursor: pointer; transition: background 0.2s; border-radius: 10px; }
.row.open:hover, .row.open:focus-visible { background: rgba(148, 173, 199, 0.07); outline: none; }
.row.open:hover .name small, .row.open:focus-visible .name small { color: var(--cyan); }
.row.me.open:hover { background: linear-gradient(90deg, rgba(92, 219, 255, 0.16), rgba(148, 173, 199, 0.05) 80%); }
body.modal-open { overflow: hidden; }

.info-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.2s;
  overflow-y: auto;
}
.info-backdrop.shown { opacity: 1; }
.panel.info {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.88);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s ease-out;
  outline: none;
}
.info-backdrop.shown .panel.info { transform: none; }
.info-top { display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: start; }
.info-picture { width: 150px; height: 150px; display: flex; align-items: center; justify-content: center; }
.info-picture img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 0 14px rgba(92, 219, 255, 0.18)); }
.info h2 { font-weight: 300; font-size: 26px; letter-spacing: 0.1em; margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
.info-subtitle { font-style: italic; color: var(--text-2); margin: 6px 0 0; }
.info-description { color: var(--text); line-height: 1.55; margin: 14px 0 0; font-size: 15px; }
.info-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--frame-faint);
}
.info-column { display: flex; flex-direction: column; gap: 16px; border-right: 1px solid var(--frame-faint); padding-right: 24px; }
.info-measure { display: flex; flex-direction: column; gap: 4px; }
#info-details { display: flex; flex-direction: column; gap: 14px; }
.info-label { color: var(--text-2); font-size: 11px; letter-spacing: 0.25em; }
.info-value { font-family: var(--mono); font-size: 26px; }
.info-measure.small .info-value { font-family: var(--sans); font-size: 15px; letter-spacing: 0.04em; }
.info-note { color: var(--cyan); font-size: 11px; letter-spacing: 0.2em; margin-top: 2px; }
.info-side { display: flex; flex-direction: column; gap: 18px; justify-content: space-between; }
.info-fact { border: 1px solid var(--frame-faint); border-radius: 14px; padding: 16px 18px; }
.info-fact-title { color: var(--cyan); font-size: 11px; letter-spacing: 0.25em; }
.info-fact p { margin: 8px 0 0; line-height: 1.5; font-size: 14px; }

@media (max-width: 560px) {
  .info-top { grid-template-columns: 1fr; gap: 14px; }
  .info-picture { width: 100%; height: 130px; }
  .info h2 { font-size: 21px; }
  .info-bottom { grid-template-columns: 1fr; }
  .info-column { border-right: none; padding-right: 0; }
}

/* --- Admin (admin/index.html) --- */

.request { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--frame-faint); flex-wrap: wrap; }
.request:last-child { border-bottom: none; }
.request .detail { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.request form { display: flex; gap: 10px; }
.request button { width: auto; padding: 10px 18px; margin: 0; }
.request button.danger { color: var(--danger); border-color: var(--danger); }

/* --- Brag page (brag.html): a shared ring, tap speed or fact --- */

.brag-main { max-width: 640px; }
.panel.brag { text-align: center; padding: 36px 32px 30px; overflow: hidden; }
.brag-stage { position: relative; width: min(78vw, 340px); aspect-ratio: 1; margin: 6px auto 22px; display: flex; align-items: center; justify-content: center; }
.brag-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.brag-stage .ring-outer-faint { fill: none; stroke: rgba(148, 173, 199, 0.22); stroke-width: 0.6; stroke-dasharray: 1.5 4; transform-origin: 100px 100px; animation: brag-spin 60s linear infinite; }
.brag-ring { transform-origin: 100px 100px; animation: brag-grow 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ring-halo { fill: none; stroke: var(--cyan); stroke-width: 7; opacity: 0.12; filter: blur(4px); }
.brag-stage .ring-main { fill: none; stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 0 6px rgba(92, 219, 255, 0.55)); }
.brag-stage .ring-arc {
  fill: none; stroke: var(--cyan); stroke-width: 2.6; stroke-linecap: round;
  stroke-dasharray: calc(var(--progress) * 100) 100; stroke-dashoffset: 25;
  filter: drop-shadow(0 0 6px var(--cyan));
  animation: brag-arc 2.4s ease-out both;
}
/* The object stands inside the ring at its size relative to the ring's inner diameter (80/100 of the box). */
.brag-object {
  position: relative; width: calc(var(--fraction) * 80%); height: calc(var(--fraction) * 80%); object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(92, 219, 255, 0.22));
  animation: brag-float 7s ease-in-out infinite alternate, brag-fade 0.9s ease-out both;
}
.brag-stage .ring-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; pointer-events: none; }
.brag-stage .ring-readout-val { font-family: var(--mono); font-size: clamp(34px, 11vw, 56px); letter-spacing: 0.02em; }
.brag-stage .ring-readout-label { color: var(--text-2); font-size: 11px; letter-spacing: 0.3em; }
.kind-ring .ring-readout-val, .kind-none .ring-readout-val { font-size: clamp(20px, 6vw, 28px); }
.brag-ripples span {
  position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; margin: -15% 0 0 -15%;
  border: 1px solid var(--cyan); border-radius: 50%; opacity: 0;
  transform: rotate(var(--angle)) translateX(133%) scale(0.2);
  animation: brag-ripple 1.2s ease-out forwards;
}
.brag-kicker { color: var(--text-2); font-size: 12px; letter-spacing: 0.34em; margin: 0 0 8px; }
.brag-headline { font-size: clamp(26px, 7vw, 40px); letter-spacing: 0.12em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.brag-subtitle { font-style: italic; color: var(--text-2); margin: 8px 0 0; }
.brag-subtitle:empty { display: none; }
.brag-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 24px 0 0; }
.brag-stats:empty { display: none; }
.brag-stat { display: flex; flex-direction: column; gap: 4px; min-width: 120px; padding: 12px 16px; border: 1px solid var(--frame-faint); border-radius: 14px; background: rgba(0, 0, 0, 0.35); }
.brag-stat-label { color: var(--text-2); font-size: 10px; letter-spacing: 0.25em; }
.brag-stat-value { font-family: var(--mono); font-size: 18px; }
.brag-stat.text .brag-stat-value { font-family: var(--sans); font-size: 15px; letter-spacing: 0.04em; }
.brag-stat.accent { border-color: var(--cyan-soft); }
.brag-stat.accent .brag-stat-value { color: var(--cyan); }
.brag-cta { margin: 30px 0 0; padding-top: 26px; border-top: 1px solid var(--frame-faint); }
.brag-cta h2 { font-weight: 300; font-size: 22px; letter-spacing: 0.16em; margin: 0 0 10px; color: var(--cyan); }
.brag-cta p { color: var(--text-2); line-height: 1.6; margin: 0 auto; max-width: 480px; font-size: 15px; }
.brag-cta .get-app { margin-top: 20px; }
.get-app .button.preferred { background: rgba(92, 219, 255, 0.11); box-shadow: 0 0 30px rgba(92, 219, 255, 0.3), inset 0 0 16px rgba(92, 219, 255, 0.1); }
.brag-fact { margin: 28px 0 0; text-align: left; }
.brag-fact .brag-fact-big { font-size: 18px; line-height: 1.5; }
.brag-fact .brag-fact-more { color: var(--text-2); font-size: 14px; }
.brag-wiki { display: inline-block; margin-top: 12px; color: var(--text-2); font-size: 11px; letter-spacing: 0.22em; text-decoration: none; }
.brag-wiki:hover { color: var(--cyan); }
.brag-share { margin: 28px 0 0; padding-top: 22px; border-top: 1px solid var(--frame-faint); display: flex; flex-direction: column; gap: 12px; text-align: left; }
.brag-share textarea {
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--text); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--frame-faint); border-radius: 14px; padding: 12px 16px; resize: vertical; outline: none;
}
.brag-share textarea:focus { border-color: var(--cyan); }
.brag-share-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.brag-share-buttons button { flex: 1; min-width: 160px; }
.brag-share-links { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; font-size: 11px; letter-spacing: 0.22em; }
.brag-share-links a { color: var(--text-2); text-decoration: none; }
.brag-share-links a:hover { color: var(--cyan); }
.brag-footer { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--frame-faint); display: flex; justify-content: center; gap: 28px; flex-wrap: wrap; font-size: 12px; letter-spacing: 0.2em; }
.brag-footer a { color: var(--text-2); text-decoration: none; }
.brag-footer a:hover { color: var(--cyan); }

@keyframes brag-spin { to { transform: rotate(360deg); } }
/* The ring grows out from the object it passed. */
@keyframes brag-grow { from { transform: scale(calc(var(--fraction) * 0.9)); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
@keyframes brag-arc { from { stroke-dasharray: 0 100; } }
@keyframes brag-float { from { transform: translateY(-1.5%) rotate(-1.5deg); } to { transform: translateY(1.5%) rotate(1.5deg); } }
@keyframes brag-fade { from { opacity: 0; } }
@keyframes brag-ripple {
  0% { opacity: 0.8; transform: rotate(var(--angle)) translateX(133%) scale(0.2); }
  100% { opacity: 0; transform: rotate(var(--angle)) translateX(133%) scale(1); }
}

.brag-stat-link { display: flex; text-decoration: none; color: inherit; }
.brag-stat-link .brag-stat { flex: 1; transition: border-color 0.2s; }
.brag-stat-link:hover .brag-stat { border-color: var(--cyan-soft); }
.brag-fact.top { margin-top: 22px; }
.brag-fact.top .brag-fact-big { margin-top: 0; }
.brag-share textarea { resize: none; overflow: hidden; }

@media (max-width: 560px) {
  .panel.brag { padding: 26px 16px 22px; }
  .brag-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .brag-stat { min-width: 0; padding: 11px 8px; }
  .brag-stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .brag-stat-label { font-size: 9px; letter-spacing: 0.16em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brag-stat-value { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brag-stat.text .brag-stat-value { font-size: 14px; }
  .brag-cta h2 { font-size: 19px; letter-spacing: 0.12em; line-height: 1.35; }
  .brag-fact .brag-fact-big { font-size: 17px; }
  .get-app .button { width: 100%; justify-content: center; white-space: nowrap; letter-spacing: 0.16em; padding: 14px 12px; }
  .brag-share-buttons button { min-width: 0; letter-spacing: 0.2em; }
  .brag-share-links { gap: 16px; letter-spacing: 0.16em; }
}
@media (max-width: 380px) {
  .get-app .button { letter-spacing: 0.1em; gap: 10px; }
  .brag-share-links { gap: 12px; letter-spacing: 0.12em; }
}
@media (prefers-reduced-motion: reduce) {
  .brag-ring, .brag-stage .ring-arc, .brag-object, .brag-stage .ring-outer-faint { animation: none; }
}
