/* Fossil Dig — parchment, timber and warm sand by day; lamplight by night. */
:root {
  color-scheme: light;
  --bg: #f1e4c4;
  --bg2: #e8d5ab;
  --surface: #fffaf0;
  --surface2: #f7ecd4;
  --text: #2a2118;
  --muted: #65553f;
  --faint: #7a6a52;
  --line: rgba(74, 48, 20, 0.16);
  --accent: #2f6688;
  --accent-ink: #ffffff;
  --amber: #c47a1c;
  --amber-ink: #8f520b;
  --gold: #e8a91e;
  --star: #f0b400;
  --good: #2f7d4f;
  --wood: #8a5a2e;
  --wood-dark: #4a2e14;
  --shadow: 0 18px 50px -22px rgba(60, 35, 10, 0.55);
  --ca-accent: #2f6688; /* the accounts SDK's sheets and chip */
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #15110d;
  --bg2: #1d1812;
  --surface: #241d16;
  --surface2: #2d241b;
  --text: #f3e9d6;
  --muted: #c2b096;
  --faint: #a8977e;
  --line: rgba(255, 230, 190, 0.13);
  --accent: #6fb0d6;
  --accent-ink: #0d1a24;
  --amber: #f0a948;
  --amber-ink: #f0a948;
  --gold: #f2bd4a;
  --star: #ffc93a;
  --good: #6fcf95;
  --wood: #6b4524;
  --wood-dark: #24170c;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
  --ca-accent: #6fb0d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #15110d; --bg2: #1d1812; --surface: #241d16; --surface2: #2d241b; --text: #f3e9d6; --muted: #c2b096; --faint: #a8977e;
    --line: rgba(255, 230, 190, 0.13); --accent: #6fb0d6; --accent-ink: #0d1a24; --amber: #f0a948; --amber-ink: #f0a948; --gold: #f2bd4a; --star: #ffc93a;
    --good: #6fcf95; --wood: #6b4524; --wood-dark: #24170c; --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8); --ca-accent: #6fb0d6;
  }
}

* { box-sizing: border-box; }
/* no double-tap zoom on iOS: js/touch-guard.js adds the same rule plus a JS fallback; this copy
   covers Safari before 16.4 under the strict CSP */
