@charset "UTF-8";

@font-face {
  font-family: 'ArcanaSerif';
  src: url('/assets/fonts/noto-serif-sc-subset.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-charcoal: #14110e;
  --bg-deep-table: #0d1210;
  --bg-table-felt: #151d18;
  --gold-primary: #c8a96a;
  --gold-dim: #9b7e44;
  --gold-highlight: #dfc488;
  --paper-white: #efe7d6;
  --paper-bg-subtle: #e6ddca;
  --paper-ink: #1e1b18;
  --paper-ink-light: #574f44;
  --paper-border: #d4c7b2;
  --border-gold-subtle: rgba(200, 169, 106, 0.22);
  --border-gold-strong: rgba(200, 169, 106, 0.55);
  --danger-muted: #8e3a35;
  --font-serif: 'ArcanaSerif', 'Noto Serif SC', 'Songti SC', 'SimSun', STSong, serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --header-height: 52px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark light;
  background-color: var(--bg-charcoal);
  color: var(--paper-white);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100svh;
  background-color: var(--bg-charcoal);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

:focus-visible {
  outline: 2px solid var(--gold-highlight);
  outline-offset: 2px;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

/* 基础按钮体系（统一>=44px触控尺寸） */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-quiet,
.btn-danger-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn-primary {
  background-color: var(--gold-primary);
  color: #120f0c;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn-primary:hover {
  background-color: var(--gold-highlight);
}

.btn-secondary {
  background-color: transparent;
  color: var(--paper-ink);
  border: 1px solid var(--paper-border);
  font-weight: 500;
}

.btn-secondary:hover {
  border-color: var(--gold-primary);
  background-color: rgba(200, 169, 106, 0.08);
}

.btn-ghost {
  background-color: rgba(20, 17, 14, 0.7);
  color: var(--paper-white);
  border: 1px solid var(--border-gold-subtle);
}

.btn-ghost:hover {
  border-color: var(--gold-primary);
  color: var(--gold-highlight);
}

.btn-quiet {
  color: var(--gold-primary);
  border: 1px solid transparent;
  padding: 0 0.85rem;
}

.btn-quiet:hover {
  color: var(--paper-white);
  border-color: var(--border-gold-subtle);
}

.btn-danger-quiet {
  color: var(--danger-muted);
  border: 1px solid rgba(142, 58, 53, 0.25);
}

.btn-danger-quiet:hover {
  background-color: rgba(142, 58, 53, 0.1);
  border-color: var(--danger-muted);
}

/* 顶部导航 */
.site-header {
  height: var(--header-height);
  padding: 0 calc(1.25rem + env(safe-area-inset-right)) 0 calc(1.25rem + env(safe-area-inset-left));
  background-color: var(--bg-charcoal);
  border-bottom: 1px solid var(--border-gold-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 20;
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-primary);
  text-decoration: none;
  letter-spacing: 0.08em;
}

.brand-title:hover {
  color: var(--gold-highlight);
}

.brand-divider {
  color: var(--gold-dim);
  font-size: 0.85rem;
  opacity: 0.6;
}

.brand-sub {
  font-size: 0.85rem;
  color: rgba(239, 231, 214, 0.72);
  letter-spacing: 0.02em;
}

/* 主容器：桌面左65%牌桌 + 右35%阅读栏 */
#reading-app {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(360px, 35fr);
  height: calc(100svh - var(--header-height));
  min-height: 0;
  width: 100%;
}

/* 左侧三维牌桌区 */
#table-mount {
  position: relative;
  background: radial-gradient(circle at 50% 48%, var(--bg-table-felt) 0%, var(--bg-deep-table) 72%, #080a09 100%);
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#table-mount canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 110px rgba(10, 8, 6, 0.85);
  border-right: 1px solid var(--border-gold-subtle);
  z-index: 2;
}

.table-loading-mask {
  position: absolute;
  inset: 0;
  background-color: rgba(14, 18, 16, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  z-index: 10;
  text-align: center;
}

.table-loading-mask[hidden] {
  display: none;
}

.table-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(200, 169, 106, 0.25);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.table-loading-text {
  font-size: 0.95rem;
  color: var(--paper-white);
  font-family: var(--font-serif);
  letter-spacing: 0.05em;
}

.table-loading-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* 牌桌悬浮HUD状态层：保证点击穿透 */
.table-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

#table-status {
  align-self: flex-start;
  background-color: rgba(14, 18, 16, 0.78);
  border: 1px solid var(--border-gold-subtle);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--paper-white);
  letter-spacing: 0.03em;
}

#table-help {
  align-self: center;
  margin-top: auto;
  margin-bottom: 0.75rem;
  background-color: rgba(20, 17, 14, 0.82);
  border: 1px solid var(--border-gold-subtle);
  padding: 0.45rem 1.1rem;
  border-radius: 20px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--gold-highlight);
  letter-spacing: 0.08em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.table-hud-controls {
  display: flex;
  gap: 0.5rem;
  align-self: flex-end;
}

