:root {
  --bg: #0a0d14;
  --bg-deep: #05080f;
  --panel: rgba(18, 24, 36, 0.78);
  --panel-raised: rgba(26, 33, 48, 0.9);
  --panel-solid: #121824;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(61, 255, 168, 0.28);
  --text: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.58);
  --faint: rgba(255, 255, 255, 0.34);
  --accent: #3dffa8;
  --accent-rgb: 61, 255, 168;
  --accent-dim: rgba(61, 255, 168, 0.12);
  --magenta: #c759f2;
  --magenta-rgb: 199, 89, 242;
  --violet: #8b6cf2;
  --gold: #d6b676;
  --warning: #ff8c40;
  --danger: #f24759;
  --wands: #ff9a4d;
  --cups: #5fb6ff;
  --swords: #cfd8ff;
  --pentacles: #7ddc8a;
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Charter, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tab-h: 62px;
  --col: 560px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 16px; color: var(--text); }
[hidden] { display: none !important; }
::selection { background: rgba(var(--accent-rgb), 0.3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Ambient field */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, #0d121f 0%, #05080f 52%, #0f0a1a 100%);
}
.ambient::before {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(ellipse 40% 30% at 30% 20%, rgba(var(--accent-rgb), 0.10), transparent 70%),
    radial-gradient(ellipse 35% 30% at 75% 75%, rgba(var(--magenta-rgb), 0.10), transparent 70%);
  filter: blur(40px);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* App frame */
#app { position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh; }
.screen {
  max-width: var(--col);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn 0.28s ease-out both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--accent);
}
.eyebrow.magenta { color: var(--magenta); }
.eyebrow.violet { color: var(--violet); }
.eyebrow.faint { color: var(--faint); letter-spacing: 0.2em; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; }
h1 { font-family: var(--serif); font-size: 34px; }
h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
.lede { color: var(--muted); margin: 6px 0 0; font-size: 15px; }
.page-head { margin-bottom: 20px; }
.page-head .eyebrow { margin-bottom: 6px; }
p { margin: 0; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.serif { font-family: var(--serif); }
.hairline { height: 1px; background: rgba(var(--accent-rgb), 0.28); margin: 12px 0; }

/* Glass panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.panel.raised { background: var(--panel-raised); }
.panel.tight { padding: 12px 14px; }
.panel.accent { border-color: var(--border-strong); }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.glyph {
  width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--accent-dim); color: var(--accent);
}
.glyph.magenta { background: rgba(var(--magenta-rgb), 0.14); color: var(--magenta); }
.glyph svg { width: 18px; height: 18px; }

/* Buttons */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  font-size: 15px; font-weight: 600; transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: #041008; box-shadow: 0 8px 28px rgba(var(--accent-rgb), 0.28); }
.btn-primary:hover:not(:disabled) { background: #62ffb8; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
.btn-outline { background: transparent; border-color: rgba(var(--accent-rgb), 0.5); color: var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-dim); }
.btn-magenta { background: var(--magenta); color: #fff; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-mono { font-family: var(--mono); letter-spacing: 0.18em; text-transform: uppercase; font-size: 13px; }
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
.btn svg { width: 18px; height: 18px; }

/* Chips / segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04); color: var(--muted);
  min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  -webkit-tap-highlight-color: transparent; transition: all 0.15s;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-dim); border-color: rgba(var(--accent-rgb), 0.55); color: var(--accent); }
.chip.on.magenta { background: rgba(var(--magenta-rgb), 0.14); border-color: rgba(var(--magenta-rgb), 0.55); color: var(--magenta); }
.seg { display: flex; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  flex: 1; min-height: 36px; border-radius: 999px; font-size: 13px; font-weight: 600; -webkit-tap-highlight-color: transparent;
}
.seg button.on { background: var(--accent); color: #041008; }

/* Voice picker */
.voices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.voice {
  appearance: none; cursor: pointer; text-align: left;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 12px 10px; color: var(--text); -webkit-tap-highlight-color: transparent; transition: all 0.15s;
}
.voice .glyph { width: 30px; height: 30px; margin-bottom: 8px; }
.voice strong { display: block; font-size: 14px; }
.voice span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.voice.on { border-color: rgba(var(--accent-rgb), 0.6); background: var(--accent-dim); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2) inset; }

/* Fields */
.field label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.input, textarea.input {
  width: 100%; appearance: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28); padding: 12px 14px; min-height: 48px; outline: none; resize: vertical;
}
.input:focus { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12); }
textarea.input { min-height: 74px; line-height: 1.45; }
.search { position: relative; }
.search .input { padding-left: 40px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); }

