:root {
  color-scheme: light;
  --white: #f7f7f2;
  --white-pure: #fff;
  --black: #090b09;
  --black-soft: #242824;
  --gray: #747a76;
  --gray-light: #d9dcd8;
  --lime: #baff2a;
  --lime-strong: #a8f000;
  --line: rgb(9 11 9 / 18%);
  --display: "Black Ops One", "Oxanium", sans-serif;
  --ui: "Oxanium", "Noto Sans JP", system-ui, sans-serif;
  --timer: "Share Tech Mono", ui-monospace, monospace;
  --sans: "Noto Sans JP", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 20rem;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--gray-light);
}

body {
  color: var(--black);
  font-family: var(--sans);
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.game-shell {
  --theme-bg: #c9c29e;
  --theme-glow: #eae2b2;
  --theme-title: var(--black);
}

.game-shell[data-level="normal"] {
  --theme-bg: #aeb5b0;
  --theme-glow: #dce2de;
}

.game-shell[data-level="hard"] {
  --theme-bg: #b8875e;
  --theme-glow: #efd0aa;
}

.game-shell[data-level="extream"] {
  --theme-bg: #d9dde1;
  --theme-glow: #f7fbff;
}

.game-shell[data-level="ultimate"] {
  --theme-bg: #15212a;
  --theme-glow: #344a59;
  --theme-title: var(--white);
}

.game-shell[data-level="unknown"] {
  --theme-bg: #050814;
  --theme-glow: #244c66;
  --theme-title: var(--white);
}

.game-shell[data-level="special"] {
  --theme-bg: #322117;
  --theme-glow: #a86c3c;
  --theme-title: var(--white);
}

.game-shell,
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

#game-canvas.is-holding {
  cursor: grabbing;
}

.scene-vignette {
  position: fixed;
  z-index: 2;
  inset: 0;
  box-shadow: inset 0 0 11rem rgb(0 0 0 / 23%);
  pointer-events: none;
}

.game-hud-stack {
  position: fixed;
  z-index: 5;
  top: max(1.5rem, env(safe-area-inset-top));
  left: max(1.5rem, env(safe-area-inset-left));
  display: grid;
  width: clamp(13.5rem, 19vw, 17rem);
  gap: 0.72rem;
  pointer-events: none;
}

.game-hud {
  position: relative;
  width: 100%;
  padding: 0.58rem 0.9rem 0.82rem;
  border-top: 0.24rem solid var(--lime);
  background: var(--black);
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 75%),
    0 0 0 2px var(--black),
    0 1.2rem 3rem rgb(0 0 0 / 20%);
  clip-path: polygon(0 0, calc(100% - 1.15rem) 0, 100% 1.15rem, 100% 100%, 0 100%);
  color: var(--white);
  font-family: var(--ui);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.game-hud p {
  margin: 0;
}

.hud-case {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.45rem;
}

