/* Points Odyssey — premium travel eurogame UI */

:root {
  --navy: #0a1224;
  --navy-2: #132038;
  --navy-3: #1c2d4a;
  --gold: #d4a017;
  --gold-soft: #e8c547;
  --cream: #f0e6d3;
  --cream-dim: #c4b8a0;
  --danger: #e74c3c;
  --ok: #2ecc71;
  --panel: rgba(19, 32, 56, 0.92);
  --border: rgba(240, 230, 211, 0.15);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--navy);
  color: var(--cream);
}

body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(212, 160, 23, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(17, 122, 202, 0.1), transparent 45%),
    var(--navy);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* ——— Setup ——— */

.setup-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.hero {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.hero img.logo {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--gold);
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  color: var(--gold-soft);
}

.hero p.lead {
  margin: 0;
  max-width: 36rem;
  color: var(--cream-dim);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  background: var(--navy-3);
  border: 1px solid var(--border);
  color: var(--cream);
  padding: 0.55rem 1rem;
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
  background: var(--navy-2);
  border-color: var(--gold);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, #b8860b, var(--gold));
  color: #1a1200;
  border: none;
  font-weight: 700;
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  background: linear-gradient(135deg, #b8860b, var(--gold));
}

.btn.action {
  text-align: left;
  padding: 0.75rem 1rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

@media (max-width: 800px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

#character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.char-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  transition: border-color 0.15s, transform 0.12s;
  color: inherit;
}

.char-card:hover:not(.taken) {
  border-color: var(--gold);
  transform: translateY(-2px);
}

.char-card.taken {
  opacity: 0.55;
}

.char-join-btns {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.char-join-btns .btn {
  flex: 1;
  min-width: 5.5rem;
  font-size: 0.78rem;
  padding: 0.4rem 0.5rem;
}

.btn-add-bot {
  border-color: rgba(155, 89, 182, 0.5);
}

.seat-kind {
  display: block;
  font-size: 0.72rem;
  color: var(--cream-dim);
  font-style: normal;
  margin-top: 0.1rem;
}

.lobby-player.is-bot .seat-kind {
  color: #c39bd3;
}

.lobby-player .toggle-bot {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--cream-dim);
  font-size: 0.68rem;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  margin-left: 0.25rem;
}

.lobby-player .toggle-bot:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.bot-badge {
  font-size: 0.65rem;
  background: #6c3483;
  color: #f5eef8;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.p-chip.bot-chip {
  border-color: rgba(155, 89, 182, 0.45);
}

.char-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: top;
}

.char-info {
  padding: 0.85rem 1rem 1rem;
}

.char-info h3 {
  margin: 0 0 0.35rem;
  color: var(--gold-soft);
  font-size: 1.05rem;
}

.char-info p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  color: var(--cream-dim);
  line-height: 1.35;
}

.char-info .special {
  color: var(--cream);
  font-size: 0.8rem;
}

.spend-struct {
  margin: 0.45rem 0 0.35rem;
}

.spend-struct-label,
.skill-struct-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cream-dim);
  margin: 0.35rem 0 0.25rem;
}

.spend-struct-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.spend-struct-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border, #2a3a55);
  border-radius: 999px;
  padding: 0.18rem 0.45rem;
}

.spend-struct-chip strong {
  color: var(--gold-soft, #e8c96a);
  font-weight: 600;
}

.skill-bullets {
  margin: 0.25rem 0 0;
  padding-left: 0.95em;
  list-style: disc;
  list-style-position: outside;
  color: var(--cream);
  font-size: 0.8rem;
  line-height: 1.4;
}

.skill-bullets li {
  margin: 0.15rem 0;
}

.char-info .skill-bullets {
  margin-top: 0.35rem;
}

.char-info .home {
  color: var(--gold);
  font-size: 0.8rem;
}

.char-info .hover-hint {
  margin-top: 0.45rem !important;
  font-size: 0.72rem !important;
  color: rgba(212, 160, 23, 0.75) !important;
  font-style: italic;
}

/* ——— Character skill tooltips ——— */

.has-tooltip {
  position: relative;
}

.skill-tooltip {
  display: none;
  position: absolute;
  z-index: 80;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  width: min(280px, 70vw);
  padding: 0.75rem 0.85rem;
  background: #0f1a30;
  border: 1px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  text-align: left;
  pointer-events: none;
  color: var(--cream);
  font-weight: 400;
  white-space: normal;
}

.skill-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #0f1a30;
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
}

.has-tooltip:hover .skill-tooltip,
.has-tooltip:focus-within .skill-tooltip {
  display: block;
}

