* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120d0b;
  color: #e8dfd2;
  font-family: system-ui, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

#scene { display: block; width: 100%; height: 100%; }

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 14px;
  gap: 10px;
}
#hud-title,
#hud-status {
  background: rgba(14, 9, 6, 0.62);
  border: 1px solid rgba(122, 84, 48, 0.55);
  border-radius: 6px;
  padding: 4px 12px;
  text-shadow: 0 1px 3px #000;
}
#hud-title { font-size: 14px; font-weight: 700; color: #d9b98c; }
#hud-status { font-size: 13px; color: #e8dfd2; font-variant-numeric: tabular-nums; }

#castbar-wrap {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70vw);
  height: 22px;
  border: 1px solid #8a6224;
  border-radius: 4px;
  background: rgba(20, 14, 7, 0.8);
  overflow: hidden;
  box-shadow: 0 0 14px rgba(255, 150, 60, 0.18);
}
#castbar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a35f16, #ffb03a 70%, #ffd98a);
}
#castbar-label {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 22px;
  font-size: 13px;
  font-weight: 700;
  color: #ffe9c4;
  text-shadow: 0 1px 2px #000;
}

#hud-hint {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 700;
  text-shadow: 0 1px 5px #000, 0 0 12px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}
.hint-hold { color: #ff9a4d; }
.hint-go { color: #5ff0b0; }

#paused {
  position: absolute;
  top: 42%;
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #ffd97a;
  text-shadow: 0 2px 6px #000;
}

#result,
#ready {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 340px;
  max-width: 90vw;
  padding: 24px 32px;
  background: rgba(16, 11, 8, 0.93);
  border: 1px solid #6b4a2a;
  border-radius: 12px;
  text-align: center;
  pointer-events: auto;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 140, 60, 0.12);
}

#ready h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: #d9b98c;
  letter-spacing: 0.04em;
}
#ready p { font-size: 13px; color: #d9cbb8; margin-bottom: 16px; }
#ready #ready-hint { font-size: 12px; color: #a08a70; margin: 12px 0 0; }
#btn-start {
  pointer-events: auto;
  padding: 12px 40px;
  font-size: 17px;
  font-weight: 700;
  color: #fff4dc;
  background: linear-gradient(180deg, #c06a1a, #8a4a12);
  border: 1px solid #e0913a;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(255, 150, 60, 0.3);
  transition: filter 0.12s, transform 0.06s;
}
#btn-start:hover { filter: brightness(1.15); }
#btn-start:active { transform: translateY(1px); }
#result h2 { font-size: 27px; margin-bottom: 8px; letter-spacing: 0.04em; }
#result h2.success { color: #6ef0b4; text-shadow: 0 0 16px rgba(110, 240, 180, 0.45); }
#result h2.fail { color: #ff7a6a; text-shadow: 0 0 16px rgba(255, 100, 90, 0.4); }
#result p { font-size: 14px; color: #d9cbb8; margin-bottom: 14px; }
#result #result-stats { font-size: 12px; color: #a08a70; margin-top: -8px; }
#result button {
  pointer-events: auto;
  margin: 0 6px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #f5e9d5;
  background: #33231a;
  border: 1px solid #7a5530;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
#result button:hover { background: #46301f; border-color: #a97b45; }

#hud-bottom {
  margin-top: auto;
  padding: 12px 16px 12px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: linear-gradient(transparent, rgba(10, 6, 4, 0.9));
}
#help { font-size: 12px; color: #b9a68e; text-shadow: 0 1px 2px #000; }
#pad-indicator {
  font-size: 12px;
  font-weight: 700;
  color: #7ee0a0;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}
.ctrl {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cbb99f;
}
.ctrl select {
  background: #241812;
  color: #e8dfd2;
  border: 1px solid #6b4a2a;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
}
.ctrl input[type="checkbox"] { accent-color: #35d07f; }
.ctrl input[type="range"] { width: 96px; accent-color: #e0913a; cursor: pointer; }
#padlook-val { min-width: 30px; color: #d9b98c; font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