.hud-btn {
  pointer-events: auto;
  min-height: 44px;
  padding: 0 1rem;
  background-color: rgba(20, 17, 14, 0.85);
  border: 1px solid var(--border-gold-subtle);
  border-radius: 22px;
  color: var(--paper-white);
  font-size: 0.85rem;
}

.hud-btn:hover {
  border-color: var(--gold-primary);
  color: var(--gold-highlight);
}

/* 右侧阅读/交互面板：纸白承托 */
#reading-panel {
  background-color: var(--paper-white);
  color: var(--paper-ink);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 2rem calc(2rem + env(safe-area-inset-right)) 2.5rem 2rem;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
}

/* 面板内表单 */
#setup-form {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  max-width: 480px;
  margin: auto 0;
}

.panel-intro .kicker {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--paper-ink-light);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.3rem;
}

.panel-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--paper-ink);
  letter-spacing: 0.03em;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--paper-ink);
}

.label-tag {
  font-weight: normal;
  font-size: 0.8rem;
  color: var(--paper-ink-light);
  margin-left: 0.3rem;
}

textarea#question {
  width: 100%;
  border: 1px solid var(--paper-border);
  background-color: #fbf8f0;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  resize: vertical;
  line-height: 1.5;
  color: var(--paper-ink);
}

textarea#question:focus {
  border-color: var(--gold-dim);
  background-color: #fffdf8;
}

.radio-fieldset {
  border: none;
  padding: 0;
}

.spread-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.spread-option {
  display: block;
  cursor: pointer;
}

.spread-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.spread-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background-color: #f7f1e3;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.spread-option input[type="radio"]:checked + .spread-card {
  border-color: var(--gold-dim);
  background-color: #fffdf7;
  box-shadow: inset 0 0 0 1px var(--gold-dim);
}

.spread-name {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--paper-ink);
}

.spread-meta {
  font-size: 0.78rem;
  color: var(--paper-ink-light);
  margin-top: 0.2rem;
}

.checkbox-group {
  margin-top: -0.2rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--paper-ink);
  cursor: pointer;
  min-height: 44px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold-dim);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.panel-disclaimer {
  font-size: 0.78rem;
  color: var(--paper-ink-light);
  line-height: 1.5;
  border-top: 1px dashed var(--paper-border);
  padding-top: 0.85rem;
}

/* 抽牌局中面板 */
.session-view,
.result-view {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.session-spread-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--paper-ink);
}

.session-question-text {
  font-size: 0.88rem;
  color: var(--paper-ink-light);
  margin-top: 0.25rem;
  font-style: italic;
}

.slots-container {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.slot-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background-color: #f7f1e3;
  text-align: left;
  transition: all 0.16s ease;
}

.slot-button:hover {
  border-color: var(--gold-dim);
}

