@font-face {
  font-family: "Noto Sans SC";
  src: url("../assets/fonts/noto-sans-sc.woff2") format("woff2");
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #b7e3a4;
  --gold: #f0c14a;
  --ink: #fff8ea;
  --p1: #2ee6c7;
  --p2: #ff6a3d;
  --panel: rgba(8, 10, 14, 0.92);
  --line: rgba(240, 193, 74, 0.9);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "WenQuanYi Micro Hei", "Droid Sans Fallback", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

button, input { font-family: inherit; }

#app { position: relative; height: 100%; }

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px 72px;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
}

.panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100% - 8px);
  overflow: auto;
  background: var(--panel);
  border: 4px solid var(--line);
  border-radius: 28px;
  padding: 22px 26px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.panel.wide { width: min(1080px, 100%); }

.logo {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 4px;
}

.logo i {
  width: 34px;
  height: 34px;
  border: 6px solid var(--p1);
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-40deg);
}

.logo i:last-child {
  border-color: var(--p2);
  border-left-color: transparent;
  transform: rotate(40deg);
}

.eyebrow {
  margin: 0;
  text-align: center;
  letter-spacing: 0.28em;
  color: var(--gold);
  font-weight: 700;
  font-size: 16px;
}

h1, h2 {
  margin: 4px 0 8px;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 0 #000;
}

h1 { font-size: clamp(48px, 7vw, 88px); }
h2 { font-size: clamp(36px, 5vw, 64px); }

.tag, .rule, .fine, .pads, .lead, .hint, .empty {
  text-align: center;
  font-weight: 700;
  line-height: 1.45;
}

.tag { margin: 0 0 12px; font-size: clamp(18px, 2vw, 24px); }
.rule, .pads, .lead { font-size: clamp(16px, 1.8vw, 20px); }
.fine { color: #d5dde8; font-size: 15px; font-weight: 500; }

.warn {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #3d2a0e;
  border: 3px solid #ffbf5a;
  color: #ffe0a3;
  text-align: center;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 800;
  line-height: 1.4;
}

.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
}

.row.maps { align-items: center; }
.label { font-weight: 800; font-size: 20px; }

button {
  min-height: 64px;
  padding: 0 22px;
  border-radius: 16px;
  border: 3px solid #d5dde8;
  background: #1c2430;
  color: #f4f7fb;
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 800;
  cursor: pointer;
}

button.primary {
  background: var(--gold);
  border-color: #ffe7a3;
  color: #1a1206;
  min-width: 180px;
}

button.toggle.on,
button.on {
  background: var(--gold);
  border-color: #ffe7a3;
  color: #1a1206;
}

button:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 2px;
}

.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 4px;
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 800;
}

.keys div {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 8px 10px;
}

.c1 { color: var(--p1); }
.c2 { color: var(--p2); }

#hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.scorebar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(760px, calc(100% - 150px));
  padding: 6px 18px;
  border-radius: 20px;
  border: 3px solid var(--line);
  background: rgba(0, 0, 0, 0.62);
}

.scorebar .side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  font-weight: 900;
}

.scorebar .p1 { color: var(--p1); }
.scorebar .p2 { color: var(--p2); justify-content: flex-end; }
.scorebar .nm { font-size: clamp(22px, 3vw, 36px); }
.scorebar .num { font-size: clamp(42px, 6vw, 72px); min-width: 1.1em; text-align: center; }
.scorebar .mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--gold);
  font-weight: 800;
  font-size: 18px;
}
.scorebar small { font-size: 14px; color: #fff; }

#btn-pause {
  position: absolute;
  top: 12px;
  right: 12px;
  pointer-events: auto;
  min-width: 108px;
}

.banner {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%);
  font-size: clamp(52px, 8vw, 104px);
  font-weight: 900;
  text-shadow: 0 6px 0 #000;
  white-space: nowrap;
}

.toast, .sound-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  border-radius: 999px;
}

.toast {
  bottom: 86px;
  background: #3d2a0e;
  color: #ffe0a3;
  border: 3px solid #ffbf5a;
  padding: 8px 16px;
  font-size: 20px;
}

