:root {
  --ink: #191914;
  --paper: #f7f6eb;
  --lime: #e2ef9b;
  --pink: #edafd3;
  --line: #ffffff3a;
  --mono: Consolas, "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #19181d; color: var(--paper); font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; word-break: keep-all; }
h1, p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
.logo { display: inline-block; color: var(--lime); font: clamp(25px, 3vw, 43px)/1 Impact, "Arial Narrow", sans-serif; text-decoration: none; letter-spacing: .035em; }
.logo span { margin-left: 4px; vertical-align: top; font-size: .45em; }
.kicker { color: var(--lime); font: 700 12px/1.4 var(--mono); letter-spacing: .15em; }
.signal { display: inline-block; width: 9px; height: 9px; margin-inline: 5px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px #e2ef9b9a; }
.display-head, .display-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px clamp(14px, 2.8vw, 48px); }
.display-head { min-height: 61px; border-bottom: 1px solid var(--line); }
.display-head p, .display-footer { color: #d0c8d4; font: 700 12px/1.4 var(--mono); letter-spacing: .12em; }
.display-footer { min-height: 34px; border-top: 1px solid var(--line); }
.display-layout {
  --stage-padding: clamp(8px, 1.2vh, 18px);
  --stage-height: calc(100dvh - 215px - 2 * var(--stage-padding));
  min-height: calc(100dvh - 95px);
  display: grid;
  grid-template-columns: minmax(0, calc(var(--stage-height) * var(--cabinet-ratio, 1))) clamp(245px, 23vw, 370px);
  align-items: center;
  justify-content: center;
  gap: clamp(13px, 2vw, 32px);
  padding: var(--stage-padding) clamp(14px, 2.8vw, 48px);
  background: radial-gradient(ellipse at 33% 30%, #3d3047 0, transparent 63%);
}
.screen { min-width: 0; border: 1px solid #ab9db9; border-radius: 12px; overflow: hidden; background: #222025; box-shadow: 0 14px 40px #0006; }
.screen-head, .screen-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 15px; padding: 8px clamp(10px, 2vw, 25px); }
.screen-head { font: 700 clamp(12px, 1.3vw, 19px)/1.4 var(--mono); letter-spacing: .1em; }
.screen-foot { min-height: 48px; font-size: clamp(14px, 1.5vw, 21px); }
#display-player { color: var(--lime); font-weight: 800; }
#display-status { color: #ded9df; }
.machine-view { display: grid; place-items: center; position: relative; background: #201d25; }
canvas { display: block; width: 100%; height: auto; max-height: var(--stage-height); object-fit: contain; }
.round-meta, .time-label { display: flex; align-items: center; gap: 10px; }
#display-attempt, .attempt-label { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--lime); font-weight: 800; }
.result-banner {
  position: absolute;
  top: 36%;
  left: 50%;
  width: max-content;
  max-width: 90%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: var(--pink);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 9px 24px;
  border-radius: 4px;
  box-shadow: 5px 6px var(--ink);
  font-size: clamp(20px, 3.4vw, 52px);
  font-weight: 900;
}
.result-banner[data-kind="win"] { top: 73%; background: var(--lime); }
.result-banner[data-kind="win"]::before { content: "테스트 상품"; display: block; font-size: clamp(11px, 1vw, 14px); letter-spacing: .06em; }
.join-card { padding: clamp(14px, 2vw, 30px); border: 1px solid var(--line); border-radius: 12px; background: #252229; }
.join-card h1 { margin-block: 7px 13px; font-size: clamp(23px, 2.9vw, 47px); line-height: 1.15; letter-spacing: -.085em; }
.join-help { margin: 13px 0 6px; color: #e6dce6; font-size: clamp(12px, 1.2vw, 17px); line-height: 1.45; }
.qr-box { width: min(100%, 216px); padding: 3px; border-radius: 5px; background: white; }
.qr-box img { display: block; width: 100%; height: auto; }
.address { color: var(--lime); font: 700 clamp(12px, 1vw, 17px)/1.4 var(--mono); overflow-wrap: anywhere; }
.queue { margin-top: 16px; padding-top: 11px; border-top: 1px solid var(--line); }
.queue .kicker { display: flex; justify-content: space-between; gap: 10px; }
.queue ol { margin: 5px 0 0; padding-left: 20px; font-size: 13px; }
.queue ol:empty { display: none; }

.phone, .operator { width: min(calc(100% - 28px), 480px); margin-inline: auto; padding-block: 22px 40px; }
.phone > .kicker, .operator > .kicker { margin-block: 12px 8px; }
.phone-card { margin-top: 13px; padding: clamp(14px, 4vw, 23px); border: 1px solid var(--line); border-radius: 12px; background: #28252e; }
.phone-card h1, .operator h1 { font-size: clamp(27px, 7vw, 45px); line-height: 1.15; letter-spacing: -.07em; }
#phone-status { margin-top: 7px; min-height: 44px; color: #eee1ef; font-size: 16px; font-weight: 700; }
#join-form { display: grid; gap: 8px; }
label { font-weight: 800; }
input:not([type="range"]) { min-width: 0; padding: 12px; border: 1px solid #b4a6b5; border-radius: 5px; background: #17151a; color: white; font-size: 16px; }
.accent-button, .small-button, .direction-pad button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  border-radius: 5px;
  border: 1px solid #ffffff66;
  font-weight: 800;
}
.accent-button { width: 100%; padding: 11px 12px; border-color: var(--lime); background: var(--lime); color: var(--ink); }
.accent-button:active, .direction-pad button:active { background: var(--pink); color: var(--ink); }
.small-button { padding: 8px 12px; color: var(--paper); background: #332b3b; }
.small-button:hover { background: #4a3e54; }
.phone-clock { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; font-size: 14px; }
.time-label { margin-left: auto; }
.phone-clock strong { color: var(--lime); font: 800 28px var(--mono); }
.aim-track { position: relative; height: 7px; margin: 10px 7px 18px; border-radius: 4px; background: #54505b; }
.aim-track span { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; transform: translate(-50%, -50%); border: 2px solid #242129; border-radius: 50%; background: var(--lime); transition: left .09s linear; }
.direction-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.direction-pad button { min-height: 76px; touch-action: none; user-select: none; background: #403749; color: var(--paper); font: 800 40px var(--mono); }
.grab-button { min-height: 64px; margin-top: 9px; font: 800 23px var(--mono); letter-spacing: .12em; }
.helper { margin-block: 10px; color: #e1d6e1; font-size: 13px; line-height: 1.55; }
.text-button { border: 0; padding: 10px 0; background: transparent; color: #f0d4e8; text-decoration: underline; text-underline-offset: 3px; }
.message { margin-top: 8px; min-height: 1em; color: var(--pink); font-size: 14px; }
.operator-links { display: flex; gap: 18px; margin-top: 11px; color: var(--lime); font-size: 14px; }
#settings label, .ops-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#failure-label { color: var(--lime); font: 800 24px var(--mono); }
#failure { width: 100%; accent-color: var(--lime); margin: 12px 0 0; }
@media (max-width: 710px) {
  .display-head p { display: none; }
  .display-layout { grid-template-columns: 1fr; }
  canvas { max-height: none; }
  .join-card { width: 100%; }
  .ops-status { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .aim-track span { transition: none; }
}