:root {
  color-scheme: light;
  --ink: #51434a;
  --muted: #987987;
  --paper: #fff8f2;
  --line: rgba(140, 92, 111, 0.2);
  --coral: #e97d98;
  --cyan: #71e0d0;
  --acid: #d6e99f;
  --mono: "Consolas", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background-color: #d4f7ab;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  inset: -60px;
  content: "";
  pointer-events: none;
  will-change: transform;
}

body::before {
  background-image: radial-gradient(circle, #1a2b6d 0 2px, transparent 2.5px);
  background-size: 32px 32px;
  opacity: 0.55;
  animation: drift-a 8s linear infinite;
}

body::after {
  background-image: radial-gradient(circle, #1a2b6d 0 1.5px, transparent 2px);
  background-size: 48px 48px;
  background-position: 16px 16px;
  opacity: 0.35;
  animation: drift-b 12s linear infinite;
}

@keyframes drift-a {
  to {
    transform: translate3d(32px, 32px, 0);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-48px, 48px, 0);
  }
}

body.dragging::before,
body.dragging::after {
  animation-play-state: paused;
}

.site-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(32px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.wordmark-mark {
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--acid);
  color: #101713;
  font-size: 19px;
}

.wordmark-divider {
  padding: 0 4px;
  color: var(--coral);
}

.header-note,
.eyebrow,
.intro-footnote,
.specimen-label,
.stage-code,
.controls-heading,
.slider-scale,
.round-stamp,
.panel-footer {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.header-note {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-light,
.note-dot {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #35b873;
}

.header-number {
  margin-left: 14px;
  color: var(--muted);
}

.page-shell {
  display: grid;
  width: min(1280px, calc(100% - 80px));
  min-height: calc(100vh - 72px);
  grid-template-columns: minmax(250px, 0.78fr) minmax(560px, 1.42fr);
  align-items: center;
  gap: 64px;
  margin: 0 auto;
  padding: 48px 0 64px;
}

.intro {
  position: relative;
  padding: 28px 0;
}

.note-dot {
  background: var(--coral);
  box-shadow: none;
}

body {
  color-scheme: light;
  color: var(--ink);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
}

.eyebrow-index {
  display: inline-grid;
  width: 22px;
  aspect-ratio: 1;
  margin-right: 7px;
  place-items: center;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
}

h1 {
  margin: 26px 0 22px;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 76px;
  font-weight: 400;
  line-height: 0.94;
}

h1 span {
  color: #e24f81;
  font-style: italic;
}

.intro-copy {
  max-width: 300px;
  margin: 0;
  color: #46534e;
  font-size: 16px;
  line-height: 1.65;
}

.intro-footnote {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 42px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.orbit {
  position: absolute;
  z-index: -1;
  width: 88px;
  height: 88px;
  border: 1px solid rgba(24, 37, 33, 0.22);
  transform: rotate(-28deg);
}

.orbit-one {
  top: 28px;
  right: 12px;
  border-radius: 48% 52% 40% 60%;
  background: repeating-linear-gradient(135deg, transparent 0 7px, rgba(220, 255, 89, 0.42) 8px 10px);
}

.orbit-two {
  top: 52px;
  right: -2px;
  width: 56px;
  height: 56px;
  border-color: rgba(250, 102, 141, 0.7);
  border-radius: 50%;
}

.game-panel {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  background: rgba(255, 250, 246, 0.62);
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-eyebrow span {
  color: var(--coral);
}

h2 {
  margin: 7px 0 0;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 27px;
  font-weight: 400;
}

.round-stamp {
  margin: 0 0 3px;
  color: var(--muted);
  white-space: nowrap;
}

.round-stamp span {
  padding: 0 4px;
  color: var(--coral);
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(220px, 0.92fr);
  gap: 28px;
  padding: 24px 28px 26px;
}

.specimen-label,
.controls-heading,
.slider-scale,
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.specimen-label {
  margin-bottom: 9px;
}

.specimen-stage {
  position: relative;
  display: grid;
  height: 276px;
  place-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(211, 144, 160, 0.28);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(117, 207, 194, 0.26), transparent 55%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 239, 235, 0.9));
}

.specimen-stage::before {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(142, 94, 117, 0.2) 0.7px, transparent 0.7px);
  background-size: 7px 7px;
  content: "";
  opacity: 0.1;
  pointer-events: none;
}

.memorize-time {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  min-width: 44px;
  height: 36px;
  place-items: center;
  padding: 0 9px;
  border: 1px solid rgba(140, 92, 111, 0.18);
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.94);
  color: var(--coral);
  font-family: "VT323", monospace;
  font-size: 24px;
  line-height: 1;
}

.memorize-time[hidden] {
  display: none;
}

#swatch {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background-color: #fff;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  animation: chiikawa-frames 1.4s steps(1, end) infinite;
}

