/* Buzzword Bingo: crystalmark.co.uk's drawing-office look (paper, ink, international orange), with rubber stamps */
:root {
  --paper: #f3efe6;
  --paper-deep: #ebe5d8;
  --card: #fbf9f4;
  --ink: #1d2433;
  --ink-soft: #4a5163;
  --orange: #e4571c;
  --orange-wash: rgba(228, 87, 28, 0.14);
  --mark: #c8461a;
  --rule: rgba(29, 36, 51, 0.18);
  --rule-strong: rgba(29, 36, 51, 0.55);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --serif: "Fraunces", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  font-size: 17px;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--orange); color: var(--paper); }
a { color: inherit; }

.sheet { max-width: 1100px; margin: 0 auto; padding: 0 28px; min-height: 100vh; display: flex; flex-direction: column; }
.view { flex: 1; }

/* ---------- data strip ---------- */
.strip {
  display: flex; flex-wrap: wrap; gap: 6px 28px; justify-content: space-between;
  padding: 14px 0; border-bottom: 1.5px solid var(--rule-strong);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
}
.strip a { text-decoration: none; }
.strip a:hover { color: var(--orange); }
.strip strong { color: var(--ink); font-weight: 500; }
.dot { color: var(--orange); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 48px; }
.hero.compact { padding: 48px 0 28px; }
.kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--orange);
  margin-bottom: 22px; display: flex; align-items: center; gap: 14px;
}
.kicker::after { content: ""; flex: 0 0 100px; height: 1px; background: var(--orange); }
h1 {
  font-size: clamp(44px, 8vw, 96px); font-weight: 560; font-variation-settings: "opsz" 144;
  line-height: 1.0; letter-spacing: -0.015em;
}
h1 em { font-style: italic; font-weight: 300; color: var(--orange); }
.mono-code { font-family: var(--mono); font-style: normal !important; font-weight: 500 !important; letter-spacing: 0.08em; }
.lede { margin-top: 26px; max-width: 54ch; font-size: 20px; font-weight: 300; color: var(--ink-soft); }
.lede strong { color: var(--ink); font-weight: 560; }

/* ---------- theme picker ---------- */
.themes { border: 0; margin: -12px 0 28px; }
.themes legend {
  font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px;
}
.theme-list { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-list label { flex-direction: row; letter-spacing: 0.06em; }
.theme-list input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-list span {
  display: inline-block; padding: 9px 14px; border: 1.5px solid var(--ink); background: var(--paper);
  font: 500 12.5px var(--mono); color: var(--ink); cursor: pointer; transition: background 0.15s ease, box-shadow 0.15s ease;
}
.theme-list span:hover { box-shadow: 3px 3px 0 var(--orange); }
.theme-list input:checked + span { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--orange); }
.theme-list input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }
.theme-blurb { margin-top: 14px; max-width: 64ch; font-size: 16px; color: var(--ink-soft); min-height: 3.1em; }
.invite-theme { margin-top: 14px; font: 500 13px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange); }

/* ---------- home panels ---------- */
.panels {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule-strong); margin-bottom: 56px;
}
.panel { background: var(--paper); padding: 28px 26px 30px; display: flex; flex-direction: column; gap: 14px; }
.panel.narrow { max-width: 460px; border: 1px solid var(--rule-strong); margin-bottom: 56px; }
.panel-id { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em; color: var(--orange); }
.panel h2 { font-size: 24px; font-weight: 560; letter-spacing: -0.01em; line-height: 1.15; }
.panel p { font-size: 15px; color: var(--ink-soft); }
.panel.solo { background: var(--paper-deep); }
.panel .btn { margin-top: auto; }
.panel.narrow .btn { margin-top: 4px; }

label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
}
input {
  font: 400 17px var(--serif); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule-strong); border-radius: 0; padding: 11px 12px; width: 100%;
}
input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
input::placeholder { color: rgba(74, 81, 99, 0.5); }
.code-input { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 500 13px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink); padding: 13px 18px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--orange); }
.btn:active { transform: none; box-shadow: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.small { padding: 8px 12px; font-size: 11.5px; }
.btn.ghost { border-color: var(--rule-strong); }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; box-shadow: none; }
.quiet {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 3px;
}
.quiet:hover { color: var(--orange); }

