:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #24352f;
  background: #f7f6f2;
  font-synthesis: none;
  --ink: #24352f;
  --muted: #68776f;
  --green: #174e45;
  --line: #e0e5dc;
  --paper: #fff;
  --radius: 20px;
}
.bank-screen .score-total {
  font-size: clamp(1.3rem, 5vw, 2rem);
  max-width: 60%;
  overflow-wrap: anywhere;
}
.display-score.currency {
  font-size: calc(clamp(1.6rem, 4vw, 4rem) * var(--scale, 1));
  overflow-wrap: anywhere;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #d99136;
  outline-offset: 3px;
}
button,
a {
  touch-action: manipulation;
}
button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 17px;
  color: var(--ink);
  background: #fff;
  font-weight: 650;
}
button:hover {
  background: #f0f3ee;
}
button.primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
button.primary:hover {
  background: #226456;
}
button.danger {
  color: #a63838;
}
button.quiet {
  border-color: transparent;
  background: transparent;
}
button.small {
  padding: 6px 11px;
  font-size: 0.85rem;
}
button.wide {
  width: 100%;
}
input,
select,
textarea {
  /* Avoid iPhone focus zoom when a field inherits a smaller label font. */
  font-size: max(16px, 1em);
  width: 100%;
  padding: 13px;
  border: 1px solid #cbd3c9;
  border-radius: 11px;
  background: white;
  color: var(--ink);
  min-height: 48px;
}
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  min-height: 20px;
  accent-color: var(--green);
}
input[type="color"] {
  width: 54px;
  padding: 3px;
}
input[type="range"] {
  padding: 0;
}
textarea {
  resize: vertical;
  min-height: 100px;
}
label {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  margin-bottom: 8px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.055em;
  margin-bottom: 14px;
}
h2 {
  font-size: 1.35rem;
  letter-spacing: -0.035em;
  margin-bottom: 14px;
}
h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}
p {
  line-height: 1.6;
}
a {
  color: var(--green);
}
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.71rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}
.shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px 110px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px 0 32px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  letter-spacing: -0.035em;
  white-space: nowrap;
}
.brand img {
  width: 34px;
  height: 34px;
}
.brand button {
  padding: 0;
  border: 0;
  min-height: 36px;
  background: transparent;
  font-size: 1.05rem;
}
.topbar .tools {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hero {
  max-width: 470px;
  margin: 4vh auto;
  text-align: center;
}
.hero-mark {
  display: inline-grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 26px;
  background: #e4ece2;
  margin: 14px 0 25px;
  transform: rotate(-8deg);
}
.hero-mark img {
  width: 51px;
  transform: rotate(8deg);
}
.hero .card {
  text-align: left;
  margin-top: 30px;
  padding: 26px;
}
.stack {
  display: grid;
  gap: 14px;
}
.gap {
  height: 20px;
}
.card {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 15px #24352f03;
}
.narrow {
  max-width: 620px;
  margin: auto;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.between {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eaf0e6;
  color: #3a5843;
  border-radius: 100px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 700;
}
.pill.offline {
  background: #fff0d8;
  color: #805510;
}
.code {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: 0.15em;
  font-size: 1.65rem;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin: 24px 0 12px;
}
.section-heading h2 {
  margin: 0;
}
.player-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf0e9;
}
.player-row:last-child {
  border-bottom: 0;
}
.avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: var(--player, #4361ee);
}
.player-name {
  font-weight: 750;
  overflow-wrap: anywhere;
}
.player-list {
  padding-top: 8px;
  padding-bottom: 8px;
}
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  width: 35px;
  height: 35px;
  min-height: 35px;
  border-radius: 50%;
  padding: 0;
  background: var(--swatch);
  border: 4px solid white;
  outline: 1px solid var(--line);
}
.swatch:hover {
  background: var(--swatch);
}
.swatch.selected {
  outline: 3px solid #24352f;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  margin: 0;
  padding: 10px 0;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.game-card {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 105px;
  border-radius: 18px;
  padding: 20px;
}
.game-logo {
  width: 55px;
  height: 55px;
  flex-shrink: 0;
  border-radius: 16px;
  background: var(--game);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 850;
  font-size: 0.85rem;
}
.game-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 5px;
}
.arrow {
  margin-left: auto;
  color: var(--muted);
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 0.8rem;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--player);
}
.score-card {
  padding: 22px;
  border-left: 5px solid var(--player);
  position: relative;
}
.score-total {
  font-size: 2.3rem;
  letter-spacing: -0.06em;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.score-input {
  font-size: 1.5rem;
  font-weight: 750;
  text-align: center;
  padding: 12px;
  max-width: 130px;
  min-width: 70px;
  font-variant-numeric: tabular-nums;
}
.score-fields {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.score-fields label {
  margin: 0;
}
.score-stack {
  display: grid;
  gap: 14px;
}
.progress {
  height: 5px;
  background: #e9eee6;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 18px;
}
.progress span {
  display: block;
  height: 100%;
  width: var(--progress);
  background: var(--player);
}
.status-note {
  padding: 13px 16px;
  border-radius: 12px;
  background: #eef3e9;
  color: #365c3f;
  font-size: 0.9rem;
}
.score-mini {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 9px 0;
}
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  background: #f7f6f2ee;
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 8px;
}
.bottom-bar button {
  background: transparent;
  border-color: transparent;
  font-size: 0.85rem;
  min-width: 85px;
}
.submit-bar {
  position: sticky;
  bottom: 85px;
  padding-top: 12px;
  z-index: 2;
}
.submit-bar button {
  min-height: 54px;
  box-shadow: 0 5px 18px #174e4525;
}
.winner {
  background: #e9efdf;
  text-align: center;
  padding: 30px;
}
.winner .trophy {
  font-size: 2.3rem;
  margin-bottom: 12px;
}
.winner h2 {
  font-size: 1.9rem;
}
.rank {
  font-size: 1.2rem;
  font-weight: 850;
  color: #85917f;
  width: 25px;
}
.route-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 15px;
}
.route-buttons button {
  padding: 8px 3px;
  font-size: 0.8rem;
}
.route-buttons strong {
  display: block;
  font-size: 1rem;
}
.route-buttons.ticket-routes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.ticket-routes .ticket-correction {
  grid-column: 1 / -1;
  font-size: 1rem;
}
#ticket-destinations-form fieldset {
  min-width: 0;
  margin: 0;
}
.ticket-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ticket-entry > div {
  min-width: 0;
}
.ticket-entry p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}
.ticket-entry button {
  flex-shrink: 0;
}
.ticket-entry.entry-removed > div {
  opacity: 0.6;
}
.ticket-manual {
  margin-top: 18px;
}
.ticket-manual summary {
  cursor: pointer;
  padding: 10px 0;
}
.history-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.history-row:last-child {
  border: 0;
}
.round-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.round-table th,
.round-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table-scroll {
  overflow: auto;
}
.empty {
  text-align: center;
  padding: 30px;
  color: var(--muted);
}
.error {
  padding: 14px;
  background: #fff0ed;
  border: 1px solid #f0cbc4;
  border-radius: 12px;
  color: #9a302e;
}
.account-strip {
  text-align: center;
  margin-top: 20px;
}
.account-strip button {
  color: var(--muted);
  font-size: 0.85rem;
}
#notice {
  position: fixed;
  z-index: 50;
  left: 50%;
  transform: translateX(-50%);
  bottom: 95px;
  max-width: calc(100% - 32px);
  width: max-content;
  padding: 13px 18px;
  border-radius: 13px;
  background: #24352f;
  color: white;
  box-shadow: 0 5px 25px #0002;
  pointer-events: none;
  display: none;
}
#notice.visible {
  display: block;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 22px;
  max-width: 500px;
  width: calc(100% - 32px);
  padding: 25px;
  color: var(--ink);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #16261f65;
  backdrop-filter: blur(3px);
}
dialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}
dialog .dialog-head h2 {
  margin: 0;
}
dialog .dialog-head button {
  font-size: 1.4rem;
  padding: 0;
  width: 42px;
  min-height: 42px;
}
.display-shell {
  max-width: 1800px;
  padding-bottom: 110px;
}
.display-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}
.display-player {
  border-top: 8px solid var(--player);
  padding: 28px;
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.display-player h2 {
  font-size: calc(clamp(1.4rem, 3vw, 2.6rem) * var(--scale, 1));
  overflow-wrap: anywhere;
}
.display-score {
  font-size: calc(clamp(4rem, 8vw, 8rem) * var(--scale, 1));
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}
.display-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}
.display-controls input {
  width: 100px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}