/* Setup cards: tooltip above so it isn't clipped by grid bottom */
.char-card .skill-tooltip {
  top: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
}

.char-card .skill-tooltip::before {
  top: auto;
  bottom: -6px;
  border-left: none;
  border-top: none;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}

/* Player chips: drop below header */
.p-chip .skill-tooltip {
  top: calc(100% + 10px);
  bottom: auto;
  left: 0;
  transform: none;
  min-width: 240px;
}

.p-chip .skill-tooltip::before {
  left: 18px;
  transform: rotate(45deg);
}

/* Lobby list: open to the left of the sticky panel */
.lobby-player .skill-tooltip {
  left: auto;
  right: calc(100% + 10px);
  top: 0;
  transform: none;
  width: 260px;
}

.lobby-player .skill-tooltip::before {
  top: 14px;
  left: auto;
  right: -6px;
  transform: rotate(45deg);
  border-left: none;
  border-top: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
  border-bottom: none;
}

.skill-tip-name {
  font-weight: 700;
  color: var(--gold-soft);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.skill-tip-blurb {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--cream-dim);
  line-height: 1.35;
}

.skill-tip-section {
  margin-bottom: 0.5rem;
}

.skill-tip-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 0.2rem;
}

.skill-mults {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--cream);
}

.skill-tip-special {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--cream);
}

ul.skill-tip-special.skill-bullets {
  padding-left: 0.95em;
  list-style: disc;
}

ul.skill-tip-special.skill-bullets li {
  margin: 0.2rem 0;
}

.skill-tip-note {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--cream-dim);
  font-style: italic;
}

.skill-tip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--cream-dim);
}

.lobby-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: sticky;
  top: 1rem;
  align-self: start;
}

.lobby-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--gold-soft);
}

#lobby-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

#lobby-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

#lobby-list img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

#lobby-list .remove-p {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--cream-dim);
  font-size: 1rem;
}

#lobby-list .remove-p:hover {
  color: var(--danger);
}

#start-game {
  width: 100%;
  margin-top: 0.5rem;
}

/* ——— Game layout ——— */

.game-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 0.65rem 1rem;
  background: rgba(10, 18, 36, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: visible;
}

.game-header .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--gold-soft);
}

.game-header .brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.meta-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--navy-3);
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.tag.gold {
  border-color: var(--gold);
  color: var(--gold-soft);
}

#players-bar {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.15rem 0;
}

.p-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--navy-3);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.7rem 0.2rem 0.25rem;
  white-space: nowrap;
  font-size: 0.75rem;
}

.p-chip.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.35);
}

.p-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.p-chip strong {
  display: block;
  font-size: 0.8rem;
}

.p-chip span {
  color: var(--cream-dim);
}

.game-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  min-height: calc(100vh - 60px);
}

@media (max-width: 960px) {
  .game-body {
    grid-template-columns: 1fr;
  }
}

.map-panel {
  position: relative;
  padding: 0.5rem;
  min-height: 420px;
}

#map-svg {
  width: 100%;
  height: auto;
  min-height: 400px;
  border-radius: var(--radius);
  background: #0d1528;
  border: 1px solid var(--border);
  display: block;
}

#city-info {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  max-width: 280px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  max-height: 50%;
  overflow: auto;
}

#city-info.open {
  opacity: 1;
  pointer-events: auto;
}

#city-info h3 {
  margin: 0 0 0.4rem;
  color: var(--gold-soft);
  font-size: 0.95rem;
}

#city-info ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.1rem;
}

#city-info .you-are-here {
  color: var(--gold);
  font-weight: 600;
}

#city-info .flyable {
  color: var(--ok);
}

.muted {
  color: var(--cream-dim);
  font-size: 0.85rem;
}

.side-panel {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 0.85rem 1rem 1.5rem;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  min-width: 0;
}

.side-panel h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.side-panel h3:first-child {
  margin-top: 0.25rem;
}

.bal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.bal {
  background: var(--navy);
  border-left: 3px solid var(--c, var(--gold));
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
}

.bal strong {
  font-family: var(--mono);
  font-size: 0.85rem;
}

#event-display {
  display: flex;
  gap: 0.65rem;
  background: var(--navy);
  border-radius: 8px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

#event-display .event-art {
  width: 56px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

#event-display h4 {
  margin: 0 0 0.25rem;
  color: var(--gold-soft);
  font-size: 0.9rem;
}

#event-display p {
  margin: 0;
  color: var(--cream-dim);
  line-height: 1.35;
}

.bonus-tag {
  color: var(--ok) !important;
  font-weight: 600;
  margin-top: 0.35rem !important;
}