/* Toggle rows */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .t { font-size: 15px; font-weight: 600; }
.toggle-row .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch {
  appearance: none; width: 50px; height: 30px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  position: relative; cursor: pointer; flex: 0 0 auto; border: 0; transition: background 0.2s; -webkit-tap-highlight-color: transparent;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: transform 0.2s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: #041008; }

/* Link rows */
.link-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  appearance: none; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); -webkit-tap-highlight-color: transparent; transition: background 0.15s;
}
.link-row:hover { background: var(--panel-raised); }
.link-row .t { font-size: 16px; font-weight: 600; }
.link-row .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.link-row .chev { margin-left: auto; color: var(--faint); flex: 0 0 auto; }
.link-row .chev svg { width: 14px; height: 14px; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, rgba(26, 33, 48, 0.94), rgba(18, 24, 36, 0.98));
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.tabbar::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.4), transparent);
}
.tabbar-inner { max-width: var(--col); margin: 0 auto; display: flex; height: var(--tab-h); }
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.04em;
  -webkit-tap-highlight-color: transparent; transition: color 0.15s;
}
.tab svg { width: 20px; height: 20px; }
.tab.on { color: var(--accent); filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.55)); }

/* Section row (Tarot sub tabs) */
.section-row { display: flex; margin: 0 -4px 18px; border-bottom: 1px solid var(--border); }
.section-row button {
  appearance: none; border: 0; background: transparent; cursor: pointer; flex: 1; padding: 6px 4px 10px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--muted); position: relative; -webkit-tap-highlight-color: transparent;
}
.section-row button.on { color: var(--accent); }
.section-row button.on::after {
  content: ""; position: absolute; left: 50%; bottom: -1px; width: 36px; height: 2px; transform: translateX(-50%);
  background: var(--accent); border-radius: 2px; box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.7);
}

/* Home */
.masthead { text-align: center; padding: 34px 0 30px; position: relative; }
.masthead::before {
  content: ""; position: absolute; left: 50%; top: 40%; width: 240px; height: 240px; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.16), transparent 65%); filter: blur(20px); pointer-events: none;
}
.masthead .wordmark {
  font-family: var(--serif); font-size: 52px; font-weight: 700; margin-top: 10px; position: relative;
  background: linear-gradient(180deg, #d1fde6, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 8px 30px rgba(var(--accent-rgb), 0.25));
}
.masthead .tag { color: var(--muted); font-size: 15px; margin-top: 8px; position: relative; }
.instrument {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; cursor: pointer;
  appearance: none; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius);
  padding: 16px; color: var(--text); min-height: 108px; -webkit-tap-highlight-color: transparent; transition: transform 0.15s, border-color 0.15s;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.instrument:hover { border-color: rgba(var(--accent-rgb), 0.35); transform: translateY(-1px); }
.instrument .art { width: 78px; height: 78px; flex: 0 0 auto; position: relative; display: grid; place-items: center; }
.instrument .art::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; filter: blur(10px); background: rgba(var(--accent-rgb), 0.12); }
.instrument.oracle .art::before { background: rgba(139, 108, 242, 0.18); }
.instrument.ball .art::before { background: rgba(80, 140, 255, 0.16); }
.instrument h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.instrument p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.instrument .status { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-top: 6px; }
.instrument .chev { margin-left: auto; color: var(--faint); }
.instrument .chev svg { width: 14px; height: 14px; }
.mini-fan { position: relative; width: 70px; height: 70px; }
.mini-fan img, .mini-fan .mini { position: absolute; left: 50%; top: 50%; width: 30px; height: 50px; border-radius: 4px; object-fit: cover;
  border: 1px solid rgba(214, 182, 118, 0.6); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); transform-origin: 50% 100%; }