.hud-case > span {
  padding: 0.2rem 0.3rem;
  background: var(--lime);
  color: var(--black);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.hud-case strong {
  min-width: 0;
  font-size: clamp(0.98rem, 1.35vw, 1.2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-case b {
  color: #b8beb9;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.hud-time-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 0.7rem;
  margin-top: 0.72rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgb(255 255 255 / 24%);
}

.hud-time-label {
  padding-bottom: 0.1rem;
  color: var(--lime);
  font-size: 0.59rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.hud-time {
  justify-self: end;
  font-family: var(--timer);
  font-size: clamp(1.18rem, 2vw, 1.65rem);
  letter-spacing: -0.055em;
  line-height: 0.9;
}

.hud-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 0.3rem;
  pointer-events: auto;
}

.hud-action {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 0.3rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
}

.hud-action-disc {
  display: grid;
  width: clamp(2.65rem, 4.4vw, 3rem);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 82%);
  border-radius: 50%;
  background: rgb(9 11 9 / 86%);
  box-shadow:
    0 0 0 1px var(--black),
    inset 0 1px 0 rgb(255 255 255 / 28%),
    0 0.65rem 1.3rem rgb(0 0 0 / 19%);
  color: var(--white-pure);
  font-size: 0.94rem;
  backdrop-filter: blur(0.75rem) saturate(1.25);
  transition: background 130ms ease, color 130ms ease, transform 130ms ease;
}

.hud-action-label {
  max-width: 100%;
  padding: 0.16rem 0.25rem;
  border: 1px solid rgb(255 255 255 / 48%);
  background: rgb(9 11 9 / 78%);
  box-shadow: 0 0.35rem 0.8rem rgb(0 0 0 / 12%);
  color: var(--white-pure);
  font-size: clamp(0.43rem, 0.72vw, 0.54rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  white-space: nowrap;
  backdrop-filter: blur(0.55rem);
}

.hud-action:not(:disabled):hover .hud-action-disc,
.hud-action[aria-pressed="true"] .hud-action-disc {
  background: var(--lime);
  color: var(--black);
  transform: translateY(-2px);
}

.hud-action:not(:disabled):active .hud-action-disc {
  transform: translateY(0) scale(0.96);
}

.hud-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.controls-card {
  position: fixed;
  z-index: 5;
  right: max(1.5rem, env(safe-area-inset-right));
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  width: min(18.8rem, calc(100vw - 3rem));
  padding: 0.72rem;
  border: 1px solid var(--black);
  background: linear-gradient(135deg, rgb(255 255 255 / 58%), rgb(235 241 234 / 34%));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 78%), 0 0.8rem 2.5rem rgb(0 0 0 / 18%);
  backdrop-filter: blur(1.25rem) saturate(1.42);
  pointer-events: none;
}

.controls-title {
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.48rem;
  background: var(--black);
  color: var(--white);
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
}

.controls-card ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.84rem 0.72rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.controls-card li {
  display: grid;
  grid-template-columns: 2.55rem 1fr;
  align-items: center;
  min-width: 0;
  gap: 0.55rem;
}

.controls-card li > span:last-child {
  display: grid;
  min-width: 0;
  padding: 0.12rem 0.18rem;
  background: transparent;
}

.controls-card b {
  font-family: var(--ui);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.controls-card small {
  margin-top: 0.08rem;
  color: #414642;
  font-size: 0.59rem;
  font-weight: 600;
  white-space: nowrap;
}

.control-visual,
.controls-card kbd {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border: 1px solid var(--black);
  background: var(--white-pure);
  color: var(--black);
}

.controls-card .text-key {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.mouse-visual svg {
  width: 1.38rem;
  height: 1.82rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.mouse-visual .mouse-fill {
  fill: var(--lime);
  stroke: none;
}

.controls-card kbd {
  padding: 0.25rem;
  font-family: var(--ui);
  font-size: 0.46rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.wheel-icon {
  position: relative;
  display: inline-block;
  width: 0.55rem;
  height: 0.85rem;
  margin-left: 0.08rem;
  border: 1px solid currentcolor;
  border-radius: 0.3rem;
  vertical-align: -0.25rem;
}

.wheel-icon::before {
  position: absolute;
  top: 0.12rem;
  left: 50%;
  width: 1px;
  height: 0.24rem;
  background: currentcolor;
  content: "";
  transform: translateX(-50%);
}

.zoom-keys {
  display: flex !important;
  gap: 0.2rem;
}

.zoom-keys span {
  display: grid;
  width: 0.82rem;
  height: 1.3rem;
  place-items: center;
  border: 1px solid var(--black);
  background: var(--lime);
  font-size: 0.72rem;
}

.zoom-in::before {
  content: "+";
}

.zoom-out::before {
  content: "−";
}

.grab-readout {
  position: fixed;
  z-index: 7;
  display: none;
  align-items: center;
  max-width: calc(100vw - 1rem);
  gap: 0.48rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--black);
  background: var(--lime);
  color: var(--black);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.grab-readout.is-visible {
  display: flex;
}

.grab-dot {
  width: 0.4rem;
  height: 0.4rem;
  border: 1px solid currentcolor;
  border-radius: 50%;
  background: currentcolor;
}

.toast {
  position: fixed;
  z-index: 30;
  top: max(1.5rem, env(safe-area-inset-top));
  left: 50%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--lime);
  background: var(--black);
  color: var(--white);
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -0.5rem);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.countdown-overlay {
  position: fixed;
  z-index: 12;
  inset: 0;
  display: grid;
  background: radial-gradient(circle, rgb(9 11 9 / 8%), rgb(9 11 9 / 34%));
  place-items: center;
  pointer-events: none;
}

.countdown-overlay::before {
  position: absolute;
  width: clamp(10rem, 24vw, 17rem);
  aspect-ratio: 1;
  border: 2px solid rgb(255 255 255 / 72%);
  border-top: 0.7rem solid var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--black), 0 1.5rem 4rem rgb(0 0 0 / 25%);
  content: "";
  animation: countdown-ring 720ms linear both;
}

.countdown-overlay p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--white);
  font-family: var(--display);
  font-size: clamp(6rem, 18vw, 13rem);
  letter-spacing: -0.08em;
  line-height: 1;
  text-shadow: 0.08em 0.08em 0 var(--black);
}

.countdown-overlay.is-go p {
  color: var(--lime);
  font-size: clamp(4.5rem, 14vw, 10rem);
  letter-spacing: 0.02em;
}

.countdown-overlay.is-pulse p {
  animation: countdown-pulse 680ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes countdown-pulse {
  from { opacity: 0; transform: scale(1.35); }
  24% { opacity: 1; }
  to { opacity: 0.92; transform: scale(1); }
}

@keyframes countdown-ring {
  to { transform: rotate(360deg); }
}

.menu-layer {
  position: fixed;
  z-index: 15;
  inset: 0;
  display: grid;
  overflow: auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2.8rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  place-items: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms;
}

.menu-layer.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.menu-layer:not(.is-visible) .menu-copyright {
  display: none;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, var(--theme-glow), transparent 38rem),
    linear-gradient(rgb(9 11 9 / 8%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(9 11 9 / 8%) 1px, transparent 1px),
    var(--theme-bg);
  background-size: auto, 2rem 2rem, 2rem 2rem, auto;
  transition: background-color 220ms ease;
}

.menu-backdrop::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 18%), transparent 30% 68%, rgb(9 11 9 / 12%)),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 2%) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% 45%, transparent 0 18rem, rgb(9 11 9 / 8%) 18.05rem 18.12rem, transparent 18.2rem);
  content: "";
  pointer-events: none;
}

.menu-atmosphere {
  position: absolute;
  z-index: 2;
  display: block;
  pointer-events: none;
}

.atmosphere-ring {
  top: 42%;
  left: 50%;
  width: min(58rem, 78vw);
  aspect-ratio: 1;
  border: 1px solid rgb(9 11 9 / 20%);
  border-radius: 50%;
  box-shadow:
    0 0 0 5rem rgb(255 255 255 / 3%),
    0 0 0 5.08rem rgb(9 11 9 / 12%),
    0 0 0 10rem rgb(255 255 255 / 2%),
    0 0 0 10.08rem rgb(9 11 9 / 8%);
  transform: translate(-50%, -50%);
}

.atmosphere-ring::before,
.atmosphere-ring::after {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgb(9 11 9 / 15%);
  content: "";
  transform: translate(-50%, -50%);
}

.atmosphere-ring::before {
  width: 120%;
  height: 1px;
}

.atmosphere-ring::after {
  width: 1px;
  height: 120%;
}

.atmosphere-cross {
  inset: 1.2rem;
  border: 1px solid rgb(255 255 255 / 15%);
  clip-path: polygon(0 0, 7rem 0, 7rem 1px, 1px 1px, 1px 7rem, 0 7rem, 0 0, 100% 0, 100% 7rem, calc(100% - 1px) 7rem, calc(100% - 1px) 1px, calc(100% - 7rem) 1px, calc(100% - 7rem) 0, 100% 0, 100% 100%, calc(100% - 7rem) 100%, calc(100% - 7rem) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 7rem), 100% calc(100% - 7rem), 100% 100%, 0 100%, 0 calc(100% - 7rem), 1px calc(100% - 7rem), 1px calc(100% - 1px), 7rem calc(100% - 1px), 7rem 100%, 0 100%);
}

.atmosphere-scan {
  top: -10%;
  left: 0;
  width: 100%;
  height: 16%;
  border-bottom: 1px solid rgb(186 255 42 / 58%);
  background: linear-gradient(transparent, rgb(186 255 42 / 5%));
  animation: menu-scan 8s linear infinite;
}

@keyframes menu-scan {
  to { transform: translateY(760%); }
}

.game-shell[data-level="easy"] .menu-backdrop {
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgb(255 250 194 / 8%) 0 1px, transparent 1px 4px),
    #6b6644;
}

