/* Slow Burn: a printed game. Flat ink colours, paper grain, one typeface.
   Tokens, buttons, dice, cards and every screen of the game live here. site.css covers the website pages. */

@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage";
  src: url("/fonts/bricolage-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Inks */
  --tomato: #ff4b2b;
  --crimson: #d1122f;
  --plum: #2a0a35;
  --plum-2: #3d1450;
  --blush: #ffe6e8;
  --paper: #fff4f4;
  --pink: #ff7aa5;
  --mustard: #ffc13d;
  /* Heat, mildest to hottest */
  --t0: #ff9dbd;
  --t1: #ff7a59;
  --t2: #ff4b2b;
  --t3: #d1122f;
  --t4: #8f0a55;

  --font: "Bricolage", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --die: 112px;
  --focus: var(--mustard);
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--plum);
  color: var(--blush);
  font: 400 1.0625rem / 1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Paper grain over everything, like ink on stock. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

h1, h2, h3 { margin: 0; font-weight: 800; font-stretch: 85%; letter-spacing: -0.03em; line-height: 0.98; }

.sprite { position: absolute; width: 0; height: 0; }
.chili { width: 1.1em; height: 1.1em; fill: currentColor; flex: none; }

.screen { width: min(100% - 2rem, 44rem); margin-inline: auto; padding-block: clamp(1.25rem, 4vw, 3rem); }

/* Type */
.title {
  margin: 0 0 1.2rem;
  font: 800 clamp(3.8rem, 16vw, 7.4rem) / 0.88 var(--font);
  font-stretch: 78%;
  letter-spacing: -0.03em;
  color: var(--blush);
  text-shadow: 0.045em 0.045em 0 var(--tomato);
}
.title-sm { font-size: clamp(2.8rem, 11vw, 4.4rem); }

.lede { max-width: 34rem; margin: 0 0 1.8rem; font: 500 clamp(1.1rem, 3.4vw, 1.3rem) / 1.45 var(--font); color: rgba(255, 230, 232, 0.86); }
.fine { margin: 0 0 1.4rem; font-size: 0.9rem; line-height: 1.5; color: rgba(255, 230, 232, 0.72); }

/* Buttons: flat ink with a hard edge, like a key that gets pressed. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.7rem;
  border: 0;
  border-radius: 12px;
  background: var(--tomato);
  color: var(--plum);
  font: 700 1.05rem / 1 var(--font);
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}
.btn:hover { background: #ff6443; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.32); }
.btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; transform: none; background: var(--tomato); }
.btn-sm { padding: 0.65rem 1.1rem; font-size: 0.95rem; }
.btn-ink { background: var(--plum); color: var(--blush); }
.btn-ink:hover { background: var(--plum-2); }
.btn-ink[disabled] { background: var(--plum); }

.link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.4rem 0.2rem;
  color: inherit;
  opacity: 0.8;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  cursor: pointer;
}
.link:hover { opacity: 1; }

/* Setup: a paper sheet on the table */
.sheet { padding: clamp(1.2rem, 4vw, 2rem); border-radius: 18px; background: var(--blush); color: var(--plum); box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3); }
.sheet .fine { color: rgba(42, 10, 53, 0.72); }
.sheet { --focus: var(--plum); }
.setup-form { display: grid; gap: 1.3rem; }

