:root {
  color-scheme: light;
  --ink: #293954;
  --muted: #697486;
  --line: #dfe6ee;
  --accent: #4566a8;
  --accent-dark: #324f91;
  --paper: #f8fafd;
  font-family: "Inter", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button { border: 0; background: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #6688c1; outline-offset: 3px; }
button:disabled { cursor: default; }
h1, h2, h3, p { margin: 0; }
i[data-icon], .ico { display: inline-flex; vertical-align: middle; flex: none; }
.ico { width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner, .main-shell { width: min(1200px, calc(100% - 96px)); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; gap: clamp(34px, 5vw, 82px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: #293954; font-family: "Bricolage Grotesque", "Trebuchet MS", Arial, sans-serif; font-weight: 900; font-size: 1.62rem; letter-spacing: -1.7px; flex: none; }
.brand img, .main-nav img, .clay-art { object-fit: contain; display: block; flex: none; }
.clay-art { pointer-events: none; }
.brand b { color: #5677b4; font-weight: inherit; }
.main-nav { display: flex; gap: 7px; align-items: center; }
.main-nav a { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; color: #536276; font-size: .94rem; font-weight: 650; white-space: nowrap; letter-spacing: -.5px; }
.main-nav .ico { width: 18px; height: 18px; }
.main-nav a:hover, .history-button:hover { background: #f0f4fa; }
.main-nav a[aria-current="page"] { color: #354f85; background: #eaf0fa; }
.history-button { margin-left: auto; display: flex; align-items: center; gap: 7px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: .875rem; color: #526073; white-space: nowrap; font-weight: 600; }
.history-button .ico { width: 17px; height: 17px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-actions select { max-width: 9em; font: inherit; font-size: .86rem; color: var(--ink); background: #fff; padding: 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.header-inner { column-gap: clamp(12px, 2vw, 32px); }
.main-nav a, .play-button { text-align: center; }
@media(max-width:900px) { .header-actions .history-button span { display: none; } }
@media(max-width:760px) {
  .header-actions { grid-column: 2; grid-row: 1; }
  .main-nav a[data-mode] { white-space: normal; min-width: 0; }
}
.main-shell { padding: 36px 0 45px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.81fr) minmax(315px, 1fr); gap: 22px; align-items: stretch; }
.play-board, .settings { min-width: 0; border: 1px solid var(--line); border-radius: 24px; }
.play-board { isolation: isolate; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 27px 18px 22px; min-height: 494px; background: radial-gradient(ellipse at 51% 42%, #fbfdff 6%, transparent 59%), linear-gradient(155deg, #edf5ff, #e9f1ff 56%, #f2f5ff); border-color: #d7e4f3; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 33px; height: 33px; border-radius: 10px; border: 1px solid #e6dece; background: #fffdf6; color: #67636c; flex: none; }
.icon-button .ico { width: 17px; height: 17px; }
.icon-button:hover { background: #fff; color: var(--ink); border-color: #aca4a3; }
.stage-art { position: relative; width: min(100%, 408px); aspect-ratio: 440 / 418; display: grid; place-items: center; flex: none; }
.wheel-canvas { display: block; width: 100%; height: 100%; }
.play-controls { display: flex; align-items: center; flex-direction: column; gap: 10px; position: relative; margin-top: 7px; }
.play-button, .dialog-primary { background: var(--accent); border: 1px solid #3b5c9b; border-radius: 13px; color: white; font-weight: 750; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-width: 216px; padding: 12px 28px 13px; font-size: 1.13rem; line-height: 1.35; letter-spacing: -.035em; box-shadow: 0 3px 0 #344f88, 0 8px 15px #38558420; transition: background .15s, transform .15s, box-shadow .15s; }
.play-button .ico { width: 18px; height: 18px; }
.play-button:hover:not(:disabled), .dialog-primary:hover { background: #3a5999; }
.play-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #344f88; }
.play-button:disabled { background: #8799b8; border-color: #778baa; box-shadow: 0 2px 0 #7284a2; }
.keyboard-hint { display: flex; align-items: center; gap: 4px; color: #5e708a; font-size: .76rem; }
kbd { display: inline-block; padding: 0 5px 1px; line-height: 16px; background: #f7fbff; border: 1px solid #c9d6e3; border-bottom-width: 2px; border-radius: 4px; color: #5a6e85; font-family: inherit; font-size: .71rem; }
.settings { display: flex; flex-direction: column; background: #fff; padding: 24px; box-shadow: 0 4px 18px #29486c07; }
.settings-heading, .panel-title, .toggle-label, .add-row, .item-row, .history-heading, .history-heading h2 { display: flex; align-items: center; }
.settings-heading { justify-content: space-between; gap: 8px; margin-bottom: 18px; min-height: 29px; }
.panel-title { gap: 8px; }
.panel-title h2, .presets h2, .history-heading h2 { font-size: 1.17rem; line-height: 1.45; font-weight: 750; letter-spacing: -.055em; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 23px; padding: 0 6px; background: #eaf0fa; color: #3d5b95; border-radius: 8px; font-size: .81rem; font-weight: 750; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: .81rem; color: #626e7e; padding: 5px 1px; }
.text-button:hover { color: var(--accent-dark); }
.text-button .ico { width: 15px; height: 15px; }
.item-list { display: flex; flex-direction: column; gap: 7px; padding: 2px 3px 3px; margin: -2px -3px -3px; max-height: 303px; overflow: auto; scrollbar-width: thin; scrollbar-color: #dbd7d5 transparent; }
.item-row { gap: 9px; min-height: 42px; flex: none; border: 1px solid #e2e8ee; background: #f9fbfc; border-radius: 9px; padding: 0 8px 0 10px; transition: border-color .15s; }
.item-row:focus-within { border-color: #829dca; }
.item-row.is-dragging { opacity: .4; }
.item-row.is-target { border-top-color: var(--accent); }
.drag { display: flex; align-items: center; padding: 6px 0; color: #aab6c4; cursor: grab; touch-action: none; }
.drag .ico { width: 13px; height: 16px; }
.swatch { flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #5c3f5610; }
.item-input { flex: 1; min-width: 0; width: 60%; font-size: .94rem; color: #3b4b62; border: 0; background: transparent; line-height: 1.45; padding: 7px 0; outline: none; letter-spacing: -.025em; }
.item-input:focus-visible { outline: 0; }
.remove-item { width: 25px; height: 30px; display: grid; place-items: center; color: #8996a4; }
.remove-item:hover { color: var(--accent-dark); }
.remove-item .ico { width: 14px; height: 14px; }
.add-row { gap: 8px; margin-top: 12px; }
.add-row input { min-width: 0; width: 100%; border: 1px solid #d2dce7; border-radius: 9px; padding: 10px 12px; color: var(--ink); background: white; font-size: .875rem; }
.add-row input::placeholder { color: #717d8d; }
.add-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 11px; align-self: stretch; border-radius: 9px; background: #eaf0fa; color: #3d5b94; font-size: .875rem; font-weight: 700; white-space: nowrap; border: 1px solid #d3e1f4; }
.add-button .ico { width: 15px; height: 15px; }
.add-button:hover { background: #dce9fa; }
.presets { margin-top: 26px; }
.presets h2, .history-heading h2 { display: flex; align-items: center; gap: 8px; }
.presets h2 .ico { color: #63779a; width: 20px; height: 20px; }
.preset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 12px; }
.preset-card { display: flex; align-items: center; padding: 14px 16px; gap: 13px; border-radius: 14px; text-align: left; background: white; border: 1px solid var(--line); transition: border-color .15s, transform .15s; }
.preset-card:hover { border-color: #b2c4df; transform: translateY(-2px); }
.preset-picture { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 13px; font-size: 1.65rem; flex: none; }
.preset-card:nth-child(1) .preset-picture { background: #fff0d4; }
.preset-card:nth-child(2) .preset-picture { background: #e6f2ec; }
.preset-card:nth-child(3) .preset-picture { background: #eee8fa; }
.preset-copy { display: grid; gap: 3px; }
.preset-copy strong { font-size: .95rem; letter-spacing: -.04em; }
.preset-copy small { font-size: .77rem; color: var(--muted); }
.preset-action { margin-left: auto; color: #9e989e; width: 17px; height: 17px; }
.preset-card[aria-pressed="true"] .preset-action { color: #42649e; }
.empty-list { font-size: .9rem; color: var(--muted); padding: 18px 8px; text-align: center; }
.range-info { border: 1px solid #dbe6f4; border-radius: 12px; padding: 14px; background: #f1f6fc; color: #4c6484; font-size: .91rem; }
.play-board[data-mode="names"] { background: radial-gradient(ellipse at center,#fcfffd,transparent 68%), linear-gradient(135deg,#eaf7f5,#e7f3ed); border-color: #d8e9e3; }

body:has(dialog[open]) { overflow: hidden; }
dialog { border: 1px solid var(--line); border-radius: 21px; color: var(--ink); background: white; box-shadow: 0 14px 100px #352a4529; width: min(410px, calc(100% - 32px)); padding: 0; }
dialog::backdrop { background: #2e263f5c; backdrop-filter: blur(3px); }
.result-value { margin: 6px 0 24px; font-size: 2rem; font-weight: 800; letter-spacing: -.06em; overflow-wrap: anywhere; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions button { flex: 1; padding: 11px; font-size: .94rem; font-weight: 650; border-radius: 10px; }
.dialog-secondary { border: 1px solid var(--line); background: #f0f4fa; }
.history-dialog { width: min(460px,calc(100% - 32px)); padding: 23px; }
.history-heading { justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.history-heading .icon-button { background: white; border-color: var(--line); }
.history-list { margin: 0; padding: 0; list-style: none; max-height: 57vh; overflow: auto; }
.history-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.history-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex: none; background: #fff0df; border-radius: 10px; }
.history-list strong { font-size: .95rem; overflow-wrap: anywhere; }
.history-list small { display: block; font-size: .77rem; color: var(--muted); margin-top: 3px; }
.history-list time { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.empty-history { text-align: center; padding: 30px 0; color: var(--muted); font-size: .94rem; }
.empty-history .ico { display: block; margin: 0 auto 12px; width: 30px; height: 30px; color: #b1a4b6; }

/* Soft, illustrated scenery behind the interactive objects. */
.scenery { position: absolute; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.cloud { position: absolute; width: 94px; height: 22px; border-radius: 40px; background: #ffffffd9; filter: drop-shadow(0 2px 0 #b5cde830); }
.cloud::before, .cloud::after { content: ''; position: absolute; bottom: 4px; border-radius: 50%; background: inherit; }
.cloud::before { left: 13px; width: 41px; height: 39px; }
.cloud::after { left: 43px; width: 34px; height: 29px; }
.cloud-left { top: 24%; left: 7%; transform: rotate(-3deg); }
.cloud-right { top: 17%; right: 6%; scale: .75; }
.hill { position: absolute; height: 28%; width: 105%; border-radius: 50% 50% 0 0; }
.hill-far { bottom: -18%; left: -31%; background: #b9d4ed55; transform: rotate(5deg); }
.hill-near { bottom: -20%; right: -31%; background: #d1d4ed73; transform: rotate(-8deg); }
.preset-card[aria-pressed="true"], .game-link[aria-current="page"] { border-color: #adbfdf; background: #f4f7fe; }
.preset-card:active { transform: translateY(0); }
.preset-card:hover .preset-picture { transform: rotate(-5deg); }
.preset-picture { transition: transform .2s; }
.play-button { border-radius: 16px; }
.play-button:hover:not(:disabled) { transform: translateY(-1px); }
.game-link { cursor: pointer; }
.game-link .preset-action { color: var(--accent); }
.game-link .preset-picture { background: #e8effa; }
.play-board[data-game="dice"] { background: radial-gradient(ellipse at center,#fffefd,transparent 67%), linear-gradient(135deg,#fbf1df,#fbf4e9); border-color: #e6decc; }
.play-board[data-game="dice"] .hill { background: #e4cfa855; }
.play-board[data-game="lotto"] { background: radial-gradient(ellipse at center,#fdfffd,transparent 64%), linear-gradient(135deg,#e1f2ed,#eef7f2); border-color: #d3e7de; }
.play-board[data-game="lotto"] .hill { background: #b7dbcc70; }
.play-board[data-game="cards"] { background: radial-gradient(ellipse at center,#fcfaff,transparent 69%), linear-gradient(135deg,#edeafa,#f3f0fa); border-color: #e1dbef; }
.play-board[data-game="cards"] .hill { background: #cfc5e955; }
@keyframes appear { from { opacity: .35; transform: translateY(7px) scale(.97); } to { opacity: 1; transform: none; } }

/* The three number games have their own physical draw and result display. */
.number-scene { position: relative; width: 100%; height: 100%; display: grid; place-items: center; container-type: inline-size; }
.object-shadow { position: absolute; width: 48%; height: 6%; left: 26%; top: 76%; border-radius: 50%; background: radial-gradient(ellipse,#616f903a,transparent 73%); }
.number-outcome { position: absolute; bottom: 2%; display: flex; justify-content: center; align-items: center; gap: 7px; color: #3b4e70; font-size: 1.03rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.die-camera { --die: 35cqi; width: var(--die); height: var(--die); perspective: 740px; }
.die-toss, .die-cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.die-cube { transform: rotateX(-15deg) rotateY(-21deg); }
.die-face, .pip-tile { display: grid; grid-template: repeat(3,1fr) / repeat(3,1fr); place-items: center; }
.die-face { position: absolute; inset: 0; padding: 13%; backface-visibility: hidden; border-radius: 12%; border: 2px solid #566b89; background: linear-gradient(145deg,#fff,#e3ebf6); box-shadow: inset 0 0 0 4px #ffffff88; }
.die-face i, .pip-tile i { width: 64%; height: 64%; border-radius: 50%; background: #405578; }
.face-1 { transform: translateZ(calc(var(--die) / 2)); }
.face-1 i { background: #dd8675; }
.face-2 { transform: rotateX(90deg) translateZ(calc(var(--die) / 2)); background: #fdfcf5; }
.face-3 { transform: rotateY(90deg) translateZ(calc(var(--die) / 2)); background: #c9d9ec; }
.face-4 { transform: rotateY(-90deg) translateZ(calc(var(--die) / 2)); background: #e2eaf5; }
.face-5 { transform: rotateX(-90deg) translateZ(calc(var(--die) / 2)); }
.face-6 { transform: rotateY(180deg) translateZ(calc(var(--die) / 2)); }
.is-playing .die-toss { animation: toss 1.7s ease-in-out both; }
@keyframes toss {
  0% { transform: translate(0,0) rotateZ(0) rotateX(0) rotateY(0); }
  15% { transform: translate(-9%,-18%) rotateZ(-9deg) rotateX(55deg) rotateY(75deg); }
  30% { transform: translate(-5%,3%) rotateZ(6deg) rotateX(115deg) rotateY(150deg); }
  49% { transform: translate(5%,-5%) rotateZ(-4deg) rotateX(215deg) rotateY(245deg); }
  72% { transform: translate(3%,1%) rotateZ(3deg) rotateX(314deg) rotateY(327deg); }
  90% { transform: translate(0,0) rotateZ(-1deg) rotateX(363deg) rotateY(361deg); }
  100% { transform: translate(0,0) rotateZ(0) rotateX(360deg) rotateY(360deg); }
}
.face-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.face-option { display: grid; justify-items: center; gap: 7px; padding: 10px 4px; background: #f7f9fc; border-radius: 11px; font-size: .88rem; color: #536077; }
.pip-tile { width: 32px; height: 32px; border: 1.5px solid #8798ad; border-radius: 7px; padding: 4px; background: white; }
.range-info { margin: 15px 0 0; display: flex; justify-content: space-between; }
.game-history { margin-top: 23px; border-top: 1px solid var(--line); padding-top: 17px; }
.game-history h3 { font-size: .91rem; }
.game-history p { margin-top: 12px; color: var(--muted); font-size: .87rem; }
.game-history ol { margin: 6px 0 0; padding: 0; list-style: none; }
.game-history li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: .9rem; }
.game-history time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.lotto-rules { margin: 0; padding: 8px 14px; border-radius: 13px; background: #eff7f4; }
.lotto-rules div { display: flex; justify-content: space-between; gap: 9px; padding: 9px 0; }
.lotto-rules dt { color: #4b695d; font-size: .9rem; }
.lotto-rules dd { margin: 0; font-weight: 700; }
.lotto-machine { width: 66%; max-width: 265px; margin-top: -4%; filter: drop-shadow(2px 5px 6px #426c6d19); }
.lotto-machine .clay-art { width: 100%; }
.is-playing .lotto-machine { animation: rock-machine .28s ease-in-out infinite alternate; transform-origin: 50% 84%; }
@keyframes rock-machine { from { transform: rotate(-4deg) translateY(1px); } to { transform: rotate(4deg) translateY(-3px); } }
.lotto-slot { display: inline-grid; place-items: center; width: clamp(28px,5vw,38px); aspect-ratio: 1; border-radius: 50%; border: 1px solid #68849155; font: 750 .98rem "Trebuchet MS",sans-serif; color: #26384b; box-shadow: inset -2px -3px 0 #43586410; }
.lotto-slot.empty { color: #7d928a; border: 1px dashed #a7bfb6; background: #ffffff80; box-shadow: none; }
.color-0 { background: #f4d489; } .color-1 { background: #abcdeb; } .color-2 { background: #f3b1a3; } .color-3 { background: #c4bcdf; } .color-4 { background: #acd9bf; }
.card-stack { position: relative; width: 43%; height: 55%; transform: rotate(-5deg); perspective: 850px; }
.stack-sheet, .flip-card, .card-front, .card-back { position: absolute; inset: 0; border-radius: 15px; }
.stack-sheet { border: 2px solid #475677; }
.sheet-last { transform: translate(12%,2%) rotate(12deg); background: #a8ceca; }
.sheet-middle { transform: translate(6%,1%) rotate(6deg); background: #f7d99c; }
.flip-card { transform-style: preserve-3d; }
.card-stack { --face-up: translate3d(-8%,-3%,12px) rotateZ(5deg) rotateY(180deg); }
.revealed .flip-card { transform: var(--face-up); }
.is-playing .revealed .flip-card { animation: deal-card var(--deal-time) both; }
@keyframes deal-card {
  0%, 8% { transform: translate3d(0,0,0) rotateZ(0) rotateY(0); animation-timing-function: ease-out; }
  31% { transform: translate3d(-18%,-10%,26px) rotateZ(-6deg) rotateY(14deg); animation-timing-function: ease-in-out; }
  69% { transform: translate3d(-12%,-13%,48px) rotateZ(4deg) rotateY(164deg); animation-timing-function: ease-out; }
  86%, 100% { transform: var(--face-up); }
}
.card-stack .departing-card { z-index: 2; pointer-events: none; animation: discard-card .24s ease-in both; }
@keyframes discard-card {
  from { opacity: 1; transform: translate3d(-8%,-3%,12px) rotateZ(5deg); }
  to { opacity: 0; transform: translate3d(28%,6%,20px) rotateZ(14deg); }
}
.card-front, .card-back { backface-visibility: hidden; border: 2.5px solid #455878; display: grid; place-items: center; }
.card-back { background: repeating-linear-gradient(45deg,#7f99c5 0 2px,transparent 2px 13px),repeating-linear-gradient(-45deg,#839ec9 0 2px,#7690bb 2px 13px); box-shadow: inset 0 0 0 6px #e5ebf5,inset 0 0 0 8px #5a73a0; }
.card-emblem { display: grid; place-items: center; width: 48%; aspect-ratio: 1; border-radius: 50%; background: #ffedbd; border: 2px solid #486081; color: #bf8942; font-size: 10cqi; }
.card-front { transform: rotateY(180deg); background: #fffaf0; box-shadow: inset 0 0 0 7px #fffaf0,inset 0 0 0 8px #d8c69e; }
.card-front strong { font: 800 min(16cqi,calc(54cqi / var(--digits,1))) "Trebuchet MS",sans-serif; color: #3e5278; }
.card-corner { position: absolute; top: 8%; left: 10%; color: #ce9378; font-size: 5cqi; }
.card-corner.lower { inset: auto 10% 8% auto; }


/* A quiet paper surface and a common illustrated style for all draw modes. */
body { background: linear-gradient(180deg,#fafbfe,#f5f7fa 85%); min-height: 100vh; }
.app-header { box-shadow: 0 2px 14px #32395605; }
.main-nav { background: #f5f6fa; border: 1px solid #e9ecf3; border-radius: 15px; padding: 4px; }
.main-nav a[aria-current="page"] { background: #fff; color: #365784; box-shadow: 0 1px 5px #3449681b; }
.play-board, .settings, .preset-card { box-shadow: 0 5px 20px #26385c07; }
.play-button { background: #496a9e; border-color: #3e5986; border-radius: 24px; }
.item-list { max-height: 343px; gap: 8px; }
.item-row { min-height: 47px; border-radius: 12px; background: #fcfcfd; }
.entry-art { display: inline-grid; place-items: center; flex: none; width: 31px; height: 31px; border-radius: 9px; background: color-mix(in srgb, var(--swatch) 28%, white); }
.entry-art .clay-art { width: 34px; height: 34px; }
.history-symbol .clay-art { width: 32px; height: 32px; }
.entry-art:empty { width: 12px; height: 12px; border-radius: 50%; background: var(--swatch); }
.preset-picture .clay-art { width: 98%; height: 98%; }
.add-row { margin-top: 17px; }
body[data-mode="names"] .preset-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.play-board[data-topic="cafe"] { background: radial-gradient(ellipse at 50% 35%,#fffdfa,#f4e9dc); border-color: #e6dacc; }
.play-board[data-topic="choice"], .play-board[data-roster="speech"] { background: radial-gradient(ellipse at 50% 35%,#fffafe,#efeaf7); border-color: #e1d9e9; }
.play-board[data-roster="team"] { background: radial-gradient(ellipse at 50% 35%,#fffef9,#f5edda); border-color: #e9dfc9; }
.play-board[data-roster="personal"] { background: radial-gradient(ellipse at 50% 35%,#fffefb,#e8eff9); }
.roster-scene { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.roster-object { display: grid; justify-items: center; justify-content: center; align-items: center; position: relative; width: 88%; max-height: 80%; gap: 10px; }
.roster-illustration .clay-art { width: clamp(110px, 16vw, 166px); height: auto; filter: drop-shadow(2px 9px 7px #4b578723); }
.roster-object strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(1.1rem,2vw,1.45rem); letter-spacing: -.045em; color: #374763; padding: 7px 22px; border-radius: 18px; background: linear-gradient(#fffefa,#f7f6fd); box-shadow: inset 0 1px 1px white, inset 0 -2px 2px #cdd1df80, 0 4px 9px #565b7520; }
.roster-tags { position: absolute; bottom: 5%; display: flex; justify-content: center; align-items: center; gap: 5px; width: 100%; }
.roster-tags span, .roster-tags small { padding: 4px 9px; border-radius: 20px; background: #ffffffe0; color: #526177; border: 1px solid #d6dfe8; font-size: .82rem; }
.roster-tags span { max-width: 25%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-playing .roster-illustration { animation: bob .42s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-5px) rotate(3deg); } }
.winner-sheet { position: relative; overflow: hidden; border-radius: 20px; text-align: center; background: #fff; }
.winner-sheet .close-result { position: absolute; z-index: 1; right: 13px; top: 13px; background: #ffffffdf; border-color: #e1e4ea; }
.result-dialog { width: min(410px, calc(100% - 32px)); border: 0; border-radius: 26px; }
.winner-poster {
  --tint: #f2dbac; position: relative; display: grid; justify-items: center; gap: 17px;
  padding: 38px 22px 25px; background: linear-gradient(180deg,color-mix(in srgb,var(--tint) 62%,white),#fff 96%);
}
.winner-poster[data-theme="cafe"] { --tint: #eac9ae; }
.winner-poster:is([data-theme="personal"],[data-theme="group"],[data-theme="team"]) { --tint: #bedfd7; }
.winner-poster:is([data-theme="choice"],[data-theme="speech"]) { --tint: #d9cbee; }
.winner-medal {
  position: relative; display: grid; place-items: center; width: 112px; aspect-ratio: 1; border-radius: 50%;
  background: linear-gradient(145deg,#ffffffed,color-mix(in srgb,var(--tint) 40%,white)); border: 2px solid #fff;
  outline: 1px dashed color-mix(in srgb,var(--tint) 75%,#907c6d); outline-offset: 5px;
  box-shadow: 0 8px 20px #43547517, inset 0 -4px 8px #70644b0a;
}
.winner-medal .clay-art { width: 82%; height: 82%; filter: drop-shadow(0 4px 2px #54495721); }
.result-dialog::backdrop {
  background: radial-gradient(ellipse at 8% 100%,#efbd9b60,transparent 50%), radial-gradient(ellipse at 94% 85%,#b5afd863,transparent 55%), #30394863;
}
#result-content { position: relative; z-index: 1; }
.celebration { position: fixed; inset: 0; overflow: hidden; pointer-events: none; user-select: none; z-index: 8; }
.result-dialog > .celebration { z-index: 0; }
.firework { position: absolute; --radius: clamp(34px, 6vmin, 70px); }
.winner-poster, .stage-art { isolation: isolate; }
.result-bloom { --radius: clamp(100px, 15vmin, 145px); z-index: -1; pointer-events: none; }
.result-bloom b:nth-child(3n+1) { --color: #eeae59; }
.result-bloom b:nth-child(3n+2) { --color: #ee91a2; }
.result-bloom b:nth-child(3n) { --color: #8a9cd9; }
.firework.result-bloom b::after { width: 5px; height: 22px; }
.firework b { position: absolute; width: 0; height: 0; transform: rotate(var(--angle)); }
.firework b::after {
  content: ''; position: absolute; left: -2px; bottom: 0; width: 4px; height: 15px; border-radius: 70%;
  background: linear-gradient(to bottom, #fff9df, var(--color) 45%, transparent);
  box-shadow: 0 -3px 4px #fff1c7a0; transform-origin: bottom;
  animation: spark-bloom 1.1s var(--delay) both;
}
@keyframes spark-bloom {
  0% { opacity: 0; transform: translateY(0) scale(.25); }
  13% { opacity: 1; }
  55% { opacity: .95; transform: translateY(calc(-.78 * var(--radius) * var(--reach))) scale(1); }
  100% { opacity: 0; transform: translateY(calc(-1 * var(--radius) * var(--reach))) scale(.45); }
}
.celebration i { position: absolute; top: 96%; width: 9px; height: 15px; animation: confetti-flight var(--duration) var(--delay) both; }
.celebration i::before { content: ''; display: block; width: 100%; height: 100%; border-radius: 3px; background: linear-gradient(115deg,#ffffff77,transparent 50%,#794e7729), var(--color); animation: confetti-flutter calc(var(--duration) * .37) calc(var(--delay) * -3) ease-in-out infinite alternate; }
.celebration i:nth-child(4n) { width: 8px; height: 8px; }
.celebration i:nth-child(4n)::before { border-radius: 50%; }
.celebration i:nth-child(5n) { width: 11px; height: 32px; }
.celebration i:nth-child(5n)::before { background: radial-gradient(ellipse at 50% 50%,transparent 38%,var(--color) 44% 64%,transparent 71%) 0 0 / 100% 12px repeat-y; }
@keyframes confetti-flight {
  0% { opacity: 0; transform: translate(0,8vh); animation-timing-function: cubic-bezier(.12,.65,.32,1); }
  4% { opacity: 1; }
  44% { transform: translate(calc(var(--across) * .74),var(--rise)); animation-timing-function: cubic-bezier(.42,0,.78,.52); }
  77% { opacity: .96; }
  100% { opacity: 0; transform: translate(var(--across),13vh); }
}
@keyframes confetti-flutter {
  from { transform: rotate(var(--tilt)) rotateY(12deg); }
  to { transform: rotate(calc(var(--tilt) + 160deg)) rotateY(72deg); }
}
@media (prefers-reduced-motion: reduce) {
  .celebration, .result-bloom { display: none; }
  .is-playing .revealed .flip-card { animation: none; }
}
.winner-text { min-width: 0; }
.winner-caption { color: #51627a; font-size: .88rem; font-weight: 650; }
.winner-text .result-value { margin: 5px 0 0; font-size: clamp(1.65rem,5vw,2.35rem); line-height: 1.2; letter-spacing: -.04em; text-wrap: balance; }
.winner-remaining { color: #607086; margin-top: 12px; font-size: .84rem; }
.winner-sheet .dialog-actions { margin: 0 20px; padding: 17px 0 21px; border-top: 1px dashed #c4cfdc; }
.winner-sheet .dialog-actions button { min-height: 44px; }
.winner-sheet .dialog-primary { flex: 1.65; }
.dialog-primary .ico { width: 13px; height: 13px; margin-inline-end: 7px; }
.result-dialog[open] .winner-medal, .has-result .number-outcome { animation: appear .35s ease-out; }
.has-result .number-outcome {
  flex-direction: column; gap: 3px; bottom: 0; max-width: 100%; padding: 7px 16px 9px; border: 1px solid #d5dfeb;
  border-radius: 16px; background: #fffffff2; box-shadow: 0 3px 10px #42506b12;
}
.outcome-caption { font-size: .74rem; font-weight: 600; color: #5d6b7e; }
.outcome-values { display: flex; align-items: center; justify-content: center; gap: clamp(3px,1vw,7px); }
.outcome-values strong { font-size: 1.2rem; }
@media(max-width:760px) { body[data-mode="names"] .preset-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }

.round-options { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; margin-top: 19px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .86rem; color: #475972; }
.round-options label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; font-weight: 600; }
.round-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.round-options .remaining { margin-left: auto; color: #5b6980; }
.round-options button { color: #365b92; text-decoration: underline; text-underline-offset: 3px; }
.item-row[data-drawn="true"] .item-input, .face-option[data-drawn="true"] small { color: #7b8290; text-decoration: line-through; }
.item-row[data-drawn="true"] .entry-art, .face-option[data-drawn="true"] .pip-tile { opacity: .5; }
/* Rounded surfaces share the soft upper-left light of the illustrations. */
body { background: linear-gradient(160deg,#fdfdfd,#f3f5fa); }
.app-header { background: #fefeff; }
.main-nav { background: #eef1f6; box-shadow: inset 1px 2px 3px #5d6e8c0e; }
.main-nav a[aria-current="page"], .history-button { box-shadow: inset 0 1px 0 white, 0 2px 4px #34496818; }
.play-board { background: radial-gradient(ellipse at 41% 28%,#fcfdff 0,#eef2fc 57%,#e1e9f7); }
.play-board, .settings { border-radius: 28px; box-shadow: inset 0 2px 1px #ffffffd9, 0 8px 24px #475b780c; }
.cloud { opacity: .45; filter: blur(1px) drop-shadow(1px 3px 3px #97a7c030); }
.play-board[data-mode="roulette"] {
  --canopy: #c2dccc;
  --studio: #e3efe6;
  background: radial-gradient(ellipse at 49% 38%, #fffdf5 8%, #faf9ef 39%, var(--studio) 100%);
  border-color: color-mix(in srgb, var(--canopy) 65%, white);
}
.play-board[data-topic="cafe"] { --canopy: #e6cbb3; --studio: #f2e6da; }
.play-board[data-topic="choice"] { --canopy: #d6cbe7; --studio: #eee9f4; }
.play-board[data-mode="roulette"] .scenery > i { display: none; }
.play-board[data-mode="roulette"] .scenery::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 24px;
  background: linear-gradient(#ffffff55, transparent 55%, #75614b12), repeating-linear-gradient(90deg,var(--canopy) 0 28px,#fff9eb 28px 56px);
  mask: linear-gradient(#000 0 0) top / 100% 14px no-repeat, radial-gradient(ellipse 50% 100% at 50% 0,#000 97%,transparent) left bottom / 28px 11px repeat-x;
}
.play-board[data-mode="roulette"] .scenery::after {
  content: ''; position: absolute; inset: auto 0 0; height: 23%; opacity: .37;
  background: linear-gradient(90deg,var(--canopy) 1px,transparent 1px), linear-gradient(var(--canopy) 1px,transparent 1px);
  background-size: 36px 20px;
  mask: linear-gradient(transparent,#000);
  transform: perspective(160px) rotateX(26deg) scale(1.3); transform-origin: bottom center;
}
@media (min-width: 761px) {
  .play-board[data-mode="roulette"] .stage-art { width: min(100%, 450px); }
}
.hill { filter: blur(5px); opacity: .65; }
.play-button, .dialog-primary { background: linear-gradient(160deg,#617cb4,#49659c 74%); border: 1px solid #4f689a; box-shadow: inset 0 2px 2px #ffffff4a, inset 0 -2px 2px #304a782e, 0 3px 0 #3d5684, 0 6px 12px #3d54842b; }
.play-button:hover:not(:disabled), .dialog-primary:hover { background: linear-gradient(160deg,#5c77ac,#3e5a90); }
.item-list { gap: 0; margin: 0; padding: 0 6px; max-height: 340px; border: 1px solid var(--line); border-radius: 15px; scrollbar-color: #b7c6d6 transparent; }
.item-row { min-height: 53px; gap: 5px; padding: 4px; border: 0; border-radius: 0; background: #fff; }
.item-row + .item-row { border-top: 1px solid #e7edf3; }
.item-row:hover, .item-row:focus-within { background: #f5f8fc; }
.item-row.is-target { box-shadow: inset 0 2px var(--accent); }
.item-input { font-size: 1rem; font-weight: 600; padding-inline: 4px; text-overflow: ellipsis; }
.item-input:focus-visible { outline: 2px solid #7190bc; outline-offset: -1px; border-radius: 5px; }
.entry-art { width: 37px; height: 37px; background: color-mix(in srgb, var(--swatch) 32%, white); border-radius: 12px; }
.entry-art .ico { color: #495b73; width: 18px; height: 18px; }
.drag, .remove-item { justify-content: center; width: 29px; height: 34px; flex: none; color: #77869a; border-radius: 7px; }
.drag:hover { color: var(--accent-dark); background: #e7edf7; }
.remove-item:hover { color: #973f42; background: #faeaeb; }
.settings-heading { margin-bottom: 13px; }
.settings-heading .text-button { background: #f2f5f9; border-radius: 9px; padding: 7px 9px; }
.round-options .remaining { font-variant-numeric: tabular-nums; }
.game-history li { padding: 10px 2px; border-bottom: 1px solid #edf0f4; font-variant-numeric: tabular-nums; }
.preset-card { border-radius: 17px; background: linear-gradient(145deg,#fff,#fbfcfe); box-shadow: inset 0 2px 1px white, 0 4px 10px #40547709; }
.preset-card[aria-pressed="true"], .game-link[aria-current="page"] { border-color: #a6badb; background: linear-gradient(150deg,#f9fbff,#edf2fa); }
.preset-picture { border-radius: 14px; box-shadow: inset 1px 2px 3px #ffffff99, inset -1px -2px 3px #55658213; }
.add-button, .dialog-secondary { background: linear-gradient(#f1f5fc,#e5ebf6); box-shadow: inset 0 1px 1px white, 0 1px 2px #4d648119; }
.die-face { border: 1px solid #acb9ca; background: linear-gradient(145deg,#fffefb,#f0f2fa 64%,#d3dfed); box-shadow: inset 2px 3px 5px white, inset -3px -5px 7px #7288a530; }
.face-2 { background: linear-gradient(150deg,#fffefa,#e7ebf4); }
.face-3,.face-4 { background: linear-gradient(140deg,#f2f6fc,#bfcfe3); }
.die-face i, .pip-tile i { background: #526986; box-shadow: inset 1px 2px 2px #2d426956, 0 1px 1px #ffffffc9; }
.face-1 i { background: #d78073; }
.pip-tile { background: linear-gradient(150deg,#fff,#e8eef6); border-color: #b5c2d3; box-shadow: 1px 2px 3px #37547817; }
.lotto-slot:not(.empty) { background-image: radial-gradient(ellipse at 30% 18%,#ffffffaa,transparent 52%,#4961782a); box-shadow: inset -1px -3px 4px #43586421, 0 2px 3px #37547812; }
.stack-sheet, .card-front, .card-back { border-width: 1px; border-color: #95a3be; border-radius: 19px; }
.stack-sheet { box-shadow: inset 1px 2px 2px #ffffffb0, inset -2px -2px 3px #62678126, 1px 3px 4px #6c688124; }
.card-back { background: linear-gradient(145deg,#aebce5,#879dca 70%,#748fbe); box-shadow: inset 0 0 0 5px #e7edf9,inset 0 0 0 7px #a4b3d0, 0 4px 5px #67779335; }
.card-emblem { width: 61%; background: transparent; border: 0; }
.card-emblem .clay-art { width: 100%; height: 100%; }
.history-list li { min-height: 61px; }
.preset-copy { min-width: 0; overflow-wrap: anywhere; }
@media(min-width:1500px) { .main-shell { padding-top: 45px; } .stage-art { width: 430px; } }
@media(max-width:1050px) { .header-inner,.main-shell { width: calc(100% - 56px); } .header-inner { gap: 28px; } .workspace { grid-template-columns: minmax(0,1.5fr) minmax(295px,1fr); gap: 16px; } .settings { padding: 19px; } .main-nav a { padding-inline: 11px; } }
@media(max-width:760px) { .header-inner,.main-shell { width: calc(100% - 32px); } .header-inner { min-height: 0; display: grid; grid-template-columns: 1fr auto; gap: 0; padding-top: 11px; } .brand { font-size: 1.4rem; gap: 6px; justify-self: start; } .brand img { width: 32px; height: 32px; } .history-button { grid-row: 1; grid-column: 2; padding: 7px 10px; } .main-nav { grid-row: 2; grid-column: 1/-1; margin: 10px 0 8px; gap: 4px; } .main-nav a { flex: 1; font-size: .88rem; padding: 8px 5px; gap: 6px; } .main-nav .ico { width: 16px; height: 16px; } .main-shell { padding-top: 23px; } .workspace { grid-template-columns: 1fr; } .play-board { min-height: auto; padding: 30px 14px 21px; } .stage-art { width: min(85%, 365px); } .settings { padding: 20px; } .presets { margin-top: 22px; } .preset-grid { gap: 8px; } .preset-card { padding: 12px 10px; gap: 8px; } .preset-picture { width: 33px; height: 33px; font-size: 1.3rem; border-radius: 9px; } .preset-action { display: none; } }
@media(max-width:480px) { .stage-art { width: min(100%, 335px); } .play-button { min-width: 188px; padding: 11px 23px; font-size: 1.02rem; } .play-controls { gap: 7px; } .preset-grid { grid-template-columns: 1fr; } .preset-card { padding: 11px 14px; } .preset-picture { width: 40px; height: 40px; } .preset-action { display: block; } }
@media(max-width:760px) {
  .cloud-left { left: -8%; scale: .65; } .cloud-right { right: -7%; scale: .55; }
}
@media(pointer:coarse) { .keyboard-hint { display: none; } .play-controls { padding-bottom: 3px; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