.slot-button[aria-current="true"] {
  border-color: var(--gold-primary);
  background-color: #fffdf8;
  box-shadow: inset 3px 0 0 var(--gold-primary);
}

.slot-index {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold-dim);
  margin-right: 0.6rem;
}

.slot-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--paper-ink);
  flex: 1;
}

.slot-state {
  font-size: 0.8rem;
  color: var(--paper-ink-light);
}

.slot-button.is-revealed .slot-state {
  color: var(--gold-dim);
  font-weight: 600;
}

.candidate-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--paper-border);
}

.candidate-guide {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--paper-ink);
}

.candidate-pager {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pager {
  width: 44px;
  height: 44px;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  color: var(--paper-ink);
}

.btn-pager:hover {
  border-color: var(--gold-dim);
}

.candidate-page-indicator {
  font-size: 0.85rem;
  color: var(--paper-ink-light);
}

.candidate-rack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 0.45rem;
}

.candidate-pick {
  min-height: 44px;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background-color: #f7f1e3;
  font-size: 0.8rem;
  color: var(--paper-ink);
  padding: 0.25rem;
}

.candidate-pick:hover,
.candidate-pick:focus-visible {
  border-color: var(--gold-primary);
  background-color: #fffdf8;
}

.session-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

/* 结果与解读区 */
.result-header {
  border-bottom: 1px solid var(--paper-border);
  padding-bottom: 0.85rem;
}

.result-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--paper-ink);
}

.result-source-note {
  font-size: 0.78rem;
  color: var(--paper-ink-light);
  margin-top: 0.35rem;
}

.result-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.reading-note {
  background-color: #fcf9f2;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.reading-note h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--paper-ink);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reading-note h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-dim);
  margin-bottom: 0.6rem;
}

.reading-note p {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--paper-ink);
  margin-bottom: 0.65rem;
}

.reading-note details {
  margin-top: 0.65rem;
  border-top: 1px dashed var(--paper-border);
  padding-top: 0.5rem;
}

.reading-note summary {
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--paper-ink-light);
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.reading-note summary:hover {
  color: var(--paper-ink);
}

.reading-note a {
  color: var(--gold-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.orientation-label {
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background-color: #eee4d1;
  color: var(--paper-ink);
  font-weight: normal;
}

.result-footer-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.result-footer-actions > button {
  flex: 1;
}

/* 历史对话框 */
.tarot-dialog {
  border: none;
  background: transparent;
  padding: 1rem;
  max-width: 520px;
  width: calc(100% - 2rem);
  margin: auto;
}

.tarot-dialog::backdrop {
  background-color: rgba(14, 11, 8, 0.75);
  backdrop-filter: blur(2px);
}

.dialog-card {
  background-color: var(--paper-white);
  color: var(--paper-ink);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-gold-strong);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.dialog-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--paper-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-dialog-close {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  color: var(--paper-ink-light);
}

.btn-dialog-close:hover {
  color: var(--paper-ink);
}

.dialog-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background-color: #f7f1e3;
}

.history-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.history-entry-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.95rem;
}

.history-entry-time {
  font-size: 0.78rem;
  color: var(--paper-ink-light);
}

.empty-history {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--paper-ink-light);
  font-size: 0.9rem;
}

.dialog-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--paper-border);
  display: flex;
  justify-content: flex-end;
}

/* 降级与备用平铺卡片 */
.fallback-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  width: 100%;
  max-width: 600px;
  margin: auto;
  overflow-y: auto;
}

.fallback-cards button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--border-gold-subtle);
  border-radius: var(--radius-sm);
  background-color: rgba(20, 17, 14, 0.8);
}

.fallback-cards img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

/* 异常与状态标记 */
.table-error {
  border-color: var(--danger-muted) !important;
  color: #d17873 !important;
}

.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