.where { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.where legend, .modes legend { padding: 0; margin-bottom: 0.6rem; font-weight: 700; font-size: 0.95rem; }
.where legend { grid-column: 1 / -1; }
.seg { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: block;
  padding: 0.8rem 0.4rem;
  border: 2px solid var(--plum);
  border-radius: 10px;
  text-align: center;
  font: 600 0.95rem / 1.2 var(--font);
  transition: background 0.15s ease, color 0.15s ease;
}
.seg:has(input:checked) span { background: var(--plum); color: var(--blush); }
.seg:has(input:focus-visible) span { outline: 3px solid var(--tomato); outline-offset: 3px; }

.names { display: grid; gap: 1rem; }
@media (min-width: 30rem) { .names { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 0.4rem; font-weight: 700; font-size: 0.95rem; }
.field input {
  padding: 0.8rem 1rem;
  border: 2px solid var(--plum);
  border-radius: 10px;
  background: #fff;
  color: var(--plum);
  font: 500 1.05rem var(--font);
}
.field input::placeholder { color: rgba(42, 10, 53, 0.42); }
.field input:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; }

.modes { display: grid; gap: 0.7rem; margin: 0; padding: 0; border: 0; }
.mode {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: start;
  padding: 0.9rem 1rem;
  border: 2px solid var(--plum);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mode:has(input:checked) { background: var(--pink); }
.mode input { margin-top: 0.3rem; accent-color: var(--plum); }
.mode strong { display: block; margin-bottom: 0.1rem; font: 800 1.3rem / 1.1 var(--font); font-stretch: 85%; letter-spacing: -0.02em; }
.mode span { line-height: 1.4; }

.check { display: grid; grid-template-columns: auto 1fr; gap: 0.8rem; align-items: start; font-weight: 600; cursor: pointer; }
.check input { margin-top: 0.2rem; width: 1.2rem; height: 1.2rem; accent-color: var(--plum); }

.form-error { margin: 0; padding: 0.7rem 1rem; border: 2px solid var(--crimson); border-radius: 10px; background: #fff; color: var(--crimson); font-weight: 600; line-height: 1.4; }
.setup-form .fine { margin: -0.4rem 0 0; }
.setup-form .btn { justify-self: start; }

/* Game: players, and the match that burns down as the room heats up */
.hud { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.7rem 1.4rem 0.7rem 1rem;
  background: var(--plum-2);
  color: var(--blush);
  font-weight: 700;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
  transition: background 0.25s ease, color 0.25s ease;
}
#chip1 { padding: 0.7rem 1rem 0.7rem 1.4rem; clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%); }
.chip.is-roller { background: var(--blush); color: var(--plum); }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-heat { display: inline-flex; align-items: center; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.chip-heat .chili { color: var(--tomato); }

.match { --pct: 3; position: relative; margin-top: 1.9rem; }
.match-track { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 230, 232, 0.18); }
.match-track::before {
  content: "";
  position: absolute;
  left: -7px;
  top: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tomato);
  box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.28);
  z-index: 1;
}
.match-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--pct) * 1%);
  border-radius: 6px;
  background: linear-gradient(90deg, var(--t0), var(--t1), var(--t2), var(--t3));
  background-size: calc(10000% / var(--pct)) 100%;
  transition: width 0.9s ease, background-size 0.9s ease;
}
.match-flame {
  position: absolute;
  top: -31px;
  left: calc(var(--pct) * 1%);
  width: 28px;
  height: 28px;
  margin-left: -14px;
  transform-origin: 50% 100%;
  transition: left 0.9s ease;
  animation: flicker 1.3s ease-in-out infinite;
}
@keyframes flicker { 0%, 100% { transform: scale(1, 1) rotate(-2deg); } 35% { transform: scale(0.94, 1.08) rotate(2deg); } 70% { transform: scale(1.04, 0.96) rotate(-1deg); } }
.match-tiers { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0.9rem 0 0; padding: 0; list-style: none; text-align: center; font-weight: 700; font-size: 0.78rem; color: rgba(255, 230, 232, 0.5); }
.match-tiers .is-current { color: var(--blush); }
.match-tiers .is-current::after { content: ""; display: block; width: 6px; height: 6px; margin: 0.25rem auto 0; border-radius: 50%; background: var(--tomato); }

.notice { margin: 1.2rem 0 0; padding: 0.7rem 1rem; border-radius: 10px; background: var(--plum-2); text-align: center; font-weight: 600; font-size: 0.95rem; line-height: 1.4; }
.turn-line { margin: 1.6rem 0 0; text-align: center; font: 600 1.1rem / 1.4 var(--font); color: rgba(255, 230, 232, 0.88); text-wrap: balance; }