#swatch[hidden],
.result-swatches[hidden] {
  display: none;
}

.result-swatches {
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.result-swatch {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.result-color {
  flex: 1;
  min-height: 0;
  border: 1px solid rgba(80, 62, 68, 0.16);
  border-radius: 14px;
  box-shadow: none;
}

#swatch.is-playing {
  animation: none;
}

@keyframes chiikawa-frames {
  0%, 49.99% {
    background-image: url("assets/chiikawa1.png");
  }
  50%, 100% {
    background-image: url("assets/chiikawa2.png");
  }
}

.stage-cross {
  position: absolute;
  z-index: 2;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  pointer-events: none;
}

.stage-cross-one {
  top: 9px;
  left: 11px;
}

.stage-cross-two {
  right: 11px;
  bottom: 9px;
}

.stage-code {
  position: absolute;
  z-index: 2;
  right: 9px;
  top: 9px;
  padding: 4px 6px;
  background: var(--acid);
  font-size: 9px;
  pointer-events: none;
}

.game-status {
  min-height: 48px;
  margin: 12px 0 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.controls {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.controls-heading {
  margin-bottom: 21px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 9px;
}

.controls-heading i {
  padding-left: 4px;
  color: var(--coral);
  font-size: 8px;
  font-style: normal;
}

.slider-control {
  display: block;
  margin: 0 0 20px;
}

.slider-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
}

.slider-heading output {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
}

.slider-control input {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  appearance: none;
  background: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 4px;
  cursor: pointer;
}

.slider-control input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.slider-control input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 0;
  background: transparent;
}

.slider-control input::-moz-range-track {
  height: 4px;
  border-radius: 0;
  background: transparent;
}

#hue {
  background-image: linear-gradient(90deg, #ff0000 0%, #ff8000 8.33%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 4px;
}

#hue::-webkit-slider-runnable-track {
  background: transparent !important;
}

#hue::-moz-range-track {
  background: transparent !important;
}

#hue::-webkit-slider-thumb {
  background: #fff;
}

#hue::-moz-range-thumb {
  background: #fff;
}

.slider-control input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  appearance: none;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.slider-control input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.slider-control input:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 4px;
}

.slider-scale {
  font-size: 9px;
  font-weight: 400;
}

#button {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 0 15px;
  border: 1px solid rgba(222, 117, 145, 0.38);
  border-radius: 12px;
  background: var(--coral);
  color: #fffaf7;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

#button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--acid);
  color: var(--ink);
}

#button:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

#button:disabled {
  border-color: #d8b2bd;
  background: #d8b2bd;
  color: #f7f7ee;
  cursor: not-allowed;
}

.button-arrow {
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 17px;
}

.control-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.note-dot {
  flex: 0 0 auto;
  margin-top: 4px;
  background: var(--coral);
  box-shadow: none;
}

.panel-footer {
  padding: 12px 28px;
  border-top: 1px solid var(--line);
  font-size: 9px;
}

@media (max-width: 980px) {
  .page-shell {
    width: min(720px, calc(100% - 48px));
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 38px 0 52px;
  }

  .intro {
    padding: 8px 0;
  }

  h1 {
    margin: 18px 0 13px;
    font-size: 60px;
  }

  .intro-copy {
    max-width: 390px;
  }

  .intro-footnote {
    margin-top: 22px;
  }

  .orbit-one {
    top: 0;
    right: 28px;
  }

  .orbit-two {
    top: 22px;
    right: 14px;
  }
}