.game-shell[data-level="easy"] .menu-backdrop::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(100vw, 133.333vh);
  height: min(100vh, 75vw);
  border: 0.35rem solid #5a5537;
  background:
    linear-gradient(90deg, transparent 0 49.55%, #665f3c 49.55% 50.45%, transparent 50.45%) 0 0 / 100% 33.333% no-repeat,
    linear-gradient(90deg, transparent 0 24.45%, #665f3c 24.45% 25.55%, transparent 25.55% 49.45%, #665f3c 49.45% 50.55%, transparent 50.55% 74.45%, #665f3c 74.45% 75.55%, transparent 75.55%) 0 100% / 100% 66.667% no-repeat,
    linear-gradient(0deg, transparent 0 66.15%, #665f3c 66.15% 67.05%, transparent 67.05%),
    repeating-linear-gradient(0deg, rgb(255 250 194 / 13%) 0 1px, transparent 1px 4px),
    linear-gradient(115deg, #aaa16b, #b9ae73 52%, #958e60);
  box-shadow: 0 0 0 1px rgb(26 25 16 / 55%), 0 0 5rem rgb(15 14 9 / 18%);
  content: "";
  transform: translate(-50%, -50%);
}

.game-shell[data-level="easy"] .menu-backdrop::after {
  background:
    linear-gradient(115deg, rgb(255 255 255 / 13%), transparent 30% 68%, rgb(9 11 9 / 16%)),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 3%) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% 44%, transparent 0 16rem, rgb(9 11 9 / 11%) 16.05rem 16.12rem, transparent 16.2rem);
}

.game-shell[data-level="hard"] .menu-backdrop {
  background:
    repeating-linear-gradient(0deg, transparent 0 4.9rem, rgb(57 28 13 / 13%) 5rem 5.1rem),
    linear-gradient(115deg, rgb(255 255 255 / 22%), transparent 42%),
    var(--theme-bg);
}

.game-shell[data-level="ultimate"] .menu-backdrop {
  background:
    linear-gradient(rgb(255 255 255 / 6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 6%) 1px, transparent 1px),
    radial-gradient(circle at 50% 40%, var(--theme-glow), transparent 38rem),
    var(--theme-bg);
  background-size: 5rem 5rem, 5rem 5rem, auto, auto;
}

.game-shell[data-level="unknown"] .menu-backdrop {
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 26%, rgb(107 231 255 / 26%), transparent 22rem),
    radial-gradient(circle at 82% 70%, rgb(218 99 255 / 20%), transparent 24rem),
    linear-gradient(rgb(186 255 42 / 11%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(186 255 42 / 11%) 1px, transparent 1px),
    var(--theme-bg);
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  background-size: auto, auto, 3rem 3rem, 3rem 3rem, auto;
  animation: cyber-grid 9s linear infinite;
}

.game-shell[data-level="unknown"] .menu-backdrop::after {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle, rgb(255 255 255 / 70%) 0 1px, transparent 1.5px) 0 0 / 5.8rem 5.8rem,
    radial-gradient(circle, rgb(186 255 42 / 65%) 0 1px, transparent 1.5px) 2rem 3rem / 8.2rem 8.2rem;
  content: "";
  opacity: 0.58;
  animation: cyber-stars 18s linear infinite;
}

@keyframes cyber-grid {
  to { background-position: 0 0, 0 0, 3rem 3rem, 3rem 3rem, 0 0; }
}

@keyframes cyber-stars {
  to { transform: translate3d(7rem, -5rem, 0) rotate(2deg); }
}

.game-shell[data-level="unknown"] .scene-vignette {
  box-shadow: inset 0 0 12rem rgb(25 66 91 / 50%);
}

.game-shell[data-level="unknown"] .spaghetti-mark {
  filter: drop-shadow(0 0 1.2rem rgb(107 231 255 / 28%));
}

.game-shell[data-level="unknown"] .difficulty-option:not(.is-selected),
.game-shell[data-level="unknown"] .start-button {
  box-shadow: 0 0 1.25rem rgb(107 231 255 / 14%);
}

.game-shell[data-level="unknown"] .menu-backdrop + .menu-shell {
  isolation: isolate;
}

.game-shell[data-level="unknown"] .menu-backdrop + .menu-shell::before {
  position: absolute;
  z-index: -1;
  inset: -1rem;
  border: 1px solid rgb(107 231 255 / 20%);
  background: rgb(5 8 20 / 24%);
  backdrop-filter: blur(0.45rem);
  content: "";
}

.game-shell[data-level="unknown"] .plate-rim {
  fill: #f7ffff;
}

.game-shell[data-level="unknown"] .plate {
  stroke: #6be7ff;
}

.game-shell[data-level="unknown"] .cable-pile > path:not(.lime-cable) {
  stroke: #111523;
}

.game-shell[data-level="unknown"] .connector,
.game-shell[data-level="unknown"] .earbud {
  fill: #111523;
}

.game-shell[data-level="unknown"] .connector-pin {
  stroke: #111523;
}

.game-shell[data-level="special"] .scene-vignette {
  box-shadow: inset 0 0 13rem rgb(25 10 3 / 58%);
}

.menu-shell {
  position: relative;
  z-index: 3;
  display: grid;
  width: min(54rem, 100%);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  padding: clamp(0.35rem, 1.6vw, 1rem);
}

.menu-heading {
  position: relative;
  z-index: 2;
  text-align: center;
}

.menu-logo {
  position: relative;
  display: grid;
  width: 100%;
  min-height: clamp(5.3rem, 9vw, 7.4rem);
  margin: 0;
  place-content: center;
  justify-items: center;
  color: var(--theme-title);
}

.logo-subline {
  font-family: var(--ui);
  font-size: clamp(0.42rem, 0.75vw, 0.58rem);
  font-weight: 800;
  letter-spacing: 0.19em;
  line-height: 1;
}

.logo-wordmark {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0.7rem 1.1rem rgb(0 0 0 / 16%));
  font-family: var(--display);
  font-size: clamp(2.9rem, 6.5vw, 5.5rem);
  letter-spacing: -0.075em;
  line-height: 0.84;
  white-space: nowrap;
}

.logo-wordmark > span {
  position: relative;
  z-index: 1;
  text-shadow: 0.045em 0.045em 0 var(--lime);
}

.logo-wordmark b {
  position: relative;
  display: inline-block;
  margin-left: 0.18em;
  padding: 0.02em 0.12em 0.05em 0.08em;
  background: var(--black);
  box-shadow: 0.07em 0.07em 0 var(--lime);
  color: var(--white-pure);
  font: inherit;
  letter-spacing: -0.06em;
  transform: skewX(-5deg);
}

