:root {
  --bg: #15110f;
  --panel: #241c17;
  --text: #f7efe4;
  --muted: #b5a797;
  --border: #3f3128;
  --accent: #ffbf5e;
  --good: #6fdc93;
  --bad: #ff7b68;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
body { background: radial-gradient(ellipse at 50% 0%, #2a1f18 0%, var(--bg) 70%); }
#app { height: 100vh; height: 100dvh; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column;
  padding: 10px 12px; gap: 8px; }

/* header */
.top { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.title { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: 0.2px; }
.icon, .pip { position: relative; display: inline-block; border-radius: 2px; background: linear-gradient(90deg, #fbe4b8, #c99054); }
.icon { width: 5px; height: 20px; transform: rotate(22deg); margin: 4px 2px 0 4px; }
.icon::before, .pip::before { content: ''; position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ff9f80, #df3a2d 50%, #7a1410); }
.icon::before { width: 9px; height: 10px; top: -5px; left: -2px; }
.pips { margin-left: auto; display: flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 12px 5px; }
.pips .lbl { font-size: 12.5px; color: var(--muted); margin-right: 1px; }
.pip { width: 4px; height: 15px; transition: opacity 0.2s; }
.pip::before { width: 7px; height: 7px; top: -3px; left: -1.5px; }
.pip.used { opacity: 0.25; }

/* task */
.goal { text-align: center; }
#goal { font-weight: 700; font-size: 17px; }
.rule { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

/* table */
.board { flex: 1; min-height: 0; position: relative; overflow: hidden; border-radius: 16px; border: 1px solid #4a3524;
  background-color: #2c1d13;
  background-image: radial-gradient(ellipse at 50% 45%, rgba(30, 18, 10, 0.1) 0%, rgba(12, 7, 4, 0.72) 100%), url(img/table.webp);
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.55), 0 6px 20px rgba(0, 0, 0, 0.35); }
.board.shake { animation: shake 0.35s; }
#svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none;
  user-select: none; -webkit-user-select: none; cursor: pointer; }

.ghost { fill: none; stroke: rgba(255, 236, 205, 0.17); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 0.1 17;
  opacity: 0; transition: opacity 0.2s, stroke 0.2s; }
.ghost.off { opacity: 1; }
.holding .ghost.off { stroke: rgba(255, 236, 205, 0.36); }
.ghost.vacated { stroke: rgba(255, 160, 90, 0.5); stroke-width: 6; stroke-dasharray: 12 10; }
.ghost.hint { stroke: var(--accent); stroke-width: 7; stroke-dasharray: 12 10; animation: blink 1s ease-in-out infinite; }
.ghost.gone { stroke: rgba(255, 110, 95, 0.8); stroke-width: 6; stroke-dasharray: 12 10; }

.m { opacity: 0; transition: opacity 0.18s; pointer-events: none; }
.m.on, .m.held { opacity: 1; }
.m.drop { opacity: 0.5; }
.m.held.away { opacity: 0.35; }
.m .lift { transition: transform 0.15s ease; }
.m.held .lift { transform: scale(1.12); filter: url(#glowWarm); }
.m.hint .lift { filter: url(#glowWarm); animation: blink 1s ease-in-out infinite; }
.win .m.on .lift, .m.new .lift { filter: url(#glowGood); }

/* feedback + buttons */
.msg { text-align: center; min-height: 20px; font-size: 14px; color: var(--muted); transition: color 0.2s; }
.msg.good { color: var(--good); font-weight: 700; }
.msg.bad { color: var(--bad); }
.msg.hint { color: #f1d58c; }

.bar { display: flex; gap: 8px; }
.bar button { flex: 1; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text);
  font: 600 14px system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.bar button:hover:not(:disabled) { background: #30251e; }
.bar button:disabled { opacity: 0.4; cursor: default; }
#reveal { border-color: #6b4a2c; color: var(--accent); }

@keyframes blink { 50% { opacity: 0.4; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
