/* agalaxy.io - "instrument" identity.
   The interface reads like a modern observatory readout: ink sky, warm paper-white type, hairline rules,
   corner registration marks instead of rounded boxes, big tight display type against small mono data.
   One accent colour, --acc, is not decoration: it is the spectral colour of the form you currently are
   (rock, planet, star, black hole, galaxy), so the whole interface shifts as you evolve. */
:root {
  --ink: #070a12;
  --paper: #ece6d6;
  --dim: rgba(236, 230, 214, .62);
  --faint: rgba(236, 230, 214, .38);
  --line: rgba(236, 230, 214, .16);
  --acc: #c8a45a;
  --danger: #ff6a4d;
  --ok: #8fe3b0;
  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 13px; -webkit-user-select: none; user-select: none; touch-action: none; -webkit-font-smoothing: antialiased; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* registration marks: two opposite corners, the way a plate is keyed */
.panel, .card, #board { position: relative; }
.panel::before, .panel::after, .card::before, .card::after, #board::before, #board::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 0 solid var(--acc); transition: border-color .6s; }
.panel::before, .card::before, #board::before { left: -1px; top: -1px; border-left-width: 2px; border-top-width: 2px; }
.panel::after, .card::after, #board::after { right: -1px; bottom: -1px; border-right-width: 2px; border-bottom-width: 2px; }
.panel::before, .panel::after { width: 26px; height: 26px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
#topleft { position: absolute; left: 20px; top: 16px; width: 290px; }
#form { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
#formName { font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1; letter-spacing: -.02em; color: var(--acc); transition: color .6s; }
#massVal { font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; }
#massVal::after { content: " M"; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .1em; }
/* progress reads as a ruled scale with a tick every tenth */
#bar { position: relative; height: 9px; margin-top: 10px; border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(90deg, var(--faint) 0 1px, transparent 1px 10%); }
#barFill { position: absolute; left: 0; bottom: -2px; height: 3px; width: 0; background: var(--acc); box-shadow: 0 0 12px var(--acc); transition: width .25s, background .6s; }
#barLabel { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-top: 7px; }
#boostRow { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 10px; letter-spacing: .18em; color: var(--dim); }
/* boost is fuel: counted in cells, not poured */
#boostBar { flex: 1; height: 7px; background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 12px); }
#boostFill { height: 100%; width: 100%; background: var(--paper); transition: width .15s;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); }
#boostFill.low { background: var(--danger); }
#objective { margin-top: 12px; font-family: var(--display); font-weight: 500; font-size: 14.5px; color: var(--paper); }
#runStats { margin-top: 6px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

#board { position: absolute; right: 20px; top: 16px; width: 220px; padding: 12px 14px 10px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 10, 18, .7), rgba(7, 10, 18, .35)); }
#board h3, .card h3 { margin: 0 0 8px; font-size: 10px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--dim);
  display: flex; justify-content: space-between; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
#board ol, #alltime, #liveList { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
#board li, #alltime li, #liveList li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; color: var(--dim); }
#board li span:first-child, #alltime li span:first-child, #liveList li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#board li span:last-child, #alltime li span:last-child, #liveList li span:last-child { font-variant-numeric: tabular-nums; color: var(--paper); }
#board li.me, #board li.me span:last-child { color: var(--acc); font-weight: 600; }
#rank { margin-top: 8px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

#feed { position: absolute; left: 20px; bottom: 18px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
#feed div { color: var(--dim); animation: fade 6s forwards; }
#feed div::before { content: "\2014\00a0"; color: var(--acc); }
#feed b { color: var(--paper); font-weight: 600; }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

#minimap { position: absolute; right: 20px; bottom: 18px; border: 1px solid var(--line); background-color: rgba(7, 10, 18, .6);
  background-image: linear-gradient(var(--line), var(--line)), linear-gradient(var(--line), var(--line)); background-size: 1px 100%, 100% 1px; background-position: 50% 0, 0 50%; background-repeat: no-repeat; }

#banner { position: absolute; left: 0; right: 0; top: 20%; text-align: center; opacity: 0; transform: translateY(12px); transition: opacity .35s, transform .35s; }
#banner.show { opacity: 1; transform: none; }
#bannerTitle { display: inline-block; font-family: var(--display); font-weight: 800; font-size: clamp(38px, 8vw, 96px); line-height: .95; letter-spacing: -.04em; color: var(--paper);
  padding: 0 .4em .1em; border-bottom: 2px solid var(--acc); text-shadow: 0 0 40px rgba(0, 0, 0, .9), 0 2px 10px rgba(0, 0, 0, .9); }