.logo-wordmark b::after {
  position: absolute;
  right: -0.08em;
  bottom: 0.08em;
  width: 0.09em;
  height: 0.62em;
  background: var(--lime);
  content: "";
}

.logo-subline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.45rem;
  letter-spacing: 0.16em;
}

.logo-subline i {
  width: 0.4rem;
  height: 0.4rem;
  border: 1px solid currentcolor;
  background: var(--lime);
}

.menu-phases {
  display: grid;
  min-height: 0;
}

.menu-phase {
  min-width: 0;
  animation: menu-phase-in 220ms ease both;
}

.difficulty-phase {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(10rem, 1fr) auto;
  align-items: center;
}

@keyframes menu-phase-in {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
}

.spaghetti-mark {
  display: block;
  width: 100%;
  max-height: min(38svh, 19rem);
  padding: 0;
  border: 0;
  margin: clamp(-1.25rem, -1.7vw, -0.4rem) auto clamp(-0.85rem, -1.2vw, -0.25rem);
  appearance: none;
  background: transparent;
  color: inherit;
  cursor: default;
  filter: drop-shadow(0 1.2rem 1.1rem rgb(0 0 0 / 14%));
  opacity: 1;
}

.spaghetti-mark.is-secret-ready {
  cursor: pointer;
}

.spaghetti-mark:disabled {
  cursor: default;
}

.spaghetti-mark.is-secret-tapped svg {
  animation: secret-logo-tap 180ms ease-out;
}

.spaghetti-mark.is-secret-ready:focus-visible svg {
  transform: scale(1.035);
}

@media (hover: hover) and (pointer: fine) {
  .spaghetti-mark.is-secret-ready:hover svg {
    transform: scale(1.035);
  }
}

@keyframes secret-logo-tap {
  45% { transform: scale(0.985) rotate(-0.35deg); }
}

.spaghetti-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(38svh, 19rem);
  overflow: visible;
  transform-origin: center;
  transition: transform 180ms ease-out;
}

.plate-shadow {
  fill: rgb(9 11 9 / 22%);
}

.plate {
  fill: url(#plate-face);
  stroke: var(--black);
  stroke-width: 4.5;
}

.plate-rim {
  fill: #e3e7e1;
  stroke: #b5bcb6;
  stroke-width: 5;
}

.plate-highlight {
  fill: none;
  stroke: rgb(255 255 255 / 82%);
  stroke-width: 3;
}

.utensil {
  fill: url(#steel);
  stroke: var(--black);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  filter: drop-shadow(0 10px 5px rgb(0 0 0 / 22%));
}

.utensil .utensil-shine {
  fill: rgb(255 255 255 / 46%);
  stroke: none;
}

.fork .fork-silhouette {
  fill: url(#steel);
}

.fork .fork-shine {
  fill: none;
  stroke: rgb(255 255 255 / 58%);
  stroke-width: 2;
}

.cable-pile > path {
  fill: none;
  stroke: var(--black);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 15;
  filter: drop-shadow(0 6px 2px rgb(0 0 0 / 23%));
}

.cable-pile > .pile-depth {
  stroke: #303530;
  stroke-width: 18;
}

.cable-pile > .lime-cable {
  stroke: var(--lime-strong);
  stroke-width: 13;
}

.cable-pile > .cable-shine {
  stroke: rgb(255 255 255 / 67%);
  stroke-width: 2.8;
  filter: none;
}

.connector,
.earbud {
  fill: var(--black);
}

.connector-pin {
  fill: none;
  stroke: var(--black);
  stroke-width: 4;
}

.connector-port {
  fill: var(--lime);
}

.power-strip-mark {
  fill: var(--black);
  stroke: var(--lime);
  stroke-width: 2;
}

.power-strip-port {
  fill: #464c47;
  stroke: var(--white-pure);
  stroke-width: 1.5;
}

.menu-actions {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0.55rem;
  border: 1px solid rgb(255 255 255 / 48%);
  background: rgb(9 11 9 / 89%);
  box-shadow:
    0 0 0 1px var(--black),
    0 1.2rem 2.8rem rgb(0 0 0 / 26%),
    inset 0 1px 0 rgb(255 255 255 / 15%);
  clip-path: polygon(0 0, calc(100% - 1.2rem) 0, 100% 1.2rem, 100% 100%, 1.2rem 100%, 0 calc(100% - 1.2rem));
}

.difficulty-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  padding: 0.15rem 0.3rem 0.35rem;
  border-bottom: 1px solid rgb(255 255 255 / 24%);
  color: var(--white-pure);
  font-family: var(--ui);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.difficulty-rail span::before {
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  margin-right: 0.45rem;
  background: var(--lime);
  content: "";
  vertical-align: -0.02rem;
}

.difficulty-rail b {
  color: var(--lime);
  font-family: var(--timer);
  font-weight: 400;
}

.ranking-phase {
  width: min(44rem, 100%);
  align-self: center;
  justify-self: center;
}

.ranking-panel {
  position: relative;
  display: grid;
  gap: 0.9rem;
  padding: clamp(0.85rem, 2vw, 1.25rem);
  border: 1px solid rgb(255 255 255 / 68%);
  background:
    linear-gradient(110deg, rgb(255 255 255 / 4%), transparent 30%),
    rgb(9 11 9 / 92%);
  box-shadow:
    0 0 0 1px var(--black),
    0 1.5rem 4rem rgb(0 0 0 / 32%),
    inset 0 1px 0 rgb(255 255 255 / 16%);
  clip-path: polygon(0 0, calc(100% - 1.1rem) 0, 100% 1.1rem, 100% 100%, 1.1rem 100%, 0 calc(100% - 1.1rem));
  color: var(--white-pure);
  backdrop-filter: blur(1.35rem) saturate(1.3);
}

.ranking-panel::before {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(7rem, 28%, 12rem);
  height: 0.28rem;
  background: var(--lime);
  box-shadow: 0 0 1.1rem rgb(186 255 42 / 38%);
  content: "";
}

.ranking-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.65rem, 2vw, 1.2rem);
}

.ranking-back {
  display: grid;
  width: 3.3rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 52%);
  background: rgb(255 255 255 / 7%);
  color: var(--white-pure);
  cursor: pointer;
  font-family: var(--ui);
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  transition: background 130ms ease, color 130ms ease, transform 130ms ease;
}

.ranking-back i {
  color: var(--lime);
  font-size: 0.9rem;
}