.connection i {
  height: 7px;
  width: 7px;
  border-radius: 50%;
  background: #4c9258;
}
.connection.offline i {
  background: #b6771e;
}
.help {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
}
.screen-title {
  margin-bottom: 25px;
}
.screen-title h1 {
  font-size: 2rem;
}
.hidden {
  display: none !important;
}
@media (max-width: 620px) {
  .shell {
    padding: 0 18px 105px;
  }
  .topbar {
    padding: 20px 0 26px;
  }
  .topbar .tools > button {
    font-size: 0.8rem;
    padding: 7px 10px;
  }
  .hero {
    margin: 1vh auto;
  }
  .hero .card {
    padding: 22px;
  }
  .game-grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 20px;
  }
  .player-list {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .game-card {
    min-height: 92px;
  }
  .score-total {
    font-size: 2rem;
  }
  .score-fields {
    gap: 8px;
  }
  .display-heading {
    display: block;
  }
  .display-controls {
    margin-top: 16px;
  }
  .display-grid {
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .display-player {
    padding: 15px 8px;
    min-height: 190px;
  }
  .display-player h2 {
    font-size: calc(1.15rem * var(--scale, 1));
  }
  .display-score {
    font-size: calc(3.6rem * var(--scale, 1));
  }
  .display-shell {
    padding: 0 14px 110px;
  }
  .brand {
    gap: 7px;
  }
  .brand button {
    font-size: 0.95rem;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .route-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
  .bottom-bar {
    gap: 0;
  }
  .bottom-bar button {
    min-width: 0;
    flex: 1;
    max-width: 160px;
    padding: 10px 6px;
  }
  .screen-title h1 {
    font-size: 1.8rem;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s ease,
      transform 0.15s ease;
  }
  button:active:not(:disabled) {
    transform: translateY(1px);
  }
}

.host-view-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.host-view-toggle button {
  flex: 1;
}
.host-player-picker {
  margin-bottom: 18px;
}
.host-player-picker .help {
  margin-bottom: 0;
}

.target-picker {
  text-align: center;
}
.target-picker > label {
  color: var(--muted);
  font-weight: 400;
}
.target-stepper {
  display: grid;
  grid-template-columns: 48px minmax(0, 150px) 48px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 22px 0;
}
.target-stepper .target-step {
  border-radius: 50%;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 1.5rem;
}
#target-score {
  text-align: center;
  color: var(--green);
  font-size: clamp(1.6rem, 7vw, 2.25rem);
  font-weight: 750;
  min-width: 0;
  padding: 10px 3px;
  appearance: textfield;
  -moz-appearance: textfield;
}
#target-score::-webkit-inner-spin-button,
#target-score::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.target-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.target-presets button {
  min-width: 0;
  padding: 10px 2px;
  border-radius: 24px;
}

