:root {
  --bg: #0c2814;
  --panel: #14351c;
  --line: #2f6a3a;
  --gold: #f0d060;
  --gold2: #d4a017;
  --green: #2ecc71;
  --emerald: #1a8f4a;
  --text: #f7fff4;
  --muted: #a8c4ae;
  --radius: 16px;
  --dock: 72px;
  font-family: "PT Sans", "Avenir Next", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(90% 60% at 15% -5%, #2a6a28 0%, transparent 50%),
    radial-gradient(70% 45% at 100% 0%, #3a5010 0%, transparent 40%),
    var(--bg);
  color: var(--text);
  touch-action: manipulation;
}
body { padding-bottom: calc(var(--dock) + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }
#hub { max-width: 520px; margin: 0 auto; padding: 12px 14px 28px; }

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.brand, .bar h2 {
  margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(90deg, var(--gold), #fff8d0, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ico {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.ico img, .mini { width: 22px; height: 22px; object-fit: contain; }
.mini { width: 28px; height: 28px; }
.ico.text { width: auto; padding: 0 10px; font-size: .78rem; color: var(--gold); }

.hero { text-align: center; padding: 4px 0 14px; }
.logo {
  width: 120px; height: 120px; object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(240,208,96,.35));
}
.logo.sm { width: 88px; height: 88px; }
.hero h1 { margin: 8px 0 6px; font-size: 1.55rem; }
.tag { color: var(--muted); font-size: .9rem; line-height: 1.45; margin: 0; }
.tag.pad { padding: 8px 0; }
.disclaimer {
  margin: 16px 0 0; font-size: .75rem; color: #7a9a80; line-height: 1.4;
  border-left: 3px solid var(--line); padding-left: 10px;
}

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { font-size: .82rem; color: var(--gold); font-weight: 700; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: #0f2416; color: var(--text); padding: 13px 14px; font-size: 1rem;
}
.field input:focus { outline: 2px solid rgba(240,208,96,.45); border-color: var(--gold); }

.stack { display: grid; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: 14px; padding: 13px; font-weight: 800; cursor: pointer;
}
.btn img { width: 24px; height: 24px; object-fit: contain; }
.btn.gold {
  background: linear-gradient(135deg, #ffe9a0, var(--gold) 55%, var(--gold2));
  color: #1a1400; box-shadow: 0 8px 20px rgba(240,208,96,.3);
}
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }

.card, .list .card {
  background: linear-gradient(160deg, #1a4224, #102818);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.card.block { display: grid; gap: 10px; margin-bottom: 10px; }
.card.row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card.row.slim { margin: 0; padding: 8px 0 0; border: 0; background: transparent; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  flex: 1; min-width: 72px; border: 1px solid var(--line); background: #0f2416;
  color: var(--muted); border-radius: 999px; padding: 8px 10px; font-size: .8rem; cursor: pointer;
}
.seg button.on { background: var(--gold); color: #1a1400; border-color: var(--gold); font-weight: 800; }

.kpi { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.kpi .card strong { display: block; font-size: 1.05rem; color: var(--gold); }
.kpi .card span { color: var(--muted); font-size: .7rem; }

.play-screen { position: relative; }
.hud-stats { text-align: center; min-width: 0; }
.play-name {
  display: block; font-weight: 800; color: var(--gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.hud-stats .muted { color: var(--muted); font-size: .75rem; }
.chant {
  text-align: center; min-height: 1.4em; margin: 0 0 8px;
  font-weight: 800; color: #e8ffd8; letter-spacing: .02em;
}
.clover-stage {
  position: relative; width: min(100%, calc(100dvh - 260px));
  max-width: 420px; aspect-ratio: 1; margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, #1f5a2c 0%, #0d2816 70%);
  border: 3px solid rgba(240,208,96,.45);
  box-shadow: inset 0 0 40px rgba(0,0,0,.35), 0 12px 28px rgba(0,0,0,.35);
}
.clover-stage .center-gem {
  position: absolute; left: 50%; top: 50%; width: 18%; height: 18%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6ec8ff, #1a4d9c 60%, #0a2a60);
  border: 3px solid var(--gold);
  box-shadow: 0 0 16px rgba(240,208,96,.4);
  z-index: 2; pointer-events: none;
}
.leaf-btn {
  position: absolute; width: 34%; height: 34%;
  border: 0; padding: 0; background: transparent; cursor: pointer;
  transform-origin: center center;
  transition: transform .18s ease, opacity .25s ease, filter .2s;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
  z-index: 1;
}
.leaf-btn img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.leaf-btn:active { transform: scale(.92); }
.leaf-btn.plucked {
  opacity: 0; transform: scale(.4) rotate(40deg);
  pointer-events: none;
}
.play-hint { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 10px; }

.for-name { color: var(--muted); margin: 0; font-size: .95rem; }
#res-answer {
  margin: 6px 0;
  background: linear-gradient(90deg, var(--gold), #fff, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.hist-list { display: grid; gap: 8px; }
.hist-item {
  display: grid; gap: 4px; text-align: left; cursor: default;
}
.hist-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.hist-item .name { font-weight: 800; color: var(--gold); }
.hist-item .ans { font-weight: 700; }
.hist-item .ans.yes { color: var(--green); }
.hist-item .ans.no { color: #ffb4a8; }
.hist-item .msg { color: var(--muted); font-size: .82rem; }
.hist-item .meta { display: flex; justify-content: space-between; font-size: .72rem; color: #7a9a80; }
.hist-item .del {
  border: 0; background: transparent; color: #ffb4a8; cursor: pointer; font-size: .75rem;
}

body.play-focus { padding-bottom: env(safe-area-inset-bottom); }
body.play-focus .dock { display: none; }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(12,40,20,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
}
.dock button {
  border: 0; background: transparent; color: var(--muted); display: grid; place-items: center;
  gap: 2px; font-size: .68rem; padding: 6px 2px; cursor: pointer;
}
.dock button img { width: 22px; height: 22px; object-fit: contain; opacity: .75; }
.dock button.on { color: var(--gold); }
.dock button.on img { opacity: 1; }

@media (max-height: 700px) {
  .logo { width: 96px; height: 96px; }
  .clover-stage { width: min(100%, calc(100dvh - 230px)); }
}
