:root {
  --ink: #10162d;
  --paper: #f7f4ec;
  --aqua: #19b6a4;
  --magenta: #f00658;
  --gold: #ffa60a;
  --purple: #5c2d88;
  --line: rgba(16, 22, 45, .14);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--ink);
  font-family: "DM Sans", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.noise {
  position: fixed; inset: 0; z-index: -1; opacity: .14; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
}
.site-header {
  height: 86px; padding: 0 clamp(22px, 4vw, 68px); display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.12);
  color: white; background: var(--ink);
}
.brand { color: inherit; text-decoration: none; display: grid; grid-template-columns: auto auto; align-items: end; line-height: .8; }
.brand span { grid-column: 1 / -1; font-size: 9px; letter-spacing: .32em; margin: 0 0 7px 3px; }
.brand strong { font-family: "Playfair Display", serif; color: var(--aqua); font-size: 28px; }
.brand em { font-style: normal; font-weight: 700; font-size: 8px; letter-spacing: .24em; margin-left: 9px; padding-bottom: 2px; }
.header-actions { display: flex; align-items: center; gap: 28px; }
.text-button { border: 0; background: none; font-weight: 600; cursor: pointer; }
.connection { font-size: 12px; color: rgba(255,255,255,.62); display: flex; gap: 8px; align-items: center; }
.connection i { width: 8px; height: 8px; background: var(--gold); border-radius: 50%; }
.connection.online i { background: var(--aqua); box-shadow: 0 0 0 4px rgba(32,182,167,.15); }

