:root {
  --bg-1: #081127;
  --bg-2: #0f2547;
  --glass: rgba(255, 255, 255, 0.12);
  --glass-edge: rgba(255, 255, 255, 0.25);
  --text-main: #f2f6ff;
  --text-soft: #c6d2eb;
  --danger: #ff6d78;
  --ok: #61ffd0;
  --accent: #7ed8ff;
}

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

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(1100px 700px at 10% -5%, rgba(120, 190, 255, 0.28), transparent 60%),
    radial-gradient(900px 600px at 95% 100%, rgba(96, 255, 198, 0.18), transparent 60%),
    linear-gradient(130deg, var(--bg-1), var(--bg-2));
  overflow: hidden;
  padding: 18px;
}

.orb {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.45;
  pointer-events: none;
  animation: drift 16s ease-in-out infinite alternate;
}

.orb-1 {
  top: 4vh;
  left: 6vw;
  background: radial-gradient(circle at 30% 30%, rgba(126, 216, 255, 0.95), rgba(126, 216, 255, 0));
}

.orb-2 {
  bottom: 6vh;
  right: 5vw;
  animation-duration: 20s;
  animation-delay: -4s;
  background: radial-gradient(circle at 70% 30%, rgba(97, 255, 208, 0.95), rgba(97, 255, 208, 0));
}

@keyframes drift {
  from {
    transform: translateY(-18px) translateX(-12px) scale(0.98);
  }
  to {
    transform: translateY(18px) translateX(16px) scale(1.05);
  }
}

.shell {
  width: min(1020px, 96vw);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 16px;
  display: grid;
  gap: 12px;
  position: relative;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 4px;
  min-height: 56px;
  position: relative;
}

.hover-tip {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 0.66rem;
  color: var(--text-soft);
  background: rgba(6, 16, 32, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 3px 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.stat:hover .hover-tip,
.stat:focus-within .hover-tip {
  opacity: 1;
  transform: translateY(0);
}

.label {
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.value {
  font-size: 1.2rem;
  font-weight: 700;
}

#eventValue {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
}

.board-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: radial-gradient(circle at 50% 10%, rgba(126, 216, 255, 0.1), rgba(5, 10, 21, 0.84));
  isolation: isolate;
}

canvas {
  display: block;
  width: 100%;
  height: min(66vh, 560px);
  touch-action: none;
}

.prism-meters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.prism-meter {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 58px;
  height: clamp(220px, 66vh, 560px);
  border: 1px solid rgba(172, 225, 255, 0.28);
  background: rgba(7, 18, 36, 0.48);
  border-radius: 13px;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  padding: 8px 8px 10px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, filter 0.22s ease;
}

.prism-meter.left {
  left: calc(-1 * clamp(44px, 5.6vw, 84px));
}

.prism-meter.right {
  right: calc(-1 * clamp(44px, 5.6vw, 84px));
}

.prism-side-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c7d8f0;
  text-align: center;
  font-weight: 700;
}

.prism-track {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  border: 1px solid rgba(169, 232, 255, 0.2);
  background: linear-gradient(180deg, rgba(18, 38, 66, 0.62), rgba(10, 21, 39, 0.86));
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.prism-fill {
  width: 100%;
  height: 0%;
  border-radius: 8px 8px 10px 10px;
  background: linear-gradient(180deg, rgba(154, 248, 255, 0.95), rgba(78, 182, 240, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 14px rgba(100, 210, 255, 0.36);
  transition: height 0.15s ease, filter 0.2s ease, background 0.22s ease;
}

.prism-meter.overexpose {
  border-color: rgba(255, 230, 142, 0.8);
  box-shadow: 0 0 22px rgba(255, 206, 89, 0.28);
  animation: prismPulse 0.85s ease-in-out infinite alternate;
}

.prism-meter.overexpose .prism-fill {
  background: linear-gradient(180deg, hsl(40 100% 78%), hsl(188 100% 62%), hsl(298 100% 66%));
  filter: saturate(1.2) brightness(1.08);
}

.prism-meter.shatter {
  animation: prismShatter 0.42s ease;
}

.prism-meter-text {
  text-align: center;
  font-size: 0.68rem;
  color: #d6e7ff;
  letter-spacing: 0.03em;
  min-height: 1em;
}

@keyframes prismPulse {
  from {
    box-shadow: 0 0 12px rgba(255, 206, 89, 0.16);
  }
  to {
    box-shadow: 0 0 24px rgba(255, 206, 89, 0.34);
  }
}

@keyframes prismShatter {
  0% {
    filter: saturate(1) brightness(1);
  }
  35% {
    filter: saturate(1.5) brightness(1.18);
  }
  100% {
    filter: saturate(1) brightness(1);
  }
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 2px;
}

.toolbar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.mode-badge {
  font-size: 0.8rem;
  color: #d9f5ec;
  border: 1px solid rgba(142, 242, 208, 0.35);
  background: rgba(9, 26, 29, 0.32);
  border-radius: 999px;
  padding: 6px 10px;
  letter-spacing: 0.03em;
}

button,
.menu-btn,
.tab-btn,
.shop-tab-btn,
.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(10, 18, 37, 0.4);
  color: var(--text-main);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

button:hover,
.menu-btn:hover,
.tab-btn:hover,
.shop-tab-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  background: rgba(126, 216, 255, 0.2);
}

.toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 20, 38, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-main);
  white-space: nowrap;
  z-index: 3;
}

