:root {
  color-scheme: light;
  --ink: #182434;
  --secondary: #4f555a;
  --muted: #60666b;
  --page: #f5f3ef;
  --line: #dfdbd3;
  --surface: #faf8f4;
  --surface-shade: #efede7;
  --accent: #1355a5;
  --glass: #ffffff65;
  --glass-edge: #ffffffb0;
  --glass-pressed: #ffffff96;
  --card-shadow: #544e3b0b;
  --motion-ease: cubic-bezier(.22,.75,.18,1);
  --radius: 12px;
  font: 16px/1.55 "Board Sans SC", "Board CJK Supplement", system-ui, "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6e6e2;
  --secondary: #c0c2c3;
  --muted: #a3a6ab;
  --page: #191b1e;
  --line: #35383d;
  --surface: #202327;
  --surface-shade: #2a2d32;
  --accent: #a7c9f5;
  --glass: #393e4759;
  --glass-edge: #ffffff1c;
  --glass-pressed: #535a6659;
  --card-shadow: #00000020;
}
* { box-sizing: border-box; }
a, button, summary, .choice-card { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
main { width: min(100% - 40px, 1056px); margin: 0 auto; overflow-anchor: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }
code { font-family: inherit; }
button, summary { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); font-size: .875rem; }
.masthead, .section-heading, .copy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.masthead { min-height: 72px; border-bottom: 1px solid var(--line); }
.masthead h1 { font-size: clamp(1.25rem, 3vw, 1.625rem); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 10px; color: var(--secondary); background: transparent; text-decoration: none; transition: background-color 180ms var(--motion-ease), color 180ms var(--motion-ease); }
.icon-button svg { width: 20px; height: 20px; flex: none; }
.icon-button:hover { color: var(--ink); background: var(--surface-shade); }
.icon-button:active { background: var(--line); }
.icon-button:disabled svg { opacity: .5; }
.notice { padding: 12px; margin-top: 12px; background: #fff1d9; border-radius: 8px; color: #704713; }
.hero { position: relative; isolation: isolate; overflow: hidden; margin-top: 24px; padding: 32px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.hero-content { position: relative; display: grid; grid-template-columns: minmax(0, .76fr) minmax(0, 1.24fr); align-items: center; gap: 16px; }
.hero h2 { font-size: clamp(2rem, 6vw, 4.25rem); font-weight: 600; line-height: 1.13; margin: 8px 0; letter-spacing: -.025em; overflow-wrap: anywhere; }
.hero-content.is-idle { min-height: 112px; }
.hero-content.is-idle h2 { font-size: clamp(1.375rem, 2.7vw, 2.125rem); line-height: 1.4; letter-spacing: -.015em; }
#ship-detail { display: flex; flex-wrap: wrap; gap: 4px 8px; }
.hero-rule { overflow-wrap: anywhere; }
.hero-rule::before { content: "·"; color: var(--muted); margin-right: 8px; }
.broadcast-note { flex-basis: 100%; overflow-wrap: anywhere; }
.ship-figure { position: relative; isolation: isolate; margin: 0; min-width: 0; }
.battle-wordmark { position: absolute; z-index: 0; top: 7%; left: 50%; translate: -50% 0; width: min(100%, 372px); color: rgb(75 87 96 / .46); line-height: 0; transition: scale 240ms ease-out, filter 240ms ease-out; }
.battle-wordmark svg { display: block; width: 100%; height: auto; aspect-ratio: 144 / 32; }
:root[data-theme="dark"] .battle-wordmark { color: rgb(207 216 223 / .42); }
@media (hover: hover) and (pointer: fine) {
  .battle-wordmark:hover { scale: 1.09; filter: drop-shadow(0 3px 5px #505b6439); }
}
.changed .battle-wordmark { animation: float-wordmark 320ms ease-out both; }
.hero-art { position: relative; z-index: 1; pointer-events: none; }
.hero-art img { width: 100%; height: auto; display: block; }
:root[data-theme="dark"] .hero-art img, :root[data-theme="dark"] .queue-row img { filter: brightness(1.65) contrast(.8); }
.hero-art svg { display: block; width: 54px; height: 54px; margin: auto; color: var(--secondary); }
.board-grid { display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); grid-template-areas: "queue history" "resources resources"; gap: 24px 32px; margin-top: 24px; }
.queue-panel { grid-area: queue; }
.history-panel { grid-area: history; }
.section { border-top: 1px solid var(--line); padding-top: 16px; }
.section-heading { min-height: 44px; margin-bottom: 12px; }
.section-heading h2 { font-size: 1.1875rem; font-weight: 600; }
.queue-heading-actions { display: flex; align-items: center; gap: 12px; }
.queue-card { padding: 0 12px; border: 1px solid transparent; border-radius: var(--radius); }
.queue { list-style: none; padding: 0; margin: 0; }
.queue-row { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) minmax(0, 108px) auto; align-items: center; gap: 8px; min-height: 60px; padding: 8px 0; }
.queue-row + .queue-row { border-top: 1px solid var(--line); }
.queue-position, .queue-remaining, #queue-count, #history-count, .history-item time { font-variant-numeric: tabular-nums; }
.queue-remaining, .history-score { text-align: right; }
.queue-row img { width: 100%; height: auto; display: block; }
.queue-row svg { width: 16px; height: 16px; margin: auto; color: var(--secondary); }
.queue-name { overflow-wrap: anywhere; }
.queue-name .muted { display: block; }
.text-button { background: transparent; color: var(--accent); border: 0; padding: 4px 8px; border-radius: 8px; }
.text-button:hover { background: var(--surface-shade); }
.result-card { border: 1px solid transparent; border-radius: var(--radius); margin-bottom: 12px; }
.result-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px; }
.result-summary > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.result-card h3 { font-size: 1rem; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px 16px; font-variant-numeric: tabular-nums; }
.result-card .metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; justify-items: start; }
.result-card .metric:first-child { grid-column: 1 / -1; }
.result-card .metric:first-child strong { font-size: clamp(1.625rem, 3.2vw, 2.25rem); line-height: 1.12; font-weight: 600; letter-spacing: -.015em; }
.missing, .result-card .metric:first-child strong.missing { color: var(--muted); font-size: .8125rem; font-weight: 400; line-height: 1.55; letter-spacing: 0; }
.metric { display: inline-grid; grid-template-columns: 16px auto; align-items: center; gap: 8px; }
.metric svg, summary svg { width: 16px; height: 16px; flex: none; }
.history { display: grid; gap: 8px; }
.history-item { border: 1px solid transparent; border-radius: var(--radius); }
.history-item > summary { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto 12px; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px; }
.history-name { overflow-wrap: anywhere; }
.history-score { font-variant-numeric: tabular-nums; font-weight: 550; }
.history-item > .details-body, .result-card > .details-body { padding: 0 16px 16px; }
.history-person { margin-top: 12px; overflow-wrap: anywhere; }
summary { cursor: pointer; list-style: none; user-select: none; -webkit-user-select: none; }
summary { position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; width: 14px; height: 14px; background: var(--secondary); mask: url("/board-assets/v1/symbols/chevron-down-v2.svg") center / contain no-repeat; -webkit-mask: url("/board-assets/v1/symbols/chevron-down-v2.svg") center / contain no-repeat; margin: 0 2px 0 auto; flex: none; }
details[open] > summary::after { transform: rotate(180deg); }
details[data-closing] > summary::after { transform: rotate(0); }
details[data-closing] > .details-body { pointer-events: none; }
summary::after { transition: transform 260ms var(--motion-ease); }
.resources { grid-area: resources; align-self: start; display: grid; grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr); align-items: start; gap: 8px 32px; }
.disclosure { border: 1px solid transparent; border-radius: var(--radius); }
.disclosure > summary { display: flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 48px; }
.expandable-card > summary:focus-visible { outline-offset: -4px; border-radius: inherit; }
.disclosure-content { padding: 12px; }
.details-body { display: flow-root; }
.rules > * + * { margin-top: 12px; }
.rules ul { padding-inline-start: 24px; }
#pools { display: grid; gap: 8px; }
.pool { border: 1px solid transparent; border-radius: 8px; }
.pool > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; min-height: 48px; }
.pool > summary::after { margin-inline-start: auto; }
.pool-body { padding: 0 12px 12px; overflow-wrap: anywhere; }
.pool-common-rule { margin-top: 12px; padding: 12px; border-left: 2px solid var(--line); border-radius: 4px; background: var(--glass); color: var(--secondary); font-size: .875rem; line-height: 1.65; white-space: pre-line; }
.common-rule-label { margin-bottom: 4px; color: var(--muted); font-size: .75rem; }
.copy-row { flex-wrap: wrap; }
.copy-row code { min-width: 0; overflow-wrap: anywhere; }
.sort-hint { margin: 8px 0; font-size: .75rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); align-items: start; gap: 8px; list-style: none; margin: 0 0 8px; padding: 0; }
.choice-card { position: relative; min-width: 0; padding: 14px 12px; border: 1px solid var(--glass-edge); border-radius: 10px; background: var(--glass); color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 12px var(--card-shadow); backdrop-filter: blur(16px) saturate(115%); -webkit-backdrop-filter: blur(16px) saturate(115%); cursor: grab; user-select: none; -webkit-user-select: none; }
.hero {
  background: var(--glass);
  border-color: var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 12px var(--card-shadow);
  backdrop-filter: blur(16px) saturate(115%);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
  transition: scale 260ms var(--motion-ease), background-color 260ms var(--motion-ease), box-shadow 260ms var(--motion-ease);
}
.expandable-card { position: relative; isolation: isolate; background: transparent; transition: scale 160ms var(--motion-ease); }
.expandable-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--glass-edge);
  border-radius: inherit;
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 12px var(--card-shadow);
  backdrop-filter: blur(16px) saturate(115%);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
  transform-origin: top;
  transition: background-color 160ms var(--motion-ease), box-shadow 160ms var(--motion-ease);
}
.hero:active, .hero[data-pressed], .expandable-card[data-pressed] {
  scale: .997;
  transition-duration: 90ms;
}
.hero[data-pressed], .expandable-card[data-pressed]::before {
  background: var(--glass-pressed);
  box-shadow: inset 0 1px 4px var(--card-shadow);
}
.choice-card > strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 18px; font-size: .9375rem; font-weight: 600; }
.choice-rule { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; margin-top: 6px; color: var(--secondary); font-size: .75rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.drag-handle { position: absolute; top: 4px; right: 1px; display: grid; place-items: center; width: 32px; height: 40px; color: var(--muted); touch-action: none; }
.drag-handle svg { width: 15px; height: 18px; }
.choice-card:hover { border-color: var(--line); }
.choice-card:focus-visible, .keyboard-picked { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-card.keyboard-picked { background: var(--surface-shade); }
.drag-source { opacity: .3; }
.choice-card.drop-target { outline: 1.5px solid var(--secondary); outline-offset: 2px; }
.drag-ghost, .drag-settling-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; cursor: grabbing; opacity: .94; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: inset 0 1px 0 var(--glass-edge), 0 14px 36px var(--card-shadow); transform-origin: center 25%; }
.drag-ghost { animation: drag-sway 560ms cubic-bezier(.37,0,.63,1) infinite alternate; }
.drag-settling-source { opacity: 0; }
.sorting-cards, .sorting-cards * { cursor: grabbing !important; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin: 24px 0 32px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .75rem; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; }
.site-footer a { display: inline-flex; align-items: center; min-height: 32px; color: inherit; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.changed h2, .changed .hero-art { animation: arrive 200ms ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } }
@keyframes float-wordmark { from { transform: translateY(4px); } }
@keyframes drag-sway { from { rotate: -.75deg; } to { rotate: .75deg; } }

/* Decorative art never enters native browser image dragging. */
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.hero-art:has(.idle-ship-button) { pointer-events: auto; }
main { user-select: none; -webkit-user-select: none; }
.queue-wheel:focus-visible { outline: 2px solid var(--secondary); outline-offset: -2px; border-radius: 10px; }
.idle-ship-button { display: block; width: 100%; padding: 12px; border: 0; border-radius: 12px; background: transparent; }
.idle-ship-button:active { background: var(--glass); }
.hero-art .idle-ship { width: 100%; max-height: 144px; object-fit: contain; opacity: .75; }
.queue-panel, .history-panel { align-self: start; min-width: 0; }
.queue-card { display: flex; flex-direction: column; padding: 12px; overflow: hidden; transition: height 300ms var(--motion-ease); }
.queue-wheel { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scrollbar-width: none; overflow-anchor: none; -webkit-user-select: none; user-select: none; }
.queue-wheel::-webkit-scrollbar { display: none; }
.queue { position: relative; margin: 0 4px; }
.queue-tile { position: absolute; inset-inline: 0; height: 120px; min-height: 0; padding: 12px 10px; border: 1px solid var(--glass-edge); border-radius: 10px; background: var(--glass); box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 12px var(--card-shadow); backdrop-filter: blur(16px) saturate(115%); -webkit-backdrop-filter: blur(16px) saturate(115%); cursor: default; transform: scale(var(--wheel-scale,1)) rotate(var(--wheel-angle,0deg)); transition: transform 180ms var(--motion-ease); }
.queue-row + .queue-row { border-top-color: var(--glass-edge); }
.queue-name strong, .queue-name .muted { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.queue-name strong { line-height: 1.45; }
.queue-name .muted { margin-top: 4px; font-size: .8125rem; }
.queue-row .roulette-art { width: 60px; max-width: 100%; height: 60px; margin: auto; object-fit: contain; }
#queue-empty { padding: 16px 8px; }
.latest-details > .history-person { border-top: 1px solid var(--line); padding: 12px 0 0; margin: 0 16px 16px; }
.pool-common-rule { border: 1px solid var(--glass-edge); border-radius: 10px; box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 12px var(--card-shadow); backdrop-filter: blur(16px) saturate(115%); -webkit-backdrop-filter: blur(16px) saturate(115%); }
.rules { display: grid; gap: 10px; }
.rules > * + * { margin-top: 0; }
.rule-card h3 { font-size: .9375rem; font-weight: 600; padding-right: 24px; }
.rule-card p { margin-top: 10px; font-size: .875rem; line-height: 1.7; color: var(--secondary); overflow-wrap: anywhere; }
.rule-card { padding: 16px; }
@media (max-width: 760px) {
  .board-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "queue" "history" "resources"; grid-template-rows: auto; gap: 24px; }
  .resources { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
  main { width: calc(100% - 24px); }
  .masthead { min-height: 68px; }
  .masthead { gap: 8px; }
  .masthead h1 { font-size: 1.125rem; }
  .header-actions { gap: 0; }
  .icon-button { width: 40px; min-width: 40px; }
  .hero { margin-top: 16px; padding: 16px; }
  .hero-content { gap: 8px; }
  .battle-wordmark { top: -3%; width: 100%; }
  .hero-rule { flex-basis: 100%; }
  .hero-rule::before { content: none; }
  .queue-row { grid-template-columns: 1rem minmax(0, 1fr) minmax(40px, 80px) auto; padding: 8px 4px; }
  .queue-tile { grid-template-columns: 1rem minmax(0,1fr) 52px auto; gap: 6px; padding: 10px 8px; }
  .queue-row .roulette-art { height: 56px; }
  .queue-remaining { font-size: .75rem; }
  .metric { font-size: .88rem; }
  .result-summary { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 380px) {
  .queue-name .muted { font-size: .75rem; line-height: 1.35; -webkit-line-clamp: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .changed h2, .changed .hero-art, .changed .battle-wordmark, .drag-ghost { animation: none; }
  .battle-wordmark, .battle-wordmark:hover { scale: none; transition: none; }
  summary::after, .icon-button { transition: none; }
  .hero, .expandable-card, .expandable-card::before { transition: none; }
  .queue-card, .queue-tile { transition: none; transform: none; }
  .hero:active, .hero[data-pressed], .expandable-card[data-pressed] { scale: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root, :root[data-theme="dark"] { --glass: var(--surface); --glass-pressed: var(--surface-shade); }
  .battle-wordmark { color: #606568; background: none; -webkit-text-stroke: 0; filter: none; }
  .choice-card, .hero, .expandable-card::before { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