@media (max-width: 600px) {
  .site-header {
    min-height: 62px;
    padding: 0 20px;
  }

  .header-note {
    gap: 7px;
    font-size: 8px;
  }

  .header-number {
    margin-left: 3px;
  }

  .page-shell {
    width: calc(100% - 32px);
    gap: 22px;
    padding: 27px 0 34px;
  }

  .eyebrow {
    font-size: 9px;
  }

  h1 {
    font-size: 52px;
  }

  .intro-copy {
    max-width: 290px;
    font-size: 14px;
  }

  .orbit-one {
    right: 8px;
    width: 66px;
    height: 66px;
  }

  .orbit-two {
    right: -3px;
    width: 44px;
    height: 44px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 18px 18px 14px;
  }

  h2 {
    font-size: 24px;
  }

  .round-stamp {
    font-size: 9px;
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 17px;
    padding: 18px;
  }

  .specimen-stage {
    height: 240px;
  }

  .controls {
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .controls-heading {
    margin-bottom: 15px;
  }

  .slider-control {
    margin-bottom: 15px;
  }

  .panel-footer {
    gap: 12px;
    padding: 11px 18px;
    font-size: 8px;
  }
}

:root {
  color-scheme: light;
  --ink: #252a31;
  --muted: #7a8088;
  --paper: #f1f2f3;
  --line: rgba(43, 50, 59, 0.12);
  --coral: #f13278;
  --cyan: #18b9d7;
  --acid: #c8e947;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.page-shell {
  width: min(1420px, calc(100% - 72px));
  min-height: 100vh;
  align-content: center;
  gap: 16px;
  padding: 30px 0;
}

#page-title {
  min-height: 74px;
  gap: 12px;
  color: #343a42;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

.game-panel {
  border: 1px solid rgba(43, 50, 59, 0.1);
  border-radius: 10px;
  background: rgba(249, 250, 250, 0.98);
  box-shadow: none;
}

.game-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 0;
  padding: 22px;
}

.specimen {
  min-width: 0;
  padding-right: 18px;
}

.specimen-stage {
  height: clamp(360px, 46vh, 480px);
  border: 1px solid rgba(52, 62, 73, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.96), rgba(244, 246, 247, 0.95));
}

.specimen-stage::before {
  background-image: radial-gradient(rgba(56, 67, 79, 0.15) 0.6px, transparent 0.6px);
  background-size: 8px 8px;
  opacity: 0.13;
}

#swatch {
  border-radius: 8px;
}

.memorize-time {
  top: 12px;
  right: 12px;
  min-width: 40px;
  height: 30px;
  border-color: rgba(43, 50, 59, 0.12);
  background: rgba(255, 255, 255, 0.94);
  color: #343a42;
  font-family: var(--mono);
  font-size: 16px;
}

.result-swatches {
  gap: 18px;
  padding: 24px;
}

.result-swatch {
  align-items: center;
  gap: 14px;
  color: #626a73;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.result-color {
  width: min(100%, 210px);
  aspect-ratio: 1;
  flex: 0 1 auto;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
}

.game-status {
  min-height: 36px;
  margin: 10px 2px 0;
  color: #565e67;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 30px 28px 34px;
  border-left: 1px solid var(--line);
}

.slider-control {
  margin-bottom: 26px;
}

.slider-heading {
  margin-bottom: 7px;
  color: #3b424a;
  font-size: 13px;
  font-weight: 600;
}

.slider-heading output {
  color: #737a82;
  font-family: var(--mono);
  font-size: 12px;
}

.slider-control input {
  height: 22px;
  background-size: 100% 6px;
}

#hue {
  background-size: 100% 6px;
}

.slider-control input::-webkit-slider-runnable-track {
  height: 6px;
}

.slider-control input::-moz-range-track {
  height: 6px;
}

.slider-control input::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 2px solid white;
  background: #3e4650;
}

.slider-control input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid white;
  background: #3e4650;
}

#hue::-webkit-slider-thumb,
#hue::-moz-range-thumb {
  background: white;
}

#button {
  min-height: 46px;
  justify-content: center;
  margin-top: 3px;
  border: 0;
  border-radius: 6px;
  background: #0481c9;
  color: white;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

#button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #096da7;
  color: white;
}

#button:disabled {
  border: 0;
  background: #aebbc4;
  color: #f8fafb;
}