.radio-grid {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
}
.radio-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.radio-options.radio-single {
  grid-template-columns: 1fr;
}
.radio-grid .check-row:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
.radio-grid legend {
  margin-bottom: 10px;
  font-weight: 600;
}
.radio-grid .check-row {
  align-items: center;
  padding: 10px 8px;
  border: 1px solid var(--line, #dce2db);
  border-radius: 10px;
  font-size: 0.9rem;
  min-height: 44px;
  margin: 0;
}
.radio-grid .check-row:has(input:checked) {
  background: #eef3e9;
  border-color: #244d43;
}
.property-list {
  margin-top: 16px;
}
.property-list summary {
  cursor: pointer;
  padding: 8px 0;
}
.property-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid #dce2db;
}
.property-row strong {
  overflow-wrap: anywhere;
}
.property-row .help {
  margin: 4px 0 0;
}

.bank-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}
.property-results {
  display: grid;
  gap: 0.4rem;
  max-height: 15rem;
  overflow-y: auto;
}
.property-match {
  display: grid;
  gap: 0.25rem;
  text-align: left;
  padding: 0.65rem;
}
.property-match .help {
  margin: 0;
}
.signed-score-field {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  max-width: 200px;
}
.score-fields:has(.signed-score-field) {
  flex-wrap: wrap;
}
.score-fields:has(.signed-score-field) > .help {
  flex: 0 0 100%;
  margin: 0;
}
.signed-score-field input {
  flex: 1;
  min-width: 0;
}
.score-sign {
  flex: 0 0 52px;
  min-height: 48px;
  font-size: 1.5rem;
}
.bank-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.25rem;
}

.board-section {
  border: 1px solid var(--line, #dfe3de);
  border-radius: 16px;
  padding: 18px;
  margin: 20px 0;
}
.board-section h3 {
  margin-top: 0;
}
.board-section form {
  margin-top: 16px;
}
.board-section input[type="file"] {
  max-width: 100%;
  min-width: 0;
}
.template-actions a {
  text-align: center;
  padding: 8px;
}
.board-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.board-label label {
  flex: 1;
}
.info-tip {
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border-radius: 50%;
}
[hidden] {
  display: none !important;
}

.target-picker .saved-target-picker {
  display: block;
  margin-top: 24px;
}

.display-target {
  margin: 18px 0 0;
  width: 100%;
}
.display-target-bar {
  height: clamp(24px, 2.8vw, 36px);
  background: #e4e9e4;
  border-radius: 999px;
  overflow: hidden;
}
.display-target-bar > span {
  display: block;
  height: 100%;
  width: var(--target-progress);
  background: var(--player);
  border-radius: inherit;
  transition: width 250ms ease;
}
.display-target .help {
  margin: 8px 0 0;
}
@media (prefers-reduced-motion: reduce) {
  .display-target-bar > span {
    transition: none;
  }
}

.turn-banner {
  max-width: 720px;
  margin: 16px auto 24px;
  padding: 20px;
  border: 3px solid var(--player);
  border-radius: 18px;
  background: white;
  text-align: center;
}
.turn-banner h2 {
  margin: 6px 0;
}
.turn-banner .stack {
  margin-top: 16px;
}
.current-turn-player {
  outline: 5px solid var(--player);
  outline-offset: 3px;
}
.turn-edge {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 5px var(--turn-color),
    inset 0 0 30px 8px var(--turn-color);
  opacity: 0.65;
}
.turn-edge-pulse {
  animation: turn-glow 3s ease-in-out infinite;
}
@keyframes turn-glow {
  0%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.7;
  }
}
@media (prefers-reduced-motion: reduce) {
  .turn-edge-pulse {
    animation: none;
    opacity: 0.45;
  }
}
