:root {
  --bg: #090807;
  --ink: #10100e;
  --paper: #f6edda;
  --paper-soft: #d8c9ad;
  --paper-dim: #8e806c;
  --line: rgba(246, 237, 218, 0.16);
  --line-strong: rgba(246, 237, 218, 0.32);
  --red: #a83224;
  --red-soft: #c24c3a;
  --green: #5c7b63;
  --tone: rgba(92, 123, 99, 0.24);
  --tone-strong: rgba(168, 50, 36, 0.20);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-body: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --font-ui: "EB Garamond", "Noto Serif SC", serif;
  --font-cn: var(--font-body);
  --font-en: var(--font-ui);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--font-body);
}

body {
  cursor: none;
}

button,
input,
textarea {
  font: inherit;
  cursor: none;
}

button {
  color: inherit;
}

.mirror-cursor {
  --cursor-x: 50vw;
  --cursor-y: 50vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  width: 1px;
  height: 1px;
  pointer-events: none;
  transform: translate3d(var(--cursor-x), var(--cursor-y), 0);
}

.cursor-ring,
.cursor-dot,
.cursor-seal {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
}

.cursor-ring {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(246, 237, 218, 0.46);
  border-radius: 50%;
  background: rgba(9, 8, 7, 0.18);
  backdrop-filter: blur(2px);
  transition: width 220ms var(--ease), height 220ms var(--ease), border-color 220ms ease, background 220ms ease;
}

.cursor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red-soft);
  box-shadow: 0 0 18px rgba(194, 76, 58, 0.62);
}

.cursor-seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--paper);
  border: 1px solid rgba(194, 76, 58, 0.7);
  background: rgba(168, 50, 36, 0.72);
  font-size: 18px;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72) rotate(-8deg);
  transition: opacity 180ms ease, transform 220ms var(--ease);
}

.mirror-cursor.is-hover .cursor-ring {
  width: 46px;
  height: 46px;
  border-color: rgba(194, 76, 58, 0.5);
  background: rgba(168, 50, 36, 0.08);
}

.mirror-cursor.is-hover .cursor-dot {
  opacity: 0;
}

.mirror-cursor.is-hover .cursor-seal {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(-8deg);
}

.mirror-cursor.is-down .cursor-ring {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

.mirror-cursor.is-down .cursor-seal {
  transform: translate(-50%, -50%) scale(0.88) rotate(-8deg);
}

.mirror-room {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at var(--mx, 52%) var(--my, 48%), var(--tone), transparent 23rem),
    radial-gradient(circle at 76% 76%, var(--tone-strong), transparent 22rem),
    linear-gradient(120deg, #070707, #12100d 62%, #0b0b0a);
}

.mirror-room[data-tone="tarot"] {
  --tone: rgba(92, 123, 99, 0.25);
  --tone-strong: rgba(168, 50, 36, 0.18);
}

.mirror-room[data-tone="meihua"] {
  --tone: rgba(121, 103, 72, 0.25);
  --tone-strong: rgba(92, 123, 99, 0.18);
}

.mirror-room[data-tone="anchor"] {
  --tone: rgba(70, 102, 118, 0.27);
  --tone-strong: rgba(168, 50, 36, 0.14);
}

.field-canvas,
.surface-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.field-canvas {
  z-index: 0;
}

.surface-noise {
  z-index: 1;
  opacity: 0.25;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(246, 237, 218, 0.18) 0 1px, transparent 1px),
    radial-gradient(circle at 66% 74%, rgba(246, 237, 218, 0.12) 0 1px, transparent 1px);
  background-size: 23px 29px, 39px 35px;
  mix-blend-mode: screen;
}

.side-rail {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 8;
  width: min(23vw, 276px);
  min-width: 188px;
  padding: 42px 36px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-right: 1px solid var(--line);
  background: rgba(9, 8, 7, 0.38);
  backdrop-filter: blur(18px);
}

.side-rail::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 42px;
  bottom: 42px;
  width: 1px;
  background: linear-gradient(transparent, rgba(246, 237, 218, 0.42), transparent);
  opacity: 0.55;
}

.brand {
  width: max-content;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  writing-mode: vertical-rl;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: 0.42em;
}

.mode-nav {
  align-self: end;
  display: grid;
  gap: 18px;
}