@media (max-width: 700px) {
  .page-shell {
    width: calc(100% - 28px);
    gap: 12px;
    padding: 18px 0 28px;
  }

  #page-title {
    min-height: 62px;
    gap: 8px;
    font-size: 25px;
  }

  .game-panel {
    border-radius: 8px;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 12px;
  }

  .specimen {
    padding: 0;
  }

  .specimen-stage {
    height: clamp(220px, 68vw, 290px);
  }

  .result-swatches {
    gap: 12px;
    padding: 18px;
  }

  .result-swatch {
    font-size: 11px;
  }

  .controls {
    padding: 18px 4px 4px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .slider-control {
    margin-bottom: 17px;
  }
}

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

  body::before,
  body::after {
    animation: none !important;
  }
}

.page-shell {
  width: min(960px, calc(100% - 48px));
  min-height: 100vh;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 24px;
  padding: 40px 0;
}

#page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: 0.2em;
  margin: 0;
  color: #bb6481;
  font-family: "VT323", monospace;
  font-size: 58px;
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
}

.game-panel {
  width: 100%;
}

.game-grid {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
}

.controls {
  align-self: center;
  padding: 0 0 0 24px;
  border-top: 0;
}

.slider-control {
  margin-bottom: 22px;
}

.slider-heading {
  justify-content: flex-start;
  gap: 6px;
}

#button {
  justify-content: center;
  text-align: center;
}

@media (max-width: 600px) {
  .page-shell {
    width: calc(100% - 32px);
    gap: 20px;
    padding: 28px 0;
  }

  h1#page-title {
    font-size: 32px;
    line-height: 1.1;
  }

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

  .controls {
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

main.page-shell {
  position: relative;
  width: min(1240px, calc(100% - 96px));
  min-height: 100vh;
  gap: 16px;
  padding: 30px 0;
}

.explosion-frame {
  position: fixed;
  z-index: 0;
  top: 0;
  left: 0;
  display: none;
  width: 100vw;
  height: 100vh;
  transform: none;
  pointer-events: none;
  user-select: none;
}

.explosion-frame--tall {
  display: none;
}

main h1#page-title,
main .game-panel {
  position: relative;
  z-index: 1;
}

main h1#page-title {
  min-height: 74px;
  gap: 12px;
  color: #242b33;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
}

#page-title .title-usagi {
  width: 2.65em;
  height: 1.65em;
}

.game-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 0;
  padding: 22px;
}

.specimen {
  min-width: 0;
  padding-right: 18px;
}

.specimen-stage {
  height: clamp(360px, 46vh, 480px);
}

.controls {
  padding: 28px 30px 28px 34px;
}

@media (max-width: 700px) {
  main.page-shell {
    width: calc(100% - 28px);
    gap: 12px;
    min-height: 100vh;
    padding: 18px 0 28px;
  }

  .explosion-frame--wide {
    display: none;
  }

  .explosion-frame--tall {
    top: 0;
    left: -15vw;
    display: none;
    width: 130vw;
    height: 100vh;
  }

  main h1#page-title {
    min-height: 62px;
    gap: 8px;
    font-size: 25px;
  }

  #page-title .title-usagi {
    width: 1.5em;
    height: 1.5em;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 12px;
  }

  .specimen {
    padding: 0;
  }

  .specimen-stage {
    height: clamp(220px, 68vw, 290px);
  }

  .controls {
    padding: 18px 4px 4px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

.battle-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.hp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hp-name {
  flex: 0 0 44px;
  color: #565e67;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.hp-bar {
  display: block;
  flex: 1;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
}

.hp-bar svg {
  display: block;
  width: 100%;
  height: 24px;
  overflow: visible;
}

.hp-clip {
  transition: width 350ms ease;
}

/* ===== battle arena ===== */
.battle-arena {
  position: relative;
  --fighter-left: min(calc(2.5% + 270px), 31%);
  --fighter-gap: clamp(220px, 30vw, 380px);
  --fighter-size: clamp(170px, 25vw, 320px);
  --enemy-fighter-size: clamp(195px, 28vw, 350px);
  width: 100%;
  height: clamp(620px, 80vh, 760px);
  overflow: hidden;
  border: 3px solid #252a31;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.hp-corner {
  position: absolute;
  top: 18px;
  width: min(380px, 42%);
}

.hp-corner-left {
  left: 18px;
}

.hp-corner-right {
  right: 18px;
}

.fighter {
  position: absolute;
  top: 20%;
  display: grid;
  justify-items: center;
  justify-content: center;
  gap: 10px;
}

.fighter-player {
  left: var(--fighter-left);
  z-index: 1;
}

.fighter-enemy {
  left: calc(var(--fighter-left) + var(--fighter-gap));
  right: auto;
  z-index: 0;
}

.fighter-sprite {
  width: var(--fighter-size);
  height: var(--fighter-size);
  border-radius: 16px;
}

.fighter-player .fighter-sprite {
  background: #f13278;
}

.fighter-enemy .fighter-sprite {
  width: var(--enemy-fighter-size);
  height: var(--enemy-fighter-size);
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
}

.fighter-name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

#enemy-name {
  display: none;
}