.toast.show {
  opacity: 1;
}

.pause-layer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 14, 28, 0.08);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition: opacity 0.32s ease, backdrop-filter 0.42s ease, background 0.32s ease;
  z-index: 920;
}

.pause-layer.open {
  opacity: 1;
  pointer-events: auto;
  background: rgba(7, 14, 28, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pause-card {
  width: min(700px, calc(100vw - 28px));
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.26);
  padding: 18px;
  transform: translateY(28px) scale(0.97);
  opacity: 0;
  transition: transform 0.36s cubic-bezier(0.2, 0.75, 0.2, 1), opacity 0.3s ease;
  display: grid;
  gap: 14px;
}

.pause-layer.open .pause-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pause-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pause-title {
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.menu-stack {
  display: grid;
  gap: 10px;
}

.menu-btn {
  padding: 10px 16px;
  font-size: 0.95rem;
  background: rgba(9, 20, 40, 0.5);
}

.menu-stack .menu-btn {
  opacity: 0;
  transform: translateY(20px);
  width: 100%;
  text-align: center;
}

.pause-layer.open .menu-stack .menu-btn {
  animation: floatIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.pause-layer.open .menu-stack .menu-btn:nth-child(1) {
  animation-delay: 0.09s;
}

.pause-layer.open .menu-stack .menu-btn:nth-child(2) {
  animation-delay: 0.15s;
}

.pause-layer.open .menu-stack .menu-btn:nth-child(3) {
  animation-delay: 0.21s;
}

.pause-layer.open .menu-stack .menu-btn:nth-child(4) {
  animation-delay: 0.27s;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.settings-panel {
  display: none;
  gap: 12px;
  animation: fadeSlide 0.25s ease;
}

.settings-panel.active {
  display: grid;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 12px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.shop-tab-btn {
  padding: 7px 12px;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.tab-btn.active,
.shop-tab-btn.active {
  border-color: rgba(145, 231, 255, 0.7);
  background: rgba(126, 216, 255, 0.26);
  transform: none;
}

.tab-panel {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(7, 15, 30, 0.36);
  border-radius: 12px;
  padding: 12px;
  gap: 10px;
  max-height: min(56vh, 500px);
  overflow-y: auto;
  align-content: start;
}

.tab-panel.active {
  display: grid;
}

.shop-tab-panel {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(7, 15, 30, 0.36);
  border-radius: 12px;
  padding: 12px;
  max-height: min(56vh, 500px);
  overflow-y: auto;
}

.shop-tab-panel.active {
  display: block;
}

.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #eaf2ff;
  font-size: 0.86rem;
}

.slider-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-value {
  min-width: 52px;
  text-align: right;
  font-size: 0.8rem;
  color: #dff3ff;
}

.setting-note {
  color: #c9d7ee;
  font-size: 0.8rem;
  line-height: 1.4;
}

.ratio-tip {
  position: absolute;
  right: 8px;
  bottom: -32px;
  z-index: 12;
  background: rgba(10, 22, 44, 0.95);
  border: 1px solid rgba(170, 230, 255, 0.45);
  color: #dff3ff;
  font-size: 0.72rem;
  padding: 5px 8px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.ratio-tip.show {
  opacity: 1;
  transform: translateY(0);
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-head h3 {
  font-size: 0.94rem;
}

.shop-points {
  font-size: 0.8rem;
  color: #cff0ff;
}

.shop-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.shop-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(11, 25, 46, 0.58);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.shop-preview {
  width: 100%;
  height: 56px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.shop-preview .preview-paddle {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 16px;
  height: 40px;
  border-radius: 4px;
  transform: translateX(-50%);
}

.shop-preview .preview-ball {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.shop-card h4 {
  font-size: 0.82rem;
  color: #ecf6ff;
}

.shop-meta {
  font-size: 0.74rem;
  color: #cae1ff;
}

.shop-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.shop-btn-small {
  padding: 6px 8px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.shop-btn-small[disabled] {
  opacity: 0.55;
  cursor: default;
}

.score-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.score-block {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(9, 22, 40, 0.46);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.score-block h3 {
  font-size: 0.87rem;
  color: #eff7ff;
}

.score-list {
  margin: 0;
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 3px;
}

ul.score-list {
  list-style: none;
  padding-left: 0;
}

ol.score-list {
  padding-left: 20px;
}

.score-list li {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(15, 31, 57, 0.54);
  padding: 6px 8px;
  color: #dceaff;
  font-size: 0.77rem;
  line-height: 1.35;
}

.score-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.score-mode {
  color: #b8d1f2;
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-block {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(10, 23, 44, 0.45);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.help-block h3 {
  font-size: 0.88rem;
  color: #eff6ff;
}

.help-block p {
  color: #c9d7ee;
  font-size: 0.81rem;
  line-height: 1.45;
}

.slider {
  width: min(210px, 55vw);
  accent-color: #84dfff;
}

.select-input {
  width: min(220px, 58vw);
  border-radius: 9px;
  border: 1px solid rgba(166, 223, 255, 0.45);
  background: rgba(14, 28, 51, 0.72);
  color: #ecf6ff;
  padding: 6px 8px;
  font: 600 0.84rem "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  outline: none;
}

.select-input:focus {
  border-color: rgba(179, 235, 255, 0.9);
}

.help-list {
  margin: 0;
  padding-left: 18px;
  color: #c9d7ee;
  font-size: 0.81rem;
  line-height: 1.45;
}

.help-list li {
  margin-bottom: 4px;
}

.help-touch {
  display: none;
}

body.device-touch .help-touch {
  display: grid;
}

body.device-touch .help-desktop {
  display: none;
}

.touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  display: none;
}

body.device-touch .touch-controls {
  display: block;
}

.touch-side {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(9, 20, 40, 0.6);
  color: var(--text-main);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  pointer-events: auto;
}

.touch-btn:hover {
  transform: translateY(-1px);
  background: rgba(126, 216, 255, 0.2);
}

.touch-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(174, 234, 255, 0.5);
  background: rgba(12, 28, 52, 0.75);
  color: #e4f6ff;
  font-size: 0.72rem;
  font-weight: 700;
}

.touch-label {
  font-weight: 600;
}

.touch-overexpose .touch-icon {
  border-color: rgba(255, 220, 120, 0.7);
  color: #ffe9b0;
}

.touch-pause {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  pointer-events: auto;
}

body.device-touch .menu-btn,
body.device-touch .tab-btn,
body.device-touch .shop-tab-btn,
body.device-touch .ghost-btn {
  font-size: 1rem;
  padding: 12px 18px;
}

body.device-scale-mobile .shell {
  width: min(100%, 100vw);
  padding: 12px;
}

body.device-scale-mobile .hud {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.device-scale-mobile canvas {
  height: min(70vh, 520px);
}

body.device-scale-tablet .shell {
  width: min(980px, 98vw);
  padding: 14px;
}

body.device-scale-tablet .hud {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.device-scale-tablet canvas {
  height: min(68vh, 560px);
}

body.device-touch button {
  font-size: 1rem;
  padding: 12px 18px;
}

body.device-touch .touch-btn {
  font-size: 0.82rem;
  padding: 10px 12px;
}

body.device-touch .icon-btn {
  padding: 0;
  width: 32px;
  height: 32px;
}

.device-prompt {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 12, 24, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
  z-index: 980;
}

.device-prompt.open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.device-confirm {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 14, 28, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
  z-index: 2;
}

.device-confirm.open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.device-card {
  width: min(420px, 92vw);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  padding: 16px;
  display: grid;
  gap: 10px;
  position: relative;
}

.device-note {
  color: #c9d7ee;
  font-size: 0.82rem;
  line-height: 1.4;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.device-options {
  display: grid;
  gap: 8px;
}

.device-options[aria-hidden="true"] {
  display: none;
}

.device-card .menu-btn {
  opacity: 1;
  transform: none;
  width: auto;
}

.device-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.icon-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(9, 18, 36, 0.7);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.orientation-prompt {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 10, 22, 0.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 970;
}

.orientation-prompt.show {
  opacity: 1;
  pointer-events: auto;
}

.orientation-card {
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(12, 24, 44, 0.85);
  color: var(--text-main);
  text-align: center;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.toggle {
  inline-size: 44px;
  block-size: 25px;
  appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(11, 20, 39, 0.6);
  position: relative;
  cursor: pointer;
  transition: background 0.25s ease;
}

.toggle::before {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  inline-size: 19px;
  block-size: 19px;
  border-radius: 50%;
  background: #ecf7ff;
  transition: transform 0.24s ease;
}

.toggle:checked {
  background: rgba(106, 224, 189, 0.55);
  border-color: rgba(152, 247, 219, 0.7);
}

.toggle:checked::before {
  transform: translateX(18px);
}

.key-grid {
  display: grid;
  gap: 8px;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7e6ff;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.key-chip {
  min-width: 36px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 34, 60, 0.68);
  padding: 5px 8px;
  font-size: 0.79rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: transform 0.17s ease, background 0.2s ease, border-color 0.2s ease;
}

.key-chip.active {
  transform: translateY(-3px) scale(1.04);
  background: rgba(126, 216, 255, 0.3);
  border-color: rgba(171, 232, 255, 0.9);
}

.manual-block {
  display: none;
}

.manual-block.active {
  display: block;
}

.ghost-btn {
  background: rgba(10, 17, 33, 0.45);
  width: fit-content;
}

body.perf-mode {
  background: linear-gradient(130deg, #081127, #0f2547);
}

body.perf-mode .orb {
  display: none;
}

body.perf-mode .shell {
  background: #0e1a34;
  border-color: #2b4269;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

body.perf-mode .stat,
body.perf-mode .board-wrap,
body.perf-mode .mode-badge,
body.perf-mode .tab-panel,
body.perf-mode .shop-tab-panel,
body.perf-mode .pause-card,
body.perf-mode .toast,
body.perf-mode .key-chip,
body.perf-mode .select-input,
body.perf-mode .prism-meter,
body.perf-mode .prism-track,
body.perf-mode button,
body.perf-mode .menu-btn,
body.perf-mode .tab-btn,
body.perf-mode .shop-tab-btn,
body.perf-mode .ghost-btn {
  background: #101f3d;
  border-color: #2f496f;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

body.perf-mode .pause-layer,
body.perf-mode .pause-layer.open {
  background: #0a152a;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.perf-mode .toggle {
  background: #0f1f3b;
  border-color: #2f496f;
}

body.perf-mode .toggle:checked {
  background: #2e8c6f;
  border-color: #5cb99a;
}

body.perf-mode .prism-fill {
  background: linear-gradient(180deg, #8ad7ff, #3e78b6);
}

body.compat-mode {
  background: linear-gradient(130deg, #081127, #0f2547);
}

body.compat-mode .orb {
  display: none;
}

body.compat-mode .shell,
body.compat-mode .stat,
body.compat-mode .board-wrap,
body.compat-mode .mode-badge,
body.compat-mode .tab-panel,
body.compat-mode .shop-tab-panel,
body.compat-mode .pause-card,
body.compat-mode .toast,
body.compat-mode .prism-meter,
body.compat-mode .prism-track,
body.compat-mode button,
body.compat-mode .menu-btn,
body.compat-mode .tab-btn,
body.compat-mode .shop-tab-btn,
body.compat-mode .ghost-btn {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

body.compat-mode .pause-layer,
body.compat-mode .pause-layer.open {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.compat-mode .menu-btn,
body.compat-mode .pause-card,
body.compat-mode .pause-layer {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.ultra-perf .pause-layer,
body.ultra-perf .pause-card,
body.ultra-perf .menu-btn {
  animation: none;
  transition: none;
}

body.ultra-perf .pause-layer .menu-btn {
  opacity: 1;
  transform: none;
}

@media (max-width: 880px) {
  .prism-meter {
    width: 50px;
    height: clamp(180px, 58vh, 440px);
    padding: 7px 6px 9px;
  }
}

@media (max-width: 720px) {
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .value {
    font-size: 1rem;
  }

  #eventValue {
    font-size: 0.82rem;
  }

  .pause-card {
    padding: 14px;
  }

  .score-columns {
    grid-template-columns: 1fr;
  }

  .prism-meter {
    width: 42px;
    height: clamp(150px, 50vh, 330px);
    padding: 6px 5px 7px;
    gap: 5px;
  }

  .prism-meter-text {
    font-size: 0.6rem;
  }

  .prism-side-label {
    font-size: 0.62rem;
  }
}