.ranking-back:hover {
  background: var(--lime);
  color: var(--black);
  transform: translateX(-0.15rem);
}

.ranking-back:hover i {
  color: var(--black);
}

.ranking-heading {
  min-width: 0;
}

.ranking-heading p,
.ranking-heading h2 {
  margin: 0;
}

.ranking-heading p {
  color: rgb(255 255 255 / 54%);
  font-family: var(--ui);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.ranking-heading h2 {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3.3rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.ranking-heading h2 small {
  color: var(--lime);
  font-family: var(--ui);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.ranking-board {
  min-height: 16.45rem;
  border: 1px solid rgb(255 255 255 / 28%);
  background:
    linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px),
    rgb(18 22 18 / 86%);
  background-size: 100% 2.92rem;
  box-shadow: inset 0 0 2.2rem rgb(0 0 0 / 36%);
}

.ranking-columns,
.ranking-list li {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 5rem;
  align-items: center;
}

.ranking-columns {
  min-height: 1.8rem;
  padding: 0 0.8rem;
  border-bottom: 1px solid var(--lime);
  background: var(--lime);
  color: var(--black);
  font-family: var(--ui);
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ranking-columns span:nth-child(2),
.ranking-list time {
  text-align: right;
}

.ranking-columns span:last-child,
.ranking-status {
  text-align: right;
}

.ranking-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  min-height: 2.92rem;
  padding: 0 0.8rem;
  border-bottom: 1px solid rgb(255 255 255 / 13%);
  color: var(--white-pure);
  font-variant-numeric: tabular-nums;
}

.ranking-list li:last-child {
  border-bottom: 0;
}

.ranking-rank {
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 800;
}

.ranking-list time {
  font-family: var(--timer);
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  letter-spacing: -0.045em;
  line-height: 1;
}

.ranking-status {
  color: var(--lime);
  font-family: var(--ui);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.ranking-list li:first-child {
  background: linear-gradient(90deg, rgb(186 255 42 / 22%), transparent 76%);
}

.ranking-list li:first-child .ranking-rank,
.ranking-list li:first-child .ranking-status {
  color: var(--lime);
}

.ranking-empty {
  display: grid;
  min-height: 14.55rem;
  margin: 0;
  place-content: center;
  text-align: center;
}

.ranking-empty b {
  color: var(--white-pure);
  font-family: var(--display);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.04em;
}

.ranking-empty span {
  margin-top: 0.45rem;
  color: rgb(255 255 255 / 56%);
  font-size: 0.7rem;
  font-weight: 600;
}

.difficulty-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.48rem;
}

.difficulty-option,
.start-button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 4.35rem;
  border: 1px solid var(--black);
  background: var(--white-pure);
  color: var(--black);
  cursor: pointer;
  font-family: var(--ui);
  transition: background 130ms ease, color 130ms ease, transform 130ms ease;
}

.difficulty-option {
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.58rem;
  padding: 0.58rem 0.68rem;
  border-color: rgb(255 255 255 / 32%);
  background: linear-gradient(115deg, #f9faf7, #e5e9e4);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 82%);
  text-align: left;
  clip-path: polygon(0 0, calc(100% - 0.7rem) 0, 100% 0.7rem, 100% 100%, 0.7rem 100%, 0 calc(100% - 0.7rem));
  overflow: hidden;
}

.difficulty-option::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgb(186 255 42 / 38%), transparent);
  content: "";
  opacity: 0;
  transform: translateX(-100%);
  transition: opacity 160ms ease, transform 260ms ease;
}

.difficulty-option::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1.6rem;
  height: 0.2rem;
  background: var(--lime);
  content: "";
}

.difficulty-option:not(:disabled):hover,
.start-button:hover {
  transform: translateY(-2px);
}

.difficulty-option:not(:disabled):hover::before {
  opacity: 1;
  transform: translateX(100%);
}

.difficulty-option.is-selected {
  background: var(--black);
  border-color: var(--lime);
  color: var(--white-pure);
  box-shadow: inset 0 0 0 1px rgb(186 255 42 / 26%), 0 0 1.3rem rgb(186 255 42 / 13%);
}

.difficulty-option.is-locked {
  border-color: rgb(255 255 255 / 15%);
  background: linear-gradient(115deg, rgb(51 56 52 / 88%), rgb(25 29 26 / 88%));
  box-shadow: none;
  color: rgb(255 255 255 / 40%);
}

.difficulty-index {
  position: relative;
  z-index: 1;
  color: #555d57;
  font-family: var(--timer);
  font-size: 1.35rem;
  letter-spacing: -0.08em;
  line-height: 1;
}

.difficulty-option.is-selected .difficulty-index {
  color: var(--lime);
}

.difficulty-option.is-locked .difficulty-index {
  color: rgb(255 255 255 / 24%);
}

.difficulty-main {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 0.14rem;
}