.mode-nav button,
.lang-btn,
.primary,
.secondary,
.panel-close,
.mirror-disc {
  border: 0;
  background: transparent;
}

.mode-nav button {
  width: max-content;
  padding: 0 0 8px;
  color: var(--paper-dim);
  border-bottom: 1px solid transparent;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.14em;
  transition: color 220ms ease, border-color 220ms ease, transform 220ms var(--ease);
}

.mode-nav button:hover,
.mode-nav button.active {
  color: var(--paper);
  border-color: var(--red);
  transform: translateX(6px);
}

.rail-actions {
  align-self: end;
  display: grid;
  gap: 12px;
  margin: 0 0 28px;
}

.rail-actions button {
  width: max-content;
  padding: 0 0 5px;
  border: 0;
  border-bottom: 1px solid rgba(246, 237, 218, 0.14);
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
  transition: color 220ms ease, border-color 220ms ease, transform 220ms var(--ease);
}

.rail-actions button:hover {
  color: var(--paper);
  border-color: var(--red);
  transform: translateX(4px);
}

.language {
  display: inline-flex;
  gap: 7px;
  align-items: baseline;
  color: var(--paper-dim);
  font-family: var(--font-en);
}

.admin-link {
  justify-self: start;
  align-self: end;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 18px;
  color: rgba(246, 237, 218, 0.42);
  border: 1px solid rgba(168, 50, 36, 0.36);
  background: rgba(168, 50, 36, 0.08);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  transform: rotate(-8deg);
  transition: color 220ms ease, border-color 220ms ease, background 220ms ease, transform 220ms var(--ease);
}

.admin-link:hover {
  color: var(--paper);
  border-color: rgba(194, 76, 58, 0.72);
  background: rgba(168, 50, 36, 0.34);
  transform: rotate(-8deg) translateY(-2px);
}

.lang-btn {
  padding: 0;
  color: var(--paper-dim);
  font-size: 20px;
}

.lang-btn.is-active {
  color: var(--paper);
}

.mirror-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.mirror-disc {
  position: relative;
  width: min(48vw, 560px);
  min-width: 330px;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: auto;
  transform: perspective(1100px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 520ms var(--ease), filter 520ms ease;
  filter: drop-shadow(0 28px 70px rgba(0, 0, 0, 0.45));
}

.mirror-disc:hover {
  filter: drop-shadow(0 34px 90px rgba(0, 0, 0, 0.62));
}

.disc-core,
.disc-glass,
.disc-ticks,
.disc-ring,
.disc-text {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.disc-core {
  inset: 19%;
  border: 1px solid rgba(246, 237, 218, 0.18);
  background:
    radial-gradient(circle at 48% 42%, rgba(246, 237, 218, 0.22), transparent 12%),
    radial-gradient(circle, rgba(92, 123, 99, 0.16), transparent 58%);
  filter: blur(0.2px);
  animation: core-breathe 7s ease-in-out infinite;
}

.disc-glass {
  inset: 14%;
  border: 1px solid rgba(246, 237, 218, 0.10);
  background:
    radial-gradient(circle at 42% 28%, rgba(246, 237, 218, 0.24), transparent 10%),
    linear-gradient(135deg, rgba(246, 237, 218, 0.16), transparent 34%, rgba(246, 237, 218, 0.05) 58%, transparent);
  mix-blend-mode: screen;
  opacity: 0.72;
}

.disc-ticks {
  inset: 5%;
  background: repeating-conic-gradient(from 4deg, rgba(246, 237, 218, 0.20) 0 1deg, transparent 1deg 12deg);
  mask: radial-gradient(circle, transparent 0 62%, black 63% 65%, transparent 66%);
  opacity: 0.5;
  animation: turn 64s linear infinite reverse;
}

.disc-ring {
  border: 1px solid rgba(246, 237, 218, 0.14);
}

.ring-a {
  inset: 8%;
  animation: turn 28s linear infinite;
}

.ring-b {
  inset: 0;
  border-color: rgba(168, 50, 36, 0.20);
  transform: scaleY(0.68) rotate(-11deg);
  animation: tilt 9s ease-in-out infinite;
}

.disc-text {
  display: grid;
  place-items: center;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 68px);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  text-shadow: 0 0 26px rgba(246, 237, 218, 0.22);
  transition: letter-spacing 260ms ease, opacity 260ms ease;
}

.mirror-disc:hover .disc-text {
  letter-spacing: 0.26em;
  opacity: 0.86;
}

.mode-label {
  position: absolute;
  left: 50%;
  bottom: clamp(38px, 7vh, 78px);
  margin: 0;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.18em;
  transform: translateX(-50%);
  transition: opacity 360ms ease;
}

.copy-block {
  position: absolute;
  right: clamp(34px, 7vw, 104px);
  top: 50%;
  z-index: 5;
  width: min(470px, 36vw);
  transform: translateY(-50%);
  transition: opacity 420ms ease, transform 560ms var(--ease);
}

.copy-block::before {
  content: "";
  display: block;
  width: 84px;
  height: 2px;
  margin-bottom: 34px;
  background: var(--red);
}

.copy-block p,
.panel-kicker {
  margin: 0 0 20px;
  color: var(--paper-dim);
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0.32em;
}

.copy-block h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(42px, 4.8vw, 72px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: 0;
  text-wrap: balance;
}

.work-panel {
  position: absolute;
  right: clamp(28px, 5vw, 82px);
  top: 50%;
  z-index: 9;
  width: min(560px, 43vw);
  padding: 34px;
  border: 1px solid var(--line);
  background: rgba(9, 8, 7, 0.58);
  backdrop-filter: blur(26px);
  opacity: 0;
  visibility: hidden;
  transform: translate(40px, -50%);
  transition: opacity 420ms ease, visibility 420ms ease, transform 560ms var(--ease);
}

.answer-panel {
  width: min(720px, 52vw);
}

.work-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(246, 237, 218, 0.055);
  pointer-events: none;
}

