@font-face {
  font-family: Square;
  src: url("/assets/css/fonts/NanumSquareB.woff") format("woff");
  font-display: swap;
  font-weight: 650 900;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  color-scheme: light;
  font-family:
    system-ui,
    -apple-system,
    "Malgun Gothic",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  word-break: keep-all;
}
body {
  margin: 0;
  --paper: #f4f2e8;
  --ink: #203e37;
  --accent: #265347;
  --surface: #fffdf6;
  --soft: #dbe5d7;
  --line: #bbc9bc;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
body.butcher {
  --paper: #f7f0e4;
  --ink: #462824;
  --accent: #943b33;
  --soft: #efdfcf;
  --surface: #fffaf0;
  --line: #d7bda6;
}
body.sound {
  --paper: #edeaf0;
  --ink: #2c2140;
  --accent: #53346b;
  --soft: #e2d9eb;
  --surface: #fffafc;
  --line: #cfc1d6;
}
main,
.top {
  max-width: 940px;
  margin: auto;
  padding-inline: clamp(14px, 4vw, 40px);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  font-size: 0.85rem;
}
.top img {
  object-fit: contain;
  vertical-align: middle;
  margin-right: 6px;
}
.top a,
.related a,
footer a {
  color: inherit;
}
.top a {
  text-decoration: none;
}
.top a:last-child:hover,
.related a:hover {
  text-decoration: underline;
}
header.title {
  border-block-start: 1px solid var(--line);
  padding: clamp(16px, 3vw, 34px) 0 18px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
button,
strong,
.round {
  font-family: Square, system-ui, sans-serif;
}
h1 {
  font-size: clamp(28px, 5vw, 50px);
  line-height: 1.18;
  letter-spacing: -0.065em;
}
.title p {
  font-size: clamp(14px, 2vw, 17px);
  margin-top: 8px;
}
.frame {
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 8%, transparent);
}
.round {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--ink);
  color: white;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(225px, 0.9fr);
  align-items: stretch;
}
.visual {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  overflow: hidden;
  background: #d5dfcd;
}
.butcher .visual {
  background: #dab88f;
}
.sound .visual {
  background: #c8b9cd;
}
.visual canvas {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.board {
  aspect-ratio: 540/330;
}
.rack {
  aspect-ratio: 420/430;
}
.panel {
  padding: clamp(16px, 3vw, 30px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
}
.panel h2 {
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.24;
  letter-spacing: -0.055em;
}
.panel p {
  font-size: 0.95rem;
}
.note {
  min-height: 1.6em;
  color: var(--accent);
  font-weight: 650;
}
button,
.action {
  font-size: 1rem;
  line-height: 1.3;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 11px 15px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
button:not(:disabled):hover {
  border-color: var(--accent);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
:focus-visible {
  outline: 3px solid #167dc2;
  outline-offset: 2px;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 32px;
}
label {
  font-size: 0.9rem;
}
details summary {
  cursor: pointer;
  font-weight: 650;
  padding: 8px 0;
}
.controls {
  display: grid;
  gap: 6px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.end {
  padding: clamp(20px, 4vw, 38px);
  max-width: 680px;
  margin: auto;
}
.end h2 {
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -0.06em;
}
.end p {
  margin: 7px 0;
}
.end ul {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}
.end li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.91rem;
}
.end li span:last-child {
  text-align: right;
  font-weight: 650;
}
.end input {
  max-width: 100%;
}
.help,
.related {
  margin-top: 26px;
}
.help {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}
.help p {
  font-size: 0.94rem;
  max-width: 68ch;
}
.related h2 {
  font-size: 1.05rem;
}
.related nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 7px;
}
.related a {
  text-underline-offset: 4px;
  font-size: 0.95rem;
}
footer {
  margin: 30px 0 20px;
  font-size: 0.78rem;
  color: var(--ink);
}
.ad {
  text-align: center;
  margin: 28px auto 8px;
  max-width: 760px;
}
.ad small {
  display: block;
  font-size: 0.7rem;
  color: #676767;
}
.ad:has(ins[data-ad-status="unfilled"]) {
  display: none;
}
.scale {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border: 3px solid #5c554a;
  border-radius: 6px;
  padding: 6px 12px;
  background: #d3d7b4;
  color: #303a28;
  box-shadow: inset 0 2px 4px #686c5240;
}
.scale output {
  font:
    bold clamp(26px, 4vw, 38px) / 1.2 ui-monospace,
    monospace;
  letter-spacing: 0.015em;
}
.ticket {
  font-weight: 700;
  color: var(--accent);
}
.deck {
  margin: clamp(18px, 4vw, 42px);
  background: #343142;
  border-radius: 16px;
  padding: 18px 15px 12px;
  border: 4px solid #4e4657;
  box-shadow:
    0 8px 0 #8e809e,
    0 12px 16px #46324e28;
  position: relative;
}
.cassette {
  border-radius: 10px;
  background: #e0ca95;
  padding: 12px;
  border: 3px solid #272433;
  box-shadow: inset 0 0 0 2px #f6e9c8;
}
.tape-label {
  background: repeating-linear-gradient(#f6edcf 0 18px, #c5ac88 19px 20px);
  border-radius: 4px;
  padding: 0 8px 4px;
  font:
    bold 16px/22px Square,
    sans-serif;
  color: #403647;
}
.tape-window {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  margin: 12px auto;
  background: #282637;
  border: 4px solid #554658;
  border-radius: 22px;
  padding: 4px;
}
.reel {
  width: clamp(30px, 6vw, 54px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #373142 0 17%, transparent 19%),
    repeating-conic-gradient(#e4ddc4 0 33deg, #8d8296 35deg 58deg);
  border: 4px solid #b6a9b1;
}
.playing .reel {
  animation: spin 1.2s linear infinite;
}
.tape-strip {
  height: 12px;
  flex: 1;
  max-width: 58px;
  border-block: 3px solid #b58f66;
}
.tape-bottom {
  width: 54%;
  height: 15px;
  margin: auto;
  background: #a88f64;
  clip-path: polygon(7% 0, 93% 0, 100% 100%, 0 100%);
}
.listen {
  width: 100%;
  margin-top: 10px;
  background: #ede3ce;
  color: #342c38;
  font-weight: 800;
  border: 0;
}
.choices {
  display: grid;
  gap: 7px;
}
.choices button {
  text-align: left;
}
.choices .right {
  background: #d5ebd9;
  color: #174e32;
  border-color: #468461;
  opacity: 1;
}
.choices .wrong {
  background: #f7ddde;
  color: #792d38;
  opacity: 1;
}
.scene {
  position: absolute;
  inset: 0;
  background: #322c40ed;
  color: #fff;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 15px;
  pointer-events: none;
}
.scene b {
  font-size: clamp(48px, 7vw, 74px);
  animation: pop 0.45s ease-out;
}
.scene span {
  max-width: 25ch;
  font-size: 0.93rem;
}
.again-audio {
  z-index: 1;
}
.deck:has(.scene:not([hidden])) {
  position: static;
}
.scene {
  bottom: 0;
}
.sound .visual:has(.scene:not([hidden])) .listen {
  position: relative;
  z-index: 2;
}
.deck:has(.scene:not([hidden])) .scene {
  padding-bottom: 68px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pop {
  from {
    transform: translateY(9px) scale(0.8);
  }
  to {
    transform: none;
  }
}
@media (max-width: 680px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 14px 16px;
    gap: 8px;
  }
  .rack {
    max-height: 46svh;
    width: auto !important;
    max-width: 100%;
    justify-self: center;
  }
  .visual:has(.rack) {
    background: #b3c5b7;
  }
  .round {
    padding: 8px 12px;
  }
  .deck {
    width: min(100% - 40px, 325px);
    margin: 16px auto 21px;
  }
  .sound .panel {
    gap: 9px;
  }
  .top {
    height: 41px;
  }
  .title p {
    margin-top: 5px;
  }
  header.title {
    padding: 12px 0;
  }
  .board {
    max-height: 36svh;
    width: auto !important;
    max-width: 100%;
    justify-self: center;
  }
  .end .actions button {
    flex: 1 1 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.scene img {
  display: block;
  height: clamp(52px, 8vw, 90px);
  width: auto;
  margin: auto;
}
.scene span {
  margin: 3px auto;
}
.visual:has(.scene:not([hidden])) .deck .listen {
  background: #f2e8ce;
}