.difficulty-name {
  overflow: hidden;
  font-family: var(--display);
  font-size: clamp(0.9rem, 1.45vw, 1.15rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
  text-overflow: ellipsis;
}

.difficulty-main small {
  overflow: hidden;
  color: #59605a;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.difficulty-option.is-selected .difficulty-main small {
  color: rgb(255 255 255 / 58%);
}

.difficulty-option.is-locked .difficulty-main small {
  color: rgb(255 255 255 / 28%);
}

.difficulty-status {
  position: relative;
  z-index: 1;
  align-self: end;
  padding: 0.18rem 0.25rem;
  border: 1px solid currentcolor;
  color: #4e554f;
  font-size: 0.42rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

.difficulty-option.is-selected .difficulty-status {
  color: var(--lime);
}

.difficulty-option.is-locked .difficulty-status {
  position: absolute;
  right: 0.5rem;
  bottom: 0.48rem;
  margin-right: 0;
  color: rgb(255 255 255 / 28%);
}

.difficulty-lock {
  position: absolute;
  z-index: 2;
  top: 0.58rem;
  right: 0.58rem;
  display: none;
  width: 0.62rem;
  height: 0.5rem;
  border: 1px solid currentcolor;
}

.difficulty-lock::before {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 0.34rem;
  height: 0.3rem;
  border: 1px solid currentcolor;
  border-bottom: 0;
  border-radius: 0.3rem 0.3rem 0 0;
  content: "";
  transform: translateX(-50%);
}

.difficulty-option.is-locked .difficulty-lock {
  display: block;
}

.start-button {
  width: 100%;
  place-content: center;
  background: var(--lime);
  font-size: clamp(0.88rem, 1.4vw, 1.12rem);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.start-button::after {
  position: absolute;
  right: 0.9rem;
  content: "→";
  font-size: 1.2rem;
}

.start-button:hover {
  background: var(--lime-strong);
}

.game-version,
.menu-copyright {
  position: fixed;
  z-index: 18;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  margin: 0;
  font-family: var(--ui);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.game-version {
  left: max(1rem, env(safe-area-inset-left));
  padding: 0.35rem 0.5rem;
  border: 1px solid rgb(255 255 255 / 48%);
  background: rgb(9 11 9 / 82%);
  box-shadow: 0 0 0 1px var(--black), 0 0.5rem 1.2rem rgb(0 0 0 / 18%);
  color: var(--white-pure);
  backdrop-filter: blur(0.6rem);
  pointer-events: none;
}

.game-version span {
  margin-right: 0.28rem;
  color: var(--lime);
  font-size: 0.48rem;
  letter-spacing: 0.14em;
}

.author-skit {
  position: fixed;
  z-index: 14;
  bottom: calc(max(0.85rem, env(safe-area-inset-bottom)) + 2.15rem);
  left: max(1rem, env(safe-area-inset-left));
  display: grid;
  width: min(34rem, calc(100vw - 2rem));
  grid-template-columns: 6.2rem minmax(0, 1fr);
  align-items: stretch;
  filter: drop-shadow(0 1rem 1.8rem rgb(0 0 0 / 32%));
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 2rem));
  transition: opacity 220ms ease, transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.author-skit.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.author-skit-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 6.2rem;
  border: 1px solid var(--black);
  background: var(--white-pure);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0.7rem 100%, 0 calc(100% - 0.7rem));
  overflow: hidden;
  place-items: center;
}

.author-skit-avatar::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 55%);
  content: "";
  pointer-events: none;
}

.author-skit-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.author-skit-dialogue {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 0.8rem 1rem 0.85rem 1.2rem;
  border: 1px solid rgb(255 255 255 / 68%);
  border-left: 0;
  background: rgb(9 11 9 / 91%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 17%);
  clip-path: polygon(0 0, calc(100% - 0.8rem) 0, 100% 0.8rem, 100% 100%, 0 100%);
  color: var(--white-pure);
  backdrop-filter: blur(1rem) saturate(1.3);
}

.author-skit-dialogue::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 5.2rem;
  height: 0.2rem;
  background: var(--lime);
  content: "";
}

