/* World: The Dusty Spur, Saguaro Bend, 1878.
   Sun-bleached parchment, woodtype headings, blue-black ink for debits and red ink for credits, like an old ledger book. */
body[data-world="saloon"] {
  --paper: #E8D2AA;
  --sheet: #F7ECD4;
  --ink: #2E1D12;
  --muted: #7A5E44;
  --rule: #CDB58C;
  --rule-soft: #E4D2AE;
  --ledger: #8E2A1B;
  --dr: #1F3B5C;
  --dr-wash: #E4E3D6;
  --cr: #9A2A1A;
  --cr-wash: #F2DCC6;
  --good: #3F6B2A;
  --bad: #A4161A;
  --bad-wash: #F3D3C8;
  --display: "Rye", "Bricolage Grotesque", Georgia, serif;
  --body: "Lora", Georgia, "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", ui-monospace, monospace;
  color-scheme: light;
  background: var(--paper);
  color: var(--ink);
}

/* Background: warm sky fading to sand, distant mesas, dust, film grain */
.sa-sky { position: absolute; inset: 0; background: linear-gradient(#F3C98E 0%, #EFD6AC 35%, #E8D2AA 70%, #DDBF8F 100%); }
.sa-ridge { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 26vh; }
.sa-dust { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-grain { position: absolute; inset: 0; opacity: .5; mix-blend-mode: multiply; pointer-events: none;
  background-image: radial-gradient(rgba(90, 60, 30, .12) 1px, transparent 1.2px), radial-gradient(rgba(90, 60, 30, .08) 1px, transparent 1.2px);
  background-size: 7px 7px, 11px 11px; background-position: 0 0, 3px 5px; }

/* Type */
body[data-world="saloon"] h1, body[data-world="saloon"] h2 { font-family: var(--display); font-weight: 400; letter-spacing: .02em; color: #5A1C14; }
body[data-world="saloon"] h3 { font-family: var(--body); font-weight: 600; letter-spacing: 0; }
body[data-world="saloon"] .eyebrow { font-family: var(--mono); font-weight: 700; color: #8A6A4C; letter-spacing: .16em; }
body[data-world="saloon"] .prose { font-family: "IM Fell English", var(--body); font-size: 18px; line-height: 1.55; }
body[data-world="saloon"] .prose b { color: #5A1C14; }
body[data-world="saloon"] .back { font-family: var(--mono); font-weight: 700; color: #5A1C14; }

/* Header: a painted board */
body[data-world="saloon"] .bar { padding: 10px 16px; background: #3B2216; color: #F1DDB4; border-radius: 4px;
  box-shadow: inset 0 0 0 2px #5A3322, inset 0 0 0 4px #2A170E, 0 3px 0 #1E110B; }
body[data-world="saloon"] .brand, body[data-world="saloon"] .brand b { color: #F6E3BA; }
body[data-world="saloon"] .brand b { font-family: var(--display); font-weight: 400; letter-spacing: .04em; }
body[data-world="saloon"] .brand span { color: #C9A877; font-family: var(--mono); }
body[data-world="saloon"] .brand .mark { color: #E2B866; }
body[data-world="saloon"] .nav a { color: #F1DDB4; font-family: var(--mono); font-weight: 700; }
body[data-world="saloon"] .nav a:hover { background: rgba(241, 221, 180, .12); }
body[data-world="saloon"] .nav a.on { background: #E2B866; color: #2E1D12; }
body[data-world="saloon"] .stats .eyebrow { color: #C9A877; }
body[data-world="saloon"] .stats .num { color: #F6E3BA; }

/* Paper: deckled edge shadow, a little warmth */
body[data-world="saloon"] .sheet, body[data-world="saloon"] .bigt, body[data-world="saloon"] .journal {
  border-radius: 3px; border-color: #D7BF94;
  box-shadow: 0 1px 0 #fff8e6 inset, 0 10px 24px -14px rgba(70, 40, 15, .55), 0 2px 4px rgba(70, 40, 15, .12);
  background-image: radial-gradient(120% 80% at 50% 0%, rgba(255, 250, 235, .7), transparent 60%);
}
body[data-world="saloon"] .panel-head { border-bottom: 1px dashed var(--rule); padding-bottom: 10px; }

body[data-world="saloon"] .btn { font-family: var(--display); font-weight: 400; letter-spacing: .04em; font-size: 16px;
  background: #8E2A1B; border-color: #5A1C14; color: #FBEFD5; border-radius: 4px; box-shadow: 0 3px 0 #4A140C; }
body[data-world="saloon"] .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #4A140C; }
body[data-world="saloon"] .btn.ghost { background: transparent; color: #5A1C14; box-shadow: none; }
body[data-world="saloon"] .pill { font-family: var(--mono); background: transparent; border-color: var(--rule); }

/* ---------- Scenario home ---------- */
.sa-hero { position: relative; aspect-ratio: 1200 / 440; min-height: 320px; border-radius: 6px; overflow: hidden;
  box-shadow: 0 0 0 6px #3B2216, 0 0 0 8px #1E110B, 0 18px 40px -16px rgba(60, 30, 10, .7); margin: 8px; }
.sa-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-tumbleweed { animation: sa-roll 22s linear infinite; }
.sa-tumbleweed .spin { animation: sa-spin 1.1s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes sa-roll { 0% { transform: translate(-60px, 404px); } 30% { transform: translate(1260px, 404px); } 100% { transform: translate(1260px, 404px); } }
@keyframes sa-spin { to { transform: rotate(360deg); } }
.sa-plaque { position: absolute; left: 5%; top: 50%; transform: translateY(-50%) rotate(-1.5deg); width: min(44%, 420px); padding: 26px 26px 22px;
  background: #F4E3BD; color: #2E1D12; text-align: center; display: grid; gap: 6px;
  box-shadow: 0 14px 30px -10px rgba(40, 15, 5, .7), inset 0 0 40px rgba(150, 100, 50, .28);
  clip-path: polygon(0 2%, 3% 0, 30% 1%, 60% 0, 97% 1%, 100% 4%, 99% 40%, 100% 75%, 98% 100%, 70% 99%, 35% 100%, 2% 99%, 0 70%, 1% 35%); }
.sa-plaque h1 { font-size: clamp(30px, 5vw, 54px) !important; line-height: .95; color: #5A1C14; }
.sa-plaque .nail { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #CFC2A6, #4A4036); }
.nail.tl { top: 10px; left: 12px; } .nail.tr { top: 10px; right: 12px; } .nail.bl { bottom: 10px; left: 12px; } .nail.br { bottom: 10px; right: 12px; }
.sa-small { font: 700 12px/1.35 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #6E4E33; }
.sa-small.strong { color: #8E2A1B; margin-top: 4px; }
.sa-rule { color: #8E2A1B; letter-spacing: .6em; font-size: 12px; }
@media (max-width: 700px) {
  .sa-hero { aspect-ratio: auto; height: 420px; }
  .sa-plaque { left: 50%; top: 24px; transform: translateX(-50%) rotate(-1.5deg); width: calc(100% - 48px); }
}

/* Prologue: a drop cap, like a printed broadside */
body[data-world="saloon"] .prologue .prose p:first-child::first-letter { font-family: var(--display); float: left; font-size: 54px; line-height: .9; margin: 4px 8px 0 0; color: #8E2A1B; }

/* Chapter list: the ledger book's index, with dot leaders */
body[data-world="saloon"] .chapter { border-top: 1px dashed var(--rule); border-radius: 2px; }
body[data-world="saloon"] .chapter .n { font-family: var(--display); font-size: 15px; letter-spacing: .04em; text-transform: none; color: #8E2A1B; }
body[data-world="saloon"] .chapter h3 { font-size: 17px; }
body[data-world="saloon"] .chapter.next { background: rgba(142, 42, 27, .07); }
body[data-world="saloon"] .chapter.locked { opacity: .55; }
body[data-world="saloon"] .chapter.locked p { font-style: italic; }
body[data-world="saloon"] .stars { color: #8E2A1B; }
body[data-world="saloon"] .c-next { color: #8E2A1B; font-family: var(--display); text-transform: none; letter-spacing: .02em; font-size: 14px; font-weight: 400; }

/* Chapter briefing */
body[data-world="saloon"] .lesson { border-left: 3px double #8E2A1B; }
body[data-world="saloon"] .lesson p { font-size: 17px; }
body[data-world="saloon"] .new-acc { background: #FBF3E0; border-color: var(--rule); }

/* ---------- Play: a ledger page ---------- */
body[data-world="saloon"] .journal { border-left: 4px solid #8E2A1B; }
body[data-world="saloon"] .journal .event { font-family: var(--body); font-weight: 600; font-size: clamp(20px, 3vw, 26px); }
body[data-world="saloon"] .journal .event .num { color: #8E2A1B; font-family: var(--mono); font-weight: 700; }
body[data-world="saloon"] .clock { background: #8E2A1B; }
body[data-world="saloon"] .bigt {
  padding-left: 60px;
  background-color: #FBF4E2;
  background-image: linear-gradient(90deg, transparent 38px, rgba(164, 22, 26, .45) 38px 39px, transparent 39px 42px, rgba(164, 22, 26, .45) 42px 43px, transparent 43px),
                    repeating-linear-gradient(transparent 0 27px, rgba(31, 59, 92, .14) 27px 28px);
}
body[data-world="saloon"] .t-top { border-bottom: 3px double var(--ink); }
body[data-world="saloon"] .t-col.cr { border-left: 3px double var(--ink); }
body[data-world="saloon"] .t-lbl { font-weight: 700; }
body[data-world="saloon"] .slot { border-color: #BFA27A; background: rgba(255, 252, 240, .6); }
body[data-world="saloon"] .pl-name { font-family: var(--body); font-weight: 600; font-style: italic; }
body[data-world="saloon"] .acc { background: linear-gradient(#F3E2BE, #E6CFA2); border-color: #B08A5A; border-radius: 4px; box-shadow: 0 2px 0 #9C7748, inset 0 1px 0 #FFF6DD; }
body[data-world="saloon"] .acc:hover:not(:disabled) { border-color: #5A1C14; }
body[data-world="saloon"] .acc-name { font-family: var(--body); font-weight: 600; }
body[data-world="saloon"] .post { background: #3B2216; color: #F6E3BA; border-top: 3px solid #1E110B; }
body[data-world="saloon"] .post .muted, body[data-world="saloon"] .post .entry-line .gap { color: #C9A877; }
body[data-world="saloon"] .post .why { color: #F1DDB4; }
body[data-world="saloon"] .post .btn { background: #E2B866; color: #2E1D12; border-color: #1E110B; box-shadow: 0 3px 0 #1E110B; }
body[data-world="saloon"] .verdict { font-family: var(--display); font-weight: 400; }
body[data-world="saloon"] .verdict.ok { color: #A9D98B; }
body[data-world="saloon"] .verdict.no { color: #F49A86; }
body[data-world="saloon"] .pts { color: #E2B866; }
body[data-world="saloon"] .stamp { font-family: var(--display); font-weight: 400; color: #8E2A1B; border-color: #8E2A1B; letter-spacing: .08em; }
body[data-world="saloon"] .stamp::after { content: " ✶ Paid up"; }

/* ---------- Arrival: sepia title card, then the batwing doors ---------- */
.arrival-saloon { color: #2E1D12; perspective: 1400px; background: transparent; }
.arrival-saloon::before { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 70% at 50% 45%, #CFA36E, #6E4526 75%, #2A170E);
  animation: sa-backdrop 3.6s ease-in-out forwards; }
@keyframes sa-backdrop { 0%, 50% { opacity: 1; } 68%, 100% { opacity: 0; } }
.arrival-saloon .sa-card { position: relative; z-index: 1; text-align: center; display: grid; gap: 10px; animation: sa-card 3.6s ease-in-out forwards; }
.arrival-saloon .sa-card h2 { font: 400 clamp(48px, 10vw, 110px)/1 "Rye", Georgia, serif; color: #3A1A0F; text-shadow: 0 2px 0 rgba(255, 230, 180, .35); }
.arrival-saloon .sa-card .sa-small { color: #4A2A18; }
@keyframes sa-card { 0% { opacity: 0; transform: scale(.96); } 15%, 40% { opacity: 1; transform: none; } 50%, 100% { opacity: 0; transform: scale(1.04); } }
.arrival-saloon .sa-doors { position: absolute; inset: 0; z-index: 2; display: flex; justify-content: center; align-items: center; pointer-events: none; }
.arrival-saloon .door { width: min(26vw, 320px); height: min(58vh, 520px); margin-top: 10vh; box-shadow: inset 0 0 30px rgba(0, 0, 0, .5), 0 30px 60px rgba(30, 10, 0, .45);
  background: repeating-linear-gradient(90deg, #6B3D23 0 22px, #4A2A18 22px 25px), #5A3322;
  border: 6px solid #2A170E;
  opacity: 0; animation: sa-door-in .4s ease-out 1.5s forwards, sa-door-open 1.1s cubic-bezier(.3, 1.4, .5, 1) 2.45s forwards; }
.arrival-saloon .door.left { transform-origin: left center; border-radius: 0 60% 0 0 / 0 16% 0 0; }
.arrival-saloon .door.right { transform-origin: right center; border-radius: 60% 0 0 0 / 16% 0 0 0; }
@keyframes sa-door-in { to { opacity: 1; } }
@keyframes sa-door-open { to { opacity: 0; } }
.arrival-saloon .door.left { animation-name: sa-door-in, sa-door-left; }
.arrival-saloon .door.right { animation-name: sa-door-in, sa-door-right; }
@keyframes sa-door-left { to { transform: rotateY(-105deg); opacity: .2; } }
@keyframes sa-door-right { to { transform: rotateY(105deg); opacity: .2; } }
.arrival-saloon .sa-grain { opacity: .7; }
.arrival-saloon .arrival-skip { color: #2A170E; font-family: "Courier Prime", var(--mono); }

@media (prefers-reduced-motion: reduce) {
  .sa-tumbleweed, .sa-tumbleweed .spin { animation: none; display: none; }
}
