:root {
  color-scheme: dark;
  --bg: #07100f;
  --bg-2: #0d1d1b;
  --surface: rgba(244, 238, 219, 0.075);
  --surface-strong: rgba(244, 238, 219, 0.12);
  --ink: #f6eddb;
  --muted: #bfc9bc;
  --soft: #8e9f93;
  --line: rgba(224, 203, 139, 0.2);
  --line-strong: rgba(224, 203, 139, 0.36);
  --gold: #d8ba62;
  --gold-strong: #f1d77e;
  --teal: #79cdb1;
  --teal-deep: #0b3935;
  --rose: #a65360;
  --danger: #eb9076;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.42);
  --serif: "Noto Serif TC", "Cormorant Garamond", serif;
  --sans: "Inter", "Noto Serif TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(8, 44, 42, 0.82), transparent 38%),
    linear-gradient(215deg, rgba(78, 44, 29, 0.38), transparent 44%),
    linear-gradient(180deg, #06100f 0%, #0a1716 42%, #10130e 100%);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}

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

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(246, 237, 219, 0.68) 0 1px, transparent 1.6px),
    linear-gradient(110deg, transparent 0 46%, rgba(121, 205, 177, 0.06) 47%, transparent 56%);
  background-size: 118px 118px, 100% 100%;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 84%);
  opacity: 0.24;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px clamp(16px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 13, 12, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(241, 215, 126, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(150deg, #f1d77e, #9f7830 52%, #0a2a27 53%, #071311);
  color: #06100f;
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 4px rgba(6, 16, 15, 0.22);
}

.brand strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.1;
}

.brand small,
.system-label {
  display: block;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.4;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.nav a {
  padding: 10px 12px;
}

.nav a:hover,
.nav a:focus-visible {
  border-color: var(--line);
  color: var(--ink);
  outline: none;
}

main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 54px) 72px;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(320px, 0.8fr) minmax(292px, 0.62fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100svh - 128px);
  scroll-margin-top: 96px;
}

.question-panel,
.camera-panel,
.result-panel,
.guide-section,
.prompt-section,
.history-section,
.info-grid {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(244, 238, 219, 0.11), rgba(244, 238, 219, 0.04)),
    rgba(5, 13, 12, 0.72);
  box-shadow: var(--shadow);
}

.question-panel,
.camera-panel,
.result-panel {
  padding: clamp(20px, 2.6vw, 34px);
}

.panel-copy {
  max-width: 680px;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  letter-spacing: 0;
}

h1 {
  max-width: 690px;
  margin-top: 10px;
  font-size: clamp(38px, 4.2vw, 58px);
  font-weight: 800;
  line-height: 1.03;
}

h2 {
  font-size: clamp(29px, 3vw, 43px);
  font-weight: 800;
  line-height: 1.1;
}

.lead,
.gesture-status,
.support-card p,
.history-actions p,
.info-grid p {
  color: var(--muted);
  line-height: 1.72;
}

.lead {
  margin: 14px 0 20px;
  font-size: 16px;
}

.field-label {
  display: grid;
  gap: 8px;
  margin: 14px 0 8px;
  color: var(--gold-strong);
  font-size: 13px;
  font-weight: 800;
}

.field-label.compact {
  margin: 0;
}

textarea,
select,
input[type="text"] {
  width: 100%;
  border: 1px solid rgba(224, 203, 139, 0.26);
  border-radius: 8px;
  background: rgba(3, 9, 8, 0.58);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 104px;
  padding: 16px;
  line-height: 1.6;
  resize: vertical;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(216, 186, 98, 0.14);
}

textarea::placeholder {
  color: rgba(191, 201, 188, 0.6);
}

.input-footer,
.history-actions,
.controls,
.gesture-controls,
.result-actions {
  display: flex;
  align-items: center;
}

.input-footer {
  justify-content: space-between;
  margin-top: 8px;
  color: rgba(191, 201, 188, 0.76);
  font-size: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-weight: 800;
}

.settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.controls,
.gesture-controls,
.result-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.primary-link,
.ghost-link {
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button,
.ghost-button {
  padding: 0 18px;
}

.primary-button,
.primary-link {
  border: 1px solid rgba(241, 215, 126, 0.78);
  background: linear-gradient(135deg, #f1d77e, #bb8733);
  color: #07100f;
  box-shadow: 0 14px 34px rgba(187, 135, 51, 0.24);
}

.ghost-button,
.ghost-link {
  border: 1px solid rgba(224, 203, 139, 0.28);
  background: rgba(244, 238, 219, 0.06);
  color: var(--ink);
}

.primary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.primary-link:hover,
.ghost-link:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.46;
}

.primary-link,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  white-space: nowrap;
}

.camera-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.camera-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.camera-head strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.15;
}

#gestureBadge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(224, 203, 139, 0.2);
  border-radius: 8px;
  background: rgba(3, 9, 8, 0.48);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.camera-frame {
  position: relative;
  display: grid;
  min-height: 260px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(224, 203, 139, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(244, 238, 219, 0.05), transparent),
    rgba(2, 7, 7, 0.78);
}

.camera-frame video,
.camera-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-frame:not(.is-active) video,
.camera-frame:not(.is-active) canvas {
  display: none;
}

.camera-placeholder {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(72%, 280px);
  aspect-ratio: 4 / 3;
  place-items: center;
  border: 1px dashed rgba(224, 203, 139, 0.25);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.camera-frame.is-active .camera-placeholder {
  display: none;
}

.camera-frame.is-triggered {
  border-color: rgba(241, 215, 126, 0.78);
  box-shadow: 0 0 0 4px rgba(216, 186, 98, 0.13);
}

.gesture-status {
  margin: 0;
  font-size: 13px;
}

.signal-row {
  display: grid;
  grid-template-columns: 84px minmax(90px, 1fr) 86px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.signal-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(224, 203, 139, 0.16);
  border-radius: 999px;
  background: rgba(2, 7, 7, 0.56);
}

.signal-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold-strong));
  transition: width 0.12s linear;
}

.signal-row strong {
  color: var(--ink);
  font-size: 11px;
  text-align: right;
}

.result-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.deck-stage {
  position: relative;
  display: grid;
  min-height: 330px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(224, 203, 139, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(121, 205, 177, 0.12), rgba(216, 186, 98, 0.08)),
    rgba(2, 7, 7, 0.5);
}

.deck-stage::before {
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(224, 203, 139, 0.12);
  content: "";
}

.deck-stack {
  position: absolute;
  bottom: 28px;
  left: 28px;
  width: 92px;
  height: 128px;
}

.deck-stack span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(241, 215, 126, 0.4);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #123c39, #0b1514 58%, #9f7830 59%, #f1d77e 62%, #0b1514 63%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.deck-stack span:nth-child(2) {
  transform: translate(7px, -7px);
}

.deck-stack span:nth-child(3) {
  transform: translate(14px, -14px);
}

.tarot-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(82%, 300px);
  aspect-ratio: 0.68;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--ink);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.48),
    12px 10px 0 rgba(3, 8, 8, 0.86);
  transform: rotate(-2deg);
  transition: transform 0.36s ease, filter 0.36s ease;
}

.tarot-card.is-revealing {
  animation: revealCard 0.72s cubic-bezier(0.19, 1, 0.22, 1);
}

.tarot-card.is-reversed {
  transform: rotate(178deg);
}

.tarot-card.is-back {
  color: var(--ink);
  background: transparent;
}

.card-face {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  text-align: center;
}

.card-face::before {
  display: none;
}

