/* Palette borrowed from krillion.io: a pixel sky above, the deep below. */
:root {
  --abyss: #050a14;
  --deep: #0b1424;
  --shallow: #101d33;
  --line: #1b3050;
  --foam: #e8f1ff;
  --drift: #7d93b8;
  --cyan: #4de3ff;
  --pink: #ff5d8f;
  --gold: #ffd166;
  --hat-band: var(--pink);

  --p-jefferson: var(--gold);
  --p-davide: var(--cyan);
  --p-jack: var(--pink);
  --tint: 20%;

  --px: "VT323", ui-monospace, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--abyss); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--foam);
  font: 400 1.3rem/1.25 var(--px);
  background: linear-gradient(180deg, #123048 0, #0d1a2e 420px, var(--abyss) 1100px) no-repeat, var(--abyss);
  -webkit-font-smoothing: none;
}

/* CRT scanlines over everything, like the game */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background: repeating-linear-gradient(180deg, rgb(0 0 0 / .07) 0 1px, transparent 1px 3px);
}

a { color: inherit; text-decoration-color: var(--pink); text-underline-offset: 3px; }
code { font-family: var(--px); color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- Sky ---------- */
.sky {
  position: relative;
  overflow: hidden;
  padding: calc(36px + env(safe-area-inset-top)) 16px 0;
  background: linear-gradient(180deg, #6fb7dd 0%, #a9d8ee 45%, #d9eef7 100%);
  text-align: center;
}
.sky-art { position: absolute; inset: 0; pointer-events: none; }
.sun {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  right: 8%;
  width: clamp(56px, 9vw, 96px);
  height: auto;
  filter: drop-shadow(0 0 24px rgb(255 209 102 / .7));
}
.cloud { position: absolute; height: auto; }
.cloud.c1 { width: clamp(140px, 22vw, 280px); aspect-ratio: 4; top: 22px; left: 6%; }
.cloud.c2 { width: clamp(100px, 14vw, 180px); aspect-ratio: 4; top: 120px; right: 4%; opacity: .9; }
.cloud.c3 { width: clamp(90px, 12vw, 160px); aspect-ratio: 4; top: 150px; left: 28%; opacity: .75; }
@media (max-width: 640px) {
  .sky { padding-top: calc(64px + env(safe-area-inset-top)); }
  .sun { top: calc(10px + env(safe-area-inset-top)); right: 16px; width: 44px; }
  .cloud.c1 { top: 14px; left: -20px; }
  .cloud.c2 { top: 150px; }
  .cloud.c3 { display: none; }
}

.masthead { position: relative; max-width: 760px; margin: 0 auto; padding-bottom: 8px; }
.wordmark {
  margin: 0;
  font: 400 clamp(3.4rem, 13vw, 7.5rem)/.9 var(--px);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
  text-shadow: -.045em 0 var(--pink), .045em 0 var(--cyan), 0 .07em 0 rgb(11 20 36 / .45);
}
.subtitle {
  margin: 10px 0 0;
  font-size: clamp(1.3rem, 3.4vw, 1.9rem);
  letter-spacing: .4em;
  text-transform: uppercase;
  color: #19a9c9;
}
.tagline { margin: 10px auto 0; max-width: 34ch; font-size: 1.25rem; color: #4a6585; }

.boat {
  position: relative;
  display: block;
  width: clamp(150px, 22vw, 238px);
  height: auto;
  margin: 18px 0 -18px 12%;
  z-index: 2;
  animation: bob 3.2s steps(4, end) infinite;
}
@keyframes bob { 50% { transform: translateY(3px); } }

.waterline {
  position: relative;
  height: 14px;
  margin: 0 -16px;
  background:
    linear-gradient(180deg, rgb(232 241 255 / .55) 0 2px, transparent 2px),
    #123048;
}

/* ---------- Banners ---------- */
.banner {
  max-width: 1088px;
  margin: 20px auto 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgb(16 29 51 / .85);
  color: var(--foam);
  font-size: 1.15rem;
}
.banner#demo-banner { border-color: var(--gold); color: var(--gold); }
@media (max-width: 1119px) { .banner { margin-inline: 16px; } }
.banner.install { display: flex; align-items: center; gap: 12px; border-color: var(--pink); }
.banner.install[hidden] { display: none; }
.banner.install p { margin: 0; flex: 1; }
.banner strong { color: var(--pink); font-weight: 400; }
.share-glyph { width: 1em; height: 1em; vertical-align: -.1em; }
.banner-close {
  flex: none;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--foam);
  font: 400 1.4rem/1 var(--px);
  cursor: pointer;
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px calc(64px + env(safe-area-inset-bottom));
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 880px) {
  .layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .tally, .standing { grid-column: 1 / -1; }
}

.kitchen, .calendar, .tally, .standing {
  position: relative;
  background: rgb(13 26 46 / .82);
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: 0 0 0 1px rgb(5 10 20 / .6), 0 18px 40px -20px rgb(0 0 0 / .8);
}
/* Pixel corner ticks: the panels' one ornament */
.kitchen::before, .calendar::before, .tally::before, .standing::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(var(--cyan), var(--cyan)) top left / 8px 2px,
    linear-gradient(var(--cyan), var(--cyan)) top left / 2px 8px,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 8px 2px,
    linear-gradient(var(--cyan), var(--cyan)) bottom right / 2px 8px;
  background-repeat: no-repeat;
}

.section-title {
  margin: 0 0 16px;
  font: 400 1.6rem/1 var(--px);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--cyan);
}