.mini-fan > :nth-child(1) { transform: translate(-50%, -50%) rotate(-16deg) translateX(-14px); }
.mini-fan > :nth-child(2) { transform: translate(-50%, -52%); z-index: 1; }
.mini-fan > :nth-child(3) { transform: translate(-50%, -50%) rotate(16deg) translateX(14px); }
.oracle-mini { width: 42px; height: 64px; border-radius: 6px; transform: rotate(-8deg); object-fit: cover; border: 1px solid rgba(214, 182, 118, 0.6); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.55); }
.ball-mini { width: 62px; height: 62px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 32% 28%, #3a3d44, #0c0d10 55%, #050608); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
.ball-mini::after { content: "8"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 26px; color: #fff; text-shadow: 0 1px 2px #000; }
.ball-mini::before { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%, -50%); background: #fff; }
.ball-mini span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 22px; color: #000; z-index: 1; }
.ball-mini::after { content: none; }

/* Card plates */
.card-plate { position: relative; border-radius: 12px; overflow: hidden; background: var(--panel-solid);
  border: 1px solid rgba(214, 182, 118, 0.55); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55); aspect-ratio: 1100 / 1920; }
.card-plate img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card-plate.reversed img { transform: rotate(180deg); }
.card-plate.instrument { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 30px rgba(var(--accent-rgb), 0.18); }
.card-plate .badge { position: absolute; left: 8px; top: 8px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  background: rgba(0, 0, 0, 0.6); color: var(--accent); padding: 4px 7px; border-radius: 6px; backdrop-filter: blur(6px); }
.card-back { background: linear-gradient(160deg, #121a2c, #070a12); display: grid; place-items: center; }
.card-back img { opacity: 0.95; }

/* Deal table */
.table { display: grid; gap: 12px; margin: 18px 0; }
.table.cols-1 { grid-template-columns: minmax(0, 220px); justify-content: center; }
.table.cols-3 { grid-template-columns: repeat(3, 1fr); }
.table.cols-5 { grid-template-columns: repeat(5, 1fr); gap: 8px; }
.table.cols-7 { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seat { text-align: center; opacity: 0; transform: translateY(14px); animation: dealIn 0.5s ease-out forwards; }
.seat .name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; line-height: 1.3; }
.seat .card-name { font-family: var(--serif); font-size: 13px; margin-top: 2px; }
.seat .card-name small { color: var(--faint); font-family: var(--font); font-size: 11px; }
@keyframes dealIn { to { opacity: 1; transform: none; } }
.card-flip { perspective: 1200px; }
.card-flip .card-plate { transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.2, 1); }
.hero-card { max-width: 250px; margin: 0 auto; }

/* Reading */
.reading { font-family: var(--serif); font-size: 17.5px; line-height: 1.62; }
.reading p + p { margin-top: 14px; }
.reading .lean { font-family: var(--font); font-weight: 600; color: var(--accent); font-size: 15px; padding: 12px 14px;
  background: var(--accent-dim); border: 1px solid rgba(var(--accent-rgb), 0.28); border-radius: var(--radius-sm); }
.reading .lean.magenta { color: var(--magenta); background: rgba(var(--magenta-rgb), 0.12); border-color: rgba(var(--magenta-rgb), 0.3); }
.plates { display: grid; gap: 10px; }
.plate { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; padding: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.plate .card-plate { border-radius: 6px; }
.plate .pos { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.plate .nm { font-family: var(--serif); font-size: 16px; margin-top: 2px; }
.plate .nm small { color: var(--faint); font-family: var(--font); font-size: 12px; margin-left: 4px; }
.plate .tx { font-size: 14px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.footer-line { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: 0.04em; text-align: center; margin-top: 16px; }
.receipt { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; padding: 8px 12px;
  background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.28); border-radius: 10px; color: var(--accent); }
.receipt b { font-size: 14px; }
.receipt .lbl { color: rgba(var(--accent-rgb), 0.75); font-size: 10px; letter-spacing: 0.12em; }

/* Energy picker */
.energy { display: flex; gap: 6px; }
.energy button { flex: 1; min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.energy button.on { background: var(--accent-dim); color: var(--accent); border-color: rgba(var(--accent-rgb), 0.5); }

/* 28-day strip */
.strip { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.strip i { display: block; aspect-ratio: 1; border-radius: 4px; background: rgba(255, 255, 255, 0.06); }
.strip i.wands { background: var(--wands); } .strip i.cups { background: var(--cups); } .strip i.swords { background: var(--swords); } .strip i.pentacles { background: var(--pentacles); }
.strip i.major { background: var(--accent); } .strip i.lab { background: var(--magenta); }
.strip i.rev { opacity: 0.45; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 11px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Codex */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.codex-item { appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer; text-align: center; color: var(--text); -webkit-tap-highlight-color: transparent; }
.codex-item .card-plate { border-radius: 8px; }
.codex-item .nm { font-size: 11px; margin-top: 6px; line-height: 1.25; color: var(--muted); }
.codex-item .nm b { color: var(--text); font-weight: 600; display: block; }
.suit-wands { color: var(--wands); } .suit-cups { color: var(--cups); } .suit-swords { color: var(--swords); } .suit-pentacles { color: var(--pentacles); }

/* Journal */
.note-item { appearance: none; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text); display: flex; gap: 12px; align-items: center; -webkit-tap-highlight-color: transparent; }
.note-item:hover { background: var(--panel-raised); }
.note-item .thumbs { display: flex; flex: 0 0 auto; }
.note-item .thumbs .card-plate { width: 28px; border-radius: 3px; margin-left: -10px; border-width: 1px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.note-item .thumbs .card-plate:first-child { margin-left: 0; }
.note-item .t { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.note-item .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14px; }

/* Oracle */
.deck-card { appearance: none; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); padding: 14px; color: var(--text); display: flex; gap: 14px; align-items: center; -webkit-tap-highlight-color: transparent; transition: border-color 0.15s; }
.deck-card:hover { border-color: rgba(139, 108, 242, 0.5); }
.deck-card.on { border-color: rgba(139, 108, 242, 0.7); box-shadow: 0 0 0 1px rgba(139, 108, 242, 0.25) inset, 0 0 26px rgba(139, 108, 242, 0.12); }
.deck-card .fan { position: relative; width: 74px; height: 74px; flex: 0 0 auto; }
.deck-card .fan img { position: absolute; width: 36px; height: 54px; border-radius: 4px; object-fit: cover; left: 50%; top: 50%; border: 1px solid rgba(214, 182, 118, 0.55); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5); }
.deck-card .fan img:nth-child(1) { transform: translate(-50%, -50%) rotate(-14deg) translateX(-12px); }
.deck-card .fan img:nth-child(2) { transform: translate(-50%, -54%); z-index: 1; }
.deck-card .fan img:nth-child(3) { transform: translate(-50%, -50%) rotate(14deg) translateX(12px); }
.deck-card h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.deck-card p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.deck-card .n { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--violet); margin-top: 6px; text-transform: uppercase; }
.plate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.oracle-plate { border-radius: 10px; overflow: hidden; aspect-ratio: 2 / 3; border: 1px solid rgba(214, 182, 118, 0.5); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); background: var(--panel-solid); position: relative; }
.oracle-plate img { width: 100%; height: 100%; object-fit: cover; }
.oracle-plate .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); font-family: var(--serif); font-size: 13px; text-align: center; }
.oracle-plate .cap small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--violet); margin-top: 2px; }
.oracle-plate.back { background: linear-gradient(160deg, #1a1430, #090612); display: grid; place-items: center; color: var(--violet); }
.oracle-plate.back svg { width: 34%; height: auto; opacity: 0.7; }
.oracle-reading { font-family: var(--serif); font-size: 17px; line-height: 1.62; }
.oracle-reading p + p { margin-top: 13px; }
.oracle-reading .asked { font-family: var(--font); font-size: 14px; color: var(--muted); }
.oracle-reading .seat-lead { font-family: var(--font); font-weight: 600; font-size: 14px; color: var(--violet); }

/* Eight ball */
.ball-stage { display: grid; place-items: center; padding: 18px 0 8px; position: relative; }
.eightball { width: min(76vw, 300px); aspect-ratio: 1; border-radius: 50%; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none;
  background: radial-gradient(circle at 34% 28%, var(--shell-lit) 0%, var(--shell-mid) 42%, var(--shell-deep) 100%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), inset 0 -12px 40px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 60px var(--rim-glow); }
.eightball::before { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--rim-line); opacity: 0.5; pointer-events: none; }
.eightball.shaking { animation: shake 0.9s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake { 10%, 90% { transform: translate3d(-2px, 0, 0) rotate(-2deg); } 20%, 80% { transform: translate3d(4px, 0, 0) rotate(2deg); } 30%, 50%, 70% { transform: translate3d(-7px, 0, 0) rotate(-4deg); } 40%, 60% { transform: translate3d(7px, 0, 0) rotate(4deg); } }
.window { position: absolute; left: 50%; top: 50%; width: 54%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--liquid-glow) 0%, var(--liquid-mid) 45%, var(--liquid-deep) 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), inset 0 -8px 20px rgba(0, 0, 0, 0.7), 0 0 0 6px #020305, 0 0 0 7px rgba(255, 255, 255, 0.06); }
.window .eight { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity 0.4s; }
.window .eight span { width: 62%; aspect-ratio: 1; border-radius: 50%; background: #f4f4f4; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: clamp(40px, 12vw, 64px); color: #050608; box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.25); }
.window .eight.off { opacity: 0; }
.die { position: absolute; left: 50%; top: 58%; width: 78%; transform: translate(-50%, -50%) translateY(70%) scale(0.6); opacity: 0; filter: blur(3px); transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.9s ease, filter 1s ease; }
.die.up { transform: translate(-50%, -50%) scale(1); opacity: 1; filter: blur(0); }
.die svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)); }
.die text { font-family: var(--font); font-weight: 600; fill: rgba(255, 255, 255, 0.92); text-anchor: middle; }
.face-reads { text-align: center; margin-top: 22px; min-height: 84px; }
.face-reads .eyebrow { margin-bottom: 8px; }
.face-reads .ans { font-family: var(--serif); font-size: 26px; line-height: 1.25; }
.face-reads .ans.magenta { color: var(--accent); }
.finishes { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.finish { appearance: none; border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.finish i { display: block; width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); }
.finish.on { color: var(--text); }
.finish.on i { border-color: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 16px currentColor; }

/* Learning */
.journey { position: relative; padding-left: 26px; }
.journey::before { content: ""; position: absolute; left: 7px; top: 12px; bottom: 12px; width: 2px; background: rgba(var(--accent-rgb), 0.3); }
.stop { position: relative; display: flex; gap: 12px; align-items: center; padding: 8px 0; width: 100%; text-align: left; appearance: none; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.stop::before { content: ""; position: absolute; left: -23px; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8); }
.stop .card-plate { width: 44px; flex: 0 0 auto; border-radius: 5px; }
.stop .r { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-right: 6px; }
.stop .nm { font-family: var(--serif); font-size: 16px; }
.stop .c { font-size: 12px; color: var(--muted); margin-top: 2px; }
.try-care { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.try-care i { display: block; border-radius: 2px; background: linear-gradient(var(--accent), rgba(var(--accent-rgb), 0.25)); }
.try-care.care i { background: linear-gradient(var(--warning), rgba(255, 140, 64, 0.25)); }
.try-care .b { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; padding: 3px 8px; border-radius: 999px; background: var(--accent-dim); color: var(--accent); margin-right: 8px; }
.try-care.care .b { background: rgba(255, 140, 64, 0.14); color: var(--warning); }
.try-care .t { font-weight: 600; font-size: 15px; }
.try-care p { font-size: 14px; color: var(--muted); margin-top: 5px; }
.steps { display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 8px; }
.step .i { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); }
.step .t { font-weight: 600; font-size: 14px; }
.step .b { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Sheet / modal */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fadeIn 0.2s; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: var(--col); max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: #0e131f; border: 1px solid var(--border); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 12px 18px calc(24px + env(safe-area-inset-bottom, 0px)); animation: slideUp 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); -webkit-overflow-scrolling: touch; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.detail-art { max-width: 210px; margin: 0 auto 16px; }
.kw { display: flex; flex-wrap: wrap; gap: 6px; }
.kw span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); color: var(--muted); }

