.toy-game {
  --td-ink:#49394a;
  --td-muted:#625262;
  --td-brand:#654377;
  --td-action:#5e3b6c;
  --td-paper:#fffcf7;
  color:var(--td-ink);
  background:radial-gradient(ellipse at 12% 12%, #ffeddd, transparent 55%),
    radial-gradient(ellipse at 88% 10%, #eee3f9, transparent 58%), #fcf5ee;
}
.td-skip,.td-sr {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%);
}
.td-skip:focus {
  width:auto;
  height:auto;
  padding:12px;
  background:#fff;
  clip-path:none;
  z-index:100;
}
.td-layout {
  font-family:var(--ui2-font-family);
  width:min(100%, 465px);
  box-sizing:border-box;
  margin:0 auto;
  padding:12px clamp(10px,3vw,24px) 28px;
}
.td-layout :focus-visible {
  outline:3px solid #855497;
  outline-offset:2px;
}
.td-heading { display:grid; justify-items:start; gap:2px; margin-bottom:10px; }
.td-modes { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.td-modes button[aria-pressed="true"] { background:var(--td-action); color:#fff; }
.td-levels[hidden] { display:none; }
.td-back {
  display:inline-flex;
  align-items:center;
  min-height:26px;
  color:var(--td-brand);
  font-size:13px;
  font-weight:750;
  text-decoration:none;
}
.td-heading h1 {
  margin:0;
  font-size:clamp(29px,6.4vw,54px);
  letter-spacing:-.045em;
  line-height:1.08;
}
.td-stage {
  display:grid;
  grid-template-columns:minmax(0,1fr) clamp(65px,19vw,86px);
  gap:8px;
}
.td-box {
  position:relative;
  padding:6px;
  border:1px solid #b28577;
  border-radius:16px;
  background:linear-gradient(135deg,#f5cdb7,#f6decb 50%,#f0bca7);
  box-shadow:inset 0 2px #ffefe4, 0 6px 0 #b97f6d30, 0 10px 24px #8d5e6b20;
}
#td-board {
  display:block;
  width:100%;
  height:auto;
  aspect-ratio:8 / 14;
  border-radius:8px;
  background:#f5e5d9;
  touch-action:none;
  user-select:none;
  cursor:grab;
  outline-offset:-3px;
}
#td-board:active { cursor:grabbing; }
.td-meters {
  display:grid;
  align-content:start;
  gap:6px;
  min-width:0;
}
.td-meters > div {
  display:grid;
  justify-items:center;
  text-align:center;
  gap:1px;
  padding:8px 2px;
  min-height:53px;
  box-sizing:border-box;
  border:1px solid #e7d6d1;
  border-radius:13px;
  background:#fffdf8;
  box-shadow:0 3px 0 #a0758930;
}
.td-meters > [hidden] { display:none; }
.td-meters span { font-size:clamp(10.5px,2.8vw,13px); font-weight:740; color:var(--td-muted); line-height:1.2; }
.td-meters strong { font-size:clamp(19px,4.9vw,25px); line-height:1.05; font-variant-numeric:tabular-nums; }
.td-meters .td-next { background:#f7edfd; border-color:#d3c0df; padding-bottom:1px; }
#td-next { display:block; width:100%; height:auto; max-width:75px; }
.td-combo[data-done="true"] { background:#e6f6e9; border-color:#9dbca9; }
.td-combo[data-done="true"] strong { color:#2d6050; }
.td-sheet {
  position:absolute;
  inset:6px;
  display:grid;
  place-items:center;
  padding:8px;
  background:#f6dfce61;
  border-radius:8px;
}
.td-sheet[hidden] { display:none; }
.td-card {
  box-sizing:border-box;
  width:min(100%,250px);
  background:#fffdf8;
  border:1px solid #e1c7bd;
  border-radius:16px;
  text-align:center;
  padding:clamp(10px,3vw,18px) 9px;
  box-shadow:0 5px 0 #97667926,0 12px 32px #76555f25;
}
.td-card h2 {
  font-size:clamp(16px,4.6vw,23px);
  letter-spacing:-.03em;
  line-height:1.2;
  margin:0;
}
.td-card p { margin:6px 0 12px; font-size:clamp(12px,3vw,14px); line-height:1.4; color:var(--td-muted); }
.td-layout button {
  min-height:44px;
  min-width:44px;
  padding:0 12px;
  box-sizing:border-box;
  border:1px solid #d9c6d7;
  border-radius:12px;
  background:#fffdfa;
  color:var(--td-ink);
  font:inherit;
  font-size:13px;
  font-weight:750;
  cursor:pointer;
  touch-action:manipulation;
}
.td-layout button:hover:not(:disabled) { border-color:#7a5589; }
.td-layout button:disabled { color:#716477; background:#f0e9ef; cursor:default; }
#td-primary,.td-levels button[aria-current] {
  background:var(--td-action);
  border-color:var(--td-action);
  color:#fff;
}
#td-primary { min-width:78px; }
.td-gestures {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:4px;
  margin-top:10px;
  color:var(--td-muted);
  font-size:clamp(10px,2.9vw,13px);
  font-weight:720;
}
.td-gestures span {
  min-height:29px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  border-radius:9px;
  text-align:center;
  background:#fffaf4;
  border:1px solid #ead7cf;
}
.td-gestures b { color:var(--td-brand); font-size:16px; line-height:1; }
.td-controls { display:flex; align-items:center; gap:6px; margin:7px 0 0; }
.td-controls strong { margin-right:auto; color:var(--td-brand); font-size:13px; }
.td-levels { display:flex; gap:6px; margin:9px 0 0; }
.td-how {
  margin:12px 0 0;
  background:#fffaf5;
  border:1px solid #ead7cf;
  border-radius:18px;
  overflow:hidden;
}
.td-how img { display:none; }
.td-how > div { padding:13px 15px; }
.td-how h2 { margin:0; font-size:17px; }
.td-how ol { padding:0 0 0 20px; margin:7px 0 0; line-height:1.5; font-size:13px; }
.td-how li + li { margin-top:4px; }
@media (max-width:380px) and (max-height:620px) {
  .td-layout { padding-top:6px; }
  .td-heading { margin-bottom:8px; }
  .td-back { min-height:22px; }
}
@media (min-width:800px) {
  .td-layout {
    display:grid;
    width:min(100%,1020px);
    padding:clamp(20px,3vw,36px) 28px;
    grid-template-columns:minmax(320px,406px) minmax(305px,395px);
    grid-template-rows:auto auto 1fr;
    gap:12px clamp(25px,5vw,60px);
    justify-content:center;
  }
  .td-heading { grid-area:1 / 2; margin:0; gap:4px; }
  .td-game { grid-area:1 / 1 / span 3; }
  .td-stage { grid-template-columns:minmax(0,1fr) 88px; }
  .td-levels { grid-area:2 / 2; margin:0; }
  .td-how { grid-area:3 / 2; align-self:start; margin:0; }
  .td-how img { display:block; width:100%; height:auto; }
}