/* Dice: flat, printed, a tomato one and a pink one */
.stage { display: flex; justify-content: center; gap: 1.1rem; margin: 1.5rem 0; }
#game.asked { --die: 78px; }
.die {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--die);
  height: var(--die);
  border-radius: calc(var(--die) * 0.2);
  background: var(--tomato);
  color: var(--plum);
  font: 800 calc(var(--die) * 0.66) / 1 var(--font);
  font-stretch: 82%;
  letter-spacing: -0.02em;
  box-shadow: 0 calc(var(--die) * 0.07) 0 rgba(0, 0, 0, 0.34);
  transform: rotate(var(--tilt, 0deg));
  transition: width 0.4s ease, height 0.4s ease, font-size 0.4s ease, border-radius 0.4s ease;
  user-select: none;
}
.die + .die { background: var(--pink); }
.die.rolling { animation: tumble 0.45s linear infinite; }
#die1.rolling { animation-delay: -0.17s; animation-direction: reverse; }
.die.landed { animation: land 0.5s cubic-bezier(0.3, 0.7, 0.3, 1); }

@keyframes tumble {
  0%   { transform: translateY(0) rotate(0deg); }
  25%  { transform: translateY(-28px) rotate(90deg); }
  50%  { transform: translateY(0) rotate(180deg); }
  75%  { transform: translateY(-18px) rotate(270deg); }
  100% { transform: translateY(0) rotate(360deg); }
}
@keyframes land {
  0%   { transform: translateY(-36px) rotate(calc(var(--tilt, 0deg) - 28deg)); }
  55%  { transform: translateY(0) rotate(var(--tilt, 0deg)); }
  72%  { transform: translateY(-10px) rotate(var(--tilt, 0deg)); }
  100% { transform: translateY(0) rotate(var(--tilt, 0deg)); }
}

.actions { display: flex; flex-direction: column; align-items: center; }
.wait { margin: 0; padding: 0.9rem 0; text-align: center; font: 600 1.1rem / 1.4 var(--font); color: rgba(255, 230, 232, 0.8); }

/* Truth or dare: two cards to pick from */
.choose { display: grid; justify-items: center; gap: 1rem; width: 100%; }
.choose-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; width: 100%; max-width: 30rem; }
.choose-btn {
  display: grid;
  gap: 0.25rem;
  padding: 1.2rem 0.8rem 1.3rem;
  border: 0;
  border-radius: 16px;
  background: var(--blush);
  color: var(--plum);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.32);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.choose-btn:hover { transform: translateY(-2px) rotate(-0.8deg); }
.choose-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.32); }
.choose-btn[disabled], #pick-dice[disabled] { opacity: 0.5; cursor: default; transform: none; }
.choose-dare { background: var(--crimson); color: var(--blush); }
.choose-dare:hover { transform: translateY(-2px) rotate(0.8deg); }
.choose-word { font: 800 clamp(2rem, 8vw, 2.6rem) / 1 var(--font); font-stretch: 82%; letter-spacing: -0.02em; }
.choose-sub { font-size: 0.88rem; font-weight: 500; opacity: 0.8; }