.color-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 560px;
  max-width: calc(100vw - 16px);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: none;
}

.color-panel .game-grid {
  grid-template-columns: 1fr 1fr;
  padding: 12px;
}

.color-panel .specimen-stage {
  height: 155px;
}

.color-panel .controls {
  padding: 0 0 0 14px;
}

@media (max-width: 800px) {
  .battle-arena {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: auto;
    overflow: visible;
    --fighter-size: clamp(130px, 33vw, 220px);
    --enemy-fighter-size: clamp(150px, 37vw, 250px);
  }

  .hp-corner,
  .fighter {
    position: static;
    width: auto;
  }

  .color-panel .game-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== battle effects ===== */
@keyframes lunge-right {
  0% {
    transform: translateX(0) scale(1);
  }

  50% {
    transform: translateX(120px) scale(1.1);
  }

  100% {
    transform: translateX(0) scale(1);
  }
}

@keyframes lunge-left {
  0% {
    transform: translateX(0) scale(1);
  }

  50% {
    transform: translateX(-120px) scale(1.1);
  }

  100% {
    transform: translateX(0) scale(1);
  }
}

.lunge-right {
  animation: lunge-right 0.4s ease-out;
}

.lunge-left {
  animation: lunge-left 0.4s ease-out;
}

@keyframes hurt-shake {
  0%,
  100% {
    transform: translateX(0);
    filter: brightness(1);
  }

  20% {
    transform: translateX(-7px);
    filter: brightness(2);
  }

  40% {
    transform: translateX(7px);
    filter: brightness(2);
  }

  60% {
    transform: translateX(-5px);
    filter: brightness(2);
  }

  80% {
    transform: translateX(5px);
    filter: brightness(2);
  }
}

.hurt {
  animation: hurt-shake 0.4s ease-in-out;
}

@keyframes float-num-rise {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-60px);
    opacity: 0;
  }
}

.float-num {
  position: absolute;
  top: 24px;
  font-family: "VT323", monospace;
  font-size: 44px;
  line-height: 1;
  pointer-events: none;
  animation: float-num-rise 1s ease-out forwards;
}

.float-num.dmg {
  color: #e8639f;
}

.float-num.miss {
  color: #8b9198;
}

/* ===== player sprite frames ===== */
@keyframes player-frames {
  0%,
  49.999% {
    background-image: url("assets/CHIIKAWA3.png");
  }

  50%,
  100% {
    background-image: url("assets/CHIIKAWA4.png");
  }
}

.fighter-player .fighter-sprite--animated {
  background-color: transparent;
  background-image: url("assets/CHIIKAWA3.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  animation: player-frames 1.2s steps(1, end) infinite;
}

.fighter-player .fighter-sprite--animated.lunge-right,
.fighter-player .fighter-sprite--animated.lunge-left,
.fighter-player .fighter-sprite--animated.hurt {
  animation-duration: 0.4s, 1.2s;
  animation-iteration-count: 1, infinite;
  animation-timing-function: ease-out, steps(1, end);
  animation-name: lunge-right, player-frames;
}

.fighter-player .fighter-sprite--animated.lunge-left {
  animation-name: lunge-left, player-frames;
}

.fighter-player .fighter-sprite--animated.hurt {
  animation-name: hurt-shake, player-frames;
}

/* ===== enemy sprite frames ===== */
@keyframes enemy-frames {
  0%,
  49.999% {
    background-image: url("assets/usagi1.png");
  }

  50%,
  100% {
    background-image: url("assets/usagi2.png");
  }
}

.fighter-enemy .fighter-sprite--animated {
  background-color: transparent;
  background-image: url("assets/usagi1.png");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  animation: enemy-frames 1.2s steps(1, end) infinite;
}

/* ===== intro overlay ===== */
#intro-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 30, 0.55);
  font-family: "VT323", monospace;
  font-size: 140px;
  line-height: 1;
  color: #ffffff;
  text-align: center;
}