.landing {
  min-height: calc(100vh - 86px); padding: 7vh clamp(22px, 7vw, 120px);
  display: grid; grid-template-columns: 1.2fr .8fr; gap: 8vw; align-items: center;
  color: white;
  background: linear-gradient(90deg, transparent 0 68%, rgba(240,6,88,.13) 68% 100%),
              radial-gradient(circle at 18% 48%, rgba(25,182,164,.24), transparent 36%),
              var(--ink);
}
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .28em; color: var(--magenta); }
.landing h1 { font-size: clamp(52px, 6.5vw, 98px); line-height: .94; letter-spacing: -.055em; margin: 18px 0 30px; }
.landing h1 span { font-family: "Playfair Display", serif; font-style: italic; font-weight: 600; color: var(--aqua); }
.lead { max-width: 590px; color: rgba(255,255,255,.68); font-size: clamp(17px, 1.5vw, 21px); line-height: 1.55; }
.feature-row { display: flex; gap: 10px; margin-top: 42px; flex-wrap: wrap; }
.feature-row span { border: 1px solid rgba(255,255,255,.18); padding: 10px 15px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.06); }
.join-card { background: var(--paper); color: var(--ink); padding: clamp(26px, 3.5vw, 48px); border-radius: 2px; box-shadow: 24px 28px 0 rgba(25,182,164,.3); }
.tabs { display: flex; border-bottom: 1px solid rgba(16,22,45,.16); margin-bottom: 26px; }
.tab { flex: 1; color: rgba(16,22,45,.48); border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0 0 15px; cursor: pointer; font-weight: 600; }
.tab.active { color: var(--ink); border-color: var(--magenta); }
label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(16,22,45,.58); margin-bottom: 20px; }
input { width: 100%; border: 0; border-bottom: 1px solid rgba(16,22,45,.28); padding: 14px 0; background: transparent; color: var(--ink); outline: none; font-size: 20px; text-transform: none; }
input:focus { border-color: var(--aqua); }
#roomCode { letter-spacing: .3em; text-transform: uppercase; }
.primary { border: 0; padding: 17px 20px; width: 100%; display: flex; align-items: center; justify-content: space-between; background: var(--magenta); color: white; font-weight: 700; cursor: pointer; }
.primary:hover { background: #d9004d; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.primary span { font-size: 20px; }
.fine-print { font-size: 11px; color: rgba(16,22,45,.48); line-height: 1.5; margin: 18px 0 0; }
.token-picker { border: 0; padding: 0; margin: 0 0 24px; }
.token-picker legend { padding: 0; margin-bottom: 10px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: rgba(16,22,45,.58); }
.token-options { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.token-option { height: 68px; border: 1px solid rgba(16,22,45,.14); background: white; padding: 4px; cursor: pointer; overflow: hidden; }
.token-option img { width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.token-option.selected { border: 2px solid var(--aqua); background: rgba(25,182,164,.12); box-shadow: 0 0 0 2px rgba(25,182,164,.16); }

.game { min-height: calc(100vh - 86px); display: grid; grid-template-columns: 330px minmax(0, 1fr); background: var(--paper); }
.sidebar { padding: 28px; border-right: 1px solid var(--line); overflow-y: auto; max-height: calc(100vh - 86px); }
.room-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.session-actions { display: flex; gap: 14px; justify-content: flex-end; margin: -12px 0 18px; }
.text-danger { border: 0; background: none; color: var(--magenta); padding: 0; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; }
.room-heading p, .turn-card p { font-size: 9px; font-weight: 700; letter-spacing: .2em; color: #777b8c; margin: 0 0 5px; }
#copyCode { border: 0; padding: 0; background: none; cursor: pointer; }
#copyCode strong { letter-spacing: .18em; font-size: 19px; }
#copyCode span { font-size: 10px; color: #777b8c; margin-left: 4px; }
.inflation { font-size: 10px; text-transform: uppercase; color: #777b8c; }
.inflation b { display: block; color: var(--purple); font-size: 24px; text-align: right; }
.turn-card { background: var(--ink); color: white; padding: 22px; margin-bottom: 18px; border-left: 4px solid var(--aqua); }
.turn-card h2 { margin: 3px 0 2px; font-size: 22px; }
.turn-card span { font-size: 12px; color: rgba(255,255,255,.55); }
.player-row { display: grid; grid-template-columns: 5px 28px 1fr auto; gap: 9px; align-items: center; padding: 10px 3px; border-bottom: 1px solid var(--line); }
.player-dot { width: 5px; height: 34px; border-radius: 4px; }
.player-avatar { width: 25px; height: 38px; object-fit: contain; object-position: bottom; }
.player-row strong { display: block; font-size: 13px; }
.player-row small { color: #7b7f8c; }
.player-money { text-align: right; font-weight: 700; font-size: 13px; }
.player-money small { display: block; font-weight: 500; font-size: 10px; }
.lobby-actions { display: grid; gap: 9px; margin: 22px 0; }
.start-button { margin: 0; }
.secondary { border: 1px solid var(--ink); padding: 13px 18px; width: 100%; background: transparent; font-weight: 700; cursor: pointer; }
.secondary:hover { background: rgba(16,22,45,.06); }
.secondary:disabled { opacity: .4; cursor: not-allowed; }
.activity { margin-top: 28px; }
.section-title { display: flex; justify-content: space-between; align-items: center; }
.section-title h3 { font-size: 13px; }
.section-title span { font-size: 8px; letter-spacing: .15em; color: var(--magenta); font-weight: 700; }
.log-entry { font-size: 11px; color: #686c7b; line-height: 1.45; border-left: 1px solid #ccc7ba; padding: 0 0 14px 12px; position: relative; }
.log-entry::before { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--aqua); left: -3px; top: 5px; }

.table { min-width: 0; padding: clamp(16px, 2.5vw, 38px); background: #e9e5da; display: flex; flex-direction: column; }
.board-shell { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.board { position: relative; width: min(100%, calc(100vh - 225px)); aspect-ratio: 1; box-shadow: 0 25px 60px rgba(16,22,45,.18); background: var(--ink); }
.board-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.tokens { position: absolute; inset: 0; pointer-events: none; }
.board .token { position: absolute; width: 3.1%; height: 5.1%; object-fit: contain; object-position: bottom; transform: translate(-50%, -72%); filter: drop-shadow(0 3px 2px rgba(0,0,0,.7)); transition: left .55s ease, top .55s ease; }
.board-status { position: absolute; left: 38%; top: 37%; width: 25%; height: 25%; display: flex; flex-direction: column; justify-content: center; text-align: center; color: white; background: rgba(16,22,45,.9); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(4px); }
.board-status small { color: var(--aqua); letter-spacing: .18em; font-size: 8px; }
.board-status strong { font-family: "Playfair Display", serif; font-style: italic; font-size: clamp(16px, 2vw, 28px); margin: 7px 0; }
.board-status span { font-size: clamp(7px, .8vw, 11px); color: rgba(255,255,255,.55); }
.controls { min-height: 58px; margin: 0 0 18px; display: flex; gap: 12px; align-items: center; justify-content: center; }
.controls .action { width: 100%; min-width: 0; overflow-wrap: anywhere; }
.control-message { text-align: center; color: #656979; font-size: 13px; }
.held-card-actions { margin: 0 0 18px; padding: 12px; border: 1px solid var(--aqua); }
.held-card-actions .control-message { margin: 8px 0; text-align: left; line-height: 1.5; }
.action { border: 0; min-width: 180px; padding: 16px 20px; background: var(--ink); color: white; font-weight: 700; cursor: pointer; }
.action.aqua { background: var(--aqua); }
.action.magenta { background: var(--magenta); }
.dice { width: 58px; height: 58px; display: grid; place-items: center; background: white; border: 3px solid var(--purple); border-radius: 12px; font-size: 28px; font-weight: 800; box-shadow: 0 8px 18px rgba(16,22,45,.16); }
.dice.rolling { animation: dice-tumble .15s linear infinite alternate; }
@keyframes dice-tumble {
  from { transform: rotate(-10deg) translateY(-2px) scale(.96); }
  to { transform: rotate(10deg) translateY(2px) scale(1.04); }
}

dialog { width: min(430px, calc(100% - 32px)); border: 0; padding: 45px; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(16,22,45,.78); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 18px; top: 12px; border: 0; background: none; font-size: 28px; cursor: pointer; }
dialog > p:first-of-type { font-size: 10px; letter-spacing: .24em; font-weight: 700; color: var(--magenta); }
dialog h2 { font-family: "Playfair Display", serif; font-size: 38px; font-style: italic; margin: 12px 0; }
.card-rule { width: 48px; height: 4px; background: var(--aqua); margin: 20px 0; }
#cardText { color: #565b6c; line-height: 1.7; margin-bottom: 30px; }
.game-card { min-height: 510px; overflow: hidden; }
.card-back-face { display: none; min-height: 420px; padding: 38px 28px 24px; color: white; text-align: center; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; border: 2px solid rgba(255,255,255,.55); outline: 8px solid rgba(255,255,255,.12); outline-offset: -18px; }
.card-front-face { display: block; }
.game-card.showing-back { padding: 24px; }
.game-card.showing-back .card-back-face { display: flex; }
.game-card.showing-back .card-front-face { display: none; }
.card-back-kicker { font-size: 11px; letter-spacing: .34em; font-weight: 800; }
.card-back-face strong { margin: 14px 0 6px; font-family: "Playfair Display", serif; font-size: 50px; font-style: italic; line-height: 1; }
.card-back-face small { font-size: 9px; letter-spacing: .25em; font-weight: 800; }
.card-back-face p { margin: auto 0 0; padding-top: 55px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; }
.game-card.card-challenge.showing-back { background: linear-gradient(145deg, #ff9f0a, #e65d00); }
.game-card.card-aqua.showing-back { background: linear-gradient(145deg, #23baa9, #087f78); }
.game-card.card-magenta.showing-back { background: linear-gradient(145deg, #f50059, #a90047); }
.game-card.card-insurance.showing-back { background: linear-gradient(145deg, #b9b9bd, #686b75); }
.game-card.card-aqua .card-rule { background: var(--aqua); }
.game-card.card-magenta .card-rule { background: var(--magenta); }
.game-card.card-challenge .card-rule { background: #ff9f0a; }
.game-card.card-insurance .card-rule { background: #8d8f98; }
.choice-dialog { width: min(480px, calc(100% - 32px)); }
.choice-dialog > p { color: #626778; line-height: 1.6; }
.choice-dialog-actions { display: grid; gap: 10px; margin-top: 26px; }
.choice-dialog-actions .action { width: 100%; }
.player-choice-dialog { width: min(520px, calc(100% - 32px)); }
.player-choice-button {
  display: grid; grid-template-columns: 6px 36px 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; border: 1px solid rgba(16,22,45,.16); background: white;
  padding: 12px 14px; cursor: pointer; color: var(--ink);
}
.player-choice-button:hover { border-color: var(--aqua); background: rgba(25,182,164,.08); }
.player-choice-stripe { width: 6px; height: 42px; border-radius: 4px; }
.player-choice-button img { width: 28px; height: 40px; object-fit: contain; object-position: bottom; }
.player-choice-button strong { display: block; font-size: 14px; }
.player-choice-button small { color: #7b7f8c; font-size: 11px; }
.player-choice-cash { font-weight: 700; font-size: 13px; white-space: nowrap; }
.insurance-dialog { width: min(560px, calc(100% - 32px)); max-height: min(90vh, 720px); flex-direction: column; }
.insurance-dialog[open] { display: flex; }
.company-pick-list { display: grid; gap: 8px; margin: 22px 0 18px; overflow-y: auto; max-height: min(46vh, 360px); padding-right: 4px; }
.company-pick {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center;
  width: 100%; text-align: left; border: 1px solid rgba(16,22,45,.16); background: white;
  padding: 12px 14px; cursor: pointer; color: var(--ink);
}
.company-pick.single-select { grid-template-columns: 1fr auto; }
.company-pick:hover { border-color: var(--aqua); }
.company-pick.selected { border-color: var(--aqua); background: rgba(25,182,164,.1); box-shadow: inset 0 0 0 1px rgba(25,182,164,.35); }
.company-pick.disabled { opacity: .45; cursor: not-allowed; }
.company-pick-mark {
  width: 14px; height: 14px; border: 2px solid rgba(16,22,45,.35); border-radius: 3px; display: grid; place-items: center;
}
.company-pick.selected .company-pick-mark { border-color: var(--aqua); background: var(--aqua); }
.company-pick.selected .company-pick-mark::after { content: ""; width: 6px; height: 6px; background: white; border-radius: 1px; }
.company-pick strong { display: block; font-size: 14px; }
.company-pick small { color: #7b7f8c; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.company-pick-price { font-weight: 700; font-size: 13px; white-space: nowrap; }
.company-pick.group-magenta .company-pick-price { color: var(--magenta); }
.company-pick.group-aqua .company-pick-price { color: var(--aqua); }
.insurance-keep-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; }
.insurance-keep-footer .primary { width: auto; min-width: 190px; }
#insuranceKeepCount { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #626778; }
.rules-drawer { position: fixed; z-index: 10; right: 0; top: 0; height: 100%; width: min(490px, 100%); background: var(--paper); padding: 64px 48px; transform: translateX(100%); transition: transform .3s ease; overflow-y: auto; }
.rules-drawer.open { transform: none; }
.rules-drawer h2 { font-size: 42px; letter-spacing: -.04em; margin: 16px 0 36px; }
.rules-drawer ol { padding: 0; margin: 0; list-style: none; counter-reset: rules; }
.rules-drawer li { counter-increment: rules; display: grid; grid-template-columns: 38px 1fr; border-top: 1px solid var(--line); padding: 18px 0; }
.rules-drawer li::before { content: "0" counter(rules); color: var(--magenta); font-weight: 700; font-size: 11px; padding-top: 3px; }
.rules-drawer li strong, .rules-drawer li span { grid-column: 2; }
.rules-drawer li span { color: #656979; font-size: 13px; line-height: 1.5; margin-top: 5px; }
.rules-note { background: var(--ink); color: white; padding: 20px; font-size: 12px; line-height: 1.6; }
.scrim { position: fixed; z-index: 9; inset: 0; background: rgba(16,22,45,.56); }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 22px; transform: translate(-50%, 30px); background: var(--ink); color: white; padding: 12px 18px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; padding-top: 50px; }
  .landing-copy { text-align: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .feature-row { justify-content: center; }
  .join-card { width: min(480px, 100%); margin: 0 auto 50px; }
  .game { grid-template-columns: 1fr; }
  .sidebar { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .activity { max-height: 220px; overflow-y: auto; }
  .table { min-height: 70vh; }
  .board { width: min(100%, 700px); }
}

/* Information and controls remain usable without reading the printed artwork. */
:focus-visible { outline: 3px solid #6046b5; outline-offset: 3px; }
.skip-link { padding: 10px; color: var(--ink); }
.board-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.board-toolbar label { flex: 1; min-width: 160px; }
.board-toolbar input { padding: 0; }
.board-toolbar .secondary { width: auto; }
.board-shell { overflow: auto; max-height: 75vh; }
.board-shell.zoomed { display: block; }
.ownership-marker { position: absolute; transform: translate(-50%, -50%); border: 2px solid white; border-radius: 50%; background: #10162d; color: white; min-width: 24px; height: 24px; font-size: 12px; cursor: pointer; }
.information-panel { background: var(--paper); padding: 20px; margin-top: 16px; font-size: 14px; line-height: 1.5; }
.information-panel h2 { font-size: 20px; }
.information-panel h3 { font-size: 16px; }
.information-panel select { max-width: 100%; width: 100%; padding: 12px; font: inherit; }
.information-panel summary { cursor: pointer; padding: 14px 0; font-weight: 700; }
.information-panel article { border-top: 1px solid var(--line); padding: 10px 0; }
#companyDirectory, #portfolios { max-height: 420px; overflow-y: auto; }
.action small { display: block; margin-top: 8px; font-weight: 400; }
.action.aqua { color: var(--ink); }
.controls { flex-wrap: wrap; }
.rules-drawer { left: auto; margin: 0; max-height: 100dvh; max-width: 100%; }
dialog { max-height: 90dvh; overflow-y: auto; }
.game-card { min-height: 0; overflow-y: auto; }
.dialog-close { min-width: 44px; min-height: 44px; }
.turn-card span { color: #e0e1e5; }
#endVote { padding: 8px 0; }
#endVote .secondary { margin: 4px 0; }
@media (max-width: 560px) {
  dialog { padding: 24px; }
  dialog h2 { font-size: 28px; }
  .card-back-face { min-height: 280px; }
  .insurance-keep-footer { flex-wrap: wrap; }
  .connection { display: inline; font-size: 10px; }
  .text-danger { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 560px) {
  .site-header { height: 70px; padding: 0 18px; }
  .brand strong { font-size: 23px; }
  .header-actions { gap: 14px; }
  .connection { display: inline; font-size: 10px; }
  .landing { min-height: calc(100vh - 70px); padding: 40px 18px; }
  .landing h1 { font-size: 49px; }
  .game { min-height: calc(100vh - 70px); }
  .sidebar { padding: 18px; }
  .table { padding: 10px; }
  .game { padding-bottom: var(--action-bar-height, 100px); }
  .controls {
    position: fixed; z-index: 8; inset: auto 0 0; margin: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(16,22,45,.16);
    max-height: 45dvh; overflow-y: auto; overscroll-behavior: contain;
    flex-wrap: wrap;
  }
  .controls .action { flex: 1 1 140px; }
  .controls .control-message { flex-basis: 100%; margin: 4px 0; }
  body:has(#game:not(.hidden)) .toast { bottom: calc(var(--action-bar-height, 100px) + 12px); }
  .action { min-width: 130px; flex: 1; }
  .rules-drawer { padding: 58px 24px; }
}