/* The card: truth is blush stock, dare is crimson */
.card {
  position: relative;
  margin-top: 1.4rem;
  padding: 1.2rem 1.4rem 1.4rem;
  border-radius: 16px;
  background: var(--blush);
  color: var(--plum);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.32);
  transform: rotate(-0.7deg);
  overflow: hidden;
  animation: deal 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.card::before {
  content: "";
  position: absolute;
  top: -34px;
  right: -34px;
  width: 190px;
  height: 190px;
  background-image: radial-gradient(circle, var(--pink) 2.4px, transparent 2.9px);
  background-size: 13px 13px;
  -webkit-mask-image: radial-gradient(circle at 70% 30%, #000 0, transparent 68%);
  mask-image: radial-gradient(circle at 70% 30%, #000 0, transparent 68%);
  opacity: 0.6;
  pointer-events: none;
}
.card::after { content: "\201C"; position: absolute; right: 0.8rem; bottom: -3.6rem; font: 800 12rem / 1 var(--font); opacity: 0.07; pointer-events: none; }
.card.is-dare { background: var(--crimson); color: var(--blush); transform: rotate(0.7deg); }
.card.is-dare::after { content: "!"; right: 1.4rem; }

.card-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.card-kind { padding: 0.35rem 0.6rem; border-radius: 6px; background: var(--plum); color: var(--blush); font: 800 0.95rem / 1 var(--font); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.card.is-dare .card-kind { background: var(--blush); color: var(--crimson); }
.card-heat { display: inline-flex; gap: 0.12rem; color: var(--tomato); }
.card-heat .chili { width: 1.2rem; height: 1.2rem; }
.card.is-dare .card-heat { color: var(--mustard); }

.card-q { position: relative; margin: 0; font: 700 clamp(1.5rem, 5.4vw, 2.1rem) / 1.1 var(--font); font-stretch: 92%; letter-spacing: -0.02em; text-wrap: balance; }
.card-how { position: relative; margin: 1.2rem 0 0; padding: 0.9rem 2.6rem 0 0; border-top: 2px dotted rgba(42, 10, 53, 0.35); font: 500 0.95rem / 1.4 var(--font); }
.card.is-dare .card-how { border-top-color: rgba(255, 230, 232, 0.5); }
.card-index { position: absolute; right: 1rem; bottom: 0.9rem; font: 800 0.95rem / 1 var(--font); font-variant-numeric: tabular-nums; opacity: 0.55; transform: rotate(180deg); }

@keyframes deal {
  from { opacity: 0; transform: translateY(34px) rotate(-4deg) scale(0.96); }
  to   { opacity: 1; }
}

/* Heat rating */
.rate { margin-top: 1.7rem; text-align: center; }
.rate-q { margin: 0 0 1rem; font: 700 1.3rem / 1.25 var(--font); font-stretch: 90%; letter-spacing: -0.015em; }
.rate-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
.rate-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 0.4rem;
  border: 0;
  border-radius: 12px;
  background: var(--plum-2);
  color: var(--blush);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.32);
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease, box-shadow 0.08s ease;
}
.rate-btn:hover { background: var(--blush); color: var(--plum); }
.rate-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.32); }
.rate-btn[disabled] { opacity: 0.5; cursor: default; }
.rate-flames { display: flex; gap: 0.1rem; }
.rate-flames .chili { width: 1.55rem; height: 1.55rem; color: var(--tomato); }
.rate-btn:hover .rate-flames .chili { color: var(--crimson); }
.pass { appearance: none; margin-top: 1rem; padding: 0.5rem; border: 0; background: none; color: inherit; opacity: 0.78; font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: pointer; }
.pass:hover { opacity: 1; }

/* Footer line inside the game */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.4rem 1rem; margin-top: 2.3rem; padding-top: 1rem; border-top: 2px dotted rgba(255, 230, 232, 0.28); font-size: 0.9rem; font-weight: 500; color: rgba(255, 230, 232, 0.78); }
.foot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem; }
.foot .link, .foot span { white-space: nowrap; }
#room-tag { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; font-weight: 700; }

/* Waiting room */
.code { display: flex; gap: 0.5rem; margin: 0 0 1.4rem; }
.code-char {
  display: grid;
  place-items: center;
  width: clamp(2.8rem, 14vw, 4rem);
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--blush);
  color: var(--plum);
  font: 800 clamp(1.9rem, 9vw, 2.8rem) / 1 var(--font);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.32);
}
.code-char:nth-child(odd) { transform: rotate(-2deg); }
.code-char:nth-child(even) { transform: rotate(1.5deg) translateY(2px); }
.invite { display: flex; gap: 0.6rem; max-width: 34rem; margin-bottom: 1rem; }
.invite input { flex: 1; min-width: 0; padding: 0.75rem 1rem; border: 0; border-radius: 10px; background: var(--plum-2); color: var(--blush); font: 500 0.95rem var(--font); }
#lobby .fine { margin-bottom: 1rem; }

/* Results */
.over-actions { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.results { display: grid; gap: 1.2rem; margin: 0 0 1.6rem; padding: 0; list-style: none; max-width: 34rem; }
.result-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.45rem; }
.result-name { font: 800 1.9rem / 1 var(--font); font-stretch: 80%; letter-spacing: -0.03em; }
.result-score { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.result-score .chili { color: var(--tomato); }
.result-bar { height: 14px; border-radius: 7px; background: rgba(255, 230, 232, 0.16); overflow: hidden; }
.result-bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--t0), var(--t1), var(--t2), var(--t3)); }

@media (max-width: 26rem) {
  :root { --die: 92px; }
  #game.asked { --die: 68px; }
  .chip { padding-inline: 0.8rem 1.2rem; }
  #chip1 { padding-inline: 1.2rem 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .die.rolling, .die.landed, .card, .match-flame { animation: none; }
  .die, .match-fill, .match-flame, .chip, .btn { transition: none; }
}