#intro-overlay[hidden] {
  display: none;
}

@keyframes intro-pop {
  from {
    transform: scale(1.6);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

#intro-text {
  display: block;
  animation: intro-pop 0.45s ease-out;
}

/* ===== end overlay ===== */
#end-overlay {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  animation: end-fade 400ms ease-out forwards;
}

#end-overlay[hidden] {
  display: none;
}

@keyframes end-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

#end-overlay.lose {
  background: rgba(200, 20, 50, 0.55);
}

#end-overlay.win {
  background: rgba(40, 180, 120, 0.5);
}

#end-title {
  margin: 0;
  color: #ffffff;
  font-family: "VT323", monospace;
  font-size: clamp(56px, 11vw, 120px);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

#end-overlay button {
  padding: 10px 26px;
  border: 2px solid #ffffff;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-family: "VT323", monospace;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

#end-overlay button:hover,
#end-overlay button:focus-visible {
  background: #ffffff;
  color: #242b33;
}

/* ===== lose animation ===== */
#lose-video {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #14141e;
  object-fit: contain;
}

#lose-video[hidden] {
  display: none;
}

/* ===== danger vignette ===== */
#danger-vignette {
  position: absolute;
  z-index: 40;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px 40px rgba(220, 20, 50, 0.55);
  transition: opacity 400ms ease;
}

@keyframes vignette-pulse {
  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

#danger-vignette.active {
  opacity: 1;
  animation: vignette-pulse 1.2s ease-in-out infinite;
}

/* ===== screen shake ===== */
@keyframes screen-shake {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  20% {
    transform: translate(-4px, 3px) rotate(-0.4deg);
  }

  40% {
    transform: translate(5px, -3px) rotate(0.4deg);
  }

  60% {
    transform: translate(-4px, -2px) rotate(-0.3deg);
  }

  80% {
    transform: translate(4px, 2px) rotate(0.3deg);
  }
}

@keyframes screen-shake-strong {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  20% {
    transform: translate(-7px, 5px) rotate(-0.8deg);
  }

  40% {
    transform: translate(8px, -5px) rotate(0.8deg);
  }

  60% {
    transform: translate(-7px, -4px) rotate(-0.6deg);
  }

  80% {
    transform: translate(7px, 4px) rotate(0.6deg);
  }
}

.battle-arena.screen-shake {
  animation: screen-shake 0.2s ease-in-out;
}

.battle-arena.screen-shake.screen-shake--strong {
  animation-name: screen-shake-strong;
}

/* ===== battle polish ===== */
.round-label {
  position: absolute;
  z-index: 41;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(37, 42, 49, 0.85);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.float-num.crit {
  color: #ffd34d;
  font-size: 58px;
}

@keyframes hp-flash-white {
  0% {
    filter: none;
  }

  40% {
    filter: brightness(4) saturate(0.1);
  }

  100% {
    filter: none;
  }
}

#enemy-hp.flash {
  animation: hp-flash-white 150ms ease-out;
}

/* ===== item drop on defeat ===== */
@keyframes poof-out {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.35);
  }
}

.fighter-player .fighter-sprite--animated.poof-out {
  animation: poof-out 300ms ease-in forwards;
}

.drop-item {
  position: absolute;
  z-index: 70;
  width: 64px;
  height: 64px;
  margin: 0;
  transform: translateX(-50%);
  image-rendering: pixelated;
  mix-blend-mode: multiply;
  pointer-events: none;
  user-select: none;
}

