* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b3a4a; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif; user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }
button { font: inherit; color: #1f2a36; background: #f3d36b; border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 700; cursor: pointer; }
button.ghost { background: rgba(255,255,255,.15); color: #fff; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
#menu { background: linear-gradient(#34495e, #22303d); justify-content: flex-start; padding-top: 40px; overflow-y: auto; }
#menu h1 { margin: 0 0 4px; font-size: 32px; letter-spacing: 1px; }
#menu .sub { margin: 0 0 20px; opacity: .75; font-size: 14px; text-align: center; }
#list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; width: 100%; max-width: 640px; margin-bottom: 20px; }
.pz { background: rgba(255,255,255,.1); border-radius: 14px; padding: 14px 10px; text-align: center; cursor: pointer; color: #fff; font-weight: 400; }
.pz:hover { background: rgba(255,255,255,.18); }
.pz .n { font-size: 13px; opacity: .7; }
.pz .nm { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
.pz .sz { font-size: 13px; opacity: .8; }
.pz.done { background: rgba(120,200,120,.25); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > div { pointer-events: auto; }
#top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top)); background: linear-gradient(rgba(0,0,0,.35), transparent); }
#top button { padding: 8px 12px; background: rgba(255,255,255,.18); color: #fff; }
#title { flex: 1; font-weight: 700; font-size: 17px; }
#stats { font-variant-numeric: tabular-nums; opacity: .9; }
#miss.bad { color: #ff8a80; }
#bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 18px;
  padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.4)); }
#slice { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 6px 10px; }
#slice .axes button { padding: 6px 10px; margin-right: 2px; background: rgba(255,255,255,.15); color: #fff; border-radius: 8px; }
#slice .axes button.on { background: #f3d36b; color: #1f2a36; }
#sliceRange { width: 140px; accent-color: #f3d36b; }
#sliceLabel { font-size: 13px; opacity: .8; min-width: 54px; }
#tools { display: flex; gap: 8px; }
#tools .tool { background: rgba(255,255,255,.15); color: #fff; min-width: 96px; }
#tools .tool.on { background: #f3d36b; color: #1f2a36; }
#undoBtn { background: rgba(255,255,255,.15); color: #fff; font-size: 18px; padding: 8px 14px; }

.card { background: #fdfaf2; color: #22303d; border-radius: 18px; padding: 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.card.left { text-align: left; }
.card .big { font-size: 26px; font-weight: 800; margin-bottom: 10px; text-align: center; }
.card p { line-height: 1.55; margin: 10px 0; }
.card .small { font-size: 13px; opacity: .75; }
.card .row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.card .ghost { background: #e4ddcc; color: #22303d; }
b.c, b.s { display: inline-block; width: 26px; height: 26px; line-height: 22px; text-align: center; border: 2.5px solid #22303d; }
b.c { border-radius: 50%; }
#win { background: transparent; justify-content: flex-end; padding-bottom: 40px; }
#winName { font-size: 20px; font-weight: 700; }
#winStats { opacity: .7; margin-top: 4px; }
#help { background: rgba(0,0,0,.5); }
