:root {
  color-scheme: light;
  --paper: #f6f1e6;
  --ink: #26241f;
  --muted: #686052;
  --red: #a22e22;
  --rule: #c4bbaa;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.65 var(--serif); }
a, button, input { color: inherit; font: inherit; }
button, label, summary { cursor: pointer; }
[hidden] { display: none !important; }
:is(a, button, summary):focus-visible, input:focus-visible + .track { outline: 3px solid #98630d; outline-offset: 4px; }
.masthead, footer {
  max-width: 1180px; margin: auto; display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; font: 12px/1.5 var(--sans); letter-spacing: .08em;
}
.masthead { border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 650; letter-spacing: .12em; }
.brand-mark { color: var(--red); border: 1.5px solid; border-radius: 3px; line-height: 1; padding: 4px; font: bold 19px/1 var(--serif); }
.spread {
  width: min(1120px, 92%); margin: clamp(34px, 5vw, 72px) auto;
  display: grid; grid-template-columns: 1.12fr 1fr; align-items: center; gap: clamp(28px, 5vw, 72px);
}
.portrait { margin: 0; background: #666762; border-radius: 42% 42% 3px 3px; overflow: hidden; }
.portrait img { width: 100%; display: block; height: auto; }
.ticket { border: 1px solid var(--rule); border-top: 4px solid var(--red); background: #fffcf4; position: relative; box-shadow: 5px 6px 0 #ded6c5; }
.ticket-body, .controls { padding: 28px clamp(20px, 3.1vw, 45px); }
.ticket-body { padding-bottom: 22px; }
.kicker, .result-meta { color: var(--red); font: 600 13px/1.6 var(--sans); letter-spacing: .14em; }
.kicker { margin: 0 0 6px; }
h1 { font-size: clamp(48px, 5.3vw, 76px); letter-spacing: .04em; line-height: 1.28; margin: 0; font-weight: 650; }
h1 span { color: var(--red); }
.invitation { margin: 30px 0 8px; font-size: clamp(18px, 2vw, 26px); font-weight: 600; }
.description, .result-message { margin: 0; font-size: 16px; line-height: 1.95; }
.controls { border-top: 1px dashed var(--rule); padding-top: 20px; padding-bottom: 12px; }
#draw { width: 100%; display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 12px 20px; background: var(--red); color: white; border: 0; font-weight: 650; letter-spacing: .16em; }
#draw:hover { background: #80281e; }
#draw span:last-child { font: 22px/1 var(--sans); }
.sound-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; font: 13px/1.5 var(--sans); }
.sound-toggle, #replay { min-height: 44px; display: inline-flex; align-items: center; }
.sound-toggle { gap: 9px; position: relative; }
.sound-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; z-index: 1; cursor: pointer; }
.track { display: inline-flex; align-items: center; width: 32px; height: 18px; padding: 3px; border-radius: 12px; background: #716858; }
.track::after { content: ""; width: 12px; height: 12px; background: white; border-radius: 50%; }
input:checked + .track { background: var(--red); }
input:checked + .track::after { margin-left: auto; }
#replay { color: var(--red); background: none; border: 0; text-decoration: underline; text-underline-offset: 4px; }
#audio-status { margin: 0 0 8px; color: var(--muted); font: 12px/1.5 var(--sans); }
#audio-status:empty, .result:empty { display: none; }
.result-meta { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0 4px; }
.result-rank { margin: 0; font-size: clamp(36px, 4vw, 54px); color: var(--red); line-height: 1.36; font-weight: 700; }
.result h2 { margin: 8px 0 6px; font-size: 22px; line-height: 1.55; }
.ticket.drawn h1 { font-size: 35px; }
footer { border-top: 1px solid var(--rule); color: var(--muted); align-items: flex-start; }
footer a { text-underline-offset: 3px; }
footer details { text-align: right; }
footer details p { letter-spacing: 0; }
@media (max-width: 1240px) { .masthead, footer { width: 92%; } }
@media (max-width: 700px) {
  .masthead, footer { width: 90%; font-size: 11px; padding: 13px 0; }
  .brand { gap: 6px; }
  .spread { width: min(88%, 440px); margin: 18px auto 34px; display: flex; flex-direction: column; gap: 14px; }
  .portrait { width: clamp(150px, min(60vw, 31svh), 250px); }
  .ticket { width: 100%; }
  .ticket-body { padding: 16px 22px 14px; }
  .kicker { margin: 0; font-size: 12px; }
  h1 { font-size: 46px; }
  .invitation { margin: 12px 0 3px; font-size: 19px; }
  .description, .result-message { font-size: 15px; line-height: 1.8; }
  .controls { padding: 14px 22px 3px; }
  .ticket.drawn h1 { font-size: 26px; }
  .result h2 { font-size: 20px; }
}
@media (max-width: 360px) {
  .spread { width: 91%; gap: 10px; margin-top: 12px; }
  .portrait { width: 150px; }
  .ticket-body { padding: 14px 16px 12px; }
  .controls { padding-inline: 16px; }
}
