.tarot-view {
  box-sizing: border-box;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #6ea892;
  border-radius: 16px;
  background: #102f2a;
  color: #f4eedb;
  text-align: center;
  font-family: Raleway, sans-serif;
  font-size: 16px;
}
.tarot-view::backdrop { background: rgb(0 0 0 / 72%); }
.tarot-view .tarot-view-close { position: absolute; top: 6px; right: 6px; margin: 0; }
.tarot-view h2 { margin: 4px 32px 16px; font-size: 22px; }
.tarot-view button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid #9abda9;
  border-radius: 8px;
  background: #204d41;
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.tarot-view button:focus-visible { outline: 3px solid #ead88b; outline-offset: 3px; }
.tarot-view-close button { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; font-size: 30px; line-height: 1; }
.tarot-view-face { max-width: 100%; height: min(38dvh, 340px); object-fit: contain; }
.tarot-view p { font-size: 16px; line-height: 1.5; }
.tarot-view [role="status"]:empty { display: none; }
.tarot-view-meaning { text-align: left; }
.tarot-view-meaning strong { color: #e8d79e; }
.tarot-view-meaning a { display: inline-block; padding: 10px 0; color: #b2e5d4; }
.tarot-view-meaning a:focus-visible { outline: 3px solid #ead88b; outline-offset: 3px; }
.tarot-position-context { border-bottom: 1px solid #527263; padding-bottom: 12px; }
.tarot-spread-picker { text-align: left; }
.tarot-spread-picker h2 { text-align: center; }
.tarot-spread-choice { border-top: 1px solid #527263; margin: 20px 0; padding-top: 12px; }
.tarot-spread-choice h3 { margin: 0; font-size: 19px; }
.tarot-spread-mini { position: relative; width: min(100%, 340px); margin: 0 auto 8px; }
.tarot-spread-mini span { position: absolute; box-sizing: border-box; width: 25.5%; height: 68px; display: grid; place-items: center; padding: 4px; border: 1px dashed #b4caac; border-radius: 4px; color: #f1dfad; text-align: center; font-size: 15px; }
.tarot-deck-select { display: flex; align-items: center; gap: 12px; }
.tarot-deck-select select { min-height: 44px; border: 1px solid #729987; border-radius: 6px; background: #204d41; color: #fff; padding: 8px; font: inherit; }
.tarot-view button:disabled { opacity: 0.5; cursor: default; }

/* The spread picker shares the Book of Mirrors shell and navigation styles. */
.tarot-spread-picker.journal-shell {
  width: min(960px, calc(100vw - 48px));
  height: min(720px, 92dvh);
  max-height: calc(100dvh - 24px);
  padding: 0;
  margin: auto;
  font-family: 'Raleway', system-ui, sans-serif;
  font-size: 16px;
  color: #2a1f3d;
}
.tarot-spread-picker:not([open]) { display: none; }
.tarot-spread-picker::backdrop {
  background: rgba(8, 5, 15, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.tarot-picker-close { position: absolute; top: 0; right: 0; margin: 0; z-index: 2; }
.tarot-picker-close .journal-close { width: 44px; height: 44px; }
.tarot-spread-picker .journal-main { min-height: 0; padding-top: 48px; }
.tarot-spread-picker h2 { text-align: left; }
.tarot-spread-picker .tarot-spread-choice { border-top: 1px solid #cdb588; margin: 20px 0; padding-top: 20px; }
.tarot-spread-picker h3 { font-family: 'Platypi', 'Raleway', serif; color: #3a2752; }
.tarot-spread-picker p { font-size: 16px; line-height: 1.5; color: #5a4670; }
.tarot-spread-picker .tarot-spread-mini span { background: rgba(255,255,255,0.4); border-color: #b89968; color: #4a3261; }
.tarot-spread-picker button { font-family: inherit; font-size: 16px; min-height: 44px; }
.tarot-spread-picker button:focus-visible { outline: 3px solid #5b3e6e; outline-offset: 2px; }
.tarot-spread-picker button:disabled { opacity: 0.5; cursor: default; }
.tarot-picker-book { margin-top: 8px; }
@media (max-width: 700px) {
  .tarot-spread-picker.journal-shell {
    width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0;
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .tarot-spread-picker .tarot-picker-close {
    position: static;
    display: flex;
    justify-content: flex-end;
    padding: 4px 8px;
    border-bottom: 1px solid #cdb588;
  }
  .tarot-spread-picker .tarot-picker-close .journal-close {
    position: static;
    font-size: 28px;
    flex-shrink: 0;
  }
  .tarot-spread-picker .journal-sidebar { padding: 8px; }
  .tarot-spread-picker .journal-main { padding: 20px 16px; }
}

.tarot-spread-picker .journal-sidebar { min-height: 0; overflow-y: auto; }
.tarot-spread-picker .journal-sidebar button {
  font-size: 16px;
  flex-shrink: 0;
  height: auto;
  box-sizing: border-box;
  line-height: 1.4;
}
@media (min-width: 701px) {
  .tarot-spread-picker .journal-sidebar button { padding: 12px; }
}
@media (max-width: 700px) {
  .tarot-spread-picker .journal-sidebar { overflow-y: hidden; }
}

/* Keep every position label within its card, even on wide spreads. */
.tarot-spread-picker .tarot-spread-mini { min-width: var(--tarot-preview-width); }
.tarot-spread-preview-scroll { overflow-x: auto; padding: 4px 0 12px; }
.tarot-spread-preview-scroll:focus-visible { outline: 2px solid #5b3e6e; outline-offset: 2px; }
.tarot-spread-picker .tarot-spread-mini > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 4px 2px;
  font-size: 15px;
  line-height: 1.2;
}
.tarot-spread-mini small {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font: inherit;
  text-align: center;
}