/* Gate */
.gate { position: fixed; inset: 0; z-index: 80; overflow-y: auto; background: linear-gradient(180deg, #0a0e18, #05070d); padding: calc(28px + env(safe-area-inset-top, 0px)) 24px 40px; }
.gate .inner { max-width: 480px; margin: 0 auto; }
.gate p { font-size: 15.5px; line-height: 1.55; margin-top: 14px; }
.gate .wordmark { font-family: var(--serif); font-size: 40px; font-weight: 700; margin-top: 6px; }

/* Ad slot (sits above the tab bar, only when ads are wanted and a unit is configured) */
.adslot { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); z-index: 39; display: flex; justify-content: center; align-items: center;
  min-height: 52px; max-height: 100px; overflow: hidden; background: #0a0d14; border-top: 1px solid var(--border); }
.adslot ins { display: block; width: 100%; max-width: var(--col); min-height: 50px; }
.adslot .adlabel { position: absolute; left: 8px; top: 2px; font-family: var(--mono); font-size: 8px; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; }
.adslot.empty { display: none; }
body.ads-on .screen { padding-bottom: calc(var(--tab-h) + 100px + 28px + env(safe-area-inset-bottom, 0px)); }
.pro-card { border-color: rgba(var(--magenta-rgb), 0.4); background: linear-gradient(160deg, rgba(var(--magenta-rgb), 0.12), var(--panel)); }
.pro-card .price { font-family: var(--serif); font-size: 26px; }
.pro-card .price small { font-family: var(--font); font-size: 13px; color: var(--muted); margin-left: 6px; }
.key-row { display: flex; gap: 8px; }
.key-row .input { font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em; }
.toolkit-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-color: rgba(var(--accent-rgb), 0.3); }
.toolkit-card .toolkit-icon { width: 56px; height: 56px; border-radius: 13px; flex: 0 0 auto; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); }
/* Badges sit on their own row: at 375px the two of them need more width than
   what is left beside the icon, and shrinking them is not ours to do. */