#pickup {
  top: 108px;
  bottom: auto;
  z-index: 5;
  background: #fff8ea;
  color: #3d2b22;
  border: 4px solid #ffb07a;
  font-size: clamp(22px, 3vw, 32px);
  padding: 8px 18px;
}

.sound-hint {
  z-index: 4;
  bottom: 18px;
  background: var(--gold);
  color: #1a1206;
  padding: 8px 16px;
  font-size: 18px;
  pointer-events: none;
}

.hints {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  font-size: clamp(14px, 1.5vw, 20px);
  font-weight: 800;
  text-shadow: 0 2px 0 #000;
}

.giant {
  margin: 0;
  text-align: center;
  font-size: clamp(56px, 8vw, 96px);
  font-weight: 900;
}

.hint {
  color: var(--gold);
  font-size: 20px;
}

.pad-card {
  margin: 10px 0;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.pad-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 18px;
}

.pid {
  color: #d5dde8;
  font-size: 14px;
  word-break: break-all;
  text-align: right;
}

.bindline, .preview {
  margin-top: 6px;
  font-weight: 700;
}

.axes { margin-top: 8px; }

.axis {
  display: grid;
  grid-template-columns: 22px 1fr 52px;
  gap: 8px;
  align-items: center;
  margin: 3px 0;
  font-variant-numeric: tabular-nums;
}

.track {
  height: 14px;
  background: #111;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}

.btns { margin: 8px 0; }

.b {
  display: inline-flex;
  width: 42px;
  height: 42px;
  margin: 3px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #222a34;
  color: #d5dde8;
  font-weight: 800;
}

.b.on {
  background: var(--gold);
  color: #1a1206;
}

.row.tight button { min-height: 52px; font-size: 18px; }

#screen-menu {
  padding: 8px 12px 28px;
  overflow: hidden;
}

#screen-menu .panel {
  overflow: hidden;
  max-height: none;
  width: min(820px, 100%);
  background: #fff4df;
  color: #3d2b22;
  border: 4px solid #ffb07a;
  box-shadow: 0 8px 0 #e7b888;
  padding: 8px 14px 10px;
}

#screen-menu h1 {
  color: #1f7a72;
  text-shadow: none;
  font-size: clamp(32px, 4.6vw, 48px);
  margin: 0;
}

#screen-menu .eyebrow {
  color: #e07a32;
  letter-spacing: 0.16em;
  font-size: 13px;
}

#screen-menu .tag,
#screen-menu .rule,
#screen-menu .pads,
#screen-menu .fine {
  color: #4a3428;
  margin: 3px 0;
  font-size: clamp(13px, 1.45vw, 16px);
  line-height: 1.3;
}

#screen-menu .warn {
  background: #ffe08a;
  color: #4a2c08;
  border: 3px solid #e09020;
  font-size: clamp(14px, 1.7vw, 18px);
  padding: 6px 10px;
  margin: 6px 0;
}

#screen-menu .row { margin: 5px 0; gap: 8px; }
#screen-menu .row.maps button { padding: 0 10px; }

#screen-menu button {
  min-height: 40px;
  padding: 0 14px;
  font-size: clamp(15px, 1.6vw, 18px);
  background: #fffdf8;
  color: #3d2b22;
  border-color: #f0c090;
  box-shadow: 0 3px 0 #e7c4a0;
}

#screen-menu button.primary {
  background: #3ed4c8;
  color: #08332e;
  border-color: #bff6ef;
}

#screen-menu button.toggle.on {
  background: #ff8a4a;
  color: #3a1408;
  border-color: #ffd0b0;
}

#screen-menu .keys {
  font-size: 14px;
  gap: 6px;
  margin: 4px 0;
}

#screen-menu .keys div {
  background: #fff;
  border: 2px solid #f0d2b4;
  padding: 4px 8px;
}

#screen-menu .logo { margin-bottom: 0; }
#screen-menu .logo i { width: 24px; height: 24px; border-width: 5px; }

@media (max-width: 800px) {
  .keys { grid-template-columns: 1fr; }
  .hints span:nth-child(2) { display: none; }
  .pad-card header { flex-direction: column; }
  .pid { text-align: left; }
}
