:root {
  --paper: #F3EDE2;
  --card: #FFFCF7;
  --ink: #1C1915;
  --red: #C5341B;
  --green: #0E7C4A;
  --blue: #1D4E89;
  --gold: #E0A100;
  --line: #E4D3BC;
  --brown: #6B4E3D;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #F8E2C4 0 18%, transparent 19%),
    var(--paper);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
button, input, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.05; margin: 0 0 8px; }
p { margin: 0 0 10px; }
main { width: min(1080px, calc(100% - 28px)); margin: 0 auto; }
.top {
  width: min(1080px, calc(100% - 28px));
  margin: 14px auto 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  text-decoration: none;
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.brand::before {
  content: "PP";
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-right: 8px;
  border: 2px solid var(--ink);
  background: var(--red);
  color: white;
  font-size: 14px;
  vertical-align: middle;
}
nav { display: flex; align-items: center; gap: 8px; }
.who { font-weight: 700; }
.hero { padding: 18px 0 8px; }
.eyebrow { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; color: var(--red); }
.lead { font-size: 18px; max-width: 46rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 18px; }
.gcard, .card, .invite, .plist, .sheet {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
}
.gcard { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.gcard.soon { box-shadow: none; border-style: dashed; }
.mark {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid var(--ink);
  color: white; display: grid; place-items: center; font-weight: 700;
}
.tag { font-size: 13px; font-weight: 700; color: var(--brown); }
.meta { color: var(--brown); font-weight: 600; }
.soon-label {
  display: inline-block; margin-top: auto; padding: 8px 12px; border: 2px solid var(--ink);
  border-radius: 999px; background: var(--gold); font-weight: 700;
}
.solid, .ghost, .linkbtn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 2px solid var(--ink);
  text-decoration: none; font-weight: 700;
}
.solid { background: var(--red); color: white; box-shadow: 3px 3px 0 var(--ink); }
.solid.small { min-height: 40px; }
.solid.xl { width: 100%; margin-top: 8px; font-size: 18px; }
.ghost { background: transparent; color: var(--ink); }
.ghost.on, .choice.on { background: var(--gold); color: var(--ink); }
.choice.on span { color: var(--ink); }
.linkbtn { margin-top: auto; }
.codejoin, .addrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.codejoin input, .addrow input, .ans, form input {
  min-height: 48px; border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px;
  background: white; color: var(--ink); font-size: 16px;
}
.codejoin input { width: 140px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.block { margin-top: 18px; }
.roomlist { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.roomlist a {
  display: inline-flex; gap: 8px; align-items: center; text-decoration: none;
  background: white; border: 2px solid var(--ink); border-radius: 999px; padding: 8px 12px; font-weight: 600;
}
.narrow { width: min(860px, 100%); margin: 10px auto 30px; }
.panels { display: grid; gap: 14px; }
.panel { display: none; padding: 16px; }
.panel.on { display: block; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
label { display: block; font-weight: 700; margin: 10px 0 4px; }
form input { width: 100%; }
.field-error { color: var(--red); font-weight: 700; margin-top: 4px; }
.banner {
  background: var(--gold); border: 2px solid var(--ink); border-radius: 14px; padding: 12px 14px; font-weight: 700;
}
.join { padding: 20px; text-align: center; }
.join h1 { font-size: 64px; letter-spacing: 0.12em; }
#room { display: grid; gap: 12px; margin-top: 8px; }
.invite, .plist, .sheet { padding: 14px; }
.invite { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center; }
.invite img { width: 180px; height: 180px; background: white; border: 2px solid var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.codebig { font-family: Fraunces, Georgia, serif; font-size: 42px; letter-spacing: 0.14em; margin: 0; }
.url { word-break: break-all; font-weight: 600; }
.plist ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plist li, .rank, .ansrow {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: white;
}
.plist li.me { background: #F8E2C4; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid var(--ink); }
.dot.on { background: var(--green); }
.pname, .rname { flex: 1; font-weight: 700; }
.tag { font-style: normal; font-size: 12px; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 6px; }
.pscore { font-size: 18px; }
.choice, .chip, .x {
  border: 2px solid var(--ink); border-radius: 12px; background: white; color: var(--ink); text-align: left;
}
.choice { display: block; width: 100%; padding: 10px 12px; margin: 6px 0; }
.choice strong, .choice span { display: block; }
.choice span, .note { color: var(--brown); font-weight: 600; }
.chips, .seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { padding: 8px 10px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.chip.on { background: var(--blue); color: white; }
.x { min-width: 36px; min-height: 36px; padding: 0 8px; background: var(--paper); }
.letterwrap { text-align: center; padding: 8px 8px 0; }
.letter {
  font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: clamp(96px, 24vw, 180px);
  line-height: 0.8; color: var(--red); margin: 0;
}
.hint { font-weight: 700; }
.track { height: 14px; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; background: white; flex: 1; }
#bar { height: 100%; width: 100%; background: var(--green); }
.clockrow { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#clock { font-family: Fraunces, Georgia, serif; font-size: 36px; min-width: 64px; }
#clock.zero { color: var(--red); }
.field { margin: 8px 0; }
.ans { width: 100%; }
.dur-wrap { position: sticky; bottom: 10px; padding-top: 8px; }
#durBtn { width: 100%; font-size: 28px; letter-spacing: 0.08em; }
#durBtn.pulse { animation: pulse 0.9s ease infinite; }
@keyframes pulse { 50% { transform: translateY(-2px); } }
.cathead { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.falling { background: #F8D7C4; }
.rank.p1 { background: var(--gold); font-size: 1.25rem; }
.rank.p2 { background: var(--blue); color: white; }
.rank.p3 { background: var(--green); color: white; }
.cell { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.sheet h3 { margin-top: 0; }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--red); display: inline-block; border: 2px solid var(--ink); }
.lamp.on { background: var(--green); }
#toasts { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; display: grid; gap: 8px; }
.toast { background: var(--ink); color: white; border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
.toast.warning { background: #8A4B08; }
@media (min-width: 860px) {
  .panel { display: block; }
  .tabs { display: none; }
  .panels { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .invite { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .actions { justify-content: center; }
}