.mini-card {
  display: inline-block;
  border: 1px solid;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  margin: 0.15rem;
  background: var(--navy);
}

.ticket {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: space-between;
  background: var(--navy);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
}

.ticket strong {
  flex: 1;
}

.ticket-status {
  flex-shrink: 0;
  font-weight: 700;
  width: 1rem;
  text-align: center;
  color: var(--cream-dim);
}

.ticket.open {
  border-color: rgba(212, 160, 23, 0.35);
}

.ticket.open .ticket-status {
  color: var(--gold-soft);
}

.ticket.completed {
  border-color: rgba(46, 204, 113, 0.45);
  background: rgba(46, 204, 113, 0.08);
  opacity: 0.95;
}

.ticket.completed strong {
  text-decoration: line-through;
  text-decoration-color: rgba(46, 204, 113, 0.55);
  color: var(--cream-dim);
}

.ticket.completed .ticket-status {
  color: var(--ok);
}

.ticket.completed .ticket-pts {
  color: var(--ok);
  font-weight: 600;
  white-space: nowrap;
}

#my-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
}

#my-stats span {
  background: var(--navy);
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
}

#my-achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.ach {
  font-size: 0.68rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: var(--navy);
  color: var(--cream-dim);
  border: 1px solid transparent;
}

.ach.got {
  color: var(--gold-soft);
  border-color: var(--gold);
}

/* Turn checklist + onboarding */
.turn-checklist {
  background: linear-gradient(145deg, #152238, #0f1a30);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
}

.turn-checklist .check-title {
  font-weight: 700;
  color: var(--gold-soft);
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.turn-checklist .check-row {
  padding: 0.15rem 0;
  color: var(--cream-dim);
}

.turn-checklist .check-row.done {
  color: #6fbf7a;
}

.turn-checklist .check-row.now {
  color: var(--cream);
  font-weight: 600;
}

.suggest-tip {
  margin-top: 0.45rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 184, 28, 0.1);
  border-left: 3px solid var(--gold);
  border-radius: 0 6px 6px 0;
  color: var(--cream);
  font-size: 0.8rem;
  line-height: 1.35;
}

.action-economy {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.55rem;
}

.pill {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--navy-2);
}

.pill.free,
.pill.ok {
  border-color: #6fbf7a;
  color: #9fd8a6;
}

.pill.used {
  opacity: 0.55;
}

.action-section {
  margin-bottom: 0.55rem;
}

.action-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 0.3rem;
}

.ticket.race {
  border-color: #ffb81c;
  background: rgba(255, 184, 28, 0.08);
}

.ticket.prog-half {
  border-color: var(--gold-soft);
}

.ticket.prog-ready {
  box-shadow: 0 0 0 1px var(--gold);
}

.card-option.sold-out {
  opacity: 0.45;
}

.tutorial-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(5, 10, 22, 0.72);
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.tutorial-overlay.show {
  display: flex;
}

.tutorial-card {
  max-width: 420px;
  width: 100%;
  background: var(--panel);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.tutorial-card h2 {
  margin: 0 0 0.75rem;
  color: var(--gold-soft);
  font-size: 1.25rem;
}

.tutorial-steps {
  margin: 0 0 0.85rem;
  padding-left: 1.2rem;
  line-height: 1.45;
  color: var(--cream);
  font-size: 0.9rem;
}

.tutorial-steps li {
  margin-bottom: 0.35rem;
}

.tutorial-goal {
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0 0 0.65rem;
}

.tutorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

#phase-panel {
  background: var(--navy);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-top: 0.75rem;
}

#phase-panel h3 {
  margin: 0 0 0.5rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  color: var(--gold-soft);
}

#phase-panel h3 small {
  color: var(--cream-dim);
  font-weight: 400;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.end-turn {
  width: 100%;
}

.income-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.spend-roll-box {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin: 0.5rem 0 0.65rem;
}

.spend-roll-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.spend-roll-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.spend-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  font-size: 0.78rem;
}

.spend-chip .spend-cat {
  color: var(--cream-dim);
  text-transform: capitalize;
}

.spend-chip strong {
  font-family: var(--mono);
  color: var(--gold-soft);
}

.income-lines {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.78rem;
}

.income-lines li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  padding: 0.15rem 0;
  color: var(--cream-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.income-lines .spend-cat {
  text-transform: capitalize;
  color: var(--gold-soft);
  min-width: 4.5rem;
}

.earn-pref-hint {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  line-height: 1.35;
}

.earn-pref-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
}

