:root {
  --paper: #f7f1e3;
  --ink: #183d3a;
  --muted: #556963;
  --red: #ae3f23;
  --rule: #b9b6a3;
  --sea: #164b4a;
  --light: #fffaf0;
  --mono: 'SFMono-Regular', 'Courier New', monospace;
  --serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', Georgia, serif;
  color: var(--ink);
  font:
    16px/1.5 'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    system-ui,
    sans-serif;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 90% 20%, #ebe1c988, transparent 65%),
    var(--paper);
}
button,
input {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #cb6b35;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.47;
  cursor: default;
}
button {
  transition:
    background 0.15s,
    transform 0.15s;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
.mast,
main {
  max-width: 1440px;
  margin: 0 auto;
}
.mast {
  height: 83px;
  padding: 0 clamp(18px, 4.5vw, 76px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
.wordmark,
.mast nav button {
  background: transparent;
  border: 0;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  text-align: left;
}
.wordmark img {
  width: 41px;
  height: 41px;
}
.wordmark span {
  font: 800 21px/1.15 var(--serif);
  letter-spacing: 0.1em;
}
.wordmark small {
  display: block;
  font: 700 9px/1.55 var(--mono);
  letter-spacing: 0.12em;
}
.mast nav {
  display: flex;
  gap: 12px;
}
.mast nav button {
  font-size: 14px;
  min-height: 42px;
  padding: 6px 10px;
  font-weight: 600;
}
.mast nav button:hover,
.quiet:hover {
  background: #ddd8c8;
}
.mast nav button span {
  font: 20px var(--serif);
  margin-right: 4px;
}
main {
  padding: clamp(18px, 3.3vw, 52px) clamp(18px, 4.5vw, 76px) 28px;
}
.home-grid,
.station {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(285px, 0.83fr);
  border: 1px solid var(--ink);
  box-shadow: 0 5px 0 #163d3910;
}
.poster {
  position: relative;
  overflow: hidden;
  min-height: 535px;
  background: #175152;
}
.poster img {
  width: 100%;
  height: 100%;
  position: absolute;
  object-fit: cover;
  object-position: 54% center;
}
.poster:after {
  content: '';
  position: absolute;
  inset: 36% 0 0;
  background: linear-gradient(0deg, #062e2def, #0c38393d 63%, transparent 100%);
}
.poster-type {
  position: absolute;
  z-index: 1;
  bottom: 8%;
  left: 7%;
  color: #fff2cf;
}
.poster-type .smallcap {
  color: inherit;
  font-size: clamp(11px, 1.1vw, 16px);
  letter-spacing: 0.24em;
}
.poster h1 {
  font: 900 clamp(58px, 6.1vw, 100px) / 1.12 var(--serif);
  letter-spacing: 0.04em;
  margin: 6px 0 12px;
  text-shadow: 0 2px 2px #103c3644;
}
.poster-type p {
  margin: 0;
  font-size: clamp(14px, 1.35vw, 21px);
  font-weight: 550;
  letter-spacing: 0.08em;
}
.dispatch {
  padding: clamp(20px, 2.65vw, 46px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--paper);
  position: relative;
}
.dispatch:before,
.sheet:before,
.result-paper:before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 5px;
  background: repeating-linear-gradient(
    120deg,
    #ba5539 0 13px,
    transparent 13px 24px,
    #457575 24px 37px,
    transparent 37px 48px
  );
  opacity: 0.85;
}
.smallcap {
  font: 700 11px/1.45 var(--mono);
  color: #61726a;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.dispatch h2,
.sheet h2,
.result-paper h1,
.modal-title {
  font: 800 clamp(27px, 2.5vw, 39px) / 1.25 var(--serif);
  margin: 8px 0 12px;
  letter-spacing: 0.04em;
}
.dispatch > p,
.lead {
  color: var(--muted);
  margin: 0 0 22px;
}
.menu-actions {
  display: grid;
  gap: 9px;
}
.mode {
  background: transparent;
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  min-height: 66px;
  padding: 10px 13px;
}
.mode:hover {
  background: #e8e4d4;
  border-color: var(--ink);
}
.mode.primary,
.primary {
  background: var(--sea);
  border-color: var(--sea);
  color: #fff3d9;
}
.mode.primary:hover,
.primary:hover:not(:disabled) {
  background: #0b3737;
}
.mode svg {
  width: 26px;
  height: 26px;
}
.mode strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.04em;
}
.mode small {
  display: block;
  font-size: 13px;
  color: var(--muted);
}
.mode.primary small {
  color: #d2ded0;
}
.note-strip {
  margin-top: 18px;
  border-top: 1px solid var(--rule);
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.note-strip b {
  color: var(--red);
  margin-right: 10px;
}
.note-strip .smallcap {
  white-space: nowrap;
}
.btn,
.quiet {
  border: 1px solid var(--rule);
  font-weight: 650;
  min-height: 42px;
  padding: 8px 17px;
  background: transparent;
  border-radius: 3px;
}
.btn.primary {
  background: var(--sea);
  border-color: var(--sea);
}
.btn.primary:hover {
  background: #0c3838;
}
.btn:hover:not(:disabled) {
  border-color: var(--ink);
}
.wide {
  width: 100%;
}
.quiet {
  border: none;
  font-size: 14px;
  padding: 5px 8px;
}
.red {
  color: var(--red);
}
.station {
  grid-template-columns: 1fr 1.12fr;
  max-width: 1000px;
  margin: auto;
}
.station .poster {
  min-height: 490px;
}
.station .poster h1 {
  font-size: 44px;
}
.station .dispatch {
  min-width: 0;
}
.form-label {
  display: grid;
  gap: 5px;
  margin: 13px 0;
  font-weight: 650;
  font-size: 14px;
}
input[type='text'] {
  border: 1px solid var(--rule);
  padding: 12px;
  background: #fffaf1;
  border-radius: 3px;
  width: 100%;
  color: var(--ink);
  min-width: 0;
  font-size: 16px;
}
.form-row {
  display: flex;
  gap: 8px;
}
.form-row input {
  flex: 1;
}
.form-row button {
  white-space: nowrap;
}
.spaced {
  margin-top: 16px;
}
.line {
  margin: 20px 0 10px;
  border: 0;
  border-top: 1px dashed var(--rule);
}
.code {
  font: 700 clamp(32px, 4vw, 55px) / 1 var(--mono);
  letter-spacing: 0.12em;
}
.roster {
  padding: 0;
  margin: 15px 0;
  list-style: none;
}
.roster li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #c5c1af;
  font-size: 14px;
}
.crew {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow-wrap: anywhere;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--team);
  color: #fff5dd;
  font-family: var(--mono);
  font-size: 14px;
}
.status {
  font-size: 13px;
  color: var(--muted);
}
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
}
.page-title h1 {
  font: 800 clamp(24px, 2.3vw, 33px) / 1.3 var(--serif);
  margin: 0;
}
.page-title .smallcap {
  margin-left: 10px;
}
.table-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(300px, 0.9fr);
  gap: clamp(16px, 2.4vw, 35px);
  align-items: start;
}
.mapwrap {
  width: 100%;
  min-width: 0;
  background: #143f40;
  border: 1px solid #153e3b;
  overflow: hidden;
}
.mapwrap svg {
  display: block;
}
.sheet,
.result-paper {
  position: relative;
  border: 1px solid var(--rule);
  background: var(--light);
  padding: clamp(16px, 1.75vw, 28px);
}
.sheet h2 {
  font-size: clamp(23px, 2.1vw, 32px);
  margin: 5px 0 8px;
  overflow-wrap: anywhere;
}
.sheet p {
  margin: 5px 0 12px;
}
.sheet h3,
.result-paper h3 {
  font-size: 14px;
  letter-spacing: 0.05em;
  margin: 13px 0 6px;
}
.turn-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.turn-line .badge {
  min-width: 30px;
  height: 30px;
}
.round {
  font: 650 12px var(--mono);
  color: var(--muted);
}
.dice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 12px 0;
}
.dice-row > div {
  padding: 11px 5px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.dice-row > div + div {
  border-left: 1px dashed var(--rule);
  padding-left: 14px;
}
.dice-row small,
.plane-list small,
.route small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.die {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid #9caa98;
  background: #e6e8d8;
  color: var(--ink);
  font: 700 26px var(--mono);
}
.die.wind {
  background: #f2d7a7;
  color: #6a4325;
  border-color: #be956b;
}
.plane-list,
.routes {
  display: flex;
  gap: 6px;
}
.plane-list button,
.route {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: #fcf8ea;
  border: 1px solid var(--rule);
  border-radius: 3px;
  min-height: 48px;
  padding: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}
.plane-list button[aria-pressed='true'],
.route[aria-pressed='true'] {
  border-color: var(--sea);
  box-shadow: inset 0 0 0 1px var(--sea);
  background: #e3eadd;
}
.route {
  font-size: 15px;
}
.preview {
  background: #efe8d5;
  border-left: 3px solid #b5814e;
  color: #3d514a;
  font-size: 14px;
  padding: 9px 11px;
  margin: 10px 0;
  min-height: 40px;
}
.brief {
  font-size: 14px;
  color: var(--muted);
}
.last {
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.last b {
  color: var(--red);
  margin-right: 8px;
}
.scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 9px 0 0;
}
.score {
  background: #ebe7d7;
  padding: 7px 9px;
  border-left: 3px solid var(--team);
  min-width: 0;
}
.score .crew {
  font-size: 14px;
  font-weight: 650;
}
.score .meters {
  font: 12px var(--mono);
  color: var(--muted);
  margin: 4px 0 0;
}
.score .badge {
  height: 20px;
  min-width: 20px;
  font-size: 11px;
}
.score.active {
  background: #e3e6d4;
}
.signal {
  color: var(--red);
  font-size: 14px;
}
.watch {
  font: 700 20px var(--serif);
  padding: 15px 0;
}
.result-paper {
  text-align: center;
  max-width: 690px;
  margin: 0 auto;
  padding: 35px clamp(22px, 4vw, 65px);
}
.result-paper > img {
  width: 130px;
  height: 110px;
  object-fit: contain;
}
.result-paper .roster {
  text-align: left;
}
.result-paper .form-row {
  justify-content: center;
}
.result-paper .smallcap {
  display: block;
}
.result-paper h1 {
  overflow-wrap: anywhere;
}
.section-cap {
  margin-top: 18px;
}
.seal {
  display: inline-block;
  border: 2px solid #a8503c;
  color: #a8503c;
  border-radius: 4px;
  transform: rotate(-7deg);
  padding: 2px 10px;
  font-family: var(--serif);
  font-weight: bold;
  letter-spacing: 0.17em;
}
.error {
  color: #9c321c;
  font-size: 14px;
  min-height: 1.4em;
  margin: 5px 0 !important;
}
.linkbox {
  width: 100%;
  font: 12px var(--mono) !important;
  padding: 7px !important;
}
dialog {
  width: min(540px, calc(100% - 28px));
  max-height: 86vh;
  border: 1px solid var(--ink);
  border-top: 5px solid var(--red);
  padding: 25px 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 20px 80px #06282255;
}
dialog::backdrop {
  background: #142c2bc2;
}
.dialog-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 38px;
  height: 38px;
  font: 25px/1 sans-serif;
  border: 0;
  background: transparent;
}
.modal-title {
  font-size: 27px;
}
.handbook p {
  margin: 0 0 12px;
  font-size: 15px;
}
.handbook h3 {
  font-size: 17px;
  margin: 15px 0 4px;
}
.slider {
  display: grid;
  grid-template-columns: 1fr 66px;
  align-items: center;
  gap: 3px 8px;
  margin: 15px 0;
}
.slider input {
  accent-color: var(--sea);
  grid-column: 1/-1;
  width: 100%;
  min-height: 32px;
}
.slider output {
  text-align: right;
  font: 14px var(--mono);
}
#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: #163a35;
  color: white;
  max-width: 90vw;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  pointer-events: none;
}
#toast:empty {
  display: none;
}
.poster-type {
  animation: arrive 0.55s ease-out both;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (min-width: 1350px) {
  .poster {
    min-height: 610px;
  }
}
@media (max-width: 900px) {
  .mast {
    height: 64px;
  }
  main {
    padding-top: 18px;
  }
  .table-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(270px, 1fr);
    gap: 12px;
  }
  .dispatch {
    padding: 20px;
  }
  .poster {
    min-height: 450px;
  }
}
@media (max-width: 700px) {
  .mast {
    height: 54px;
    padding: 0 12px;
  }
  .wordmark {
    gap: 7px;
  }
  .wordmark img {
    width: 32px;
    height: 32px;
  }
  .wordmark span {
    font-size: 16px;
  }
  .wordmark small {
    font-size: 7px;
  }
  .mast nav {
    gap: 0;
  }
  .mast nav button {
    font-size: 13px;
    padding: 5px 7px;
  }
  .mast nav button span {
    margin-right: 1px;
  }
  .home-grid,
  .station,
  .table-grid {
    display: flex;
    flex-direction: column;
  }
  .home-grid > *,
  .station > *,
  .table-grid > * {
    width: 100%;
  }
  .poster {
    min-height: 0;
    aspect-ratio: 1.55;
  }
  .poster-type {
    bottom: 9%;
  }
  .poster h1 {
    font-size: clamp(43px, 11vw, 66px);
    margin: 3px 0 5px;
  }
  .poster-type p {
    font-size: 13px;
  }
  .dispatch {
    padding: 20px;
  }
  .dispatch h2 {
    font-size: 25px;
  }
  .dispatch > p {
    font-size: 14px;
    margin-bottom: 13px;
  }
  .mode {
    min-height: 57px;
  }
  .station .poster {
    min-height: 0;
    aspect-ratio: 3.5;
  }
  .station .poster h1 {
    font-size: 32px;
  }
  .station .poster-type p,
  .station .poster-type .smallcap {
    display: none;
  }
  .station .poster img {
    object-position: center 48%;
  }
  .note-strip .smallcap {
    display: none;
  }
  .note-strip {
    margin-top: 10px;
  }
  .page-title {
    margin-bottom: 6px;
  }
  .page-title h1 {
    font-size: 21px;
  }
  .page-title .smallcap {
    font-size: 9px;
    margin-left: 5px;
  }
  .table-grid {
    gap: 8px;
  }
  main {
    padding: 12px 10px 18px;
  }
  .sheet {
    padding: 12px 13px;
  }
  .sheet h2 {
    font-size: 23px;
  }
  .sheet h3 {
    margin: 6px 0 4px;
  }
  .dice-row {
    margin: 6px 0;
  }
  .dice-row > div {
    padding: 5px;
  }
  .die {
    min-width: 32px;
    height: 32px;
    font-size: 24px;
  }
  .last {
    padding: 5px 2px;
    font-size: 13px;
  }
  .scores {
    gap: 4px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .score {
    padding: 4px 7px;
  }
  .table-grid .left-side {
    display: contents;
  }
  .mapwrap {
    order: 0;
  }
  .sheet {
    order: 1;
  }
  .below-map {
    order: 2;
  }
  .preview {
    margin: 6px 0;
    padding: 6px 9px;
    min-height: 0;
  }
  .btn {
    min-height: 44px;
  }
  .plane-list button,
  .route {
    min-height: 44px;
  }
  .result-paper {
    padding: 21px 14px;
  }
  .result-paper .form-row {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
