:root {
  color-scheme: light;
  --ink: #f1f5ff;
  --muted: #aeb9cc;
  --line: rgba(220,235,255,.08);
  --paper: rgba(15,19,29,.62);
  --canvas: #fff;
  --glow: rgba(192,220,255,.75);
  --japanese-font: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-family: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

@property --selection-ring-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #fff;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100% - 48px, 1640px); margin: 0 auto; }
.topbar {
  position: relative;
  display: flex;
  height: 74px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(220,235,255,.055);
}
.header-emblem { position: absolute; top: 50%; left: calc(50% - 8px); display: flex; align-items: end; gap: 7px; transform: translate(-50%, -50%); white-space: nowrap; }
.header-emblem-label { margin-bottom: 5px; color: #000; font: 500 11px/1 var(--japanese-font); }
.header-emblem-image { display: block; width: 90px; height: 49px; overflow: hidden; background: #fff; }
.header-emblem-image img { display: block; width: 100%; height: auto; }
.elapsed-timer { position: absolute; left: calc(25% + 66px); bottom: 15px; display: inline-flex; align-items: baseline; gap: 2px; padding: 0; border: 0; color: #000; background: transparent; font: 600 11px/1 var(--japanese-font); white-space: nowrap; transform: translateX(-50%); cursor: pointer; }
.elapsed-timer-number { font-size: 26px; font-weight: 800; line-height: 1; }
.elapsed-timer.is-stopped .elapsed-timer-number { color: #d12b3b; font-size: 30px; }
.elapsed-timer:hover { color: #000; }
.elapsed-timer:focus-visible { outline: 1px solid #000; outline-offset: 4px; }
.disqualification-rule { position: absolute; left: calc(75% - 34px); bottom: 15px; display: inline-flex; align-items: baseline; gap: 2px; color: #000; white-space: nowrap; transform: translateX(-50%); }
.disqualification-rule strong { color: #d12b3b; font: 800 44px/1 var(--japanese-font); }
.disqualification-rule > span { font: 600 11px/1 var(--japanese-font); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #f8fbff; text-decoration: none; font-size: 15px; text-shadow: 0 0 10px rgba(192,220,255,.48); }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0 8px 0 0;
  appearance: none;
  border: 1px solid rgba(205,229,255,.2);
  border-radius: 0;
  color: #fff;
  background-color: #121823;
  background-image: linear-gradient(45deg, transparent 50%, #aebbd0 50%), linear-gradient(135deg, #aebbd0 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 6px) 15px, calc(100% - 3px) 15px;
  background-size: 3px 3px;
  font: 700 20px/1 var(--japanese-font);
  text-align: center;
  text-align-last: center;
  text-shadow: 0 0 7px #fff, 0 0 18px rgba(155,207,255,.92);
  box-shadow: none;
  cursor: pointer;
}
.brand-mark option, .question-heading option { color: #f1f5ff; background: #141923; text-shadow: none; }
.brand-mark:focus-visible, .question-heading:focus-visible { outline: 1px solid rgba(205,229,255,.65); outline-offset: 3px; }
.question-heading { width: 100px; height: 28px; margin-left: 7px; padding: 0 14px 0 12px; appearance: none; border: 0; border-left: 1px solid rgba(220,235,255,.1); border-radius: 0; color: #c7d4e9; background-color: transparent; background-image: linear-gradient(45deg, transparent 50%, #9eacc1 50%), linear-gradient(135deg, #9eacc1 50%, transparent 50%); background-repeat: no-repeat; background-position: calc(100% - 6px) 12px, calc(100% - 3px) 12px; background-size: 3px 3px; font-size: 15px; font-weight: 500; white-space: nowrap; text-shadow: 0 0 8px rgba(192,220,255,.7); cursor: pointer; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0;
  color: #dce8fa;
  background: transparent;
  font-size: 23px;
  text-shadow: 0 0 9px rgba(190,218,255,.72);
  cursor: pointer;
}
.icon-button:hover { border-color: rgba(220,235,255,.09); color: #fff; background: rgba(255,255,255,.04); box-shadow: 0 0 18px rgba(124,173,255,.12); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; filter: drop-shadow(0 0 4px rgba(190,218,255,.8)); }
.icon-button svg.settings-gear { width: 19px; height: 19px; fill: currentColor; stroke: none; filter: drop-shadow(0 0 4px rgba(190,218,255,.65)); }
#settingsButton, #settingsButton:hover { box-shadow: none; text-shadow: none; }
#settingsButton .settings-gear { filter: none; }
.help-button { border-color: rgba(190,218,255,.12); border-radius: 50%; font: 700 17px/1 var(--japanese-font); }
.help-dialog { width: min(620px, calc(100% - 28px)); max-height: min(90vh, 780px); overflow-y: auto; padding: 0; border: 1px solid rgba(214,232,255,.1); border-radius: 0; color: #f2f6ff; background: #141923; box-shadow: 0 18px 48px rgba(0,0,0,.65); }
.help-dialog::backdrop { background: rgba(1,3,7,.78); backdrop-filter: blur(4px); }
.help-form { display: grid; gap: 16px; padding: 21px; }
.help-section { display: grid; gap: 7px; }
.help-section h2 { margin: 0; padding-bottom: 5px; border-bottom: 1px solid rgba(220,235,255,.1); color: #dbe9ff; font-size: 12px; text-shadow: 0 0 8px rgba(120,171,255,.35); }
.help-list { display: grid; gap: 5px; margin: 0; }
.help-list > div { display: grid; grid-template-columns: minmax(145px,.7fr) minmax(0,1fr); gap: 12px; align-items: baseline; padding: 3px 0; }
.help-list dt { color: #edf4ff; font-size: 11px; font-weight: 600; }
.help-list dd { margin: 0; color: #b9c7dc; font-size: 11px; line-height: 1.55; }
.help-list kbd { display: inline-block; padding: 2px 5px; border: 1px solid #354155; border-radius: 3px; color: #eaf2ff; background: #151c27; font: 10px var(--japanese-font); white-space: nowrap; }
.help-note { margin: 0; color: #9baac0; font-size: 10px; }
main { position: relative; padding: 22px 0 38px; }
.prompt-stage { display: grid; width: min(100%, 1280px); grid-template-columns: 64px minmax(0,1fr) 64px; align-items: center; gap: 8px; margin: 0 auto; }
.prompt-card {
  display: flex;
  min-width: 0;
  height: 155px;
  min-height: 155px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: default;
}
.prompt-card.is-start-pending { cursor: pointer; }
.prompt-card.is-start-pending:hover, .prompt-card.is-start-pending:focus-visible { border: 0; box-shadow: none; outline: 0; }
.prompt-copy {
  min-width: 0;
  width: 88%;
  margin-inline: auto;
  text-align: center;
}
.topic-display {
  overflow-wrap: anywhere;
  color: #f8fbff;
  font-size: 36px;
  font-weight: 800;
  line-height: 1.35;
  text-shadow: 0 0 4px rgba(235,245,255,.46), 0 0 12px rgba(137,183,255,.22);
}
.provider-display { min-height: 1.4em; margin-top: 7px; color: #d3dced; font-size: 13px; line-height: 1.35; text-shadow: 0 0 9px rgba(173,207,255,.58); }
.provider-display > span { display: block; }
.provider-display > .group-display { margin-top: 2px; color: #9baac0; font-size: 9px; line-height: 1.2; opacity: .8; text-shadow: 0 0 6px rgba(173,207,255,.4); }
.round-message { position: absolute; top: 190px; left: 50%; z-index: 100; display: grid; width: min(760px, calc(100vw - 28px)); gap: 3px; justify-items: center; margin: 0; padding: 0 22px; border: 0; color: #1c2940; background: transparent; font-size: 15px; font-weight: 600; line-height: 1.45; text-align: center; pointer-events: none; transform: translateX(-50%); animation: sudden-death-fade 5s ease-in forwards; }
.round-message[hidden] { display: none; }
.round-message.is-result { opacity: 1; font-size: 14px; animation: winner-result-appear .35s ease-out both; }
@keyframes winner-result-appear { from { opacity: 0; } to { opacity: 1; } }
.round-message.is-result strong,
.round-message.is-result b { color: #e0b400; font-size: 19px; }
.round-message.is-result .elimination-result,
.round-message.is-result .elimination-result strong,
.round-message.is-result .elimination-result b { color: #c92e40; }
.round-message.is-result .elimination-result strong { font-size: 19px; }
@keyframes sudden-death-fade { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
.round-message strong { color: #c92e40; font-size: 24px; font-weight: 900; }
.round-message:not(.is-result) strong { color: #f28c28; }
.round-message b { color: #1769c2; font-size: 21px; font-weight: 800; }
.round-message:not(.is-result) b { font-size: 24px; }
.round-message .name-suffix { color: #000; font-size: 15px; font-weight: 600; }
.question-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}
.question-nav {
  display: grid;
  width: 64px;
  height: 100px;
  place-items: center;
  padding: 0;
  border: 0;
  color: #17243a;
  background: transparent;
  font: 24px/1 var(--japanese-font);
  text-shadow: none;
  opacity: 0;
  transition: opacity .16s ease;
  cursor: pointer;
}
.question-nav:hover:not(:disabled), .question-nav:focus-visible { opacity: 1; }
.question-nav:focus-visible { outline: 0; text-decoration: underline; text-underline-offset: 4px; }
.question-nav:disabled { opacity: 0; cursor: default; }
@media (hover: none) {
  .question-nav:not(:disabled) { opacity: 1; }
}
.board-scroll { overflow-x: auto; margin-top: 20px; padding: 0 0 9px; scrollbar-color: rgba(176,204,245,.26) transparent; scrollbar-width: thin; }
.scoreboard {
  --player-count: 4;
  --score-baseline-top: 529px;
  position: relative;
  display: grid;
  min-width: max(100%, calc(var(--player-count) * 170px + (var(--player-count) - 1) * 13px));
  grid-template-columns: repeat(var(--player-count), minmax(150px,1fr));
  gap: 13px;
  align-items: stretch;
}
.scoreboard::before { position: absolute; top: calc(var(--score-baseline-top) - var(--disqualification-line-height, 0px)); right: 0; left: 0; z-index: 4; height: 1.5px; content: ""; background: linear-gradient(90deg, transparent, #338fe9 8%, #65b8ff 50%, #338fe9 92%, transparent); filter: drop-shadow(0 0 1px rgba(50,134,236,.85)) drop-shadow(0 0 3px rgba(35,111,222,.5)); opacity: 0; pointer-events: none; transform: translateY(-.75px); }
.scoreboard.has-disqualification-line::before { opacity: 1; }
.scoreboard.has-elimination-warning::before { background: linear-gradient(90deg, transparent, #ff4055 8%, #ff6978 50%, #ff4055 92%, transparent); filter: drop-shadow(0 0 1px rgba(233,25,48,.9)) drop-shadow(0 0 3px rgba(224,20,44,.55)); }
.scoreboard::after { position: absolute; top: var(--score-baseline-top); right: 0; left: 0; z-index: 3; height: 1px; content: ""; background: rgba(239,245,255,.42); pointer-events: none; }
.player-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 535px;
  flex-direction: column;
  align-items: center;
  padding: 19px 14px 15px;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transition: box-shadow .18s ease, background .18s ease;
}
.player-card.is-selected { background: transparent; box-shadow: none; }
.player-key {
  position: static;
  min-width: 22px;
  height: 20px;
  margin: 2px 0 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  color: rgba(230,240,255,.68);
  background: transparent;
  font: 11px/20px var(--japanese-font);
  text-shadow: 0 0 6px rgba(193,221,255,.46);
  cursor: pointer;
}
.player-key:hover { color: #fff; text-shadow: 0 0 6px #fff, 0 0 15px rgba(147,197,255,.95); }
.scoreboard.needs-selection .player-key { animation: key-pulse .32s ease-in-out 2; color: #fff; text-shadow: 0 0 7px #fff, 0 0 20px rgba(147,197,255,1); }
@keyframes key-pulse { 50% { transform: scale(1.28); } }
.total-value {
  position: absolute;
  right: 0;
  bottom: calc(var(--stack-height, 0px) + 7px);
  left: 0;
  z-index: 5;
  width: 100%;
  padding: 0;
  color: rgb(var(--total-rgb, 255,255,255));
  font-family: var(--japanese-font);
  font-size: var(--total-font-size, 32px);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.045em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 var(--total-glow-small, 5px) rgba(var(--total-rgb, 255,255,255),.95), 0 0 var(--total-glow-large, 12px) rgba(var(--total-rgb, 139,188,255),var(--total-glow-opacity, .55));
}
.elimination-warning { position: absolute; bottom: calc(100% + 3px); left: 50%; display: block; color: #d12b3b; font-family: inherit; font-size: min(34px, var(--total-font-size, 32px)); font-weight: inherit; line-height: 1; letter-spacing: 0; white-space: nowrap; transform: translateX(-50%); animation: elimination-warning-blink 1.6s ease-in-out infinite; }
@keyframes elimination-warning-blink {
  0%, 15%, 85%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
.score-viewport {
  position: relative;
  width: 100%;
  height: 510px;
  min-height: 510px;
  flex: 0 0 510px;
  overflow: hidden;
}
.score-list { position: absolute; right: 0; bottom: 0; left: 0; width: 100%; min-height: 0; margin: 0; padding: 0; list-style: none; }
.score-entry {
  position: absolute;
  right: 0;
  bottom: var(--block-bottom);
  left: 0;
  display: grid;
  height: var(--block-height);
  place-items: center;
  overflow: visible;
  border: 1px solid #77879d;
  border-radius: 3px;
  color: #fff;
  background: rgba(51,64,82,.42);
  box-shadow: 0 0 6px rgba(180,210,255,.2);
}
.score-entry::after { display: none; }
.score-entry.score-green { border-color: #55df83; background: rgba(20,122,58,.42); box-shadow: 0 0 6px rgba(85,223,131,.24), 0 0 12px rgba(85,223,131,.1); }
.score-entry.score-blue { border-color: #6aaeff; background: rgba(35,91,158,.44); box-shadow: 0 0 6px rgba(106,174,255,.3), 0 0 12px rgba(106,174,255,.14); }
.score-entry.score-yellow { border-color: #e7c83d; background: rgba(150,117,0,.42); box-shadow: 0 0 6px rgba(231,200,61,.24), 0 0 12px rgba(231,200,61,.1); }
.score-entry.score-red { border-color: #ef737b; background: rgba(168,39,53,.42); box-shadow: 0 0 6px rgba(239,115,123,.24), 0 0 12px rgba(239,115,123,.1); }
.score-entry.score-gray { border-color: #aeb8c5; background: rgba(102,114,130,.5); box-shadow: 0 0 6px rgba(125,139,158,.24), 0 0 12px rgba(125,139,158,.1); }
.entry-value { position: relative; z-index: 4; display: block; padding: 0; border: 0; color: #fff; background: transparent; font-family: var(--japanese-font); font-size: 14px; font-weight: 700; line-height: 1.15; text-align: center; text-shadow: none; }
.score-entry.is-new { z-index: 2; animation: score-grow-up .58s cubic-bezier(.16,.92,.28,1) both; }
.score-entry.is-new .entry-value { animation: score-grow-label .58s ease-out both; }
@keyframes score-grow-up {
  from { height: 2px; }
  to { height: var(--block-height); }
}
@keyframes score-grow-label {
  0%, 48% { opacity: 0; }
  100% { opacity: 1; }
}
.score-entry.is-new::before { content: ""; position: absolute; right: 0; bottom: calc(100% - 1px); left: 0; z-index: 3; width: 100%; height: clamp(90px, 22vh, 190px); background: linear-gradient(to top, rgba(51,64,82,.78) 0%, rgba(51,64,82,.42) 38%, rgba(51,64,82,.14) 72%, rgba(51,64,82,0) 100%); -webkit-mask-image: linear-gradient(to top, #000 0%, #000 48%, transparent 100%); mask-image: linear-gradient(to top, #000 0%, #000 48%, transparent 100%); animation: score-trail .56s linear both; pointer-events: none; }
.score-entry.score-green.is-new::before { background: linear-gradient(to top, rgba(20,122,58,.82) 0%, rgba(20,122,58,.44) 38%, rgba(20,122,58,.14) 72%, rgba(20,122,58,0) 100%); }
.score-entry.score-blue.is-new::before { background: linear-gradient(to top, rgba(35,91,158,.84) 0%, rgba(35,91,158,.46) 38%, rgba(35,91,158,.14) 72%, rgba(35,91,158,0) 100%); }
.score-entry.score-yellow.is-new::before { background: linear-gradient(to top, rgba(150,117,0,.82) 0%, rgba(150,117,0,.44) 38%, rgba(150,117,0,.14) 72%, rgba(150,117,0,0) 100%); }
.score-entry.score-red.is-new::before { background: linear-gradient(to top, rgba(168,39,53,.82) 0%, rgba(168,39,53,.44) 38%, rgba(168,39,53,.14) 72%, rgba(168,39,53,0) 100%); }
.score-entry.score-gray.is-new::before { background: linear-gradient(to top, rgba(102,114,130,.82) 0%, rgba(102,114,130,.44) 38%, rgba(102,114,130,.14) 72%, rgba(102,114,130,0) 100%); }
@keyframes score-trail {
  0% { opacity: 0; }
  10% { opacity: .9; }
  25% { opacity: .82; }
  50% { opacity: .64; }
  75% { opacity: .36; }
  100% { opacity: 0; }
}
.player-name-wrap { position: relative; display: flex; width: 100%; justify-content: center; margin: 15px 0 0; overflow: visible; }
.player-name { width: 100%; overflow: hidden; margin: 0; color: #fff; font-size: 16px; font-weight: 700; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.player-card.is-selected .player-name { color: #fff; text-shadow: 0 0 7px var(--player-glow, #fff), 0 0 18px var(--player-glow, #fff), 0 0 32px var(--player-glow, #fff); }
.player-card.is-eliminated .score-entry, .player-card.is-eliminated .total-value { opacity: .27; }
.player-card.is-eliminated .player-name { color: #fff; opacity: .35; text-shadow: none; }
.player-card.is-newly-eliminated .score-entry, .player-card.is-newly-eliminated .total-value { animation: elimination-fade 1.5s ease-out both; }
.player-card.is-newly-eliminated .player-name { animation: elimination-name-fade 1.5s ease-out both; }
.player-card.is-newly-eliminated .player-key { animation: elimination-key-fade 1.5s ease-out both; }
@keyframes elimination-fade { from { opacity: 1; } to { opacity: .27; } }
@keyframes elimination-name-fade { from { opacity: 1; } to { opacity: .35; } }
@keyframes elimination-key-fade { from { opacity: 1; } to { opacity: .28; } }
.player-card.is-eliminated .player-key { opacity: .28; cursor: default; }
.player-key:disabled { opacity: .28; cursor: default; }

.settings-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(90vh, 780px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid rgba(214,232,255,.1);
  border-radius: 0;
  color: #f2f6ff;
  background: #141923;
  box-shadow: 0 18px 48px rgba(0,0,0,.65);
}
.settings-dialog::backdrop { background: rgba(1,3,7,.78); backdrop-filter: blur(4px); }
.settings-form { display: grid; gap: 9px; padding: 21px; }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.settings-header h1 { margin: 0; color: #fff; font-size: 18px; font-weight: 700; text-shadow: 0 0 11px rgba(201,225,255,.8); }
.close-button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 1px solid #354155; border-radius: 0; color: #edf4ff; background: #151c27; font-size: 22px; text-shadow: 0 0 8px #fff; cursor: pointer; }
.field-label { display: grid; gap: 5px; color: #d4e0f3; font-size: 11px; font-weight: 600; text-shadow: 0 0 7px rgba(170,208,255,.5); }
.field-label input, .field-label textarea, .field-label select, .name-field input, .prompt-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 0;
  outline: 0;
  color: #fff;
  background: #18202c;
  font-size: 13px;
  box-shadow: inset 0 0 15px rgba(150,190,255,.035);
}
.field-label input, .field-label select, .name-field input { height: 36px; padding: 0 10px; }
.field-label textarea { min-height: 66px; resize: vertical; padding: 8px 10px; line-height: 1.5; }
.field-label input:focus, .field-label textarea:focus, .field-label select:focus, .name-field input:focus, .prompt-row input:focus { box-shadow: 0 0 13px rgba(139,188,255,.19), inset 0 0 14px rgba(157,202,255,.08); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; margin-top: 5px; }
.settings-grid .field-label { gap: 5px; }
.settings-tabs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 8px; border-bottom: 1px solid rgba(220,235,255,.16); }
.settings-tab { min-height: 40px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: #91a3bb; background: transparent; font: 600 12px var(--japanese-font); cursor: pointer; }
.settings-tab[aria-selected="true"] { border-bottom-color: #e8f3ff; color: #fff; text-shadow: 0 0 8px rgba(220,238,255,.8); }
.settings-panel { display: grid; gap: 14px; padding-top: 12px; }
.settings-panel[hidden] { display: none; }
.question-count-setting { width: min(180px, 100%); }
.survivor-count-setting { width: min(180px, 100%); }
.survivor-count-field { display: flex; align-items: center; gap: 7px; }
.survivor-count-field input { width: 100px; }
.disqualification-settings { gap: 12px; min-width: 0; }
.disqualification-settings-note { margin: 0; color: #aebbd0; font-size: 11px; line-height: 1.6; }
.disqualification-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.disqualification-decrease-row { display: grid; gap: 5px; }
.disqualification-decrease-title { color: #d4e0f3; font-size: 11px; font-weight: 600; }
.disqualification-decrease-fields { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.disqualification-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.disqualification-field input { width: 76px; flex: 0 0 76px; }
.disqualification-field > span { color: #aebbd0; font-size: 11px; white-space: nowrap; }
.simultaneous-elimination-setting { min-width: 0; margin: 0; padding: 0; border: 0; }
.simultaneous-elimination-setting legend { padding: 0 0 7px; color: #d4e0f3; font-size: 11px; font-weight: 600; }
.simultaneous-elimination-setting label { display: inline-flex; align-items: center; gap: 6px; margin-right: 20px; color: #d4e0f3; font-size: 11px; cursor: pointer; }
.simultaneous-elimination-setting input { margin: 0; accent-color: #4276b4; }
.name-settings-header { display: flex; align-items: center; gap: 8px; margin-top: 5px; color: #d4e0f3; font-size: 11px; }
.name-settings-header > span { margin-left: auto; color: #9baac0; font-size: 10px; }
.randomize-button { min-height: 30px; padding: 0 9px; border: 1px solid #354155; border-radius: 0; color: #edf4ff; background: #151c27; font-size: 10px; text-shadow: 0 0 7px rgba(220,235,255,.5); cursor: pointer; }
.randomize-button:hover { border-color: #6e83a1; background: #1b2635; }
.name-groups { display: grid; gap: 9px; }
.name-group { display: grid; gap: 5px; }
.name-group h2 { margin: 0; padding-top: 7px; border-top: 1px solid rgba(220,235,255,.08); color: #e7f0ff; font: 700 11px var(--japanese-font); text-shadow: 0 0 7px rgba(160,204,255,.55); }
.block-name-input { width: 100px; height: 26px; margin-right: 5px; padding: 0 6px; border: 1px solid rgba(220,235,255,.14); border-radius: 0; outline: 0; color: #fff; background: #18202c; font: 700 11px var(--japanese-font); }
.block-name-input:focus { border-color: rgba(205,229,255,.55); box-shadow: 0 0 10px rgba(139,188,255,.18); }
.name-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.name-field { display: flex; align-items: center; gap: 7px; min-width: 0; }
.name-field > span { width: 14px; flex: 0 0 14px; color: #d4e5ff; font: 9px var(--japanese-font); text-align: center; text-shadow: 0 0 7px rgba(194,222,255,.9); }
.prompt-source-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: #b8c8e0; font-size: 11px; }
.prompt-source-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.prompt-source-row button:disabled { opacity: .55; cursor: wait; }
.prompt-fields { display: grid; gap: 13px; margin-top: 8px; }
.settings-block { display: grid; gap: 5px; }
.settings-block h2 { margin: 0 0 2px; padding-top: 9px; border-top: 1px solid rgba(220,235,255,.08); color: #e7f0ff; font: 700 12px var(--japanese-font); text-shadow: 0 0 8px rgba(160,204,255,.75); }
.prompt-row { display: grid; grid-template-columns: 37px minmax(0,1fr) minmax(105px,.52fr) minmax(80px,.36fr); align-items: center; gap: 7px; }
.prompt-row:not(.has-group) { grid-template-columns: 37px minmax(0,1fr) minmax(105px,.52fr); }
.prompt-row-title { color: #b8c8e0; font: 9px var(--japanese-font); text-align: center; text-shadow: 0 0 6px rgba(180,215,255,.58); }
.prompt-row-labels { color: #cbd9ed; font-size: 9px; text-shadow: 0 0 6px rgba(180,215,255,.5); }
.prompt-row-labels > span { padding-left: 8px; }
.prompt-row input { height: 32px; padding: 0 8px; font-size: 11px; }
.prompt-row input::placeholder { color: rgba(221,234,252,.45); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; padding: 9px 13px; border: 1px solid #354155; border-radius: 0; color: #fff; background: #151c27; font-size: 11px; text-shadow: 0 0 8px #fff; box-shadow: none; opacity: 0; pointer-events: none; transform: translateY(5px); transition: opacity .15s ease, transform .15s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

  position: relative;
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 9px;
  color: #1e2b40;
  text-shadow: none !important;
  background: transparent;
}
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  content: "";
  background: conic-gradient(from var(--selection-ring-angle), #000 0deg 300deg, #fff 325deg, #000 350deg 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: drop-shadow(0 0 4px rgba(255,255,255,1)) drop-shadow(0 0 10px rgba(255,255,255,.9));
  pointer-events: none;
  animation: selected-name-ring-spin 2.4s linear infinite;
}
@keyframes selected-name-ring-spin {
  to { --selection-ring-angle: 360deg; }
}

@media (min-width: 701px) and (max-width: 900px) {
  .topbar { height: auto; min-height: 74px; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto; row-gap: 6px; padding: 8px 0; }
  .brand { grid-column: 1; grid-row: 1; }
  .topbar-actions { grid-column: 2; grid-row: 1; }
  .elapsed-timer { position: relative; left: auto; bottom: auto; grid-column: 1; grid-row: 2; justify-self: start; transform: none; }
  .disqualification-rule { position: relative; left: auto; bottom: auto; grid-column: 2; grid-row: 2; justify-self: end; transform: none; }
}

@media (max-width: 700px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar { height: auto; min-height: 62px; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto; row-gap: 7px; padding: 8px 0; }
  .brand { gap: 7px; font-size: 13px; }
  .header-emblem { gap: 5px; }
  .header-emblem-image { width: 76px; height: 41px; }
  .elapsed-timer { position: relative; left: auto; bottom: auto; grid-column: 1; grid-row: 2; justify-self: start; gap: 1px; font-size: 9px; transform: none; }
  .elapsed-timer-number { font-size: 19px; }
  .elapsed-timer.is-stopped .elapsed-timer-number { font-size: 22px; }
  .disqualification-rule { position: relative; left: auto; bottom: auto; grid-column: 2; grid-row: 2; justify-self: end; transform: none; }
  .disqualification-rule strong { font-size: 36px; }
  .disqualification-rule > span { font-size: 10px; }
  .brand-mark { width: 29px; height: 29px; font-size: 18px; }
  .topbar-actions { grid-column: 2; grid-row: 1; }
  .question-heading { width: 86px; margin-left: 3px; padding-left: 8px; font-size: 12px; background-position: calc(100% - 6px) 12px, calc(100% - 3px) 12px; }
  main { padding-top: 14px; }
  .prompt-stage { grid-template-columns: 44px minmax(0,1fr) 44px; gap: 5px; }
  .prompt-card { height: 128px; min-height: 128px; padding: 12px 9px; }
  .topic-display { font-size: 28px; }
  .provider-display { font-size: 11px; }
  .provider-display > .group-display { font-size: 8px; }
  .question-controls { gap: 3px; }
  .question-nav { width: 44px; height: 84px; font-size: 21px; }
  .board-scroll { margin-right: -14px; }
  .scoreboard { --score-baseline-top: 527px; min-width: max(100%, calc(var(--player-count) * 145px + (var(--player-count) - 1) * 9px)); grid-template-columns: repeat(var(--player-count), minmax(137px,1fr)); gap: 9px; }
  .player-card { min-height: 480px; padding: 17px 11px 13px; }
  .score-viewport { height: 510px; min-height: 510px; flex: 0 0 510px; }
  .settings-form { padding: 17px; }
  .settings-tab { padding: 0 2px; font-size: 10px; white-space: nowrap; }
  .help-form { padding: 17px; }
  .help-list > div { grid-template-columns: minmax(115px,.7fr) minmax(0,1fr); gap: 8px; }
  .help-list dt, .help-list dd { font-size: 10px; }
  .settings-grid { gap: 6px; }
  .settings-grid .field-label { font-size: 10px; }
  .disqualification-settings-grid { grid-template-columns: 1fr; }
  .disqualification-field { gap: 4px; }
  .disqualification-field input { width: 64px; flex-basis: 64px; }
  .disqualification-field > span { font-size: 10px; }
  .prompt-row { grid-template-columns: 25px minmax(0,1fr) minmax(75px,.5fr) minmax(62px,.34fr); gap: 5px; }
  .prompt-row:not(.has-group) { grid-template-columns: 25px minmax(0,1fr) minmax(75px,.5fr); }
  .prompt-row input { height: 31px; padding: 0 6px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .score-entry.is-new, .score-entry.is-new .entry-value { animation-duration: .01ms !important; }
  .score-entry.is-new::before { animation-duration: .01ms !important; }
  .elimination-warning { animation: none !important; }
}

.brand { letter-spacing: .12em; }

body.is-light-theme {
  color-scheme: light;
  color: #1e2b40;
  background: #f5f7fb;
}
body.is-light-theme .topbar { border-bottom-color: rgba(36,55,82,.14); }
body.is-light-theme .brand { color: #17243a; text-shadow: 0 1px 0 rgba(255,255,255,.9); }
body.is-light-theme .brand-mark { border-color: #aebbd0; color: #24344d; background-color: #e7edf6; text-shadow: none; }
body.is-light-theme .brand-mark option, body.is-light-theme .question-heading option { color: #1e2b40; background: #fff; }
body.is-light-theme .brand-mark:focus-visible, body.is-light-theme .question-heading:focus-visible { outline-color: #5578af; }
body.is-light-theme .question-heading { border-left-color: rgba(36,55,82,.18); color: #344761; background-image: linear-gradient(45deg, transparent 50%, #60748f 50%), linear-gradient(135deg, #60748f 50%, transparent 50%); text-shadow: none; }
body.is-light-theme .icon-button { color: #344761; text-shadow: 0 1px 3px rgba(44,75,120,.2); }
body.is-light-theme .icon-button:hover { border-color: rgba(48,72,110,.2); color: #17243a; background: rgba(52,93,154,.08); box-shadow: 0 0 16px rgba(70,120,190,.12); }
body.is-light-theme .icon-button svg { filter: drop-shadow(0 1px 2px rgba(60,95,150,.25)); }
body.is-light-theme .prompt-card { border-color: #c7d1df; background: rgba(255,255,255,.62); }
body.is-light-theme .prompt-card.is-start-pending:hover, body.is-light-theme .prompt-card.is-start-pending:focus-visible { border-color: #6d8fbe; box-shadow: 0 0 22px rgba(69,119,188,.14); }
body.is-light-theme .topic-display { color: #1c2940; text-shadow: 0 1px 0 #fff, 0 0 10px rgba(84,137,213,.16); }
body.is-light-theme .provider-display { color: #53647d; text-shadow: none; }
body.is-light-theme .provider-display > .group-display { color: #65758a; text-shadow: none; }
body.is-light-theme .question-nav { color: #17243a; background: transparent; box-shadow: none; }
body.is-light-theme .disqualification-settings-note { color: #66758a; }
body.is-light-theme .disqualification-decrease-title { color: #34445d; }
body.is-light-theme .disqualification-field > span { color: #66758a; }
body.is-light-theme .simultaneous-elimination-setting legend, body.is-light-theme .simultaneous-elimination-setting label { color: #34445d; }
body.is-light-theme .board-scroll { scrollbar-color: rgba(76,105,145,.38) transparent; }
body.is-light-theme .scoreboard::after { background: rgba(55,70,91,.42); }
body.is-light-theme .player-key { color: #65758a; text-shadow: none; }
body.is-light-theme .player-key:hover { color: #1c355a; text-shadow: 0 0 8px rgba(100,151,225,.48); }
body.is-light-theme .scoreboard.needs-selection .player-key { color: #1c355a; text-shadow: 0 0 8px rgba(100,151,225,.65); }
body.is-light-theme * { text-shadow: none !important; }
body.is-light-theme .topic-display, body.is-light-theme .provider-display { text-shadow: none !important; }
body.is-light-theme .total-value { color: #17243a; text-shadow: none !important; }
body.is-light-theme .score-entry { border-color: #7892b5; color: #fff; background: #4e6e98; box-shadow: none !important; }
body.is-light-theme .score-entry.score-green { border-color: #68cb8b; background: #258c53; }
body.is-light-theme .score-entry.score-blue { border-color: #7ca1eb; background: #3d68bf; }
body.is-light-theme .score-entry.score-yellow { border-color: #d9b45e; background: #a98220; }
body.is-light-theme .score-entry.score-red { border-color: #e77c87; background: #bd4054; }
body.is-light-theme .score-entry.score-gray { border-color: #aeb8c5; background: #78869a; }
body.is-light-theme .score-entry .entry-value { color: #fff; text-shadow: none !important; }
body.is-light-theme .score-entry.is-new::before { background: linear-gradient(to top, rgba(78,110,152,1) 0%, rgba(78,110,152,.72) 38%, rgba(78,110,152,.3) 72%, rgba(78,110,152,0) 100%); }
body.is-light-theme .score-entry.score-green.is-new::before { background: linear-gradient(to top, rgba(37,140,83,1) 0%, rgba(37,140,83,.72) 38%, rgba(37,140,83,.3) 72%, rgba(37,140,83,0) 100%); }
body.is-light-theme .score-entry.score-blue.is-new::before { background: linear-gradient(to top, rgba(61,104,191,1) 0%, rgba(61,104,191,.72) 38%, rgba(61,104,191,.3) 72%, rgba(61,104,191,0) 100%); }
body.is-light-theme .score-entry.score-yellow.is-new::before { background: linear-gradient(to top, rgba(169,130,32,1) 0%, rgba(169,130,32,.72) 38%, rgba(169,130,32,.3) 72%, rgba(169,130,32,0) 100%); }
body.is-light-theme .score-entry.score-red.is-new::before { background: linear-gradient(to top, rgba(189,64,84,1) 0%, rgba(189,64,84,.72) 38%, rgba(189,64,84,.3) 72%, rgba(189,64,84,0) 100%); }
body.is-light-theme .score-entry.score-gray.is-new::before { background: linear-gradient(to top, rgba(120,134,154,1) 0%, rgba(120,134,154,.72) 38%, rgba(120,134,154,.3) 72%, rgba(120,134,154,0) 100%); }
body.is-light-theme .player-name { color: #1e2b40; }
body.is-light-theme .player-card.is-selected .player-name {
  position: relative;
  width: max-content;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 9px;
  color: #1e2b40;
  text-shadow: none !important;
  background: transparent;
}
body.is-light-theme .player-card.is-selected .player-name::before {
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: inherit;
  content: "";
  background: conic-gradient(from var(--selection-ring-angle), #000 0deg 300deg, #fff 325deg, #000 350deg 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: drop-shadow(0 0 4px rgba(255,255,255,1)) drop-shadow(0 0 10px rgba(255,255,255,.9));
  pointer-events: none;
  animation: selected-name-ring-spin 2.4s linear infinite;
}
@keyframes selected-name-ring-spin {
  to { --selection-ring-angle: 360deg; }
}
body.is-light-theme .settings-dialog, body.is-light-theme .help-dialog { border-color: #c5d0de; color: #23324a; background: #fff; box-shadow: 0 18px 48px rgba(28,45,70,.22); }
body.is-light-theme .settings-dialog::backdrop, body.is-light-theme .help-dialog::backdrop { background: rgba(28,42,63,.35); }
body.is-light-theme .settings-header h1 { color: #1c2b43; text-shadow: none; }
body.is-light-theme .close-button { border-color: #c9d3e0; color: #354963; background: #edf1f7; text-shadow: none; }
body.is-light-theme .field-label, body.is-light-theme .name-settings-header { color: #34445d; text-shadow: none; }
body.is-light-theme .field-label input, body.is-light-theme .field-label textarea, body.is-light-theme .field-label select, body.is-light-theme .name-field input, body.is-light-theme .prompt-row input, body.is-light-theme .block-name-input { border-color: #cbd5e1; color: #1d2a40; background: #f3f6fa; box-shadow: none; }
body.is-light-theme .field-label input::placeholder, body.is-light-theme .prompt-row input::placeholder { color: #7a899d; }
body.is-light-theme .name-settings-header > span { color: #66758a; }
body.is-light-theme .settings-tabs { border-bottom-color: #d8e0e9; }
body.is-light-theme .settings-tab { color: #687991; }
body.is-light-theme .settings-tab[aria-selected="true"] { border-bottom-color: #3e659d; color: #233c60; text-shadow: none; }
body.is-light-theme .name-group h2, body.is-light-theme .settings-block h2 { border-top-color: #d9e1eb; color: #2c405b; text-shadow: none; }
body.is-light-theme .name-field > span { color: #526984; text-shadow: none; }
body.is-light-theme .prompt-row-title, body.is-light-theme .prompt-row-labels { color: #586a82; text-shadow: none; }
body.is-light-theme .prompt-source-row { color: #52647c; }
body.is-light-theme .randomize-button { border-color: #c7d2df; color: #344963; background: #edf2f8; text-shadow: none; }
body.is-light-theme .randomize-button:hover { border-color: #8da3bf; background: #e3ebf5; }
body.is-light-theme .help-section h2 { border-bottom-color: #d7e0eb; color: #2d4668; text-shadow: none; }
body.is-light-theme .help-list dt { color: #263a56; }
body.is-light-theme .help-list dd, body.is-light-theme .help-note { color: #586a82; }
body.is-light-theme .help-list kbd { border-color: #cbd5e1; color: #30445e; background: #edf2f8; }
body.is-light-theme .toast { border-color: #c4cfdd; color: #213149; background: #fff; text-shadow: none; box-shadow: 0 4px 16px rgba(32,50,76,.14); }


/* White paper background with a small, faint centered logo */
body.is-light-theme {
  color-scheme: light;
  background-color: #fff;
  background-image: linear-gradient(rgba(255,255,255,.95), rgba(255,255,255,.95)), url('./assets/ouroboros-watermark.jpg');
  background-position: center, center;
  background-size: cover, min(70vw, 1000px) auto;
  background-repeat: no-repeat, no-repeat;
  background-attachment: scroll, scroll;
}
body.is-light-theme .prompt-card,
body.is-light-theme .prompt-card.is-start-pending:hover,
body.is-light-theme .prompt-card.is-start-pending:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
}
@media (max-width: 700px) {
  body.is-light-theme { background-size: cover, min(94vw, 620px) auto; }
}

/* Narrow black score blocks with softly rounded white outlines. */
body.is-light-theme .scoreboard .score-entry {
  left: 22%;
  right: 22%;
  overflow: hidden;
  border: 1px solid #fff;
  border-radius: 4px;
  color: #fff;
  background: #000 !important;
  box-shadow: none !important;
}
body.is-light-theme .scoreboard .score-entry::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border-radius: inherit;
  background: url('./assets/raden-player-atlas-jade.png') var(--raden-x, 0%) calc(100% + var(--block-bottom)) / 800% 510px no-repeat;
  content: "";
  opacity: .21;
  pointer-events: none;
}
body.is-light-theme .scoreboard .score-entry .entry-value {
  color: #fff;
  font-family: var(--japanese-font);
  font-weight: 700;
  text-shadow: none !important;
}
body.is-light-theme .scoreboard .score-entry.is-five .entry-value { color: #fff; }
body.is-light-theme .scoreboard .score-entry.is-new::before {
  display: none;
}

/* Increase contrast of the main ink colors across the light interface */
body.is-light-theme { color: #000; }
body.is-light-theme .brand,
body.is-light-theme .brand-mark,
body.is-light-theme .brand-mark option,
body.is-light-theme .question-heading option,
body.is-light-theme .icon-button:hover,
body.is-light-theme .total-value,
body.is-light-theme .topic-display,
body.is-light-theme .player-name,
body.is-light-theme .player-card.is-selected .player-name,
body.is-light-theme .settings-header h1,
body.is-light-theme .help-list dt,
body.is-light-theme .field-label input,
body.is-light-theme .field-label textarea,
body.is-light-theme .field-label select,
body.is-light-theme .name-field input,
body.is-light-theme .prompt-row input,
body.is-light-theme .block-name-input,
body.is-light-theme .toast {
  color: #000;
}
body.is-light-theme .scoreboard .total-value.is-highest { color: #1769c2; }
body.is-light-theme .scoreboard .total-value.is-lowest { color: #d12b3b; }
body.is-light-theme .player-card.is-eliminated .player-name { color: #000; }
@media (max-width: 700px) { .round-message { top: 160px; } }

/* Keep the six-player column width for smaller groups; fit larger groups on screen. */
.board-scroll { container-type: inline-size; }
.scoreboard {
  --board-gap: 13px;
  --six-card-width: calc((max(100cqw, 1085px) - 65px) / 6);
  width: max-content;
  min-width: 0;
  grid-template-columns: repeat(var(--player-count), var(--six-card-width));
  gap: var(--board-gap);
  margin-inline: auto;
}
.scoreboard.is-dense {
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(var(--player-count), minmax(0, 1fr));
  gap: clamp(3px, .8vw, 13px);
}
.scoreboard.is-dense .player-card { padding-inline: clamp(2px, .8vw, 10px); }
.scoreboard.is-dense .player-name { font-size: clamp(9px, 1.2vw, 16px); }
.scoreboard.is-dense .total-value { font-size: min(var(--total-font-size), max(13px, 2.4vw)); }
body.is-light-theme .scoreboard.is-dense .score-entry { right: 8%; left: 8%; }
@media (max-width: 700px) {
  .scoreboard {
    --board-gap: 9px;
    --six-card-width: calc((max(100cqw, 915px) - 45px) / 6);
  }
}