.toolkit-card .badges { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 0 100%; margin-top: 10px; }
.store-badge { display: inline-block; line-height: 0; flex: 0 0 auto; text-decoration: none; background: none; border: 0; padding: 0; border-radius: 0; box-shadow: none; }
.store-badge:hover, .store-badge:active { opacity: 0.92; transform: none; }
.store-badge img { display: block; height: 40px; width: auto; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70;
  background: #101724; border: 1px solid rgba(var(--accent-rgb), 0.4); color: var(--text); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); animation: fadeIn 0.2s; white-space: nowrap; }

/* Install hint */
.install { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: rgba(var(--magenta-rgb), 0.08); border: 1px solid rgba(var(--magenta-rgb), 0.3); border-radius: var(--radius-sm); font-size: 13px; }
.install .glyph { background: rgba(var(--magenta-rgb), 0.14); color: var(--magenta); }
.install b { display: block; font-size: 14px; }

@media (min-width: 720px) {
  .screen { padding-top: 34px; }
  .table.cols-7 { grid-template-columns: repeat(7, 1fr); }
}
@media (max-width: 380px) {
  .voices { grid-template-columns: 1fr; }
  .voice .glyph { display: none; }
  .table.cols-5 { grid-template-columns: repeat(3, 1fr); }
}