/* Stacked rows so long card names never crush the side panel */
.earn-pref-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.4rem 0.45rem;
  background: var(--navy-2, #0f1a30);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.earn-pref-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.earn-pref-cat {
  text-transform: capitalize;
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.earn-pref-rate {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-family: var(--mono, ui-monospace, monospace);
  color: var(--gold-soft, #e8c56a);
  background: rgba(212, 160, 23, 0.12);
  border: 1px solid rgba(212, 160, 23, 0.35);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  white-space: nowrap;
}

.earn-pref-select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.78rem;
  line-height: 1.3;
  padding: 0.35rem 0.45rem;
  background: var(--navy, #0a1224);
  color: var(--cream, #f0e6d3);
  border: 1px solid var(--border, #2a3a55);
  border-radius: 6px;
  /* Prevent native select from forcing row wider than panel */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.earn-pref-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.earn-pref-select:focus {
  outline: none;
  border-color: var(--gold, #d4a017);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.35);
}

#earn-prefs {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Hotel icons (i2i from real exteriors) */
.hotel-list {
  list-style: none;
  margin: 0.4rem 0 0.75rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hotel-list-item {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
}

.hotel-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border, #2a3a55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  background: #e8e8e8;
}

.hotel-icon-lg {
  width: 64px;
  height: 64px;
  border-radius: 12px;
}

.hotel-pick {
  display: flex !important;
  align-items: center;
  gap: 0.65rem;
}

.hotel-pick .hotel-icon {
  margin-left: 0.15rem;
}

.char-tip {
  font-size: 0.8rem;
  color: var(--cream-dim);
}

#game-log {
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.72rem;
  color: var(--cream-dim);
}

.log-line {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.35;
}

.log-line .r {
  color: var(--gold);
  font-family: var(--mono);
  margin-right: 0.3rem;
}

/* ——— Modal ——— */

#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--navy-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 1.25rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  margin: 0 0 0.75rem;
  color: var(--gold-soft);
  font-size: 1.15rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.field input,
.field select {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
}

.card-option {
  display: flex;
  gap: 0.55rem;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.card-option:hover {
  border-color: var(--gold);
}

.card-option.disabled-opt {
  opacity: 0.45;
  cursor: not-allowed;
}

.card-option strong {
  display: block;
  margin-bottom: 0.15rem;
}

.card-option p {
  margin: 0.15rem 0;
  color: var(--cream-dim);
}

.bank-tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: #fff;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.card-pick-list,
.flight-list {
  max-height: 320px;
  overflow-y: auto;
}

.flight-search-field input[type='search'] {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  width: 100%;
  color: var(--cream);
}

.flight-search-field input[type='search']:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.35);
}

.flight-search-field input[type='search']::placeholder {
  color: var(--cream-dim);
  opacity: 0.75;
}

.ticket-pick {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.ticket.pick {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--navy);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}

/* ——— Toast ——— */

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--navy-3);
  border: 1px solid var(--gold);
  color: var(--cream);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  z-index: 200;
  transition: transform 0.25s ease;
  font-size: 0.9rem;
  max-width: 90vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--danger);
}

/* ——— Rules / Game over ——— */

.rules-wrap,
.gameover-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.rules-wrap h1,
.gameover-wrap h1 {
  color: var(--gold-soft);
}

.rules-wrap h2 {
  color: var(--gold);
  margin-top: 1.75rem;
  font-size: 1.15rem;
}

.rules-wrap p,
.rules-wrap li {
  color: var(--cream-dim);
  line-height: 1.55;
  font-size: 0.95rem;
}

.rules-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}

.rules-wrap th,
.rules-wrap td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.rules-wrap th {
  background: var(--navy-3);
  color: var(--gold-soft);
}

#winner-banner {
  font-size: 1.4rem;
  color: var(--gold-soft);
  margin: 1rem 0;
}

#final-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

#final-table th,
#final-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

#final-table th {
  background: var(--navy-3);
}

.winner-row {
  background: rgba(212, 160, 23, 0.15);
}

.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  color: var(--cream-dim);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-right: 0.3rem;
  vertical-align: middle;
  border-radius: 2px;
}

.legend .ua::before {
  background: #ffb81c;
}
.legend .dl::before {
  background: #c8102e;
}
.legend .aa::before {
  background: #0078d2;
}

/* Flight animation plane + headshot + trail */
.flight-plane {
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}

.flight-plane-img {
  /* wings read better slightly larger */
}

.flight-head-g {
  pointer-events: none;
}

.flight-trail {
  pointer-events: none;
}

.hotel-list-item.hotel-claimed,
.hotel-pick.hotel-claimed {
  opacity: 0.55;
}
.hotel-list-item.hotel-claimed strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