/* ---------- your own words ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.panel.own { grid-column: 1 / -1; background: var(--card); transition: background 0.15s ease, outline-color 0.15s ease; }
.panel.own p { max-width: 70ch; }
.panel.own p strong { color: var(--ink); font-weight: 560; }
.panel.own.over { background: var(--orange-wash); outline: 2px dashed var(--orange); outline-offset: -8px; }
.own-pick { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: auto; }
.own-pick .btn { margin: 0; }
.own-pick .hint { font: 400 12px var(--mono); color: var(--ink-soft); }
.panel.own.busy .own-pick .btn { opacity: 0.5; pointer-events: none; }

#view-own { padding-bottom: 48px; }
.own-form { display: flex; flex-direction: column; gap: 26px; max-width: 900px; }
.own-form > label { max-width: 520px; }
.own-words h3 {
  font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange);
  margin-bottom: 12px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
}
.own-words h3 span { color: var(--ink-soft); letter-spacing: 0.06em; }
.own-words h3 span.short { color: var(--orange); font-weight: 500; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 12px;
  border: 1.5px solid var(--ink); background: var(--card); font-size: 15px; line-height: 1.2;
}
.chips button {
  border: 0; background: none; cursor: pointer; color: var(--ink-soft); font: 500 16px/1 var(--mono);
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
}
.chips button:hover { color: var(--paper); background: var(--orange); }
.more .chips li { border-style: dashed; border-color: var(--rule-strong); background: transparent; padding: 0; }
.more .chips li button { width: auto; height: auto; padding: 6px 12px; font: 400 15px/1.2 var(--serif); color: var(--ink); }
.more .chips li button::before { content: "+ "; color: var(--orange); font-family: var(--mono); }
.more .chips li button:hover { background: var(--paper-deep); color: var(--ink); }
.add-row { display: flex; gap: 8px; margin-top: 14px; max-width: 520px; }
.add-row input { min-width: 0; }
.own-settings { display: flex; flex-direction: column; gap: 14px; max-width: 520px; border-top: 1.5px solid var(--rule-strong); padding-top: 22px; }
label.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
label.inline input { width: 84px; font-family: var(--mono); text-align: center; }
.own-settings .hint { font-size: 14px; color: var(--ink-soft); margin-top: -6px; }
.own-go { display: flex; gap: 18px; align-items: center; }

/* ---------- waiting for players ---------- */
.waiting {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(243, 239, 230, 0.6); backdrop-filter: blur(2px);
}
.waiting-box {
  display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center;
  background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--orange); padding: 22px 26px;
}
.waiting p { font: 560 clamp(18px, 3vw, 26px)/1.3 var(--serif); max-width: 22ch; }
.waiting p small { display: block; margin-top: 6px; font: 400 13px var(--mono); color: var(--ink-soft); }

/* ---------- the game ---------- */
#view-game { padding: 32px 0 48px; }
.board { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }

.banner {
  border: 1.5px solid var(--ink); background: var(--card); padding: 14px 18px; margin-bottom: 24px;
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  animation: drop 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.banner.win { background: var(--orange); border-color: var(--orange); color: var(--paper); }
.banner strong { font-size: 20px; font-weight: 700; }
.banner .words { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em; opacity: 0.85; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.card-wrap { position: relative; max-width: 640px; }
.card {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--card); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink);
}
.card .head {
  font: 500 clamp(18px, 4vw, 30px) var(--mono); text-align: center; padding: 6px 0 4px;
  background: var(--ink); color: var(--paper); letter-spacing: 0.1em;
}
.cell {
  position: relative; aspect-ratio: 1; border: 0; border-right: 1px solid var(--rule-strong); border-top: 1px solid var(--rule-strong);
  background: transparent; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px;
  font: 400 clamp(11px, 2.25vw, 16.5px)/1.15 var(--serif);
  hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere;
  transition: background 0.15s ease;
}
.cell.long { font-size: clamp(9.5px, 1.9vw, 14px); }
.cell:nth-child(5n + 5) { border-right: 0; } /* the five column heads come first, so every fifth cell ends a row */
.cell:hover { background: var(--paper-deep); }
.cell:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; z-index: 1; }
.cell .w { position: relative; z-index: 1; }
.cell.free { font-family: var(--mono); font-size: clamp(9px, 1.6vw, 12px); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); cursor: default; }
.cell.free:hover { background: transparent; }

