:root {
  color-scheme: dark;
  --bg: #101514;
  --panel: #18221f;
  --panel-darker: #131c19;
  --edge: #293933;
  --ink: #fcf6e8;
  --muted: #b3c3ba;
  --accent: #ffda88;
  --accent-ink: #291b08;
  --accent-shadow: #bb8448;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 44% 0, #20312a, transparent 49%), var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
button, select, input { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.site-header { background: #111916; border-bottom: 1px solid var(--edge); }
.header-inner {
  max-width: 1290px; margin: auto; min-height: 68px; padding: 10px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.wordmark { min-width: 0; display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.025em; white-space: nowrap; }
#brandFallback { overflow: hidden; text-overflow: ellipsis; }
.header-controls { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.text-button, .sound-button, .ticket {
  border: 1px solid var(--edge); border-radius: 10px; background: #1b2823;
  min-height: 40px; padding: 6px 11px;
}
.text-button:hover, .sound-button:hover, .ticket:hover { border-color: var(--accent-shadow); }
.sound-button { min-width: 41px; color: var(--muted); font-size: 18px; }
.sound-button[aria-pressed="true"] { color: var(--accent); }
.ticket { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--accent); }
.ticket-icon { display: inline-block; width: 17px; height: 12px; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-12deg); }
.page { max-width: 1290px; margin: auto; padding: 30px 32px 24px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
h1, h2, p { margin: 0; }
h1, .dialog-inner h2 {
  font-family: Georgia, "Times New Roman", serif; font-weight: 700;
  font-size: clamp(2.25rem, 4.4vw, 4rem); line-height: 1.01; letter-spacing: -.05em;
}
.intro p { margin-top: 10px; color: var(--muted); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 14px; align-items: start; }
.arena {
  position: relative; aspect-ratio: 480 / 300; overflow: hidden; isolation: isolate; width: 100%;
  cursor: grab; touch-action: none; user-select: none;
  background: #182b37; border-radius: 15px; border: 1px solid #536258; box-shadow: 0 12px 40px #0005;
}
.arena canvas, .target-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.target-layer { transform-origin: 0 0; pointer-events: none; }
.arena.is-dragging, .arena.is-dragging .target { cursor: grabbing; }
.arena canvas { pointer-events: none; }
canvas { image-rendering: pixelated; }
.arena-badge {
  position: absolute; bottom: 10px; left: 10px; z-index: 1; border-radius: 6px;
  padding: 3px 7px; font-size: .8rem; color: #fff5d8; background: #121e1ce8; border: 1px solid #65736a;
  pointer-events: none;
}
.target {
  position: absolute; transform: translate(-50%, -50%); background: transparent; border: 0; border-radius: 3px;
  padding: 0; cursor: crosshair; touch-action: none; pointer-events: auto; -webkit-tap-highlight-color: transparent;
}
.target:focus-visible { outline-offset: -2px; }
.target:hover { background: #ffedbc11; }
.target:disabled { cursor: wait; }
.play-panel {
  display: grid; gap: 13px; background: linear-gradient(160deg, #22302a, #171f1c);
  border: 1px solid var(--edge); border-radius: 15px; padding: 15px;
}
.selection { display: flex; align-items: center; min-width: 0; gap: 12px; }
.gift-emblem {
  display: grid; place-items: center; width: 66px; height: 66px; flex: none;
  background: #121d1a; border: 1px solid #33473d; border-radius: 12px;
}
.gift-emblem canvas { width: 60px; height: 60px; }
.caption { color: var(--muted); font-size: .875rem; font-weight: 700; }
.selection h2 { margin-top: 3px; font-size: clamp(1.1rem, 2vw, 1.4rem); line-height: 1.12; }
.game-status { color: var(--muted); min-height: 1.3em; margin: 0 0 1px; font-size: .9rem; }
.shoot-button {
  display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%;
  min-height: 52px; padding: 8px 12px 10px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-bottom: 3px solid var(--accent-shadow);
  border-radius: 9px; font-weight: 800; font-size: 1rem;
}
.shoot-button:not(:disabled):hover { filter: brightness(1.09); }
.shoot-button:not(:disabled):active { transform: translateY(1px); }
.shoot-button:disabled { opacity: .65; cursor: wait; }
.aim-icon {
  width: 17px; height: 17px; position: relative; border: 1.5px solid currentColor; border-radius: 50%;
}
.aim-icon::before, .aim-icon::after {
  content: ""; position: absolute; background: currentColor; left: 50%; top: 50%; transform: translate(-50%,-50%);
}
.aim-icon::before { height: 1.5px; width: 25px; }
.aim-icon::after { height: 25px; width: 1.5px; }
.keyboard-hint { color: var(--muted); text-align: center; font-size: .85rem; }
kbd {
  font: inherit; padding: 2px 5px; background: #17221e; border: 1px solid #43554a;
  border-radius: 4px; margin-right: 3px;
}
.history { margin-top: 18px; background: var(--panel-darker); border: 1px solid var(--edge); border-radius: 13px; padding: 13px 15px; }
.history h2 { font-size: 1rem; }
.history p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.history ol { list-style: none; padding: 0; margin: 6px 0 0; }
.history ol:empty { display: none; }
.history li { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; padding: 8px 0; min-height: 39px; overflow-wrap: anywhere; }
.history li + li { border-top: 1px solid var(--edge); }
.history li span { color: var(--muted); font-size: .9rem; }

dialog {
  width: min(430px, calc(100% - 28px)); max-height: 88vh; padding: 0;
  background: var(--panel); color: var(--ink); border: 1px solid #607469; border-radius: 17px;
  box-shadow: 0 18px 80px #000a;
}
dialog::backdrop { background: #09100cce; }
.dialog-inner { position: relative; padding: 24px; }
.dialog-inner h2 { font-size: 2rem; padding-right: 22px; }
.dialog-inner p:not(.caption) { color: var(--muted); margin: 8px 0 12px; }
.close-button {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; font-size: 25px;
  line-height: 1; border: 0; border-radius: 7px; background: transparent;
}
.close-button:hover { background: #fff2; }
.result-inner { text-align: center; }
.result-inner h2 { padding-right: 0; margin-top: 6px; }
.result-art {
  display: grid; place-items: center; width: 114px; height: 114px; margin: 0 auto 12px;
  background: radial-gradient(#69513a, #26342a 75%); border: 1px solid #6d7560; border-radius: 19px;
}
.result-art canvas { width: 104px; height: 104px; }
.voucher-label { display: inline-block; margin-bottom: 5px; font-weight: 700; }
.voucher-entry { display: flex; gap: 6px; }
.voucher-entry input {
  padding: 8px; min-width: 0; width: 100%; border: 1px solid #576b60; border-radius: 8px;
  color: var(--ink); background: #131d19; text-transform: uppercase;
}
.dialog-inner .form-message { color: #ffb59e !important; min-height: 1.25em; margin: 5px 0; }
.prizes { margin: 13px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; list-style: none; }
.prizes li { padding: 8px; background: #101c16; border: 1px solid var(--edge); border-radius: 7px; }
@media (max-width: 970px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 10px; }
  .header-inner, .page { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 720px) {
  .header-inner { min-height: 56px; padding: 7px 12px; }
  .header-controls { gap: 5px; }
  .header-controls button { min-height: 39px; padding: 4px 8px; }
  .sound-button { min-width: 35px; }
  .wordmark { gap: 5px; font-size: .92rem; }
  .ticket-icon { display: none; }
  .page { padding: 15px 11px max(13px, env(safe-area-inset-bottom)); }
  .intro { margin-bottom: 11px; gap: 9px; align-items: end; }
  h1 { font-size: clamp(1.55rem, 6vw, 2.5rem); overflow-wrap: anywhere; }
  .intro p { margin-top: 5px; font-size: .85rem; line-height: 1.25; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .arena { aspect-ratio: 360 / 300; border-radius: 10px; }
  .arena-badge { bottom: 5px; left: 5px; }
  .play-panel {
    grid-template-columns: minmax(0, 1fr) minmax(104px, .67fr); align-items: center;
    align-self: start; gap: 4px 8px; padding: 7px; border-radius: 10px;
  }
  .selection { gap: 7px; grid-column: 1; grid-row: 1 / 3; }
  .caption { font-size: .79rem; }
  .gift-emblem { width: 47px; height: 47px; border-radius: 8px; }
  .gift-emblem canvas { width: 45px; height: 45px; }
  .selection h2 { margin-top: 1px; white-space: normal; font-size: 1.05rem; }
  .game-status { grid-column: 1 / -1; grid-row: 3; min-height: 0; margin: 0 2px; font-size: .8rem; }
  #shootButton { grid-column: 2; grid-row: 1 / 3; min-height: 46px; padding: 5px; font-size: .91rem; gap: 7px; }
  #shootButton .aim-icon { display: none; }
  .keyboard-hint { display: none; }
  .history { margin-top: 9px; padding: 8px 10px; }
}
@media (max-width: 370px) {
  .intro p { font-size: .79rem; }
  .header-controls button { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }
.wordmark img { display: block; max-width: min(36vw, 180px); max-height: 44px; width: auto; height: auto; object-fit: contain; }
.platform-copyright { padding: 20px 6px 5px; text-align: center; color: var(--muted); font-size: .8rem; }
#memberId {
  display: block; width: 100%; margin-bottom: 12px; padding: 8px;
  border: 1px solid #576b60; border-radius: 8px; color: var(--ink); background: #131d19;
}
.dialog-inner h2, #resultGift { overflow-wrap: anywhere; }
.dialog-inner p.result-value { font-size: 1.2rem; font-weight: 800; color: var(--accent); overflow-wrap: anywhere; }
.claim-link { display: inline-block; margin-bottom: 12px; color: var(--accent); text-decoration: underline; }
.history li .claim-link { margin: 0; font-size: .85rem; }
.prizes li { display: grid; gap: 3px; overflow-wrap: anywhere; }