#bannerSub { font-size: clamp(11px, 1.6vw, 14px); letter-spacing: .16em; text-transform: uppercase; margin-top: 12px; color: var(--acc); }

#warn { position: absolute; left: 0; right: 0; bottom: 22%; text-align: center; font-weight: 600; font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--danger);
  opacity: 0; transition: opacity .15s; }
#warn.show { opacity: 1; }
#net { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); font-size: 10px; letter-spacing: .1em; color: var(--faint); }

/* round controls: the only circles in the interface are things you can press, like the bodies you steer */
#mute, #boostBtn, #flingBtn, #splitBtn { pointer-events: auto; position: absolute; border-radius: 50%; border: 1px solid var(--faint); background: rgba(7, 10, 18, .55);
  font-size: 10px; font-weight: 600; letter-spacing: .14em; cursor: pointer; }
#mute { right: 184px; bottom: 18px; width: 34px; height: 34px; font-size: 15px; letter-spacing: 0; }
#mute.off { color: var(--faint); text-decoration: line-through; }
#boostBtn { display: none; left: 20px; bottom: 90px; width: 96px; height: 96px; border-color: var(--acc); box-shadow: inset 0 0 0 5px rgba(7, 10, 18, .55), inset 0 0 0 6px var(--line); }
#boostBtn.on { background: var(--acc); color: var(--ink); }
#flingBtn, #splitBtn { display: none; left: 130px; width: 64px; height: 64px; }
#flingBtn { bottom: 96px; }
#splitBtn { bottom: 170px; }
@media (pointer: coarse) { #boostBtn, #flingBtn, #splitBtn { display: block; } #feed { bottom: 250px; } }

/* ---------- menu and end-of-run plates ---------- */
.panelwrap { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding: 22px 16px; overflow: auto;
  touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  /* faint orbits behind the plate */
  background: repeating-radial-gradient(circle at 50% 34%, transparent 0 139px, rgba(236, 230, 214, .04) 139px 140px),
    radial-gradient(ellipse at 50% 34%, rgba(7, 10, 18, .55), rgba(7, 10, 18, .93)); }
.panel { width: min(920px, 100%); margin: auto; padding: 34px 38px 26px; border: 1px solid var(--line); background: rgba(9, 13, 23, .86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-user-select: text; user-select: text; }
.panel.small { width: min(480px, 100%); text-align: center; }

h1 { margin: 0; text-align: center; font-family: var(--display); font-weight: 800; font-size: clamp(54px, 11vw, 108px); line-height: .88; letter-spacing: -.055em; color: var(--paper); }
h1 span { font-family: var(--mono); font-weight: 500; font-size: .19em; letter-spacing: .12em; color: var(--acc); vertical-align: 2.2em; margin-left: .3em; transition: color .6s; }
h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1; letter-spacing: -.04em; }
.tag { text-align: center; margin: 16px 0 6px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
#liveNow { text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ok); margin-bottom: 26px; }
#liveNow::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 9px; vertical-align: 1px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.row { display: flex; gap: 14px; align-items: flex-end; }
.namebox { position: relative; display: flex; flex: 1; min-width: 0; gap: 0; padding-top: 16px; border-bottom: 1px solid var(--faint); transition: border-color .2s; }
.namebox:focus-within { border-color: var(--acc); }
.namebox::before { content: "Designation"; position: absolute; left: 0; top: 0; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
input#name { flex: 1; width: auto; min-width: 0; padding: 4px 0 8px; border: 0; outline: none; background: transparent; color: var(--paper);
  font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; -webkit-user-select: text; user-select: text; touch-action: manipulation; }
input#name::placeholder { color: var(--faint); font-weight: 400; }
#reroll { width: 40px; border: 0; background: transparent; color: var(--dim); font-size: 22px; cursor: pointer; transition: color .15s, transform .3s; }
#reroll:hover { color: var(--acc); transform: rotate(180deg); }
/* the launch key: a cut plate, not a pill */
.primary { padding: 0 34px; height: 56px; border: 0; cursor: pointer; background: var(--acc); color: var(--ink); font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); transition: filter .15s, transform .1s, background .6s; }
.primary:hover:not(:disabled) { filter: brightness(1.12); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { opacity: .45; cursor: default; }
.primary small { font-weight: 400; letter-spacing: .1em; opacity: .7; }
.ghost { margin-left: 10px; height: 56px; padding: 0 22px; border: 1px solid var(--faint); background: transparent; cursor: pointer; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }
.ghost:hover { border-color: var(--paper); }

.how { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 28px; margin: 26px 0 0; font-size: 12px; color: var(--dim); }
.how b { color: var(--paper); font-weight: 600; }
.how div { padding-left: 14px; position: relative; }
.how div::before { content: ""; position: absolute; left: 0; top: .62em; width: 6px; height: 1px; background: var(--acc); }
.how .touch { display: none; }
@media (pointer: coarse) { .how .desk { display: none; } .how .touch { display: block; } }

/* the eight forms as a ruled scale; the ones you have reached are inked in */
.ladder { display: flex; align-items: center; gap: 0; margin: 28px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.ladder span { white-space: nowrap; }
.ladder span.done { color: var(--acc); }
.ladder i { flex: 1; min-width: 8px; height: 1px; margin: 0 8px; background: var(--line); font-size: 0; }

#skins { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 22px 0 8px; }
.skin { width: 50px; height: 50px; border: 1px solid var(--line); background: rgba(236, 230, 214, .03); cursor: pointer; transition: border-color .15s, transform .15s; }
.skin:hover { transform: translateY(-2px); border-color: var(--faint); }
.skin.sel { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); background: rgba(236, 230, 214, .07); }
.skin.locked { filter: grayscale(1) brightness(.42); cursor: help; }
#skinHint { text-align: center; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 26px; min-height: 14px; }

.cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.card { padding: 14px 16px 12px; border: 1px solid var(--line); }
#lvl, #liveCount { color: var(--acc); letter-spacing: .1em; }
#liveList li.human, #liveList li.human span:last-child { color: var(--ok); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 12.5px; color: var(--dim); }
.stats span:nth-child(even) { text-align: right; color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; }
.stats.big { font-size: 14px; margin: 22px auto 18px; max-width: 320px; text-align: left; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
#alltime .empty { color: var(--faint); }
#online { text-align: center; margin-top: 18px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
#deathSub { margin: 10px 0 0; }
#xpRow { margin-bottom: 22px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); }

@media (max-width: 760px) {
  .panel { padding: 24px 18px 18px; }
  .row { flex-direction: column; align-items: stretch; gap: 16px; }
  .namebox { flex: none; width: 100%; }
  .primary { width: 100%; }
  .cols { grid-template-columns: 1fr; gap: 14px; }
  .how { grid-template-columns: 1fr; margin-top: 20px; }
  .ladder { display: none; }
  .skin { width: 42px; height: 42px; }
  #liveNow { margin-bottom: 20px; }
  #board { display: none; }
  #topleft { left: 14px; top: 12px; width: 230px; }
  #massVal { font-size: 28px; }
  #formName { font-size: 20px; }
  .panel.small .primary { width: auto; }
}
