* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #d9bc90;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  color: #3b3026;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 112px;
  height: 52px;
  padding: 0 24px;
  border-radius: 26px;
  border: 2px solid #e7ddcd;
  background: #fbf8f2;
  color: #3b3026;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(70, 45, 15, .18);
  cursor: pointer;
  touch-action: manipulation;
}
.pill svg { width: 18px; height: 18px; }
.pill:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(70, 45, 15, .2); }
.pill.primary { border-color: #2f5f68; color: #2f5f68; }
.pill.big { min-width: 168px; height: 56px; font-size: 20px; }

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  padding: 0 22px;
  pointer-events: none;
}
.bar .pill { pointer-events: auto; }

.hud {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 14px;
  background: rgba(251, 248, 242, .82);
  font-size: 13px;
  color: #5a4a3a;
  white-space: nowrap;
  pointer-events: none;
}
.hud b { color: #9a3b2c; font-weight: 700; }

.mute {
  position: fixed;
  z-index: 2;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
  width: 38px;
  height: 38px;
  padding: 8px;
  border: 0;
  border-radius: 19px;
  background: rgba(251, 248, 242, .82);
  color: #5a4a3a;
  cursor: pointer;
  touch-action: manipulation;
}
.mute svg { display: block; width: 100%; height: 100%; }
.mute .cross, .mute.off .wave { display: none; }
.mute.off .cross { display: block; }

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 16px;
  background: rgba(40, 32, 24, .72);
  color: #fbf8f2;
  font-size: 14px;
  white-space: nowrap;
  pointer-events: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.cream { background: #f1e8da; }

#title canvas { width: 168px; height: 168px; }
#title h1 { margin: 22px 0 10px; font-size: 52px; letter-spacing: 6px; color: #2a221b; }
#title p { margin: 0 0 40px; font-size: 18px; line-height: 1.7; color: #5a4a3a; }

.card {
  display: flex;
  width: min(100%, 560px);
  aspect-ratio: 16 / 8.5;
  margin-bottom: 36px;
  border-radius: 16px;
  overflow: hidden;
  background: #f8f3eb;
  border: 3px solid #e4d9c8;
  box-shadow: 0 8px 24px rgba(80, 55, 25, .14);
}
.card canvas { width: 56%; height: 100%; display: block; }
.card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  text-align: center;
}
.card h2 { margin: 0 0 10px; font-size: clamp(16px, 4.6vw, 30px); color: #2a221b; letter-spacing: 0; white-space: nowrap; }
.metric { font-size: 13px; color: #5a4a3a; }
.metric b { margin-left: 6px; font-size: clamp(26px, 8vw, 44px); line-height: 1; }
.metric i { font-style: normal; font-size: 16px; font-weight: 700; }
.metric.good b, .metric.good i { color: #2f5f68; }
.metric.mid b, .metric.mid i { color: #8a6a2a; }
.metric.bad b, .metric.bad i { color: #9a3b2c; }
.note { margin-top: 10px; font-size: 11px; line-height: 1.6; color: #9a8a78; white-space: pre-line; }