.author-skit-dialogue span {
  color: var(--lime);
  font-family: var(--ui);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.author-skit-dialogue p {
  margin: 0.42rem 0 0;
  font-family: var(--sans);
  font-size: clamp(0.7rem, 1.35vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 1.7;
}

.menu-copyright {
  right: max(1rem, env(safe-area-inset-right));
  color: var(--theme-title);
  text-shadow: 0 1px 0 rgb(255 255 255 / 32%);
}

.menu-copyright a {
  padding: 0.13rem 0.2rem;
  border-bottom: 1px solid currentcolor;
  font-weight: 900;
  text-decoration: none;
  text-underline-offset: 0.2rem;
}

.menu-copyright a:hover {
  border-color: var(--lime);
  background: var(--black);
  color: var(--lime);
}

.debug-indicator {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 1.25rem;
  margin: 0;
  padding: 0.35rem 0.48rem;
  border: 1px solid var(--lime);
  background: var(--black);
  color: var(--lime);
  font-family: var(--ui);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.game-dialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--black);
  background: var(--white-pure);
  box-shadow: 0 1.8rem 6rem rgb(0 0 0 / 42%);
  color: var(--black);
  opacity: 0;
  overflow: auto;
  transform: translateY(1rem) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.game-dialog[open].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.game-dialog::backdrop {
  background: rgb(9 11 9 / 65%);
  backdrop-filter: blur(1rem);
}

.pause-dialog::backdrop,
.help-dialog::backdrop,
.retry-confirm-dialog::backdrop,
.game-over-dialog::backdrop {
  background: rgb(9 11 9 / 72%);
  backdrop-filter: blur(2.2rem) brightness(0.35);
}

.clear-shell,
.pause-shell,
.help-shell,
.retry-confirm-shell,
.game-over-shell {
  display: grid;
  padding: clamp(1.5rem, 6vw, 2.8rem);
  background: var(--white-pure);
}

.clear-eyebrow,
.dialog-eyebrow,
.clear-level {
  margin: 0;
  font-family: var(--ui);
}

.clear-eyebrow,
.dialog-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.clear-eyebrow::before,
.dialog-eyebrow::before {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--lime);
  box-shadow: 0 0 0 1px var(--black);
  content: "";
}

.game-dialog h2 {
  margin: 0.75rem 0 0;
  font-family: var(--display);
  font-size: clamp(2.8rem, 10vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.clear-dialog h2 {
  font-size: clamp(2.4rem, 8.5vw, 4.35rem);
}

.clear-level {
  margin-top: 0.8rem;
  color: #555b56;
  font-size: 0.72rem;
  font-weight: 700;
}

.score-block {
  display: grid;
  margin: clamp(1.4rem, 4vw, 2.2rem) 0;
  padding: 1.15rem 0;
  border-top: 1px solid var(--black);
  border-bottom: 1px solid var(--black);
  font-family: var(--ui);
}

.score-block span {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.score-block output {
  margin-top: 0.3rem;
  font-family: var(--timer);
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  letter-spacing: -0.07em;
  line-height: 1;
}

.clear-actions,
.pause-actions,
.retry-confirm-actions,
.game-over-actions {
  display: grid;
  gap: 0.55rem;
}

.pause-actions,
.retry-confirm-actions,
.game-over-actions {
  margin-top: clamp(1.5rem, 5vw, 2.4rem);
}

.retry-confirm-description {
  margin: 1.25rem 0 0;
  color: #414642;
  font-size: 0.78rem;
  font-weight: 600;
}

.game-over-dialog h2 {
  color: #a51d18;
  font-size: clamp(2.6rem, 9vw, 4.4rem);
}

.game-over-description {
  margin: 1.25rem 0 0;
  color: #414642;
  font-size: 0.78rem;
  font-weight: 700;
}

.help-content {
  display: grid;
  margin: 1.5rem 0;
  border: 1px solid var(--black);
  background: #f3f5f1;
}

.help-section {
  padding: 1rem;
}

.help-section + .help-section {
  border-top: 1px solid var(--black);
}

.help-section h3 {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  margin: 0 0 0.65rem;
  font-family: var(--ui);
  font-size: 0.8rem;
  font-weight: 800;
}

.help-section h3::before {
  width: 0.42rem;
  height: 0.42rem;
  flex: 0 0 auto;
  background: var(--lime);
  box-shadow: 0 0 0 1px var(--black);
  content: "";
}

.help-section p {
  margin: 0;
  color: #343834;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.85;
}

.help-section p + p {
  margin-top: 0.5rem;
}

.dialog-action {
  display: flex;
  min-height: 3.55rem;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border: 1px solid var(--black);
  background: var(--white-pure);
  color: var(--black);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 130ms ease, color 130ms ease, transform 130ms ease;
}

.dialog-action:hover {
  background: var(--black);
  color: var(--white);
  transform: translateX(0.2rem);
}

.dialog-action b {
  font-family: var(--ui);
  font-size: 1rem;
}

.dialog-action > i {
  font-size: 1rem;
}

.replay-icon::before {
  content: "↻";
}

.menu-icon::before {
  content: "→";
}

.primary-action {
  background: var(--lime);
}

.dialog-action.primary-action:hover {
  background: var(--lime-strong);
  color: var(--black);
}

.dialog-action.text-action {
  min-height: auto;
  width: max-content;
  justify-self: center;
  padding: 0.5rem 0.2rem;
  border: 0;
  background: transparent;
  color: #353a36;
  font-size: 0.7rem;
  text-decoration: underline;
  text-decoration-color: rgb(9 11 9 / 38%);
  text-underline-offset: 0.25rem;
}

.dialog-action.text-action:hover {
  background: transparent;
  color: var(--black);
  text-decoration-color: var(--lime-strong);
  transform: none;
}

.fatal-message {
  position: fixed;
  z-index: 40;
  inset: 0;
  padding: 2rem;
  background: var(--white);
  text-align: center;
}

.fatal-message:not([hidden]) {
  display: grid;
  place-content: center;
}

.fatal-message p {
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.fatal-message h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.6rem, 4vw, 3rem);
}

.fatal-message span {
  color: var(--black-soft);
  font-size: 0.8rem;
}

noscript {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 2rem;
  place-content: center;
  background: var(--white);
  font-family: var(--ui);
}

@media (max-width: 800px) {
  .controls-card {
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    width: auto;
    padding: 0.58rem;
  }

  .controls-card ul {
    display: flex;
    gap: 0.42rem;
  }

  .controls-card li {
    display: block;
  }

  .controls-card li > span:last-child {
    display: none;
  }

  .menu-shell {
    width: min(44rem, 100%);
  }
}

@media (max-width: 560px) {
  .game-hud-stack {
    top: max(0.85rem, env(safe-area-inset-top));
    left: max(0.85rem, env(safe-area-inset-left));
    width: 13.2rem;
  }

  .hud-action-disc {
    width: 2.55rem;
  }

  .hud-action-label {
    font-size: 0.43rem;
  }

  .hud-case strong {
    font-size: 0.98rem;
  }

  .scene-vignette {
    box-shadow: inset 0 0 5rem rgb(0 0 0 / 20%);
  }

  .menu-layer {
    align-items: start;
    padding: max(0.65rem, env(safe-area-inset-top)) 0.65rem max(2.75rem, env(safe-area-inset-bottom));
  }

  .menu-shell {
    min-height: calc(100svh - 3.4rem);
    grid-template-rows: auto minmax(0, 1fr);
    padding: 0.25rem 0;
  }

  .menu-logo {
    min-height: clamp(4.7rem, 19vw, 5.7rem);
  }

  .logo-wordmark {
    font-size: clamp(2rem, 9.2vw, 2.85rem);
  }

  .logo-subline {
    font-size: 0.38rem;
    letter-spacing: 0.1em;
  }

  .spaghetti-mark,
  .spaghetti-mark svg {
    max-height: 28svh;
  }

  .spaghetti-mark {
    margin: -0.7rem 0 -0.45rem;
  }

  .menu-actions {
    padding: 0.42rem;
  }

  .difficulty-rail {
    margin-bottom: 0.35rem;
    font-size: 0.48rem;
  }

  .difficulty-list {
    gap: 0.35rem;
  }

  .ranking-panel {
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .ranking-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
  }

  .ranking-back {
    width: 2.85rem;
  }

  .ranking-heading p {
    font-size: 0.5rem;
  }

  .ranking-heading h2 {
    gap: 0.4rem;
    font-size: clamp(1.65rem, 8.4vw, 2.25rem);
  }

  .ranking-heading h2 small {
    font-size: 0.52rem;
  }

  .ranking-board {
    min-height: 14.8rem;
  }

  .ranking-columns,
  .ranking-list li {
    grid-template-columns: 3.1rem minmax(0, 1fr) 4.1rem;
  }

  .ranking-list li {
    min-height: 2.6rem;
    padding: 0 0.65rem;
  }

  .ranking-empty {
    min-height: 12.95rem;
  }

  .difficulty-option,
  .start-button {
    min-height: 4rem;
  }

  .difficulty-option {
    grid-template-columns: 1.2rem minmax(0, 1fr);
    gap: 0.3rem;
    padding: 0.45rem 0.4rem;
  }

  .difficulty-index {
    font-size: 0.88rem;
  }

  .difficulty-name {
    font-size: clamp(0.63rem, 2.9vw, 0.8rem);
  }

  .difficulty-main small {
    margin-top: 0.1rem;
    font-size: 0.32rem;
    letter-spacing: 0.04em;
  }

  .difficulty-status {
    position: absolute;
    right: 0.32rem;
    bottom: 0.28rem;
    padding: 0;
    border: 0;
    font-size: 0.3rem;
  }

  .difficulty-option.is-locked .difficulty-status {
    margin-right: 0;
  }

  .difficulty-lock {
    top: 0.35rem;
    right: 0.35rem;
    transform: scale(0.8);
  }

  .start-button::after {
    right: 0.38rem;
    font-size: 0.92rem;
  }

  .game-version,
  .menu-copyright {
    bottom: max(0.7rem, env(safe-area-inset-bottom));
    font-size: 0.49rem;
  }

  .game-version {
    left: max(0.7rem, env(safe-area-inset-left));
  }

  .author-skit {
    bottom: calc(max(0.7rem, env(safe-area-inset-bottom)) + 2rem);
    left: max(0.7rem, env(safe-area-inset-left));
    width: calc(100vw - 1.4rem);
    grid-template-columns: 5.2rem minmax(0, 1fr);
  }

  .author-skit-avatar {
    min-height: 5.2rem;
  }

  .author-skit-dialogue {
    padding: 0.62rem 0.72rem 0.65rem 0.88rem;
  }

  .author-skit-dialogue span {
    font-size: 0.44rem;
  }

  .author-skit-dialogue p {
    font-size: 0.64rem;
    line-height: 1.55;
  }

  .menu-copyright {
    right: max(0.7rem, env(safe-area-inset-right));
  }

  .game-dialog {
    width: calc(100vw - 1.25rem);
  }
}

@media (max-height: 670px) and (min-width: 561px) {
  .menu-layer {
    align-items: start;
  }

  .menu-shell {
    width: min(45rem, 100%);
  }

  .spaghetti-mark,
  .spaghetti-mark svg {
    max-height: 27svh;
  }

  .menu-logo {
    min-height: 4.6rem;
  }

  .logo-wordmark {
    font-size: clamp(2.7rem, 6vw, 4rem);
  }

  .logo-subline {
    margin-top: 0.25rem;
  }

  .difficulty-option,
  .start-button {
    min-height: 3.75rem;
  }

  .difficulty-option {
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
  }

  .clear-shell {
    padding: 1.5rem 2.8rem;
  }

  .clear-dialog h2 {
    font-size: 3.25rem;
  }

  .clear-level {
    margin-top: 0.55rem;
  }

  .score-block {
    margin: 1rem 0;
    padding: 0.8rem 0;
  }

  .clear-actions {
    gap: 0.45rem;
  }

  .clear-actions .dialog-action:not(.text-action) {
    min-height: 3.2rem;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .game-hud-stack {
    top: max(0.55rem, env(safe-area-inset-top));
    left: max(0.55rem, env(safe-area-inset-left));
    width: 11.9rem;
    gap: 0.42rem;
  }

  .game-hud {
    padding: 0.42rem 0.58rem 0.55rem;
    border-top-width: 0.18rem;
  }

  .hud-case {
    gap: 0.32rem;
  }

  .hud-case > span,
  .hud-case b,
  .hud-time-label {
    font-size: 0.48rem;
  }

  .hud-case strong {
    font-size: 0.86rem;
  }

  .hud-time-panel {
    gap: 0.45rem;
    margin-top: 0.42rem;
    padding-top: 0.4rem;
  }

  .hud-time {
    font-size: 1.03rem;
  }

  .hud-actions {
    gap: 0.22rem;
  }

  .hud-action {
    gap: 0.18rem;
  }

  .hud-action-disc {
    width: 2.18rem;
    font-size: 0.76rem;
  }

  .hud-action-label {
    padding: 0.12rem 0.16rem;
    font-size: 0.36rem;
  }

  .controls-card {
    right: max(0.55rem, env(safe-area-inset-right));
    bottom: max(0.55rem, env(safe-area-inset-bottom));
    width: auto;
    padding: 0.42rem;
  }

  .controls-title {
    margin-bottom: 0.35rem;
    padding: 0.25rem 0.35rem;
    font-size: 0.54rem;
  }

  .controls-card ul {
    display: flex;
    gap: 0.28rem;
  }

  .controls-card li {
    display: block;
  }

  .controls-card li > span:last-child {
    display: none;
  }

  .control-visual,
  .controls-card kbd {
    width: 2.08rem;
    height: 2.08rem;
  }

  .mouse-visual svg {
    width: 1.12rem;
    height: 1.48rem;
  }

  .controls-card kbd {
    font-size: 0.39rem;
  }

  .menu-layer {
    padding: max(0.35rem, env(safe-area-inset-top)) max(0.65rem, env(safe-area-inset-right)) max(1.8rem, env(safe-area-inset-bottom)) max(0.65rem, env(safe-area-inset-left));
  }

  .menu-shell {
    width: min(45rem, 100%);
    padding: 0;
  }

  #start-screen[data-phase="ranking"] .menu-heading {
    display: none;
  }

  #start-screen[data-phase="ranking"] .menu-shell {
    grid-template-rows: minmax(0, 1fr);
  }

  .menu-logo {
    min-height: 3.65rem;
  }

  .logo-subline {
    font-size: 0.36rem;
  }

  .logo-wordmark {
    font-size: clamp(2.25rem, 8.5vh, 3.2rem);
  }

  .spaghetti-mark,
  .spaghetti-mark svg {
    max-height: 22svh;
  }

  .spaghetti-mark {
    margin: -0.85rem 0 -0.65rem;
  }

  .difficulty-phase {
    grid-template-rows: minmax(7rem, 1fr) auto;
  }

  .menu-actions {
    padding: 0.36rem;
  }

  .difficulty-list {
    gap: 0.3rem;
  }

  .difficulty-option {
    min-height: 2.75rem;
    padding-top: 0.24rem;
    padding-bottom: 0.24rem;
  }

  .ranking-panel {
    gap: 0.45rem;
    padding: 0.58rem;
  }

  .ranking-back {
    width: 2.65rem;
  }

  .ranking-heading p {
    font-size: 0.46rem;
  }

  .ranking-heading h2 {
    font-size: 1.9rem;
  }

  .ranking-board {
    min-height: 11.7rem;
    background-size: 100% 2.18rem;
  }

  .ranking-columns {
    min-height: 1.45rem;
  }

  .ranking-list li {
    min-height: 2.05rem;
  }

  .ranking-list time {
    font-size: 1.04rem;
  }

  .ranking-empty {
    min-height: 10.15rem;
  }

  .ranking-panel .start-button {
    min-height: 3rem;
  }

  .game-version,
  .menu-copyright {
    bottom: max(0.42rem, env(safe-area-inset-bottom));
  }

  .game-version {
    left: max(0.55rem, env(safe-area-inset-left));
  }

  .author-skit {
    bottom: calc(max(0.42rem, env(safe-area-inset-bottom)) + 1.75rem);
    left: max(0.55rem, env(safe-area-inset-left));
    width: min(30rem, 62vw);
    grid-template-columns: 4.7rem minmax(0, 1fr);
  }

  .author-skit-avatar {
    min-height: 4.7rem;
  }

  .author-skit-dialogue {
    padding: 0.5rem 0.72rem 0.55rem 0.85rem;
  }

  .author-skit-dialogue p {
    margin-top: 0.25rem;
    font-size: 0.62rem;
    line-height: 1.45;
  }

  .menu-copyright {
    right: max(0.55rem, env(safe-area-inset-right));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