/* ---------- Today's catch ---------- */
.plates { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.plate {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  background: color-mix(in srgb, var(--pc) 9%, var(--deep));
  border: 1px solid var(--line);
  border-left: 3px solid var(--pc);
}
.plate.lead { border-color: var(--pc); box-shadow: 0 0 18px -6px var(--pc), inset 0 0 0 1px color-mix(in srgb, var(--pc) 40%, transparent); }
.plate .who { display: flex; align-items: center; gap: 8px; font-size: 1.45rem; text-transform: uppercase; letter-spacing: .08em; }
.plate .who svg { width: 25px; height: 20px; color: #fff; --hat-band: var(--pc); }
.plate .pts { font-size: 2.2rem; line-height: 1; color: var(--pc); font-variant-numeric: tabular-nums; text-shadow: 0 0 12px color-mix(in srgb, var(--pc) 45%, transparent); }
.plate .pts.none { font-size: 1.15rem; color: var(--drift); text-shadow: none; }

.avatar {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--pc);
  color: var(--abyss);
  font: 400 1.7rem/1 var(--px);
  box-shadow: inset -3px -3px 0 rgb(0 0 0 / .25), inset 3px 3px 0 rgb(255 255 255 / .3);
}
.avatar.sm { width: 26px; height: 26px; font-size: 1.15rem; box-shadow: inset -2px -2px 0 rgb(0 0 0 / .25); }

/* ---------- Score form ---------- */
.order { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.order .field:first-child { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; }
.field label { font-size: 1.05rem; letter-spacing: .2em; text-transform: uppercase; color: var(--drift); }
select, input {
  font: 400 1.4rem/1 var(--px);
  color: var(--foam);
  background: var(--abyss);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
  min-height: 48px;
  width: 100%;
}
select:focus, input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 16px -4px var(--cyan); }
input::placeholder { color: #3d4f6e; }
input#score { font-size: 1.8rem; color: var(--gold); }

.btn {
  grid-column: 1 / -1;
  font: 400 1.6rem/1 var(--px);
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--foam);
  background: var(--shallow);
  border: 2px solid var(--cyan);
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: 0 0 18px -4px rgb(77 227 255 / .6), inset 0 0 18px -8px rgb(77 227 255 / .5), 0 4px 0 #0e6f86;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #142846; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 18px -4px rgb(77 227 255 / .6), 0 1px 0 #0e6f86; }
.btn:disabled { opacity: .6; cursor: progress; }
.form-msg:empty { display: none; }
.form-msg { grid-column: 1 / -1; margin: 0; font-size: 1.2rem; color: var(--cyan); }
.form-msg.err { color: var(--pink); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cal-head .section-title { margin: 0; text-align: center; color: var(--foam); }
.icon-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  background: var(--abyss);
  color: var(--cyan);
  font: 400 1.6rem/1 var(--px);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--cyan); }
.icon-btn:disabled { color: var(--line); cursor: default; }
.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekdays span { text-align: center; font-size: 1rem; letter-spacing: .12em; text-transform: uppercase; color: var(--drift); padding-bottom: 4px; }

.day {
  position: relative;
  aspect-ratio: 1 / 1.05;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--drift);
  font: 400 1.1rem/1 var(--px);
  padding: 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  overflow: hidden;
}
.day:hover:not(:disabled) { border-color: var(--drift); }
.day.blank { visibility: hidden; }
.day.future { opacity: .35; cursor: default; }
.day .num { line-height: 1; }
.day.won { background: var(--cell-bg); color: var(--foam); }
.day.today { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 14px -4px var(--cyan); }
.day.selected { outline: 2px solid var(--foam); outline-offset: 2px; }
.day .hats { display: flex; gap: 2px; align-self: center; }
.day .hats svg { width: clamp(16px, 3.6vw, 30px); height: clamp(13px, 2.9vw, 24px); color: #fff; }
.day .hats.tie svg { width: clamp(11px, 2.2vw, 20px); height: clamp(9px, 1.8vw, 16px); }
.day .top { font-size: 1.05rem; align-self: flex-end; line-height: 1; color: var(--foam); }
@media (max-width: 480px) { .day .top { display: none; } .day { padding: 3px; } }

.day-detail { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.day-detail h3 { margin: 0 0 10px; font-size: 1.35rem; font-weight: 400; color: var(--foam); }
.day-detail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.day-detail li { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.day-detail .pts { margin-left: auto; color: var(--pc); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.day-detail .none { color: var(--drift); font-size: 1.2rem; }
.day-detail .hat-inline { width: 20px; height: 16px; color: #fff; --hat-band: var(--pc); }

/* ---------- Tally ---------- */
.tally table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tally th { text-align: left; font-weight: 400; font-size: 1.05rem; letter-spacing: .15em; text-transform: uppercase; color: var(--drift); padding: 0 8px 8px; }
.tally td { padding: 10px 8px; border-top: 1px solid var(--line); font-size: 1.4rem; }
.tally td:first-child { display: flex; align-items: center; gap: 10px; }
.tally td.big { font-size: 2rem; line-height: 1; color: var(--pc); }
.tally .short { display: none; }
@media (max-width: 480px) {
  .tally th, .tally td { padding-inline: 4px; }
  .tally th { letter-spacing: .05em; font-size: .95rem; }
  .tally .name { display: none; }
  .tally .short { display: inline; }
}

/* ---------- Current Lebron / Current doofus ---------- */
.lebron .section-title { color: var(--gold); }
.doofus .section-title { color: var(--pink); }
.standing-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.standing-list li { display: flex; align-items: center; gap: 18px; }
.standing-icon { flex: none; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--pc) 40%, transparent)); }
.standing-icon.crown { width: 66px; height: 54px; filter: drop-shadow(0 0 16px rgb(255 209 102 / .55)); }
.standing-icon.dunce { width: 54px; height: 66px; }
.standing-text { display: grid; gap: 4px; min-width: 0; }
.standing-name { font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1; text-transform: uppercase; letter-spacing: .08em; color: var(--pc); text-shadow: 0 0 14px color-mix(in srgb, var(--pc) 45%, transparent); }
.standing-why { font-size: 1.25rem; color: var(--drift); }
.standing-why strong { font-weight: 400; color: var(--foam); }
.standing-empty { margin: 0; color: var(--drift); font-size: 1.25rem; }

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