@keyframes drop-pop {
  0% {
    transform: translateX(-50%) translateY(0) scale(1, 1);
  }

  35% {
    transform: translateX(-50%) translateY(-70px) rotate(-10deg) scale(1.06, 1.06);
  }

  70% {
    transform: translateX(-50%) translateY(-8px) rotate(5deg) scale(0.98, 1.02);
  }

  85% {
    transform: translateX(-50%) translateY(0) rotate(0deg) scale(1.14, 0.84);
  }

  100% {
    transform: translateX(-50%) translateY(0) rotate(0deg) scale(1, 1);
  }
}

.drop-item.is-pop {
  animation: drop-pop 600ms ease-out;
}

@keyframes drop-idle {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) rotate(-4deg);
  }

  50% {
    transform: translateX(-50%) translateY(-6px) rotate(4deg);
  }
}

.drop-item.is-idle {
  animation: drop-idle 2s ease-in-out infinite;
}

.drop-shadow {
  position: absolute;
  z-index: 69;
  width: 56px;
  height: 13px;
  border-radius: 50%;
  background: rgba(20, 24, 32, 0.3);
  filter: blur(2px);
  transform: translateX(-50%);
  pointer-events: none;
}

@keyframes shadow-pop {
  0% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }

  35% {
    transform: translateX(-50%) scale(0.66);
    opacity: 0.55;
  }

  85% {
    transform: translateX(-50%) scale(1.14);
    opacity: 1;
  }

  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
}

.drop-shadow.is-pop {
  animation: shadow-pop 600ms ease-out;
}

@keyframes shadow-idle {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }

  50% {
    transform: translateX(-50%) scale(0.8);
    opacity: 0.7;
  }
}

.drop-shadow.is-idle {
  animation: shadow-idle 2s ease-in-out infinite;
}

/* ===== arena scene: floor + standing fighters ===== */
.battle-arena {
  background: rgba(255, 255, 255, 0.55);
}

.battle-arena::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 150px;
  background: #e8e2ee;
  border-top: 2px solid #c6bcd2;
  pointer-events: none;
}

@media (min-width: 801px) {
  .fighter {
    top: auto;
    bottom: 140px;
  }

  .fighter-enemy {
    bottom: 140px;
  }
}

.result-color {
  aspect-ratio: 1;
  border-radius: 12px;
}

.hp-name {
  flex-basis: 62px;
  font-family: "VT323", monospace;
  font-size: 26px;
  font-weight: 400;
}

.fighter-name {
  font-family: "VT323", monospace;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ===== draggable color panel ===== */
.color-panel {
  will-change: transform;
  transition: none;
}

.panel-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(43, 50, 59, 0.1);
  border-radius: 10px 10px 0 0;
  color: #7a8088;
  font-family: "VT323", monospace;
  font-size: 18px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.panel-grip {
  flex: 0 0 auto;
  width: 14px;
  height: 10px;
  background-image:
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px),
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px),
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px),
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px),
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px),
    radial-gradient(circle, #7a8088 1.1px, transparent 1.4px);
  background-position:
    1px 1px,
    6px 1px,
    11px 1px,
    1px 7px,
    6px 7px,
    11px 7px;
  background-size: 3px 3px;
  background-repeat: no-repeat;
}

.panel-title {
  line-height: 1;
}

.color-panel.dragging {
  cursor: grabbing;
  box-shadow: none;
}

.color-panel.dragging .panel-handle,
.color-panel.dragging .game-grid,
.color-panel.dragging .game-grid * {
  transition: none;
}

.color-panel.dragging .panel-handle {
  cursor: grabbing;
}

body.dragging {
  user-select: none;
}

body.dragging .fighter-sprite,
body.dragging #swatch {
  animation-play-state: paused;
}

.explosion-frame {
  will-change: transform;
  transform: translateZ(0);
}

@media (max-width: 800px) {
  .color-panel {
    position: static;
    width: 100%;
    max-width: none;
    margin: 12px auto;
    transform: none;
  }

  .panel-handle {
    display: none;
  }

  .color-panel.dragging {
    z-index: auto;
    cursor: auto;
    box-shadow: none;
  }
}

/* ===== hp label colors ===== */
.hp-corner-left .hp-name {
  color: #1a2b6d;
}

.hp-corner-right .hp-name {
  color: #252a31;
}