/* a marked square fills solid, from the middle out. The fill is a shade deeper than the brand orange, so white
   text on it is readable at these sizes (4.8:1); the winning line turns ink, to stand out from the other marks. */
.cell::before {
  content: ""; position: absolute; inset: 0; background: var(--mark);
  transform: scale(0); transition: transform 0.16s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s ease;
}
.cell.on::before { transform: scale(1); }
.cell.on .w, .cell.free.on .w { color: #fff; }
.cell.line::before { background: var(--ink); box-shadow: inset 0 0 0 3px var(--mark); }
.cell.line .w { font-weight: 560; }

.stamp {
  position: absolute; left: 50%; top: 50%; pointer-events: none;
  font: 700 italic clamp(48px, 12vw, 104px) var(--serif); color: var(--orange); letter-spacing: -0.02em;
  border: 6px solid var(--orange); border-radius: 12px; padding: 0 24px; line-height: 1.15;
  background: rgba(251, 249, 244, 0.6);
  transform: translate(-50%, -50%) rotate(-12deg) scale(2.4); opacity: 0;
}
.stamp.show { animation: stamp 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(2.4); }
  14% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}

.card-foot {
  margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft);
}
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- the side: invite + room ---------- */
.side { display: flex; flex-direction: column; gap: 22px; }
.side section { border: 1px solid var(--rule-strong); background: var(--paper); padding: 18px 18px 20px; }
.side h3 {
  font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--orange);
  margin-bottom: 10px; display: flex; justify-content: space-between;
}
.side h3 span { color: var(--ink-soft); }
.big-code { font: 500 44px/1 var(--mono); letter-spacing: 0.18em; margin-bottom: 14px; }
.share-row { display: flex; gap: 6px; margin-bottom: 8px; }
.share-row .btn { white-space: nowrap; flex: none; }
.share-row input { font: 400 12.5px var(--mono); padding: 8px; min-width: 0; }
.hint { font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; }

.room ol { list-style: none; display: flex; flex-direction: column; }
.room li {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: baseline;
  padding: 8px 0; border-top: 1px solid var(--rule); font-size: 15.5px;
}
.room li:first-child { border-top: 0; }
.room .pos { font: 500 12px var(--mono); color: var(--ink-soft); }
.room .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room .who small { font: 400 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-left: 6px; }
.room .you .who { font-weight: 560; }
.room .left { font: 400 12px var(--mono); color: var(--ink-soft); white-space: nowrap; }
.room .close .left { color: var(--orange); font-weight: 500; }
.room .done .pos, .room .done .left { color: var(--orange); font-weight: 500; }
.room li.done:first-child { background: var(--orange-wash); margin: 0 -18px; padding: 8px 18px; }

/* ---------- toast + footer ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--paper); font: 400 14px var(--mono); padding: 12px 18px; box-shadow: 4px 4px 0 var(--orange);
}
footer {
  border-top: 1.5px solid var(--rule-strong); padding: 18px 0 32px;
  display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between;
  font: 400 11px var(--mono); letter-spacing: 0.05em; color: var(--ink-soft);
}
footer a { text-decoration-color: var(--orange); text-underline-offset: 3px; }

@media (max-width: 900px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .card-wrap { max-width: none; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .sheet { padding: 0 16px; }
  body { background-size: 48px 48px; }
  .hero { padding: 40px 0 32px; }
  .lede { font-size: 18px; }
  .card { box-shadow: 4px 4px 0 var(--ink); }
  .cell { padding: 2px; }
  .big-code { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell::before, .btn, .banner { transition: none; animation: none; }
  .stamp.show { animation-duration: 0.01s; }
}