.tarot-card.is-back .card-face {
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.tarot-card.is-back .card-art {
  width: 100%;
  height: 100%;
  max-width: none;
}

.card-face strong {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  color: inherit;
  font-family: var(--serif);
  font-size: clamp(20px, 2.1vw, 29px);
  font-weight: 800;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.card-number {
  position: relative;
  z-index: 1;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.card-face small {
  position: relative;
  z-index: 1;
  color: rgba(246, 237, 219, 0.64);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.card-art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: 0;
  overflow: visible;
}

.generated-card-art {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 28px;
  background: #07100f;
  box-shadow: inset 0 0 0 1px rgba(241, 215, 126, 0.24);
  isolation: isolate;
}

.generated-card-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.92) contrast(1.05);
}

.generated-card-image.is-card-back {
  object-position: center;
}

.generated-card-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(2, 7, 7, 0.2), transparent 25%, transparent 66%, rgba(2, 7, 7, 0.68)),
    radial-gradient(circle at 50% 38%, transparent 36%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

.generated-card-art::after {
  content: "";
  position: absolute;
  inset: 4.5%;
  z-index: 3;
  border: 1px solid rgba(241, 215, 126, 0.62);
  border-radius: 22px;
  box-shadow:
    inset 0 0 0 1px rgba(241, 215, 126, 0.16),
    0 0 20px rgba(241, 215, 126, 0.08);
  pointer-events: none;
}

.generated-medallion {
  position: absolute;
  top: 7.2%;
  left: 50%;
  z-index: 4;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(241, 215, 126, 0.66);
  border-radius: 999px;
  background: rgba(5, 13, 12, 0.62);
  color: rgba(241, 215, 126, 0.96);
  font-family: "Cormorant Garamond", var(--serif);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translateX(-50%);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.42);
}

.generated-card-caption {
  position: absolute;
  right: 8.5%;
  bottom: 8%;
  left: 8.5%;
  z-index: 4;
  display: grid;
  gap: 2px;
  padding: 11px 12px 12px;
  border: 1px solid rgba(241, 215, 126, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(3, 9, 8, 0.42), rgba(3, 9, 8, 0.76));
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

.generated-card-caption span,
.generated-card-caption small {
  color: rgba(241, 215, 126, 0.78);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1.1;
  text-transform: uppercase;
}

.generated-card-caption strong {
  color: rgba(246, 237, 219, 0.96);
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 29px);
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.56);
}

.generated-card-shine {
  position: absolute;
  inset: -20%;
  z-index: 2;
  background: linear-gradient(115deg, transparent 34%, rgba(246, 237, 219, 0.09) 44%, transparent 54%);
  opacity: 0.58;
  pointer-events: none;
  transform: translateX(-8%);
}

.generated-card-art.is-mini-art {
  border-radius: 8px;
}

.generated-card-art.is-mini-art::after {
  inset: 7%;
  border-radius: 6px;
}

.generated-card-art.is-mini-art .generated-medallion {
  top: 7%;
  width: 16px;
  height: 16px;
  font-size: 8px;
  border-width: 0.7px;
}

.draw-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.draw-strip[hidden] {
  display: none;
}