.panel-index {
  position: absolute;
  left: 34px;
  top: 24px;
  color: rgba(246, 237, 218, 0.24);
  font-family: var(--font-en);
  font-size: 42px;
  line-height: 1;
  pointer-events: none;
  z-index: 0;
}

.answer-panel .panel-index {
  left: auto;
  right: 70px;
  top: 26px;
  color: rgba(246, 237, 218, 0.12);
}

.panel-close {
  position: absolute;
  right: 24px;
  top: 20px;
  z-index: 2;
  padding: 0;
  color: var(--paper-dim);
  font-size: 30px;
}

.panel-close:hover {
  color: var(--paper);
}

.compose-panel form {
  display: grid;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: none;
  padding: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--paper);
  caret-color: var(--red-soft);
  font-family: var(--font-body);
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.72;
}

textarea::placeholder {
  color: var(--paper-dim);
  opacity: 0.62;
}

textarea:focus {
  border-bottom-color: var(--line-strong);
}

textarea:disabled {
  opacity: 0.35;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  background: transparent;
  color: var(--paper);
  caret-color: var(--red-soft);
  font-family: var(--font-body);
  font-size: 18px;
}

input::placeholder {
  color: var(--paper-dim);
  opacity: 0.7;
}

input:focus {
  border-bottom-color: var(--line-strong);
}

.hint,
.loading-line {
  margin: 18px 0 0;
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.08em;
}

.primary,
.secondary {
  min-height: 48px;
  color: var(--paper);
  border: 1px solid var(--line-strong);
  background: rgba(168, 50, 36, 0.22);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.2em;
  transition: background 220ms ease, border-color 220ms ease, transform 220ms var(--ease), color 220ms ease;
}

.primary {
  width: 100%;
  margin-top: 28px;
}

.primary:hover,
.secondary:hover {
  border-color: rgba(194, 76, 58, 0.65);
  background: rgba(168, 50, 36, 0.38);
  transform: translateY(-2px);
}

.result-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.answer-panel .panel-kicker {
  position: relative;
  z-index: 1;
  padding-right: 82px;
}

.symbol-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 250px;
}

.symbol-card::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(246, 237, 218, 0.08);
  transform: rotate(-3deg);
}

.tarot-symbol img {
  position: relative;
  z-index: 1;
  width: min(150px, 28vw);
  max-height: 250px;
  object-fit: contain;
  border: 1px solid rgba(246, 237, 218, 0.20);
  filter: sepia(0.16) saturate(0.82) brightness(0.96) contrast(1.04);
  transition: border-color 220ms ease, filter 220ms ease, transform 220ms var(--ease);
}