/* 通知浮条 */
.reading-toast {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(20, 17, 14, 0.92);
  color: var(--gold-highlight);
  border: 1px solid var(--gold-dim);
  padding: 0.6rem 1.4rem;
  border-radius: 24px;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  z-index: 99;
  pointer-events: none;
}

/* 响应式适配 */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  #reading-app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100svh - var(--header-height));
  }

  #table-mount {
    height: clamp(360px, 54svh, 540px);
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-gold-subtle);
  }

  .scene-vignette {
    border-right: none;
    border-bottom: 1px solid var(--border-gold-subtle);
  }

  #reading-panel {
    height: auto;
    overflow-y: visible;
    box-shadow: none;
    padding: 1.5rem calc(1.25rem + env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) calc(1.25rem + env(safe-area-inset-left));
  }

  #setup-form {
    max-width: 100%;
  }
}

/* 横屏适配 (如 844x390 紧凑横屏) */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --header-height: 42px;
  }

  #reading-app {
    display: grid;
    grid-template-columns: 58fr 42fr;
    height: calc(100svh - var(--header-height));
  }

  #table-mount {
    height: 100%;
  }

  #reading-panel {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
  }
}

/* 极窄屏适配 (320px) */
@media (max-width: 340px) {
  .spread-options {
    grid-template-columns: 1fr;
  }
  
  .result-footer-actions {
    flex-direction: column;
  }
}

