:root {
  --bg: #fff8ee;
  --card: #ffffff;
  --ink: #1d1b2e;
  --muted: #6b6680;
  --line: #ece3d4;
  --accent: #ff5a4e;
  --accent-dark: #e2443a;
  --sun: #ffd23f;
  --ok: #2a9d8f;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(29, 27, 46, 0.04), 0 6px 24px rgba(29, 27, 46, 0.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }

.top { max-width: 1040px; margin: 0 auto; padding: 14px 18px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 9px; }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 24px; }
body.game main { max-width: 560px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card.center { text-align: center; padding: 36px 20px; }
.fine { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }
.tiny { text-align: center; font-size: 0.85rem; color: var(--muted); }
.kicker { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 4px; }
.sub { color: var(--muted); }
.error { color: #c62828; font-size: 0.92rem; min-height: 0; margin: 6px 0 0; }
.error:empty { display: none; }

label { display: block; font-weight: 650; font-size: 0.92rem; margin: 12px 0 6px; }
input, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fffdf9; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 78, 0.18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; gap: 0; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; color: var(--ink); text-decoration: none; cursor: pointer;
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 18px; min-height: 44px;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:hover { background: #fdf6ea; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; margin-top: 14px; }
.btn.icon { padding: 0; width: 48px; min-height: 48px; font-size: 1.3rem; flex: none; }
.link-btn { background: none; border: 0; padding: 4px 2px; font: inherit; font-size: 0.88rem; color: var(--accent-dark); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: #c62828; }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: start; padding: 24px 0 32px; }
.hero h1 { font-size: clamp(2rem, 5.2vw, 3.2rem); margin-bottom: 16px; }
.lead { font-size: 1.15rem; color: #3b3850; }
.ticks { list-style: none; padding: 0; margin: 18px 0 0; }
.ticks li { padding-left: 30px; position: relative; margin: 8px 0; font-weight: 600; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--sun); box-shadow: inset 0 0 0 5px var(--sun), inset 0 0 0 20px var(--ink); transform: scale(0.75); }
.create h2 { margin-bottom: 2px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 8px; } }

.mine { margin: 0 0 32px; }
.game-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.game-list a { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 650; text-decoration: none; color: var(--ink); }

.how, .example, .faq { padding: 28px 0; border-top: 1px solid var(--line); }
.how h2, .example h2, .faq h2 { font-size: 1.5rem; margin-bottom: 18px; }
.steps3 { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps3 li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.steps3 p { color: #4a4660; margin: 0; }
.num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); font-weight: 800; margin-bottom: 10px; }
@media (max-width: 760px) { .steps3 { grid-template-columns: 1fr; } }

.chain-demo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: stretch; }
.demo-step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.demo-step small { color: var(--muted); font-weight: 600; }
.demo-step.text b { font-size: 1.2rem; flex: 1; display: flex; align-items: center; }
@media (max-width: 760px) { .chain-demo { grid-template-columns: 1fr 1fr; } }

.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: #4a4660; }

.foot { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 24px 16px 40px; }
.foot p { margin: 4px 0; }

/* ---------- game ---------- */
.game-head { padding: 6px 2px 14px; }
.game-head h1 { font-size: 1.8rem; word-break: break-word; }
.game-head .sub { margin: 0; }
.invite.big { border: 2px solid var(--sun); background: #fffdf2; }
.linkbox { display: flex; gap: 8px; margin: 4px 0 10px; }
.linkbox input { min-width: 0; font-size: 15px; color: var(--muted); }
.invite .btn.primary { width: 100%; }

.turn-card.ready { border: 2px solid var(--accent); }
.turn-card.done { background: #f6fbfa; border-color: #cfe8e4; }
.inrow { display: flex; gap: 8px; }
.inrow input { min-width: 0; }

.plist { list-style: none; padding: 0; margin: 0; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.plist li:first-child { border-top: 0; }
.pname { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.pname small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chip { font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #f1ece3; color: #4a4660; white-space: nowrap; }
.chip.ok { background: #d9f2ee; color: #1d6b61; }
.chip.wait { background: #fff1c2; color: #7a5a00; }
.rounds { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.how-mini ol { margin: 0; padding-left: 20px; }

/* turn screen */
.turn-top { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 10px; }
.turn-top .kicker { margin: 0; }
.turn .label { font-weight: 700; color: var(--muted); margin: 0 0 4px; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.04em; }
.phrase { font-size: 1.6rem; font-weight: 800; margin: 0 0 12px; line-height: 1.25; overflow-wrap: anywhere; }
.turn-actions { display: flex; gap: 10px; align-items: flex-end; }
.turn-actions .btn.big { flex: 1; }
.turn-actions > .btn:not(.big) { min-height: 54px; margin-top: 14px; }
.guess-art { margin: 0 0 12px; }
canvas.drawing { display: block; width: 100%; aspect-ratio: 1 / 1; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; }

.pad-wrap { position: relative; }
canvas.pad {
  display: block; width: 100%; aspect-ratio: 1 / 1; background: #fff; border: 2px solid var(--line); border-radius: 16px;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: crosshair;
}
.tools { margin-top: 10px; }
.swatches { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.sw { aspect-ratio: 1 / 1; width: 100%; border-radius: 50%; border: 2px solid rgba(29, 27, 46, 0.12); background: var(--c); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.sw.eraser { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 16l8-8 6 6-5 5H7z' fill='%23ffb3ad' stroke='%231d1b2e' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") center / 62% no-repeat; }
.tool-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.sizes { display: flex; gap: 6px; flex: 1; }
.sz { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.sz i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--brush, #1d1b2e); }
.sz[aria-pressed="true"] { border-color: var(--ink); background: #fdf6ea; }
.tbtn { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 650; font-size: 0.92rem; cursor: pointer; color: var(--ink); }

/* reveal */
.reveal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 6px 2px 12px; }
.chain h3 small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chain-steps { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 12px; }
.step small { display: block; color: var(--muted); font-weight: 600; font-size: 0.85rem; margin-bottom: 4px; }
.step.text p { background: #fff8ee; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 1.2rem; font-weight: 750; margin: 0; overflow-wrap: anywhere; }
.step.removed p { color: var(--muted); font-style: italic; margin: 0; }
.step .link-btn { font-size: 0.78rem; margin-left: 6px; color: var(--muted); }
.chain > .btn.primary { width: 100%; }
.chain-end { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chain-end .kicker { text-transform: none; letter-spacing: 0; font-size: 0.95rem; flex: 1; min-width: 180px; }
.next-round { border: 2px solid var(--sun); background: #fffdf2; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 0.95rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* privacy */
.doc { max-width: 720px; }
.doc h1 { margin-top: 12px; }
.doc h2 { margin-top: 24px; }

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