/* Orsona - the home-page intro (intro.js builds the scene).
   A foggy moonlit cove -> the title focuses -> New Game -> the view tilts down onto the ship's deck,
   where the six decks sit in a circle round a pile of gold -> the decks fly off one by one -> the
   ship sways and heels, the gold slides overboard -> the deck levels out and the setup screen appears.

   3D model: .ix is the camera (perspective 50vh). .ix-world holds a cube room: the cove is the front
   wall, the deck is the floor, and the world rotates about the camera point (z = +50vh), so turning
   it rotateX(-90deg) is the camera looking straight down at the floor. */

html.ix-pending, html.ix-pending body { overflow: hidden; background: #05090f; }
html.ix-pending body > *:not(.ix) { visibility: hidden; }
html.ix-reveal body > .appframe { animation: ix-reveal calc(900ms / var(--ix-sp, 1)) cubic-bezier(.2,.7,.2,1) both; }
@keyframes ix-reveal { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.ix {
  position: fixed; inset: 0; z-index: 5000; overflow: hidden;
  background: repeating-radial-gradient(ellipse 30% 8% at 60% 40%, rgba(120,170,180,.07) 0 3px, transparent 3px 22px), radial-gradient(ellipse at 70% 50%, #123845, #051a22 60%, #020b10);
  perspective: 50vh; perspective-origin: 50% 50%;
  color: #f3ead3; font-family: Georgia, "Times New Roman", serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.ix *, .ix *::before, .ix *::after { box-sizing: border-box; }
.ix-cam, .ix-world, .ix-deck, .ix-heel, .ix-center, .ix-stack { transform-style: preserve-3d; }
.ix-cam { position: absolute; inset: 0; transform-origin: 50% 50% 50vh; }
.ix-world { position: absolute; inset: 0; transform-origin: 50% 50% 50vh; }

/* ---------------------------------------------------------------- the cove (front wall) */
.ix-cove { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(180deg, #060d16 0%, #0d1d2a 38%, #1d3644 60%, #274453 63%, #10232e 64%, #0a1822 100%); }
.ix-stars { position: absolute; left: 0; right: 0; top: 0; height: 55%; opacity: .55;
  background-image:
    radial-gradient(1.2px 1.2px at 8% 12%, #fff, transparent), radial-gradient(1px 1px at 17% 30%, #cfe, transparent),
    radial-gradient(1.4px 1.4px at 26% 8%, #fff, transparent), radial-gradient(1px 1px at 38% 22%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 47% 5%, #dff, transparent), radial-gradient(1px 1px at 55% 28%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 63% 14%, #fff, transparent), radial-gradient(1px 1px at 81% 34%, #cfe, transparent),
    radial-gradient(1.4px 1.4px at 88% 9%, #fff, transparent), radial-gradient(1px 1px at 94% 24%, #fff, transparent),
    radial-gradient(1px 1px at 33% 40%, #fff, transparent), radial-gradient(1.1px 1.1px at 70% 42%, #fff, transparent);
  animation: ix-twinkle 5s ease-in-out infinite alternate; }
@keyframes ix-twinkle { to { opacity: .3; } }
.ix-moon { position: absolute; left: 83%; top: 7%; width: 9.5vmin; height: 9.5vmin; border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, #fffbe8, #e8e2c4 55%, #bdb898 100%);
  box-shadow: 0 0 6vmin 2vmin rgba(230,235,210,.28), 0 0 22vmin 10vmin rgba(160,190,200,.14); opacity: .85; }
.ix-moon::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 60%, rgba(0,0,0,.08) 0 10%, transparent 11%), radial-gradient(circle at 62% 35%, rgba(0,0,0,.07) 0 8%, transparent 9%), radial-gradient(circle at 55% 70%, rgba(0,0,0,.06) 0 6%, transparent 7%); }
.ix-land { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.ix-landbox { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; }
@media (max-aspect-ratio: 1/1) { .ix-landbox { left: -30%; width: 160%; } }
.ix-glitter { position: absolute; left: calc(83% + 4.75vmin); top: 63.5%; width: 16vmin; height: 26%; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, rgba(240,240,215,.5) 0 2px, transparent 2px 7px);
  -webkit-mask-image: radial-gradient(ellipse 50% 100% at 50% 0%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 50% 100% at 50% 0%, #000 20%, transparent 75%);
  opacity: .5; animation: ix-glitter 2.6s ease-in-out infinite alternate; }
@keyframes ix-glitter { 0% { opacity: .35; transform: translateX(-50%) scaleX(.8); } 100% { opacity: .6; transform: translateX(-50%) scaleX(1.15); } }
.ix-swell { position: absolute; left: 0; right: 0; top: 64%; bottom: 0; opacity: .35;
  background: repeating-linear-gradient(178deg, transparent 0 14px, rgba(150,190,200,.12) 14px 16px, transparent 16px 34px);
  animation: ix-swell 9s linear infinite; }
@keyframes ix-swell { from { background-position: 0 0; } to { background-position: 0 136px; } }
.ix-shipbox { position: absolute; left: 41%; width: 15vmin; top: calc(64.4% - 11.25vmin); opacity: .9; }
.ix-light { position: absolute; width: 4px; height: 5px; margin: -2px; background: #ffc46b; border-radius: 1px;
  box-shadow: 0 0 6px 2px rgba(255,170,70,.55), 0 0 22px 8px rgba(255,150,50,.18); }
.ix-shipsvg { display: block; width: 100%; height: auto; overflow: visible; }
.ix-ship { transform-box: fill-box; transform-origin: 50% 90%; animation: ix-bob 5.5s ease-in-out infinite; }
@keyframes ix-bob { 0%, 100% { transform: translateY(0) rotate(-1.6deg); } 50% { transform: translateY(3px) rotate(1.8deg); } }
.ix-lamp { animation: ix-flicker 1.7s steps(6) infinite; }
.ix-lamp2 { animation: ix-flicker 2.3s steps(5) infinite reverse; }
@keyframes ix-flicker { 0%, 100% { opacity: 1; } 30% { opacity: .75; } 55% { opacity: .95; } 80% { opacity: .7; } }

.ix-haze { position: absolute; left: 0; right: 0; top: 44%; height: 34%;
  background: linear-gradient(180deg, transparent, rgba(150,178,186,.22) 45%, rgba(150,178,186,.18) 60%, transparent); }
.ix-fog { position: absolute; left: 0; width: 200%; background-repeat: repeat-x; background-size: 50% 100%; pointer-events: none;
  animation: ix-drift linear infinite; }
.ix-fog.f1 { top: 38%; height: 40%; opacity: .9; animation-duration: 85s;
  background-image: radial-gradient(ellipse 22% 30% at 15% 55%, rgba(195,212,216,.30), transparent 70%), radial-gradient(ellipse 30% 26% at 52% 45%, rgba(195,212,216,.24), transparent 70%), radial-gradient(ellipse 20% 34% at 84% 60%, rgba(195,212,216,.27), transparent 70%); }
.ix-fog.f2 { top: 52%; height: 38%; opacity: .8; animation-duration: 55s; animation-direction: reverse;
  background-image: radial-gradient(ellipse 28% 28% at 30% 50%, rgba(205,220,222,.28), transparent 70%), radial-gradient(ellipse 24% 36% at 75% 40%, rgba(205,220,222,.25), transparent 70%); }
.ix-fog.f3 { top: 66%; height: 30%; opacity: .75; animation-duration: 38s;
  background-image: radial-gradient(ellipse 26% 40% at 20% 60%, rgba(215,228,230,.30), transparent 70%), radial-gradient(ellipse 30% 30% at 64% 45%, rgba(215,228,230,.26), transparent 70%); }
@keyframes ix-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* the ship's rail in the foreground: you're standing on deck looking over it */
.ix-rail { position: absolute; left: 0; right: 0; bottom: 0; height: 17%; }
.ix-rail::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22%;
  background: linear-gradient(180deg, #7b5130 0%, #4d301b 45%, #2c1a0e 100%); box-shadow: 0 6px 14px rgba(0,0,0,.55); z-index: 1; }
.ix-rail::after { content: ""; position: absolute; left: 0; right: 0; top: 20%; bottom: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55)),
    repeating-linear-gradient(90deg, transparent 0 calc(4.2vmin), #3b2413 calc(4.2vmin) calc(6.4vmin), #56361f calc(6.4vmin) calc(7vmin), transparent calc(7vmin) calc(9vmin)),
    linear-gradient(180deg, transparent 72%, #3a2313 72%, #22140a); }

/* ---------------------------------------------------------------- the deck (floor) */
.ix-deck { position: absolute; transform: rotateX(90deg); }
.ix-heel { position: absolute; inset: 0; background: #4a2d17; }   /* shown for any patch the browser hasn't painted yet mid-tilt */
.ix-planks { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ix-center { position: absolute; width: 0; height: 0; }
.ix-stack { position: absolute; left: 0; top: 0; width: var(--cw); height: calc(var(--cw) * 1.4); }
.ix-shadow { position: absolute; inset: -8%; border-radius: 14%; background: radial-gradient(closest-side, rgba(0,0,0,.6), transparent); transform: translate(5%, 7%); }
.ix-card { position: absolute; inset: 0; border-radius: calc(var(--cw) * .07); border: 1px solid rgba(0,0,0,.4);
  background: linear-gradient(160deg, #efe4c8, #cdbd96); box-shadow: 0 1px 1px rgba(0,0,0,.35); }
.ix-card.top { --c1: #1c4e63; --c2: #0f2f3d;
  border: calc(var(--cw) * .035) solid #e0b84a;
  background:
    radial-gradient(circle at 50% 44%, rgba(224,184,74,.22) 0 24%, transparent 25%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.055) 0 5px, transparent 5px 10px),
    linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%; color: #e0b84a; }
.ix-card.top::before { content: ""; position: absolute; inset: 7%; border: 1px solid rgba(224,184,74,.55); border-radius: calc(var(--cw) * .045); }
.ix-card.top svg { width: 46%; height: auto; fill: currentColor; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.ix-card.top b { font: 700 calc(var(--cw) * .1)/1 Georgia, serif; letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.ix-card.top b.long { font-size: calc(var(--cw) * .085); letter-spacing: .06em; }
.ix-coin { position: absolute; left: 0; top: 0; width: var(--coin); height: var(--coin); margin: calc(var(--coin) / -2) 0 0 calc(var(--coin) / -2); border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 52%, rgba(120,70,0,.55) 53% 57%, transparent 58%),
    radial-gradient(circle at 36% 30%, #fff6c8 0 8%, #ffd85a 26%, #e3a824 58%, #a86d0c 86%, #7a4a05 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.6), inset 0 0 0 1px rgba(90,50,0,.45); }
.ix-coin.flat { box-shadow: 1px 2px 3px rgba(0,0,0,.55), inset 0 0 0 1px rgba(90,50,0,.45); }
.ix-coin::after { content: "\2726"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: calc(var(--coin) * .42)/1 Georgia, serif; color: rgba(125,72,0,.6); }
.ix-glint { position: absolute; left: 0; top: 0; width: 1px; height: 1px; }
.ix-glint::before { content: ""; position: absolute; left: -2.5vmin; top: -2.5vmin; width: 5vmin; height: 5vmin;
  background: radial-gradient(circle, #fff 0 6%, rgba(255,240,180,.7) 12%, transparent 40%),
    linear-gradient(0deg, transparent 47%, rgba(255,255,230,.9) 50%, transparent 53%),
    linear-gradient(90deg, transparent 47%, rgba(255,255,230,.9) 50%, transparent 53%);
  opacity: 0; transform: scale(.2) rotate(0deg); }
.ix-glint.on::before { animation: ix-glint 900ms ease-out; }
@keyframes ix-glint { 0% { opacity: 0; transform: scale(.2) rotate(0deg); } 35% { opacity: 1; transform: scale(1) rotate(45deg); } 100% { opacity: 0; transform: scale(.3) rotate(120deg); } }

/* ---------------------------------------------------------------- title, buttons */
.ix-veil { position: absolute; inset: 0; background: #03070c; pointer-events: none; }
.ix-ui { position: absolute; left: 0; right: 0; top: 0; height: 64%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.6vh; padding: 0 16px; text-align: center; pointer-events: none; }
.ix-title { margin: 0; font: 700 clamp(2.7rem, 10.5vw, 7rem)/1.02 Georgia, "Times New Roman", serif; letter-spacing: .04em; opacity: 0;
  background: linear-gradient(180deg, #fff6d2 0%, #f0cf6e 42%, #c38d23 70%, #8d5d10 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: blur(0px) drop-shadow(0 .5vh 1.4vh rgba(0,0,0,.85)); }
.ix-sub { margin: 0; font: italic 400 clamp(.95rem, 2.4vw, 1.35rem)/1.3 Georgia, serif; color: #d9e3e0; letter-spacing: .08em; opacity: 0; text-shadow: 0 2px 8px rgba(0,0,0,.9); }
.ix-go { pointer-events: auto; margin-top: 2.4vh; opacity: 0; font: 700 clamp(1.05rem, 2.6vw, 1.4rem)/1 Georgia, serif; letter-spacing: .06em;
  color: #2a1a06; padding: .85em 2.1em; border-radius: 999px; cursor: pointer;
  border: 2px solid #fff0bd; background: linear-gradient(180deg, #ffe7a0, #e0b84a 55%, #b8881f);
  box-shadow: 0 0 0 4px rgba(224,184,74,.25), 0 10px 30px rgba(0,0,0,.6), 0 0 40px rgba(224,184,74,.25);
  transition: transform .15s, box-shadow .15s; }
.ix-go:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 0 6px rgba(224,184,74,.3), 0 14px 36px rgba(0,0,0,.6), 0 0 60px rgba(224,184,74,.4); }
.ix-go:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.ix-go.ready { animation: ix-pulse 2.4s ease-in-out infinite; }
@keyframes ix-pulse { 50% { box-shadow: 0 0 0 9px rgba(224,184,74,.12), 0 10px 30px rgba(0,0,0,.6), 0 0 70px rgba(224,184,74,.45); } }
.ix-btn { position: absolute; z-index: 3; font: 600 .82rem/1 system-ui, sans-serif; color: rgba(243,234,211,.8); background: rgba(5,12,18,.45);
  border: 1px solid rgba(243,234,211,.25); border-radius: 999px; padding: .55em 1em; cursor: pointer; }
.ix-btn:hover { color: #fff; background: rgba(5,12,18,.7); }
.ix-skip { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
.ix-snd { right: 16px; top: max(14px, env(safe-area-inset-top)); }
.ix-hint { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; pointer-events: none;
  font: 500 .82rem/1 system-ui, sans-serif; color: rgba(243,234,211,.75); white-space: nowrap; animation: ix-hint 2.2s ease-in-out infinite; }
.ix-hint[hidden] { display: none; }
@keyframes ix-hint { 50% { opacity: .4; } }
@media (max-width: 520px) { .ix-hint { left: 16px; transform: none; } }

.ix-replay { font-size: .9rem; color: var(--muted); text-decoration: none; border-bottom: 1px dotted currentColor; }
.ix-replay:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .ix-fog, .ix-ship, .ix-swell, .ix-glitter, .ix-stars, .ix-go.ready, .ix-hint { animation: none !important; }
}