/* 动效减弱偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Shared visibility and static-mode semantics. */
[hidden] { display: none !important; }
button:disabled { cursor: default; opacity: .52; }
#reading-panel :focus-visible, .dialog-card :focus-visible { outline-color: #574f44; }
.reading-note a { display: inline-flex; align-items: center; min-height: 44px; margin-right: 12px; color: #715323; }
.original-text { font-family: Georgia, serif; line-height: 1.7; }
.fallback-cards { position: absolute; inset: 52px 12px 96px; display: flex; flex-direction: column; justify-content: center; }
.fallback-cards > div { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.fallback-card { width: min(29%, 160px); color: var(--paper-white); }
.fallback-card img { width: 100%; aspect-ratio: 3/5; object-fit: contain; }
.fallback-card img.is-reversed { transform: rotate(180deg); }
.fallback-cards [data-candidate] { max-width: 72px; }
.history-entry { gap: 12px; }
.history-entry-main { min-width: 0; overflow-wrap: anywhere; }
#table-help { max-width: 100%; text-align: center; }
@media (prefers-reduced-motion: reduce) { .table-spinner { animation: none; } }
.header-actions { display: flex; align-items: center; gap: 4px; }
.back-to-gallery { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--paper-white); text-decoration: none; font-size: 13px; }
.panel-disclaimer a { display: inline-flex; align-items: center; min-height: 44px; margin-left: 6px; color: #715323; }
.fallback-candidate { width: min(12%, 62px); min-width: 32px; padding: 0 !important; }
.fallback-spread { flex-wrap: nowrap !important; }
.fallback-cards[data-inspect] .fallback-spread { position: absolute; inset: 0; align-items: center; background: var(--bg-deep-table); }
.fallback-cards[data-inspect="0"] .fallback-card:not([data-slot="0"]),
.fallback-cards[data-inspect="1"] .fallback-card:not([data-slot="1"]),
.fallback-cards[data-inspect="2"] .fallback-card:not([data-slot="2"]) { display: none; }
.fallback-cards[data-inspect] .fallback-card { width: auto; max-width: 80%; height: 100%; }
.fallback-cards[data-inspect] .fallback-card img { height: calc(100% - 24px); width: auto; max-width: 100%; }
@media (max-width: 420px) { .brand-sub { font-size: 11px; } .site-header { padding-left: 12px; padding-right: 8px; } .back-to-gallery { padding-inline: 8px; } }
.fallback-deck { width: min(36%, 200px); align-self: center; box-shadow: 2px 3px 0 #dbceae, 4px 6px 0 #a79a81, 0 18px 24px #0008; }

.slot-title { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.slot-button.is-revealed .slot-state { color: #715323; }
#reading-panel .btn-quiet { color: #574f44; }
#reading-panel .btn-quiet:hover { color: #1e1b18; background: #c8a96a15; border-color: #9b7e44; }
#table-help { margin-bottom: 6px; font-family: var(--font-sans); font-size: 12px; letter-spacing: .02em; }
.spread-option:focus-within .spread-card { outline: 2px solid #574f44; outline-offset: 3px; }
.brand-title { display: inline-flex; align-items: center; min-height: 44px; }
.reading-credit { margin-top: 20px; }

/* Optional question-aware reading: original meanings remain above this panel. */
textarea#reading-context,
.ai-reader-textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background: #fbf8f0;
  color: var(--paper-ink);
  font: 400 16px/1.65 var(--font-sans);
  resize: vertical;
}
textarea#reading-context:focus,
.ai-reader-textarea:focus {
  border-color: var(--gold-dim);
  background: #fffdf8;
}
.ai-context-note {
  color: var(--paper-ink-light);
  font-size: 14px;
  line-height: 1.7;
}
.ai-reader {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding-top: 24px;
  border-top: 1px solid var(--paper-border);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.ai-reader-title {
  font: 600 21px/1.6 var(--font-serif);
  color: var(--paper-ink);
}
.ai-reader-intro,
.ai-reader-consent,
.ai-reader-status {
  font-size: 16px;
  line-height: 1.8;
  color: var(--paper-ink-light);
}
.ai-reader-intro { margin-top: 8px; }
.ai-reader-consent {
  padding-left: 12px;
  border-left: 2px solid var(--paper-border);
}
.ai-reader-field,
.ai-reader-followup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ai-reader-label {
  color: var(--paper-ink);
  font-size: 16px;
  font-weight: 600;
}
.ai-reader-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.ai-reader button {
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 16px;
  font-size: 16px;
  line-height: 1.5;
  white-space: normal;
}
.ai-reader-status:empty { display: none; }
.ai-reader #ai-reader-status-retry { align-self: flex-start; }
.ai-reader-output {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding: 20px 16px;
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  background: #fbf8f0;
}
.ai-reader-output h3 {
  margin-bottom: 8px;
  font: 600 18px/1.65 var(--font-serif);
  color: var(--paper-ink);
}
.ai-reader-output p,
.ai-reader-output li {
  color: var(--paper-ink);
  font-size: 16px;
  line-height: 1.85;
  white-space: pre-line;
}
.ai-reader-output ul { padding-left: 22px; }
.ai-reader-output li + li { margin-top: 10px; }
.ai-reader-followup {
  padding-top: 18px;
  border-top: 1px solid var(--paper-border);
}
.ai-reader-followup button { align-self: flex-start; }
.ai-reader :focus-visible,
textarea#reading-context:focus-visible {
  outline: 2px solid var(--paper-ink-light);
  outline-offset: 3px;
}
@media (max-width: 420px) {
  .ai-reader-actions { align-items: stretch; }
  .ai-reader-actions > .btn-primary { flex: 1 1 100%; }
  .ai-reader-output { padding: 16px 12px; }
}

.byok-settings { margin: 1.1rem 0; padding: 1rem; border: 1px solid var(--paper-border); border-radius: 3px; }
.byok-settings summary { cursor: pointer; padding: .35rem 0; min-height: 44px; font-size: 1rem; color: var(--paper-ink); }
.byok-settings p { font-size: .9375rem; line-height: 1.75; }
.byok-form { display: grid; gap: .65rem; margin-top: .8rem; }
.byok-form label { font-size: 1rem; }
.byok-form input { width: 100%; min-height: 44px; border: 1px solid var(--paper-border); border-radius: 3px; background: #faf7ef; color: var(--paper-ink); font: inherit; padding: .65rem; }
.byok-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.byok-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem; color: #73501f; }