:where(html, body, body *) { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; height: 100%; background: var(--bg); }
body {
  margin: 0; height: 100%; overflow: hidden;
  background: radial-gradient(120% 70% at 50% -10%, var(--surface2), transparent 70%), linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* a game page: no text selection or long-press callouts anywhere; form fields and the help's
   prose opt back in */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, .prose p, .prose li, .fact { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ the app frame */
.app {
  height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 8px; min-height: 60px; }
/* both ends are the SDK's (App Standard §4.1). Between them the screen's own title: on the map only
   the stars won (the brand names the game), at a site and in the museum the place — the brand's
   name gives way to it there, its mark and icon stay */
.app[data-screen='map'] .title { display: none; }
.app:is([data-screen='dig'], [data-screen='museum']) .ca-brand-name { display: none; }
.title-wrap { flex: 1; min-width: 0; }
.title { margin: 0; font: 700 21px/1.15 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { margin: 1px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub:empty { display: none; }
/* the game's own Back, site info and museum are round bar tools like the SDK's */
.bar-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.bar-tools:not(:has(> :not([hidden]))) { display: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none;
  box-shadow: 0 2px 6px -3px rgba(60, 35, 10, 0.35);
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.icon-btn:active { transform: scale(0.94); }
.screens { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen.enter { animation: screen-in 0.28s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; white-space: nowrap; transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 16px -8px var(--accent); }
.btn.wide { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ------------------------------------------------------------------ the expedition */
.map-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px calc(24px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; max-width: 980px; margin: 0 auto; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow);
}
.card h2 { margin: 0; font: 700 17px/1.2 "Iowan Old Style", Palatino, Georgia, serif; }
.card p { margin: 2px 0 0; font-size: 14px; }
.card-text { min-width: 0; }
.card-art { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; }
.daily-art { background: linear-gradient(160deg, #ffd27a, #e08a2c); color: #5a2c06; }
.daily-art .ic { width: 30px; height: 30px; }
.museum-art { width: 72px; height: 56px; background: linear-gradient(180deg, #3a2a1c, #1e150e); }
.streak { color: var(--amber-ink); font-weight: 650; display: flex; align-items: center; gap: 4px; }
.streak:empty { display: none; }
@media (max-width: 380px) {
  .card { grid-template-columns: auto 1fr; }
  .card .btn { grid-column: 1 / -1; }
}

.regions { display: grid; gap: 16px; max-width: 980px; margin: 18px auto 0; }
.region {
  position: relative; border-radius: calc(var(--r) + 2px); overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.region-banner { display: block; width: 100%; height: 96px; }
.region-head { position: absolute; left: 0; right: 0; top: 0; height: 96px; padding: 12px 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  background: linear-gradient(180deg, transparent 30%, rgba(20, 12, 4, 0.62)); color: #fff; }
.region-head h2 { margin: 0; font: 700 21px/1.1 "Iowan Old Style", Palatino, Georgia, serif; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.region-head .rstars { font-weight: 700; font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 3px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.region-head .rstars .ic { width: 16px; height: 16px; color: var(--star); }
.region-body { padding: 10px 12px 14px; }
.region-desc { margin: 0 0 2px; font-size: 14px; color: var(--muted); }
.region-new { margin: 0 0 10px; font-size: 13px; color: var(--amber-ink); font-weight: 650; }
.sites { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 620px) { .sites { grid-template-columns: repeat(8, 1fr); } }
.site {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 14px; border: 0; cursor: pointer; padding: 0;
  background: linear-gradient(160deg, #f2dfb4, #d9b67c); color: #3a2410;
  box-shadow: inset 0 -3px 0 rgba(90, 55, 20, 0.35), 0 4px 10px -6px rgba(60, 35, 10, 0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform 0.15s ease;
}
.site:active { transform: scale(0.95); }
.site b { font: 800 19px/1 ui-rounded, system-ui, -apple-system, sans-serif; }
.site .pips { display: flex; gap: 1px; }
.site .pips .ic { width: 13px; height: 13px; color: rgba(90, 55, 20, 0.28); }
.site .pips .ic.on { color: var(--star); filter: drop-shadow(0 1px 0 rgba(90, 50, 0, 0.5)); }
.site.done { background: linear-gradient(160deg, #a9774a, #7c5230); color: #fff3df; }
.site.done .pips .ic { color: rgba(255, 255, 255, 0.28); }
.site.next { outline: 3px solid var(--accent); outline-offset: 2px; }
.site.locked { background: linear-gradient(160deg, #d8cdb6, #bfb39a); color: rgba(50, 36, 18, 0.82); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(60, 45, 25, 0.18); }
:root[data-theme='dark'] .site.locked { background: linear-gradient(160deg, #3a3128, #2c251e); color: rgba(240, 225, 200, 0.78); }
.site.locked .ic.lock { width: 18px; height: 18px; opacity: 0.6; }
.site .two { position: absolute; top: 5px; right: 6px; font-size: 10px; font-weight: 800; opacity: 0.7; }
.region.locked .region-body { opacity: 0.85; }
.region .lockline { margin: 0 0 10px; font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.region .lockline .ic { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ the dig */
.dig { padding-bottom: var(--safe-b); }
.hud { flex: none; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'digs bones score'; align-items: center; gap: 10px; padding: 0 14px 6px; }
.hud-digs { grid-area: digs; }
.hud-bones { grid-area: bones; }
.hud-score { grid-area: score; }
@media (max-width: 520px) {
  .hud { grid-template-columns: auto 1fr; grid-template-areas: 'digs score' 'bones bones'; row-gap: 2px; }
  .hud-bones { flex-direction: row; flex-wrap: wrap; column-gap: 14px; row-gap: 0; min-height: 36px; }
}
@media (max-width: 400px) {
  .title { font-size: 18px; }
  .bar { gap: 6px; padding-left: 10px; padding-right: 10px; }
}
/* the smallest phone at a site: the site's card opens from the bones in the HUD, so the bar keeps
   its room for the place's name */
@media (max-width: 359px) { .app[data-screen='dig'] #open-info { display: none !important; } }
.hud-digs { justify-self: start; display: flex; align-items: baseline; gap: 4px; padding: 6px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); min-width: 92px; }
.hud-digs .ic { width: 22px; height: 22px; align-self: center; }
.hud-digs b { font: 800 22px/1 ui-rounded, system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums; }
.hud-digs small { color: var(--muted); font-size: 13px; }
.hud-digs.low b { color: #d0452b; }
:root[data-theme='dark'] .hud-digs.low b { color: #ff8a70; }
.hud-digs.bump { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.hud-bones { min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; background: none; border: 0; padding: 2px; cursor: pointer; text-align: left; border-radius: 12px; }
.skel-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.skel-row .fig { width: 34px; height: 22px; flex: none; }
.skel-row .pips { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(5px, 13px); gap: 1px; min-width: 0; overflow: hidden; }
.skel-row .pip { width: 100%; height: 12px; color: rgba(90, 60, 30, 0.25); transition: color 0.2s ease, transform 0.2s ease; }
:root[data-theme='dark'] .skel-row .pip { color: rgba(255, 235, 200, 0.2); }
.skel-row .pip.on { color: var(--gold); }
.skel-row .pip.hurt { color: #c96f4a; }
.skel-row.done .fig { filter: drop-shadow(0 0 3px rgba(240, 180, 40, 0.9)); }
.hud-score { text-align: right; min-width: 64px; }
.hud-score b { display: block; font: 800 22px/1 ui-rounded, system-ui, -apple-system, sans-serif; font-variant-numeric: tabular-nums; }
.hud-score .target { font-size: 11px; color: var(--muted); white-space: nowrap; }
.board-wrap { flex: 1; min-height: 0; position: relative; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: pointer; }
#board:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.tray { flex: none; display: flex; justify-content: center; gap: 8px; padding: 8px 12px 10px; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior: contain; }
.tool {
  position: relative; flex: 0 1 76px; min-width: 56px; height: 62px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(90, 55, 20, 0.12); transition: transform 0.15s ease, background-color 0.15s ease;
}
.tool .ic { width: 28px; height: 28px; }
.tool span { font-size: 11px; font-weight: 650; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.tool .n { position: absolute; top: 4px; right: 6px; min-width: 20px; height: 20px; border-radius: 10px; background: #a35d10; color: #fff; font: 800 12px/20px ui-rounded, system-ui, sans-serif; text-align: center; padding: 0 5px; }
.tool[aria-pressed='true'] { background: var(--accent); border-color: transparent; box-shadow: 0 6px 14px -8px var(--accent); }
.tool[aria-pressed='true'] span { color: var(--accent-ink); }
.tool:disabled { opacity: 0.4; cursor: default; }
.tool.gain { animation: gain 0.6s ease; }
@keyframes gain { 30% { transform: translateY(-6px) scale(1.08); } }
.tool:active:not(:disabled) { transform: scale(0.95); }
@media (max-height: 560px) {
  .bar { min-height: 50px; padding-top: 4px; padding-bottom: 4px; }
  .tool { height: 50px; }
  .tool span { display: none; }
  .hud { padding-bottom: 2px; }
}
@media (max-height: 460px) and (min-aspect-ratio: 1/1) {
  .bar { min-height: 48px; }
  .dig { display: grid; grid-template-columns: minmax(150px, 32%) 1fr; grid-template-rows: auto 1fr; grid-template-areas: 'hud board' 'tray board'; }
  .dig .hud { grid-area: hud; grid-template-columns: auto 1fr; grid-template-areas: 'digs digs' 'score score' 'bones bones'; padding: 0 8px 4px 12px; gap: 2px 8px; }
  .dig .hud-score { text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .dig .hud-score b { display: inline; font-size: 18px; }
  .dig .hud-bones { flex-direction: row; flex-wrap: wrap; column-gap: 10px; min-height: 36px; }
  .dig .board-wrap { grid-area: board; }
  .dig .tray { grid-area: tray; flex-wrap: wrap; align-content: flex-start; justify-content: flex-start; overflow-y: auto; padding: 2px 8px 8px 12px; gap: 6px; }
  .dig .tool { flex: 0 0 54px; min-width: 54px; height: 48px; }
  .dig .tool span { display: none; }
}

/* ------------------------------------------------------------------ the museum */
.museum-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 14px calc(24px + var(--safe-b)); }
.museum-scroll > * { max-width: 980px; margin-left: auto; margin-right: auto; }
.tabs { display: flex; gap: 6px; padding: 2px 0 12px; overflow-x: auto; }
.tabs [role='tab'] { flex: 1 0 auto; min-height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 11px; font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--muted); }
.tabs [role='tab'] .ic { width: 18px; height: 18px; }
@media (max-width: 400px) { .sheet-tabs .tabs [role='tab'] .ic { display: none; } }
.tabs [aria-selected='true'] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.hall { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .hall { grid-template-columns: repeat(4, 1fr); } }
.case {
  position: relative; border-radius: 16px; overflow: hidden; border: 0; padding: 0; cursor: pointer; text-align: left;
  background: linear-gradient(180deg, #3b2a1d, #20160f); color: #f6ead2; box-shadow: var(--shadow);
}
.case canvas { display: block; width: 100%; aspect-ratio: 4 / 3; }
.case .cap { padding: 8px 10px 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; background: linear-gradient(180deg, #5a3f26, #3e2b1a); border-top: 2px solid #b08a4e; }
.case .cap b { font: 700 14px/1.2 "Iowan Old Style", Palatino, Georgia, serif; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case .cap small { color: #f2c46a; font-weight: 800; white-space: nowrap; }
.case.empty .cap b { color: #c9b89a; font-style: italic; }
.cabinet-title, .museum-h { margin: 22px 0 10px; font: 700 18px/1.2 "Iowan Old Style", Palatino, Georgia, serif; }
.cabinet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.shelf { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 4px 10px; text-align: center; }
.shelf canvas { width: 54px; height: 54px; display: block; margin: 0 auto 4px; }
.shelf b { display: block; font: 800 18px/1 ui-rounded, system-ui, sans-serif; }
.shelf small { display: block; font-size: 11px; color: var(--muted); line-height: 1.2; margin-top: 2px; }
.shelf.none canvas { opacity: 0.35; filter: grayscale(1); }
.friend-list { display: grid; gap: 8px; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.friend-row .fig { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-weight: 800; flex: none; overflow: hidden; }
.friend-row .who { flex: 1; min-width: 0; }
.friend-row .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row .who small { color: var(--muted); font-size: 13px; }
.visiting { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.visiting b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the landing page's live demo, in the SDK's stage */
.fd-demo { display: block; width: 100%; height: 100%; min-height: 300px; border-radius: inherit; }

/* ------------------------------------------------------------------ sheets */
.backdrop { position: fixed; inset: 0; background: rgba(20, 12, 4, 0.45); opacity: 0; transition: opacity 0.25s ease; z-index: 40; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: min(calc(88dvh / var(--ca-zoom, 1)), 760px); display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.5);
  transform: translateY(105%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: var(--safe-b);
}
.sheet.show { transform: none; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; border-radius: 22px; transform: translate(-50%, -46%); opacity: 0; transition: transform 0.25s ease, opacity 0.25s ease; max-height: min(calc(86dvh / var(--ca-zoom, 1)), 760px); }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 8px 20px; flex: none; }
.sheet-head h2 { margin: 0; font: 700 20px/1.2 "Iowan Old Style", Palatino, Georgia, serif; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sheet-tabs { padding: 0 16px; flex: none; }
.sheet-foot {
  flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  padding: 10px 20px 12px; border-top: 1px solid var(--line); background: var(--surface);
}
.sheet-foot:empty { display: none; }
.sheet-foot .btn { min-width: 0; white-space: normal; line-height: 1.15; padding: 6px 12px; text-align: center; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 22px; flex: 1; min-height: 0; overflow-x: hidden; }
.sheet h3 { margin: 18px 0 8px; font: 700 16px/1.25 "Iowan Old Style", Palatino, Georgia, serif; }
.prose p, .prose li { color: var(--text); margin: 0 0 10px; }
.help-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; margin: 0 0 10px; }
.help-row canvas { width: 52px; height: 52px; border-radius: 12px; background: var(--surface2); }
.help-row p { margin: 0; }
.help-row b { display: block; }
.warm-demo { display: block; width: 100%; max-width: 360px; height: auto; margin: 4px auto 12px; border-radius: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.row-text { min-width: 0; }
.row-text b { display: block; font-weight: 600; }
.row-text small { display: block; color: var(--muted); font-size: 13px; }
.row select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); padding: 0 10px; font: inherit; }
.toggle { cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { flex: none; width: 50px; height: 30px; border-radius: 15px; background: rgba(120, 100, 70, 0.35); position: relative; transition: background-color 0.2s ease; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease; }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(20px); }
.toggle input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice { flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { min-height: 38px; border: 0; background: none; border-radius: 9px; padding: 0 11px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-checked='true'] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); }
.version { color: var(--muted); font-size: 13px; margin-top: 16px; }
.board-host { min-height: 120px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 4px; }
.stat { background: var(--surface2); border-radius: 12px; padding: 8px 10px; }
.stat b { display: block; font: 800 20px/1.1 ui-rounded, system-ui, sans-serif; }
.stat small { color: var(--muted); font-size: 12px; }

/* site sheet */
.site-list { display: grid; gap: 8px; margin: 0 0 12px; }
.site-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface2); border-radius: 12px; }
.site-item canvas { width: 64px; height: 44px; flex: none; }
.site-item .tag { margin-left: auto; font-size: 12px; font-weight: 700; color: #a8452a; background: rgba(200, 90, 50, 0.14); padding: 3px 8px; border-radius: 8px; white-space: nowrap; }
:root[data-theme='dark'] .site-item .tag { color: #ffab8f; }
.kit { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.item-ic { width: 26px; height: 26px; flex: none; }
.kit span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface2); font-weight: 600; font-size: 14px; }
.news { border: 2px solid var(--amber); border-radius: 14px; padding: 10px 12px; margin: 0 0 14px; }
.news h3 { margin: 0 0 6px; color: var(--amber-ink); }
.news p { margin: 0 0 4px; }
.stack { display: grid; gap: 8px; margin-top: 14px; }

/* creature sheet */
.creature-stage { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 16px; background: radial-gradient(70% 80% at 50% 30%, #4b3523, #1c140d); cursor: pointer; }
.fact { margin: 12px 0 8px; font-size: 16px; }
.creature-meta { display: grid; gap: 4px; color: var(--muted); font-size: 14px; }

/* challenge sheet */
.ch-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ch-head canvas { width: 96px; height: 72px; border-radius: 12px; flex: none; }
.ch-head p { margin: 0; }

/* ------------------------------------------------------------------ the result card */
.result {
  position: fixed; z-index: 45; left: 50%; top: 50%; width: min(calc(92vw / var(--ca-zoom, 1)), 400px); max-height: calc(92dvh / var(--ca-zoom, 1)); overflow-y: auto; overscroll-behavior: contain;
  transform: translate(-50%, -46%) scale(0.96); opacity: 0; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease;
  background: var(--surface); color: var(--text); border-radius: 24px; padding: 18px 18px 16px; box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.6); text-align: center;
  border-top: 6px solid var(--gold);
}
.result.show { transform: translate(-50%, -50%); opacity: 1; }
.result.lost { border-top-color: #9a8f80; }
.result h2 { margin: 6px 0 2px; font: 700 24px/1.15 "Iowan Old Style", Palatino, Georgia, serif; }
.result-note { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.result-note:empty { display: none; }
.result-stars { display: flex; justify-content: center; gap: 6px; min-height: 52px; }
.result-stars .ic { width: 50px; height: 50px; color: rgba(120, 100, 70, 0.25); }
.result-stars .ic.on { color: var(--star); animation: star-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; filter: drop-shadow(0 2px 2px rgba(90, 50, 0, 0.45)); }
.result-stars .ic:nth-child(2) { transform: translateY(-8px); width: 58px; height: 58px; }
.result-stars .ic.on:nth-child(2) { animation-delay: 0.18s; }
.result-stars .ic.on:nth-child(3) { animation-delay: 0.36s; }
@keyframes star-pop { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
.result-stars .ic:nth-child(2).on { animation-name: star-pop2; }
@keyframes star-pop2 { from { transform: translateY(-8px) scale(0.2) rotate(-30deg); opacity: 0; } to { transform: translateY(-8px); } }
.result-lines { margin: 8px 0 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; font-size: 15px; }
.result-lines dt { color: var(--muted); }
.result-lines dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.result-lines .total { border-top: 1px solid var(--line); padding-top: 6px; font-size: 17px; color: var(--text); font-weight: 800; }
.result-lines .flag { grid-column: 1 / -1; text-align: center; color: var(--amber-ink); font-weight: 750; }
.result-actions { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.result-actions .btn { min-width: 0; white-space: normal; line-height: 1.15; padding: 6px 10px; text-align: center; }
.result-actions .btn.wide { grid-column: 1 / -1; }

.confirm { position: fixed; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(calc(90vw / var(--ca-zoom, 1)), 360px); background: var(--surface); color: var(--text); border-radius: 20px; padding: 18px; box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.6); }
.confirm p { margin: 0 0 14px; font-size: 16px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toast {
  position: fixed; z-index: 70; left: 12px; right: 12px; width: fit-content; max-width: 520px; margin: 0 auto; bottom: calc(18px + var(--safe-b));
  background: #2a2118; color: #fbf3e2; padding: 11px 16px; border-radius: 14px; font-size: 15px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(12px); transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none; text-align: center;
}
.toast.show { opacity: 1; transform: none; }
:root[data-theme='dark'] .toast { background: #f3e9d6; color: #241d16; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* cloud-apps bar 1.30.0 */
:root { --ca-brand-icon-w: 89px; } /* the brand's width with the icon alone (the mark, the divider, the app's icon) */
.ca-start { display: flex; align-items: center; flex: 0 100 auto; min-width: min(var(--ca-brand-icon-w), 100%); }
.ca-brand { display: flex; align-items: center; min-width: 0; height: 40px; color: inherit; font-family: inherit; }
.ca-brand a { display: flex !important; align-items: center !important; box-sizing: border-box !important; color: inherit !important; text-decoration: none !important; border-radius: 12px !important; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease; }
.ca-brand-home { flex: none !important; justify-content: center !important; width: 40px !important; height: 40px !important; padding: 0 !important; margin: 0 0 0 -5px !important; }
.ca-brand-home img { display: block !important; width: 30px !important; height: 30px !important; margin: 0 !important; transition: transform .38s cubic-bezier(.34, 1.56, .64, 1); }
.ca-brand-sep { flex: none; display: block; width: 1.5px; height: 18px; margin: 0 4px; border-radius: 1px; background: currentColor; opacity: .22; transform: rotate(18deg); }
.ca-brand-app { flex: 0 1 auto !important; min-width: 44px !important; height: 40px !important; padding: 0 9px 0 5px !important; margin: 0 !important; }
.ca-brand-in { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; column-gap: 9px; min-width: 0; height: 40px; overflow: hidden; }
.ca-brand-in img { flex: none; display: block !important; width: 30px !important; height: 30px !important; margin: 5px 0 !important; border-radius: 8px; }
.ca-brand[data-ca-icon] .ca-brand-name { display: none !important; }
.ca-brand[data-ca-icon] .ca-brand-app { padding-right: 5px !important; }
.ca-brand-name { display: block; height: 40px; margin: 0 !important; padding: 0 !important; line-height: 40px !important; white-space: nowrap; font-family: var(--ca-brand-font, inherit); font-size: 17px !important; font-weight: 700; letter-spacing: -.015em; color: inherit; text-shadow: var(--ca-brand-shadow, none); }
@media (hover: hover) { .ca-brand a:hover { background-color: color-mix(in srgb, currentColor 7%, transparent); } .ca-brand-home:hover img { transform: rotate(-6deg) scale(1.06); } }
.ca-brand a:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: -3px; }
.ca-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: none; min-width: 0; }
.ca-tools { display: flex; align-items: center; gap: 6px; }
.ca-tools[hidden] { display: none !important; }
.ca-tool { position: relative; flex: none; display: inline-grid; place-items: center !important; box-sizing: border-box !important; width: 36px !important; height: 36px !important; min-width: 0 !important; min-height: 0 !important; max-width: none !important; padding: 0 !important; margin: 0; border-radius: 50% !important;
  border: 1px solid var(--ca-tool-line, color-mix(in srgb, currentColor 16%, transparent)) !important; background: var(--ca-tool-bg, color-mix(in srgb, currentColor 6%, transparent)) !important; color: var(--ca-tool-ink, inherit) !important;
  font: inherit; line-height: 0 !important; letter-spacing: 0; text-decoration: none !important; box-shadow: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, transform .12s ease; }
.ca-tool[hidden] { display: none !important; }
.ca-tool::before { content: ""; position: absolute; inset: -4px; }
.ca-tool svg { display: block; width: 20px !important; height: 20px !important; margin: 0 !important; pointer-events: none; }
.ca-tool svg[hidden] { display: none !important; }
@media (hover: hover) { .ca-tool:hover { background: var(--ca-tool-hover, color-mix(in srgb, currentColor 13%, transparent)) !important; } }
.ca-tool:active { transform: scale(.94); }
.ca-tool:focus-visible { outline: 3px solid var(--ca-accent, #4f6bff); outline-offset: 2px; }
.ca-tool-talk { color: var(--ca-accent, #4f6bff) !important; border-color: color-mix(in srgb, var(--ca-accent, #4f6bff) 50%, transparent) !important; background: color-mix(in srgb, var(--ca-accent, #4f6bff) 13%, transparent) !important; }
.ca-tool .ca-tlive { position: absolute; top: 1px; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 30%, transparent); }
.ca-tool-talk.ca-new::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; pointer-events: none; animation: ca-bar-ring 1.2s ease-out 2; }
@keyframes ca-bar-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ca-accent, #4f6bff) 55%, transparent); } to { box-shadow: 0 0 0 11px transparent; } }
.ca-tool .ca-tcount, .ca-tool .ca-tunread { position: absolute; right: -5px; display: grid; place-items: center; box-sizing: border-box; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; color: #fff; font: 700 10.5px/1 -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: 0; pointer-events: none; }
.ca-tool .ca-tcount { bottom: -5px; background: #1f9d55; }
.ca-tool .ca-tunread { top: -5px; background: #e5484d; }
@media (max-width: 599.98px), (max-height: 499.98px) { .ca-tools-app { display: none !important; } }
.ca-end[data-ca-cramped] .ca-tools-app { display: none !important; }
.ca-end[data-ca-tight] .ca-tool-friends { display: none !important; }
@media (prefers-reduced-motion: reduce) { .ca-tool, .ca-brand a, .ca-brand-home img { transition: none; } .ca-tool-talk.ca-new::after { animation: none; } }
/* end of the cloud-apps bar */
/* ---- cloud-apps: big screens (App Standard §6.5) — written by `cloud-apps vendor-sdk`; do not edit ---- */
/* Past 1584 × 990 the page is laid out at about 1440 × 900 and zoomed to fill the screen; viewport
   units in this file are divided by --ca-zoom. cloud-kit.js turns it off where the engine has no
   standard zoom (html[data-ca-zoom="off"]). */
@media (min-width: 1585px) and (min-height: 991px) { :root { --ca-zoom: 1.1; } }
@media (min-width: 1656px) and (min-height: 1035px) { :root { --ca-zoom: 1.15; } }
@media (min-width: 1728px) and (min-height: 1080px) { :root { --ca-zoom: 1.2; } }
@media (min-width: 1800px) and (min-height: 1125px) { :root { --ca-zoom: 1.25; } }
@media (min-width: 1872px) and (min-height: 1170px) { :root { --ca-zoom: 1.3; } }
@media (min-width: 1945px) and (min-height: 1215px) { :root { --ca-zoom: 1.35; } }
@media (min-width: 2016px) and (min-height: 1260px) { :root { --ca-zoom: 1.4; } }
@media (min-width: 2088px) and (min-height: 1305px) { :root { --ca-zoom: 1.45; } }
@media (min-width: 2160px) and (min-height: 1350px) { :root { --ca-zoom: 1.5; } }
@media (min-width: 2232px) and (min-height: 1395px) { :root { --ca-zoom: 1.55; } }
@media (min-width: 2304px) and (min-height: 1440px) { :root { --ca-zoom: 1.6; } }
@media (min-width: 2376px) and (min-height: 1485px) { :root { --ca-zoom: 1.65; } }
@media (min-width: 2448px) and (min-height: 1530px) { :root { --ca-zoom: 1.7; } }
@media (min-width: 2520px) and (min-height: 1575px) { :root { --ca-zoom: 1.75; } }
@media (min-width: 2592px) and (min-height: 1620px) { :root { --ca-zoom: 1.8; } }
@media (min-width: 2664px) and (min-height: 1665px) { :root { --ca-zoom: 1.85; } }
@media (min-width: 2736px) and (min-height: 1710px) { :root { --ca-zoom: 1.9; } }
@media (min-width: 2808px) and (min-height: 1755px) { :root { --ca-zoom: 1.95; } }
@media (min-width: 2880px) and (min-height: 1800px) { :root { --ca-zoom: 2; } }
@media (min-width: 2952px) and (min-height: 1845px) { :root { --ca-zoom: 2.05; } }
@media (min-width: 3024px) and (min-height: 1890px) { :root { --ca-zoom: 2.1; } }
@media (min-width: 3096px) and (min-height: 1935px) { :root { --ca-zoom: 2.15; } }
@media (min-width: 3169px) and (min-height: 1981px) { :root { --ca-zoom: 2.2; } }
@media (min-width: 3240px) and (min-height: 2025px) { :root { --ca-zoom: 2.25; } }
@media (min-width: 3312px) and (min-height: 2070px) { :root { --ca-zoom: 2.3; } }
@media (min-width: 3384px) and (min-height: 2115px) { :root { --ca-zoom: 2.35; } }
@media (min-width: 3456px) and (min-height: 2160px) { :root { --ca-zoom: 2.4; } }
@media (min-width: 3529px) and (min-height: 2205px) { :root { --ca-zoom: 2.45; } }
@media (min-width: 3600px) and (min-height: 2250px) { :root { --ca-zoom: 2.5; } }
@media (min-width: 3672px) and (min-height: 2295px) { :root { --ca-zoom: 2.55; } }
@media (min-width: 3744px) and (min-height: 2340px) { :root { --ca-zoom: 2.6; } }
@media (min-width: 3816px) and (min-height: 2385px) { :root { --ca-zoom: 2.65; } }
@media (min-width: 3889px) and (min-height: 2430px) { :root { --ca-zoom: 2.7; } }
@media (min-width: 3960px) and (min-height: 2475px) { :root { --ca-zoom: 2.75; } }
@media (min-width: 4032px) and (min-height: 2520px) { :root { --ca-zoom: 2.8; } }
@media (min-width: 4104px) and (min-height: 2565px) { :root { --ca-zoom: 2.85; } }
@media (min-width: 4176px) and (min-height: 2610px) { :root { --ca-zoom: 2.9; } }
@media (min-width: 4248px) and (min-height: 2655px) { :root { --ca-zoom: 2.95; } }
@media (min-width: 4320px) and (min-height: 2700px) { :root { --ca-zoom: 3; } }
@media (min-width: 4392px) and (min-height: 2745px) { :root { --ca-zoom: 3.05; } }
@media (min-width: 4464px) and (min-height: 2790px) { :root { --ca-zoom: 3.1; } }
@media (min-width: 4536px) and (min-height: 2835px) { :root { --ca-zoom: 3.15; } }
@media (min-width: 4608px) and (min-height: 2880px) { :root { --ca-zoom: 3.2; } }
@media (min-width: 4680px) and (min-height: 2925px) { :root { --ca-zoom: 3.25; } }
@media (min-width: 4752px) and (min-height: 2970px) { :root { --ca-zoom: 3.3; } }
@media (min-width: 4824px) and (min-height: 3015px) { :root { --ca-zoom: 3.35; } }
@media (min-width: 4896px) and (min-height: 3060px) { :root { --ca-zoom: 3.4; } }
@media (min-width: 4968px) and (min-height: 3105px) { :root { --ca-zoom: 3.45; } }
@media (min-width: 5040px) and (min-height: 3150px) { :root { --ca-zoom: 3.5; } }
@media (min-width: 5112px) and (min-height: 3195px) { :root { --ca-zoom: 3.55; } }
@media (min-width: 5184px) and (min-height: 3240px) { :root { --ca-zoom: 3.6; } }
@media (min-width: 5256px) and (min-height: 3285px) { :root { --ca-zoom: 3.65; } }
@media (min-width: 5328px) and (min-height: 3330px) { :root { --ca-zoom: 3.7; } }
@media (min-width: 5400px) and (min-height: 3375px) { :root { --ca-zoom: 3.75; } }
@media (min-width: 5472px) and (min-height: 3420px) { :root { --ca-zoom: 3.8; } }
@media (min-width: 5544px) and (min-height: 3465px) { :root { --ca-zoom: 3.85; } }
@media (min-width: 5616px) and (min-height: 3510px) { :root { --ca-zoom: 3.9; } }
@media (min-width: 5688px) and (min-height: 3555px) { :root { --ca-zoom: 3.95; } }
@media (min-width: 5760px) and (min-height: 3600px) { :root { --ca-zoom: 4; } }
@media (min-width: 5832px) and (min-height: 3645px) { :root { --ca-zoom: 4.05; } }
@media (min-width: 5904px) and (min-height: 3690px) { :root { --ca-zoom: 4.1; } }
@media (min-width: 5977px) and (min-height: 3736px) { :root { --ca-zoom: 4.15; } }
@media (min-width: 6048px) and (min-height: 3780px) { :root { --ca-zoom: 4.2; } }
@media (min-width: 6120px) and (min-height: 3825px) { :root { --ca-zoom: 4.25; } }
@media (min-width: 6192px) and (min-height: 3870px) { :root { --ca-zoom: 4.3; } }
@media (min-width: 6264px) and (min-height: 3915px) { :root { --ca-zoom: 4.35; } }
@media (min-width: 6337px) and (min-height: 3961px) { :root { --ca-zoom: 4.4; } }
@media (min-width: 6408px) and (min-height: 4005px) { :root { --ca-zoom: 4.45; } }
@media (min-width: 6480px) and (min-height: 4050px) { :root { --ca-zoom: 4.5; } }
@media (min-width: 6552px) and (min-height: 4095px) { :root { --ca-zoom: 4.55; } }
@media (min-width: 6624px) and (min-height: 4140px) { :root { --ca-zoom: 4.6; } }
@media (min-width: 6697px) and (min-height: 4185px) { :root { --ca-zoom: 4.65; } }
@media (min-width: 6768px) and (min-height: 4230px) { :root { --ca-zoom: 4.7; } }
@media (min-width: 6840px) and (min-height: 4275px) { :root { --ca-zoom: 4.75; } }
@media (min-width: 6912px) and (min-height: 4320px) { :root { --ca-zoom: 4.8; } }
@media (min-width: 6984px) and (min-height: 4365px) { :root { --ca-zoom: 4.85; } }
@media (min-width: 7057px) and (min-height: 4410px) { :root { --ca-zoom: 4.9; } }
@media (min-width: 7128px) and (min-height: 4455px) { :root { --ca-zoom: 4.95; } }
@media (min-width: 7200px) and (min-height: 4500px) { :root { --ca-zoom: 5; } }
@media (min-width: 1585px) and (min-height: 991px) {
  html { zoom: var(--ca-zoom, 1); }
  html[data-ca-zoom='off'] { --ca-zoom: 1 !important; }
}
/* ---- end of big screens ---- */