.tarot-symbol img:hover,
.tarot-symbol img:focus-visible {
  border-color: rgba(194, 76, 58, 0.68);
  filter: sepia(0.16) saturate(0.9) brightness(1.05) contrast(1.06);
  transform: translateY(-2px);
}

.gua-symbol {
  position: relative;
  z-index: 1;
  width: min(160px, 28vw);
  display: grid;
  gap: 18px;
  padding: 42px 24px;
}

.gua-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-height: 12px;
}

.gua-line.yin {
  grid-template-columns: 1fr 1fr;
}

.gua-line span {
  display: block;
  height: 10px;
  background: var(--paper);
}

.answer-title {
  margin: 0;
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.16em;
}

.action-sentence {
  min-height: 104px;
  margin: 24px 0 0;
  padding-left: 22px;
  border-left: 2px solid var(--red);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(29px, 3.3vw, 44px);
  font-weight: 500;
  line-height: 1.52;
  letter-spacing: 0;
}

.action-sentence:empty {
  border-color: rgba(246, 237, 218, 0.08);
}

.anchor-grid {
  margin: 22px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border: 1px solid rgba(246, 237, 218, 0.08);
  background: rgba(246, 237, 218, 0.08);
}

.anchor-grid div {
  min-height: 76px;
  padding: 14px;
  background: rgba(9, 8, 7, 0.68);
}

.anchor-grid span {
  display: block;
  color: var(--paper-dim);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.anchor-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 500;
}

.result-actions {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.secondary {
  min-width: 132px;
  padding: 0 18px;
  background: transparent;
}

.secondary.muted {
  color: var(--paper-dim);
}

.mirror-room[data-step="compose"] .compose-panel,
.mirror-room[data-step="answer"] .answer-panel {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.mirror-room[data-step="compose"] .idle-copy,
.mirror-room[data-step="answer"] .idle-copy {
  opacity: 0;
  transform: translate(24px, -50%);
}

.mirror-room[data-step="compose"] .mirror-disc,
.mirror-room[data-step="answer"] .mirror-disc {
  transform: translateX(-15vw) scale(0.82) perspective(1100px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

.mirror-room[data-step="compose"] .mode-label,
.mirror-room[data-step="answer"] .mode-label {
  opacity: 0;
}

.card-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 48px;
}

.card-lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(4, 4, 3, 0.76);
  backdrop-filter: blur(16px);
}

.lightbox-frame {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0;
  padding: 22px 22px 16px;
  border: 1px solid rgba(246, 237, 218, 0.18);
  background: rgba(9, 8, 7, 0.70);
}

.lightbox-frame img {
  width: min(30vw, 280px);
  max-height: min(72vh, 500px);
  object-fit: contain;
  border: 1px solid rgba(246, 237, 218, 0.24);
  filter: sepia(0.12) saturate(0.9) brightness(1.02) contrast(1.04);
}

.lightbox-frame figcaption {
  color: var(--paper-dim);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
}

.lightbox-close {
  position: absolute;
  right: 14px;
  top: 10px;
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 30px;
}

.lightbox-close:hover {
  color: var(--paper);
}

.utility-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: end;
}

.utility-panel[hidden] {
  display: none;
}

.utility-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(4, 4, 3, 0.58);
  backdrop-filter: blur(10px);
}

.utility-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 42px));
  max-height: calc(100dvh - 42px);
  margin: 21px;
  padding: 30px;
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(9, 8, 7, 0.86);
  backdrop-filter: blur(22px);
}

.utility-close {
  position: absolute;
  right: 18px;
  top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper-dim);
  font-size: 28px;
}

.utility-close:hover {
  color: var(--paper);
}

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

.history-empty,
.auth-status {
  margin: 0;
  color: var(--paper-dim);
  font-size: 14px;
  line-height: 1.7;
}

.history-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid rgba(246, 237, 218, 0.12);
  background: transparent;
  color: var(--paper);
  text-align: left;
}

.history-item strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.history-item span,
.history-item em {
  color: var(--paper-dim);
  font-size: 13px;
  font-style: normal;
  line-height: 1.6;
}

.history-item:hover strong {
  color: var(--red-soft);
}