.draw-mini-card {
  display: grid;
  min-width: 0;
  gap: 5px;
  justify-items: center;
  padding: 10px 8px;
  border: 1px solid rgba(224, 203, 139, 0.16);
  border-radius: 8px;
  background: rgba(244, 238, 219, 0.045);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.draw-mini-card:hover,
.draw-mini-card:focus-visible,
.draw-mini-card.is-active {
  border-color: rgba(241, 215, 126, 0.58);
  background: rgba(244, 238, 219, 0.08);
  outline: none;
}

.draw-mini-card.is-active {
  transform: translateY(-2px);
}

.draw-mini-card .card-art {
  width: 58px;
  height: auto;
  max-width: 58px;
  aspect-ratio: 304 / 420;
}

.draw-mini-card .card-art .art-label {
  display: none;
}

.draw-mini-card span {
  color: var(--gold-strong);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.draw-mini-card strong {
  max-width: 100%;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

@keyframes revealCard {
  0% {
    opacity: 0.45;
    transform: translateY(46px) rotate(-12deg) scale(0.86);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(-2deg) scale(1);
  }
}

.result-copy span {
  display: block;
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-copy h2 {
  margin-top: 8px;
  font-size: clamp(28px, 3vw, 38px);
}

.result-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.keyword-list span,
.method-list span {
  padding: 8px 10px;
  border: 1px solid rgba(121, 205, 177, 0.32);
  border-radius: 8px;
  color: #c7efdf;
  font-size: 12px;
  font-weight: 800;
}

.guide-section,
.prompt-section,
.history-section,
.info-grid {
  padding: clamp(22px, 3vw, 34px);
  scroll-margin-top: 96px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading .system-label {
  margin-bottom: 8px;
}

.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tutorial-grid figure {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(224, 203, 139, 0.16);
  border-radius: 8px;
  background: rgba(244, 238, 219, 0.045);
}

.tutorial-grid img {
  width: 100%;
  border: 1px solid rgba(224, 203, 139, 0.14);
  border-radius: 8px;
  background: #07100f;
}

.tutorial-grid figcaption {
  display: grid;
  gap: 5px;
}

.tutorial-grid strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.15;
}

.tutorial-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.prompt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.52fr);
  gap: 18px;
}

.prompt-card,
.support-card {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(224, 203, 139, 0.16);
  border-radius: 8px;
  background: rgba(3, 9, 8, 0.42);
}

.mini-heading {
  display: grid;
  gap: 5px;
}

.mini-heading span {
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.mini-heading strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.18;
}

#promptOutput {
  min-height: 340px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.history-actions {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.history-actions p {
  margin: 0;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(224, 203, 139, 0.16);
  border-radius: 8px;
  background: rgba(244, 238, 219, 0.045);
}

.history-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.18;
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.history-item button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(224, 203, 139, 0.2);
  border-radius: 8px;
  background: rgba(244, 238, 219, 0.06);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.history-empty {
  padding: 24px;
  border: 1px dashed rgba(224, 203, 139, 0.25);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, auto);
  gap: 24px;
  align-items: center;
}

.info-grid p {
  max-width: 860px;
  margin: 14px 0 0;
}

.method-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(390px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid rgba(224, 203, 139, 0.24);
  border-radius: 8px;
  background: rgba(5, 13, 12, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .tool-shell {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  }

  .result-panel {
    grid-column: 1 / -1;
    grid-template-columns: minmax(260px, 0.44fr) minmax(0, 1fr);
    align-items: center;
  }

  .draw-strip,
  .result-actions {
    grid-column: 2;
  }

  .deck-stage {
    min-height: 300px;
  }
}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .nav {
    grid-column: 1 / -1;
    order: 3;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tool-shell,
  .result-panel,
  .tutorial-grid,
  .prompt-layout,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .tool-shell {
    min-height: auto;
  }

  .draw-strip,
  .result-actions {
    grid-column: auto;
  }

  .method-list {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  main {
    padding: 22px 14px 56px;
  }

  .site-header {
    padding: 14px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    font-size: 17px;
  }

  h1 {
    font-size: 38px;
    line-height: 1.08;
  }

  .question-panel,
  .camera-panel,
  .result-panel,
  .guide-section,
  .prompt-section,
  .history-section,
  .info-grid {
    padding: 18px;
  }

  .settings-row,
  .history-item,
  .camera-head {
    grid-template-columns: 1fr;
  }

  .camera-head {
    display: grid;
  }

  #gestureBadge {
    width: max-content;
  }

  .camera-frame {
    min-height: 220px;
  }

  .signal-row {
    grid-template-columns: 76px minmax(70px, 1fr) 76px;
  }

  .deck-stage {
    min-height: 280px;
  }

  .tarot-card {
    width: min(78%, 230px);
  }

  .card-face {
    padding: 0;
  }

  .card-art {
    max-width: none;
  }

  .card-face strong {
    font-size: 21px;
  }

  .draw-strip {
    gap: 8px;
  }

  .draw-mini-card {
    padding: 9px 6px;
  }

  .draw-mini-card .card-art {
    width: 48px;
  }

  .draw-mini-card strong {
    font-size: 13px;
  }

  .controls .primary-button,
  .controls .ghost-button,
  .gesture-controls .ghost-button,
  .result-actions .ghost-link,
  .support-card .primary-link {
    width: 100%;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

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