:root {
  --bg: #f4efe6; --card: #fffdf9; --soft: #f0e9dd; --line: #e2d8c8; --text: #2b2620; --muted: #857a6b;
  --accent: #2f4a3a; --pos: #3f7a55; --neg: #b0493b; --gold: #b88a2b;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; }
#app { max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 16px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.card.active { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.card.soft { background: var(--soft); border-color: transparent; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.row.c { justify-content: center; }
.grow { flex: 1; min-width: 0; }
.gap { height: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
button {
  font: inherit; font-weight: 600; font-size: 15px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px;
  background: var(--card); color: var(--text); cursor: pointer; touch-action: manipulation; user-select: none;
}
button:active { opacity: .75; }
button:disabled { opacity: .4; }
button.primary, button.on { background: var(--text); border-color: var(--text); color: #fff; }
button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
button.pos { background: var(--pos); border-color: var(--pos); color: #fff; }
button.neg { background: var(--neg); border-color: var(--neg); color: #fff; }
button.flat { background: transparent; border-color: transparent; color: var(--muted); }
button.big { width: 100%; padding: 16px; font-size: 17px; border-radius: 12px; }
button.sm { padding: 7px 11px; font-size: 14px; border-radius: 8px; }
button.xs { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
input, textarea {
  font: inherit; width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text);
}
input:focus, textarea:focus { outline: none; border-color: var(--text); }
textarea { min-height: 220px; font-size: 14px; font-family: ui-monospace, Menlo, monospace; }
.prompt { font-size: 30px; font-weight: 700; text-align: center; margin: 10px 0; word-break: break-word; line-height: 1.2; letter-spacing: -0.01em; }
.prompt.long { font-size: 22px; }
.avoid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.avoid span { border: 1px solid var(--neg); color: var(--neg); padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 14px; text-decoration: line-through; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 600; }
.pad { width: 100%; aspect-ratio: 1; height: auto; display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; touch-action: none; }
.pad.thumb { max-width: 220px; margin: 0 auto; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.sel { box-shadow: 0 0 0 2px var(--text); }
.timer { font-size: 40px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.timer:empty { display: none; }
.timer.urgent { color: var(--neg); }
.score { font-size: 72px; font-weight: 700; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.list { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.item .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.sel { border-color: var(--text); background: var(--soft); }
.item.dim { opacity: .45; }
.item.tap { cursor: pointer; }
.num { min-width: 36px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pm { display: inline-flex; align-items: center; gap: 4px; }
.gain { font-weight: 700; color: var(--pos); min-width: 34px; text-align: right; }
.gain.neg { color: var(--neg); }
.answer { font-weight: 600; color: var(--accent); }
.flash { animation: flash .5s ease-out; }
@keyframes flash { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.offline-bar { display: none; position: fixed; top: 0; left: 0; right: 0; background: var(--neg); color: #fff; text-align: center; padding: 6px; font-weight: 600; z-index: 20; }
body.offline .offline-bar { display: block; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::before { content: "+ "; color: var(--muted); }
details[open] > summary::before { content: "– "; }
#qr { background: #fff; padding: 10px; border-radius: 10px; width: max-content; margin: 8px auto; border: 1px solid var(--line); }
#qr:empty { display: none; }
#qr img, #qr canvas { display: block; width: 160px; height: 160px; }
.seg { display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 12px; overflow-x: auto; }
.seg button { flex: 1 0 auto; border: 0; background: transparent; padding: 9px 12px; font-size: 14px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.bar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 6px; align-items: center; overflow-x: auto; }
.teamdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.search { padding: 10px 12px; }
.scroll { max-height: 340px; overflow-y: auto; }
.tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.wait { text-align: center; padding: 70px 10px; color: var(--muted); }
.wait .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); margin: 0 auto 16px; animation: breathe 2s infinite ease-in-out; }
@keyframes breathe { 50% { transform: scale(1.6); background: var(--muted); } }
code { background: var(--soft); padding: 1px 5px; border-radius: 5px; }