.history-clear {
  width: 100%;
  min-height: 44px;
  margin-top: 18px;
  border: 1px solid rgba(168, 50, 36, 0.36);
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-display);
  letter-spacing: 0.16em;
}

.history-clear:hover {
  color: var(--paper);
  border-color: rgba(194, 76, 58, 0.66);
  background: rgba(168, 50, 36, 0.16);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.auth-actions .secondary {
  min-width: 104px;
}

:focus-visible {
  outline: 1px solid var(--red);
  outline-offset: 5px;
}

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

@keyframes tilt {
  0%, 100% {
    transform: scaleY(0.68) rotate(-11deg);
  }
  50% {
    transform: scaleY(0.74) rotate(9deg);
  }
}

@keyframes core-breathe {
  0%, 100% {
    transform: scale(1);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .mirror-room {
    min-height: 100dvh;
    overflow-y: auto;
  }

  .side-rail {
    width: 100vw;
    min-width: 0;
    height: 92px;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: 1fr;
    padding: 20px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-rail::after {
    display: none;
  }

  .brand {
    writing-mode: horizontal-tb;
    font-size: 23px;
    letter-spacing: 0.18em;
  }

  .mode-nav {
    justify-self: center;
    align-self: center;
    display: flex;
    gap: 16px;
  }

  .mode-nav button {
    font-size: 15px;
  }

  .rail-actions {
    position: absolute;
    right: 66px;
    bottom: -38px;
    display: flex;
    gap: 14px;
    margin: 0;
  }

  .rail-actions button {
    font-size: 14px;
  }

  .language {
    justify-self: end;
    align-self: center;
  }

  .admin-link {
    position: absolute;
    right: 22px;
    bottom: -40px;
  }

  .mirror-disc {
    min-width: 270px;
    width: 72vw;
  }

  .copy-block,
  .work-panel {
    left: 22px;
    right: 22px;
    top: auto;
    bottom: 30px;
    width: auto;
    transform: none;
  }

  .copy-block h1 {
    font-size: 40px;
    line-height: 1.22;
  }

  .mirror-room[data-step="compose"] .compose-panel,
  .mirror-room[data-step="answer"] .answer-panel {
    transform: none;
  }

  .mirror-room[data-step="compose"] .mirror-disc,
  .mirror-room[data-step="answer"] .mirror-disc {
    transform: translateY(-16vh) scale(0.72);
  }

  .answer-panel {
    max-height: calc(100dvh - 124px);
    overflow: auto;
  }

  .result-body {
    grid-template-columns: 1fr;
  }

  .symbol-card {
    min-height: 190px;
  }

  .tarot-symbol img {
    width: min(126px, 36vw);
  }

  .lightbox-frame img {
    width: min(52vw, 260px);
    max-height: 66vh;
  }

  .action-sentence {
    font-size: clamp(25px, 7.4vw, 33px);
    line-height: 1.58;
  }
}

@media (max-width: 620px) {
  .side-rail {
    height: 158px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 14px;
  }

  .mode-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
  }

  .language {
    position: absolute;
    top: 116px;
    left: 128px;
    width: max-content;
    transform: none;
  }

  .rail-actions {
    position: static;
    grid-column: 1 / -1;
    grid-row: 3;
    justify-self: start;
    max-width: calc(100vw - 96px);
    overflow: hidden;
  }

  .admin-link {
    left: 244px;
    right: auto;
    bottom: 18px;
  }

  .mirror-stage {
    padding-top: 104px;
  }

  .mirror-disc {
    min-width: 238px;
    width: 76vw;
  }

  .mode-label {
    bottom: 42%;
  }

  .copy-block,
  .work-panel {
    bottom: 18px;
  }

  .answer-panel {
    max-height: calc(100dvh - 204px);
  }

  .anchor-grid,
  .result-actions {
    grid-template-columns: 1fr;
  }

  .result-actions {
    display: grid;
  }

  .card-lightbox {
    padding: 20px;
  }

  .lightbox-frame {
    padding: 20px 18px 16px;
  }

  .lightbox-frame img {
    width: min(76vw, 300px);
    max-height: 68vh;
  }
}

@media (pointer: coarse) {
  body,
  button,
  textarea {
    cursor: auto;
  }

  .mirror-cursor {
    display: none;
  }
}

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

  .field-canvas {
    display: none;
  }
}
