:root {
  color-scheme: dark;
  --bg-deep: #0b0413;
  --bg-main: #14071f;
  --panel: rgba(53, 20, 79, 0.58);
  --panel-strong: rgba(44, 14, 65, 0.82);
  --line: rgba(255, 255, 255, 0.96);
  --text: #f8f4ff;
  --muted: #cbb8de;
  --accent: #facc15;
  --accent-2: #f59e0b;
  --accent-soft: rgba(250, 204, 21, 0.12);
  --purple-soft: rgba(168, 85, 247, 0.18);
  --border: rgba(250, 204, 21, 0.14);
  --border-strong: rgba(250, 204, 21, 0.26);
  --error: #fecaca;
  --success: #bbf7d0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  background:
    radial-gradient(circle at 12% 18%, rgba(168, 85, 247, 0.28), transparent 24%),
    radial-gradient(circle at 88% 14%, rgba(250, 204, 21, 0.14), transparent 20%),
    linear-gradient(135deg, var(--bg-deep) 0%, #1b0b2e 48%, var(--bg-main) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: transparent;
  overflow-x: hidden;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(11, 4, 19, 0.58);
  backdrop-filter: blur(4px);
}

body.booting #auth-app,
body.booting #main-app {
  visibility: hidden;
}

.boot-screen-spinner {
  width: 30px;
  height: 30px;
  border: 2.5px solid rgba(250, 204, 21, 0.28);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: bootSpin 0.8s linear infinite;
}

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

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 320px;
  height: 320px;
  left: -120px;
  bottom: 80px;
  background: rgba(168, 85, 247, 0.2);
}

body::after {
  width: 280px;
  height: 280px;
  top: 50px;
  right: -80px;
  background: rgba(250, 204, 21, 0.16);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.page-shell {
  min-height: calc(100vh - 100px);
}

.hidden {
  display: none !important;
}

.glass-card,
.result-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title,
.brand-title,
.page-title {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero-title,
.brand-title {
  background: linear-gradient(90deg, #fff6c4 0%, #ffffff 42%, #e9d5ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-title {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.04;
}

.brand-title {
  font-size: 28px;
}

.hero-subtitle,
.page-copy {
  color: rgba(248, 244, 255, 0.82);
  line-height: 1.8;
}

.page-copy {
  margin: 10px 0 0;
}

.auth-wrap {
  min-height: calc(100vh - 100px);
  display: grid;
  grid-template-columns: 1.2fr minmax(360px, 460px);
  align-items: center;
  gap: 36px;
}

.auth-hero {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}

#auth-app .auth-hero .eyebrow {
  margin-bottom: 0;
}

#auth-app .auth-hero .hero-title {
  margin-top: 2px;
}

.auth-card {
  padding: 24px;
}

.auth-tabs,
.topnav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(250, 204, 21, 0.08);
}

.tab-btn,
.nav-btn,
button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
}

.tab-btn,
.nav-btn {
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.18s ease;
  white-space: nowrap;
}

.tab-btn.active,
.nav-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #341a00;
  box-shadow: 0 14px 30px rgba(250, 204, 21, 0.2);
}

.auth-panel {
  padding-top: 18px;
}

.auth-switch-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.link-btn {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  color: var(--accent);
  font-weight: 700;
  min-height: auto;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  transform: none;
  opacity: 0.9;
}

.auth-panel-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-panel-head h2 {
  margin: 0 0 8px;
  font-size: 32px;
  color: var(--accent);
}

.auth-panel-head p {
  margin: 0;
  color: var(--muted);
}

.auth-icon,
.profile-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #341a00;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 14px 34px rgba(250, 204, 21, 0.22);
}

.form-stack {
  display: grid;
  gap: 4px;
}

.label {
  display: block;
  margin: 8px 0 8px;
  font-weight: 600;
  color: #f8f3ff;
}

.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(250, 204, 21, 0.14);
  background: rgba(11, 5, 20, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.7;
  transition: 0.18s ease;
}

.input::placeholder {
  color: rgba(203, 184, 222, 0.5);
}

.input:focus {
  outline: none;
  border-color: rgba(250, 204, 21, 0.44);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.24),
    0 0 0 6px rgba(250, 204, 21, 0.08);
}

.textarea {
  resize: vertical;
}

button {
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.wide-btn {
  width: 100%;
  margin-top: 18px;
}

.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #2f1800;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(245, 158, 11, 0.22);
}

.secondary,
.ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(250, 204, 21, 0.12);
  color: var(--text);
}

.secondary:hover,
.ghost:hover {
  border-color: rgba(250, 204, 21, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.message {
  min-height: 22px;
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.message.error {
  color: var(--error);
}

.message.success {
  color: var(--success);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff1a8;
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.16);
}

.view-page {
  margin-top: 20px;
}

.page-intro {
  text-align: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 38px;
  font-weight: 700;
  color: var(--accent);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 320px;
  gap: 16px;
}

.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.main-card,
.side-card,
.history-page-card,
.result-panel {
  padding: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

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

.tips-box {
  margin: 18px 0 22px;
  padding: 14px 16px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(250, 204, 21, 0.1), rgba(250, 204, 21, 0.03)),
    rgba(250, 204, 21, 0.06);
  border: 1px solid rgba(250, 204, 21, 0.14);
  color: #f6ecc2;
}

.tips-box p {
  margin: 6px 0;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.actions > button {
  min-height: 48px;
}

.stat-list,
.meta-list,
.formula-list,
.profile-stats {
  display: grid;
  gap: 12px;
}

.stat-item,
.meta-list p,
.formula-list p,
.profile-stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid rgba(250, 204, 21, 0.1);
}

.stat-item:last-child,
.meta-list p:last-child,
.formula-list p:last-child,
.profile-stat:last-child {
  border-bottom: 0;
}

.stat-item span,
.meta-list span,
.profile-stat span,
.small-note {
  color: var(--muted);
}

.result-panel {
  margin-top: 18px;
  background:
    radial-gradient(circle at 88% 8%, rgba(250, 204, 21, 0.11), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    var(--panel);
}

.result-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px 22px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(250, 204, 21, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(250, 204, 21, 0.08), rgba(168, 85, 247, 0.08)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(250, 204, 21, 0.14);
}

.result-kicker {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.result-question-heading {
  margin: 0;
  font-size: 26px;
  line-height: 1.4;
  color: #fff7cf;
}

.result-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-content: flex-start;
}

.result-tag,
.history-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  color: #f7ebc2;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(250, 204, 21, 0.12);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.summary-item {
  padding: 22px 18px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(250, 204, 21, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(250, 204, 21, 0.08), rgba(250, 204, 21, 0.03)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(250, 204, 21, 0.12);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.summary-item span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-item strong {
  color: #fff1a8;
  font-size: 20px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.result-card {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    var(--panel-strong);
}

.result-card h4 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #fff1a8;
}

.result-ai-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.result-ai-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wide-card {
  grid-column: 1 / -1;
}

.hexagram {
  display: grid;
  gap: 12px;
}

.hex-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segments {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.segment {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.segment.solid {
  grid-column: 1 / 4;
}

.segment.gap {
  width: 34px;
  background: transparent;
}

.hex-line.active .segment {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.24);
}

.hex-line.active .segment.broken {
  background: transparent;
}

.line-tag {
  width: 40px;
  padding: 4px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.ai-output {
  min-height: 140px;
  padding: 16px;
  border-radius: 16px;
  line-height: 1.9;
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.05), rgba(250, 204, 21, 0.01)),
    rgba(7, 4, 14, 0.48);
  border: 1px solid rgba(250, 204, 21, 0.12);
}

.ai-section + .ai-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(250, 204, 21, 0.1);
}

.ai-section h5 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #fff1a8;
}

.ai-section p {
  margin: 0;
  color: var(--text);
  line-height: 1.9;
}

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

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px repeat(4, auto);
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.history-select {
  padding-right: 34px;
}

.history-item {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(17, 7, 29, 0.46);
  border: 1px solid rgba(250, 204, 21, 0.1);
  cursor: pointer;
  transition: 0.18s ease;
}

.history-item:hover {
  transform: translateY(-1px);
  border-color: rgba(250, 204, 21, 0.24);
}

.history-item.active {
  border-color: rgba(250, 204, 21, 0.34);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12) inset;
}

.history-item.selected {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.2) inset,
    0 12px 28px rgba(0, 0, 0, 0.2);
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-item-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.history-delete-btn {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1;
  border-radius: 999px;
}

.history-head-main {
  display: grid;
  gap: 6px;
}

.history-select-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.history-select-checkbox {
  width: 16px;
  height: 16px;
}

@media (max-width: 1180px) {
  .history-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .history-toolbar > .ghost {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-grid,
  .history-detail-grid {
    grid-template-columns: 1fr;
  }
}

.history-item-top strong {
  font-size: 16px;
}

.history-question {
  color: #fff7cf;
}

.history-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.history-status {
  flex-shrink: 0;
}

.history-status.ready {
  color: #231400;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.history-time,
.history-meta,
.history-ai {
  color: var(--muted);
}

.history-time {
  font-size: 13px;
}

.history-meta,
.history-ai {
  margin: 10px 0 0;
  line-height: 1.7;
}

.history-ai {
  white-space: normal;
}

.history-numbers {
  font-size: 13px;
}

.history-excerpt {
  margin: 12px 0 0;
  color: rgba(248, 244, 255, 0.9);
  line-height: 1.8;
}

.history-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(250, 204, 21, 0.1);
}

.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.history-detail-grid p {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(250, 204, 21, 0.08);
}

.history-detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.history-detail-grid strong {
  color: #fff4b8;
}

.history-ai-block {
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.05), rgba(250, 204, 21, 0.01)),
    rgba(7, 4, 14, 0.42);
  border: 1px solid rgba(250, 204, 21, 0.1);
}

.history-ai-block .ai-section + .ai-section {
  margin-top: 14px;
  padding-top: 14px;
}

.history-ai-block .ai-section h5 {
  font-size: 15px;
}

.history-ai-block .ai-section p {
  color: rgba(248, 244, 255, 0.92);
}

.empty-state {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  border-radius: 20px;
  border: 1px dashed rgba(250, 204, 21, 0.12);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.profile-grid {
  align-items: start;
}

.profile-main-card {
  padding-bottom: 18px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-head-content {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 8px;
}

.profile-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-id-row h3 {
  margin: 0;
}

.profile-id-row .small-note {
  white-space: nowrap;
}

.profile-id-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-copy-btn,
.profile-logout-btn {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-copy-btn::before,
.profile-logout-btn::before {
  font-size: 12px;
  line-height: 1;
  opacity: 0.9;
}

.profile-copy-btn::before {
  content: "⎘";
}

.profile-logout-btn::before {
  content: "↪";
}

.profile-icon {
  margin: 0;
  flex-shrink: 0;
}

.profile-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.profile-highlight {
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(250, 204, 21, 0.07), rgba(250, 204, 21, 0.02)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(250, 204, 21, 0.12);
}

.profile-highlight span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.profile-highlight strong {
  display: block;
  color: #fff6c4;
  font-size: 18px;
  line-height: 1.5;
  word-break: break-word;
}

.profile-recent-card {
  padding: 16px 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(168, 85, 247, 0.08), rgba(168, 85, 247, 0.03)),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(168, 85, 247, 0.16);
}

.profile-recent-title {
  margin: 0 0 8px;
  font-size: 15px;
  color: #f8edff;
}

.feature-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.feature-list li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

@media (max-width: 1024px) {
  .auth-wrap,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .auth-wrap {
    min-height: auto;
  }

  .topnav {
    justify-content: flex-start;
  }

}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding: 16px 0 48px;
  }

  .auth-wrap {
    gap: 20px;
  }

  .auth-hero {
    padding: 8px 4px 0;
  }

  .hero-title {
    font-size: 34px;
    line-height: 1.12;
  }

  .hero-subtitle,
  .page-copy {
    font-size: 14px;
    line-height: 1.7;
  }

  .topbar {
    padding: 16px;
    gap: 14px;
    position: sticky;
    top: 8px;
    z-index: 10;
  }

  .auth-tabs,
  .actions,
  .section-head,
  .result-hero,
  .history-item-top,
  .meta-list p,
  .formula-list p,
  .stat-item,
  .profile-stat {
    flex-direction: column;
    align-items: stretch;
  }

  .field-grid,
  .result-grid,
  .result-summary,
  .profile-highlight-grid,
  .history-detail-grid {
    grid-template-columns: 1fr;
  }

  .auth-tabs,
  .topnav {
    width: 100%;
    overflow: visible;
    padding: 4px;
  }

  .topnav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(250, 204, 21, 0.12);
  }

  .tab-btn,
  .nav-btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .nav-btn {
    border-radius: 12px;
    padding: 10px 8px;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .nav-btn.active {
    box-shadow: 0 8px 18px rgba(250, 204, 21, 0.22);
  }

  .glass-card,
  .result-card {
    border-radius: 20px;
  }

  .main-card,
  .side-card,
  .history-page-card,
  .result-panel,
  .auth-card {
    padding: 18px;
  }

  .status-chip,
  .result-tag {
    justify-content: center;
  }

  .history-chip-row .history-chip {
    width: 100%;
    justify-content: center;
  }

  .actions > button {
    width: 100%;
  }

  .result-question-heading {
    font-size: 22px;
  }

  .result-tags {
    justify-content: flex-start;
  }

  .result-ai-head {
    flex-direction: column;
    align-items: stretch;
  }

  .result-ai-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .result-ai-tools .small-note {
    width: 100%;
  }

  .result-ai-tools > .history-delete-btn {
    flex: 1 1 calc(50% - 5px);
    text-align: center;
  }

  .summary-item {
    padding: 18px 16px;
  }

  .result-card h4 {
    font-size: 17px;
  }

  .meta-list p strong,
  .profile-stat strong {
    word-break: break-word;
  }

  .segments {
    gap: 10px;
  }

  .segment {
    height: 10px;
  }

  .segment.gap {
    width: 24px;
  }

  .line-tag {
    width: 44px;
    font-size: 11px;
  }

  .history-item {
    padding: 16px;
  }

  .history-chip-row {
    gap: 8px;
  }

  .history-item-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .history-item-actions .history-chip {
    width: auto;
    justify-content: center;
  }

  .history-item-actions .history-delete-btn {
    margin-left: auto;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
  }

  .history-select,
  .history-toolbar .ghost {
    width: 100%;
  }

  .history-question {
    font-size: 15px;
    line-height: 1.6;
  }

  .history-excerpt {
    font-size: 14px;
    line-height: 1.75;
  }

  .history-ai-block,
  .ai-output {
    padding: 14px;
  }

  .profile-head {
    align-items: flex-start;
  }

  .profile-id-row {
    align-items: flex-start;
  }

  .profile-id-row .small-note {
    width: 100%;
    white-space: normal;
  }

  .profile-id-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-copy-btn,
  .profile-logout-btn {
    width: 100%;
  }

  .page-title {
    font-size: 30px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    width: min(100% - 16px, 1240px);
    padding-top: 12px;
  }

  .glass-card,
  .result-card,
  .summary-item,
  .history-item,
  .history-ai-block {
    border-radius: 18px;
  }

  .auth-card,
  .main-card,
  .side-card,
  .history-page-card,
  .result-panel {
    padding: 16px;
  }

  .hero-title,
  .page-title {
    font-size: 28px;
  }

  .profile-id-actions {
    grid-template-columns: 1fr;
  }

  .profile-copy-btn,
  .profile-logout-btn {
    justify-content: center;
  }

  .brand-title {
    font-size: 24px;
  }

  .auth-panel-head h2 {
    font-size: 28px;
  }

  .auth-icon,
  .profile-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
  }

  .input {
    padding: 13px 14px;
    border-radius: 14px;
  }

  .result-hero {
    padding: 16px;
  }

  .result-question-heading {
    font-size: 20px;
  }

  .summary-item strong {
    font-size: 18px;
  }

  .result-card,
  .history-item {
    padding: 14px;
  }

  .topbar {
    padding: 14px;
    gap: 10px;
  }

  .brand-title {
    font-size: 22px;
  }

  .topnav {
    gap: 4px;
    padding: 5px;
  }

  .nav-btn {
    font-size: 14px;
    padding: 9px 6px;
  }

  .result-ai-tools > .history-delete-btn {
    flex: 1 1 100%;
  }

  .segments {
    gap: 8px;
  }

  .segment.gap {
    width: 20px;
  }

  .line-tag {
    width: 40px;
  }
}

/* ===== Stitch Scholar Theme Overrides (2026-04-15) ===== */
:root {
  --bg-deep: #131313;
  --bg-main: #131313;
  --panel: #1c1b1b;
  --panel-strong: #20201f;
  --line: #4e4639;
  --text: #e5e2e1;
  --muted: #b8aa96;
  --accent: #e9c176;
  --accent-2: #c5a059;
  --accent-soft: rgba(233, 193, 118, 0.1);
  --purple-soft: rgba(181, 200, 223, 0.08);
  --border: rgba(154, 143, 128, 0.32);
  --border-strong: rgba(233, 193, 118, 0.44);
  --error: #ffb4ab;
  --success: #d1e4fb;
  --shadow: none;
}

html {
  background:
    radial-gradient(circle at 20% 14%, rgba(233, 193, 118, 0.06), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(181, 200, 223, 0.06), transparent 24%),
    #131313;
}

body {
  background: #131313;
  color: #e5e2e1;
  font-family: "Work Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.01em;
}

body::before,
body::after {
  display: none;
}

.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.app-shell {
  width: min(1200px, calc(100% - 28px));
  padding: 18px 0 40px;
}

.page-shell {
  min-height: calc(100vh - 60px);
}

.glass-card,
.result-card,
.history-item,
.summary-item,
.profile-highlight,
.profile-recent-card,
.topbar,
.topnav,
.auth-card,
.history-page-card,
.result-panel,
.main-card,
.side-card {
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.glass-card,
.result-card,
.history-page-card,
.result-panel,
.main-card,
.side-card,
.history-item,
.summary-item,
.profile-highlight,
.profile-recent-card {
  background: var(--panel);
  border: 0.5px solid var(--border);
}

.hero-title,
.brand-title,
.page-title,
.auth-panel-head h2,
.section-head h3,
.result-question-heading,
.summary-item strong,
.profile-name,
.profile-id-row h3 {
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e5e2e1;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: #c5a059;
  margin: 0 0 10px;
}

.hero-title {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.15;
}

.hero-subtitle,
.page-copy {
  color: var(--muted);
  line-height: 1.9;
}

.auth-wrap {
  grid-template-columns: 1fr minmax(360px, 460px);
  gap: 40px;
}

.auth-card {
  padding: 26px 24px;
  background: var(--panel-strong);
}

.auth-panel {
  padding-top: 8px;
}

.auth-panel-head {
  text-align: left;
}

.auth-panel-head h2 {
  font-size: 30px;
  margin-bottom: 10px;
  color: #e9c176;
}

.auth-panel-head p {
  color: var(--muted);
}

.auth-icon,
.profile-icon {
  width: 54px;
  height: 54px;
  margin: 0 0 16px;
  border-radius: 0;
  background: #2a2a2a;
  color: #e9c176;
  box-shadow: none;
  border: 0.5px solid rgba(233, 193, 118, 0.45);
}

.form-stack {
  gap: 8px;
}

.label {
  margin: 10px 0 6px;
  color: #9a8f80;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}

.input,
.history-select {
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--line);
  border-radius: 0;
  padding: 11px 0;
  color: var(--text);
}

.input::placeholder {
  color: rgba(229, 226, 225, 0.35);
}

.input:focus,
.history-select:focus {
  border-color: var(--accent);
  box-shadow: none;
  background: transparent;
}

.textarea {
  min-height: 110px;
  padding-top: 10px;
  padding-bottom: 10px;
}

button,
.tab-btn,
.nav-btn,
.primary,
.secondary,
.ghost {
  border-radius: 0;
  letter-spacing: 0.08em;
}

.primary {
  background: linear-gradient(15deg, #c5a059, #e9c176);
  color: #412d00;
  border: 0;
  min-height: 48px;
  font-weight: 700;
}

.primary:hover {
  transform: none;
  filter: brightness(1.05);
}

.secondary,
.ghost,
.history-delete-btn {
  background: transparent;
  color: var(--accent);
  border: 0.5px solid rgba(154, 143, 128, 0.36);
}

.secondary:hover,
.ghost:hover,
.history-delete-btn:hover {
  border-color: var(--accent);
  color: #ffdea5;
  transform: none;
}

.message {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 0;
  border: 0.5px solid rgba(154, 143, 128, 0.36);
  background: rgba(32, 32, 31, 0.6);
  color: var(--muted);
}

.message:empty {
  display: none;
}

.message.success {
  border-color: rgba(181, 200, 223, 0.5);
  color: #d1e4fb;
}

.message.error {
  border-color: rgba(255, 180, 171, 0.5);
  color: #ffb4ab;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  padding: 14px 18px;
  background: #131313;
  border: 0.5px solid rgba(197, 160, 89, 0.42);
  border-top: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
}

.brand-block {
  display: grid;
  gap: 2px;
}

.brand-title {
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
  color: #e9c176;
}

.topnav {
  justify-self: end;
  display: inline-flex;
  background: transparent;
  border: 0;
  padding: 0;
  gap: 6px;
}

.nav-btn {
  min-width: 72px;
  padding: 9px 14px;
  background: transparent;
  border: 0.5px solid rgba(78, 70, 57, 0.45);
  color: #d1c5b4;
}

.nav-btn.active {
  background: rgba(233, 193, 118, 0.12);
  border-color: rgba(233, 193, 118, 0.55);
  color: #e9c176;
  box-shadow: none;
}

.page-intro {
  margin: 16px 0 18px;
}

.page-title {
  font-size: clamp(32px, 4vw, 46px);
  letter-spacing: 0.08em;
}

.main-card,
.result-panel,
.history-page-card {
  padding: 20px;
}

.section-head {
  margin-bottom: 14px;
}

.field-grid {
  gap: 18px;
}

.actions {
  gap: 10px;
  margin-top: 16px;
}

.result-panel {
  margin-top: 16px;
  background: var(--panel-strong);
}

.result-hero {
  border-radius: 0;
  border: 0.5px solid rgba(197, 160, 89, 0.3);
  background: rgba(42, 42, 42, 0.35);
  padding: 16px;
}

.result-kicker {
  color: #c5a059;
  letter-spacing: 0.18em;
  font-size: 10px;
}

.result-question-heading {
  font-size: 24px;
  color: #e5e2e1;
}

.result-tag,
.history-chip,
.status-chip {
  border-radius: 0;
  border: 0.5px solid rgba(78, 70, 57, 0.56);
  background: rgba(42, 42, 42, 0.35);
  color: #d1c5b4;
}

.status-chip {
  color: #e9c176;
  border-color: rgba(233, 193, 118, 0.48);
}

.result-summary {
  gap: 10px;
}

.summary-item {
  border: 0.5px solid rgba(154, 143, 128, 0.38);
  padding: 14px 12px;
  text-align: left;
}

.summary-item span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.summary-item strong {
  color: #e9c176;
  font-size: 20px;
}

.result-card h4,
.history-detail-grid span,
.profile-recent-title,
.profile-highlight span {
  color: #9a8f80;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.result-card h4 {
  margin-bottom: 10px;
}

.meta-list p,
.profile-stat {
  border-bottom-color: rgba(78, 70, 57, 0.35);
}

.hex-line.active .segment {
  background: #e9c176 !important;
}

.history-list {
  gap: 10px;
}

.history-item {
  padding: 14px;
  border: 0.5px solid rgba(154, 143, 128, 0.32);
}

.history-item.active {
  border-color: rgba(233, 193, 118, 0.52);
  background: #20201f;
}

.history-excerpt,
.history-meta,
.history-ai,
.ai-output,
.ai-section p {
  color: #d1c5b4;
  line-height: 1.85;
}

.history-ai-block,
.ai-output {
  border-radius: 0;
  border: 0.5px solid rgba(154, 143, 128, 0.26);
  background: rgba(42, 42, 42, 0.38);
}

.ai-section h5 {
  margin: 0 0 6px;
  font-family: "Noto Serif SC", serif;
  letter-spacing: 0.08em;
  color: #e9c176;
}

.empty-state {
  border-radius: 0;
  border: 0.5px dashed rgba(154, 143, 128, 0.4);
  background: rgba(32, 32, 31, 0.45);
}

.profile-head {
  margin-bottom: 16px;
}

.profile-id-row .small-note,
.small-note {
  color: #9a8f80;
}

.profile-id-actions {
  gap: 6px;
}

.profile-copy-btn::before,
.profile-logout-btn::before {
  opacity: 0.8;
}

.profile-highlight-grid {
  gap: 10px;
}

.profile-highlight strong,
.profile-stat strong,
#profile-name {
  color: #e9c176;
}

.profile-recent-card {
  background: rgba(42, 42, 42, 0.42);
  border-color: rgba(154, 143, 128, 0.34);
}

@media (max-width: 1024px) {
  .auth-wrap {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1200px);
    padding: 10px 0 32px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    top: 4px;
  }

  .brand-title {
    font-size: 18px;
  }

  .topnav {
    justify-self: stretch;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-btn {
    width: 100%;
    min-width: 0;
    padding: 10px 6px;
  }

  .field-grid,
  .result-grid,
  .result-summary,
  .profile-highlight-grid,
  .history-detail-grid {
    grid-template-columns: 1fr;
  }

  .result-question-heading {
    font-size: 20px;
  }

  .result-hero,
  .history-item-top,
  .section-head,
  .result-ai-head,
  .profile-id-row {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-id-actions {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .main-card,
  .result-panel,
  .history-page-card,
  .auth-card {
    padding: 14px;
  }

  .hero-title,
  .page-title {
    font-size: 28px;
  }

  .profile-id-actions {
    grid-template-columns: 1fr;
  }
}

/* ===== Stitch Pixel Pass (2026-04-15) ===== */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 350, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.topbar {
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
}

.topbar-left,
.topbar-right {
  color: #e9c176;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  opacity: 0.9;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.topbar-left:hover,
.topbar-right:hover {
  opacity: 1;
}

.topbar-left .material-symbols-outlined,
.topbar-right .material-symbols-outlined {
  font-size: 20px;
}

.topnav {
  justify-self: end;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
}

.nav-icon {
  font-size: 18px;
}

.nav-label {
  font-size: 12px;
  letter-spacing: 0.12em;
}

.auth-hero {
  position: relative;
  padding-left: 16px;
}

.auth-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 0.5px;
  background: rgba(197, 160, 89, 0.38);
}

.auth-switch-row {
  justify-content: flex-start;
}

#view-divination .page-intro {
  text-align: center;
}

#view-divination .page-copy {
  max-width: 440px;
  margin: 10px auto 0;
}

#view-history .page-title,
#view-profile .page-title {
  font-size: clamp(42px, 4.8vw, 60px);
}

.history-item {
  position: relative;
  padding-left: 18px;
}

.history-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  bottom: 14px;
  width: 0.5px;
  background: rgba(197, 160, 89, 0.52);
}

.history-item.selected::before {
  background: rgba(255, 127, 115, 0.65);
}

.empty-state {
  position: relative;
  overflow: hidden;
  padding-top: 96px;
}

.empty-state::before {
  content: "";
  position: absolute;
  top: 26px;
  left: 50%;
  width: 52px;
  height: 44px;
  transform: translateX(-50%);
  background:
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 0 / 100% 1px no-repeat,
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 20% / 100% 1px no-repeat,
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 40% / 100% 1px no-repeat,
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 60% / 100% 1px no-repeat,
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 80% / 100% 1px no-repeat,
    linear-gradient(rgba(78, 70, 57, 0.35), rgba(78, 70, 57, 0.35)) 0 100% / 100% 1px no-repeat;
}

.empty-state::after {
  content: "史";
  position: absolute;
  right: 10%;
  bottom: -8px;
  font-family: "Noto Serif SC", serif;
  font-size: 180px;
  line-height: 1;
  color: rgba(229, 226, 225, 0.03);
  pointer-events: none;
}

.history-empty-wrap {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.history-empty-title {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  line-height: 1.45;
  letter-spacing: 0.06em;
  color: #e5e2e1;
}

.history-empty-copy {
  margin: 0;
  color: #9a8f80;
  line-height: 1.9;
}

.history-empty-action {
  margin-top: 8px;
  min-height: 42px;
  min-width: 148px;
}

#view-profile .content-grid {
  max-width: 860px;
  margin: 0 auto;
}

#view-profile .profile-head {
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

#view-profile .profile-head-content {
  width: 100%;
}

#view-profile .profile-id-row {
  justify-content: center;
}

#view-profile .profile-id-actions {
  margin-left: 0;
}

#view-profile .profile-highlight-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(78, 70, 57, 0.4);
  border: 0.5px solid rgba(78, 70, 57, 0.35);
}

#view-profile .profile-highlight {
  border: 0;
  border-radius: 0;
  background: #1c1b1b;
}

#view-profile .profile-recent-card {
  border-radius: 0;
}

#view-profile .profile-stat span {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

.profile-go-history-btn {
  margin-top: 12px;
  min-height: 42px;
  width: 100%;
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 12px 14px;
  }

  .brand-block {
    text-align: center;
  }

  .brand-block .eyebrow {
    display: none;
  }

  .topnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 2px;
    padding: 10px 10px 20px;
    background: rgba(28, 27, 27, 0.88);
    border-top: 0.5px solid rgba(197, 160, 89, 0.34);
    backdrop-filter: blur(12px);
  }

  .history-empty-title {
    font-size: 20px;
  }

  .empty-state::after {
    font-size: 128px;
    right: 8%;
    bottom: 10px;
  }

  .nav-btn {
    border: 0;
    padding: 8px 4px;
    border-radius: 0;
    flex-direction: column;
    justify-content: center;
    color: rgba(229, 226, 225, 0.58);
    gap: 4px;
  }

  .nav-btn.active {
    transform: scale(1.06);
    background: transparent;
    color: #e9c176;
    border-color: transparent;
  }

  .nav-icon {
    font-size: 20px;
  }

  .nav-label {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .app-shell {
    padding-bottom: 96px;
  }

  #view-profile .profile-highlight-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Result Page Fidelity Pass (_4) ===== */
.result-panel {
  padding: 18px 20px 20px;
}

.result-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.result-top-label {
  margin: 0;
  color: #c5a059;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.24em;
}

.report-context {
  display: grid;
  grid-template-columns: 2px 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.report-context-line {
  background: rgba(197, 160, 89, 0.35);
}

.report-context-main {
  display: grid;
  gap: 8px;
}

.report-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-meta-row .result-tag {
  padding: 7px 10px;
  font-size: 11px;
}

.gua-ritual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.gua-column,
.gua-moving-column {
  background: rgba(32, 32, 31, 0.72);
  border: 0.5px solid rgba(154, 143, 128, 0.3);
  padding: 14px;
  display: grid;
  justify-items: center;
  align-content: start;
}

.gua-column-label {
  margin: 0 0 8px;
  color: #e9c176;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}

.gua-column-title {
  margin: 0 0 12px;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: #e5e2e1;
}

.gua-column-meta {
  margin: 8px 0 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #9a8f80;
}

.gua-column-meta strong {
  color: #d1c5b4;
  font-weight: 600;
}

.gua-moving-column {
  justify-content: center;
  align-content: center;
  text-align: center;
}

.gua-moving-symbol {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid rgba(197, 160, 89, 0.38);
  transform: rotate(45deg);
  margin-bottom: 16px;
}

.gua-moving-symbol .material-symbols-outlined {
  transform: rotate(-45deg);
  color: #e9c176;
  font-size: 28px;
}

.ritual-hexagram {
  width: 104px;
  margin: 0 auto;
}

.ritual-hexagram .hex-line {
  margin: 4px 0;
}

.ritual-hexagram .segments {
  justify-content: center;
}

.ritual-hexagram .segment.solid {
  width: 82px;
}

.ritual-hexagram .segment.broken {
  width: 34px;
}

.ritual-hexagram .segment.gap {
  width: 14px;
}

.report-bento {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 12px;
}

.report-main-card,
.report-side-card {
  padding: 16px;
}

.report-main-card .result-ai-head {
  margin-bottom: 8px;
  align-items: flex-start;
}

.report-main-card .result-ai-head h4 {
  margin: 0;
  color: #e9c176;
  font-family: "Noto Serif SC", serif;
  letter-spacing: 0.08em;
}

.report-side-card h4 {
  margin: 0 0 8px;
}

.result-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.report-main-card .ai-output {
  min-height: 220px;
}

.ai-output .ai-section {
  margin: 0;
  padding: 12px 0;
  border-bottom: 0.5px solid rgba(78, 70, 57, 0.35);
}

.ai-output .ai-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.ai-output .ai-section h5 {
  margin: 0 0 6px;
  color: #e9c176;
}

@media (max-width: 1024px) {
  .gua-ritual-grid {
    grid-template-columns: 1fr;
  }

  .gua-moving-column {
    order: 2;
  }

  .report-bento {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .result-panel {
    padding: 14px;
  }

  .report-context {
    grid-template-columns: 1px 1fr;
    gap: 10px;
  }

  .gua-column,
  .gua-moving-column,
  .report-main-card,
  .report-side-card {
    padding: 12px;
  }

  .gua-column-title {
    font-size: 19px;
  }

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

/* ===== History Page Fidelity Pass (_5) ===== */
#view-history .page-intro {
  margin: 18px 0 16px;
}

#view-history .page-copy {
  color: #9a8f80;
}

.history-toolbar {
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.history-item {
  position: relative;
  padding: 0;
  background: #1c1b1b;
  border: 0.5px solid rgba(78, 70, 57, 0.35);
  border-left: 1px solid rgba(197, 160, 89, 0.32);
  border-radius: 0;
}

.history-item::before {
  display: none;
}

.history-item:hover {
  transform: none;
  border-color: rgba(233, 193, 118, 0.42);
}

.history-item.active {
  border-color: rgba(233, 193, 118, 0.5);
  box-shadow: none;
}

.history-item.selected {
  border-left-color: rgba(255, 127, 115, 0.65);
  box-shadow: none;
}

.history-item-shell {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px 14px 12px;
}

.history-anchor {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
}

.history-mini-gua {
  width: 40px;
  display: grid;
  gap: 6px;
}

.mini-gua-line {
  height: 1px;
  background: rgba(197, 160, 89, 0.55);
}

.mini-gua-line.broken {
  background: transparent;
  display: flex;
  justify-content: space-between;
}

.mini-gua-line.broken span {
  width: 44%;
  height: 1px;
  background: rgba(197, 160, 89, 0.55);
}

.history-anchor-name {
  margin: 0;
  color: #c5a059;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.history-content {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.history-item-top {
  gap: 10px;
}

.history-head-main {
  gap: 8px;
}

.history-question {
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
  line-height: 1.35;
  letter-spacing: 0.04em;
  color: #e5e2e1;
}

.history-item-actions {
  align-items: flex-start;
}

.history-item-actions .history-chip {
  min-height: 28px;
}

.history-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #9a8f80;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-dot {
  width: 3px;
  height: 3px;
  background: rgba(154, 143, 128, 0.7);
}

.history-brief {
  color: #b8aa96;
}

.history-excerpt {
  margin-top: 0;
  color: rgba(229, 226, 225, 0.78);
  line-height: 1.85;
}

.history-numbers {
  margin-top: 0;
  color: #8f8578;
}

.history-item-arrow {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: #e9c176;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.history-item:hover .history-item-arrow {
  opacity: 1;
}

.history-detail {
  margin-top: 8px;
  padding-top: 10px;
}

.history-detail-grid p {
  border-radius: 0;
  border-color: rgba(78, 70, 57, 0.38);
  background: rgba(32, 32, 31, 0.6);
}

@media (max-width: 960px) {
  .history-question {
    font-size: 20px;
  }
}

@media (max-width: 720px) {
  .history-item-shell {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 12px 12px 12px 10px;
    gap: 10px;
  }

  .history-mini-gua {
    width: 32px;
    gap: 5px;
  }

  .history-question {
    font-size: 18px;
  }

  .history-meta-strip {
    font-size: 10px;
  }

  .history-item-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .history-item-arrow {
    display: none;
  }
}

/* ===== History Detail Page (Result Subpage) ===== */
#view-history-detail .page-intro {
  margin: 18px 0 14px;
  position: relative;
  padding-left: 12px;
}

#view-history-detail .page-intro::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: rgba(197, 160, 89, 0.22);
}

.history-detail-back-btn {
  margin-bottom: 12px;
  min-height: 38px;
  padding-inline: 12px;
  border-color: rgba(197, 160, 89, 0.24);
  color: #d1c5b4;
}

.history-detail-question {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1.36;
  letter-spacing: 0.04em;
  color: #e5e2e1;
}

.history-detail-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.history-detail-panel {
  border-radius: 0;
  background: #131313;
  border: 0.5px solid rgba(78, 70, 57, 0.38);
  box-shadow: none;
  padding: 18px;
}

.history-detail-gua-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}

.history-detail-gua,
.history-detail-moving {
  background: #1c1b1b;
  border: 0.5px solid rgba(78, 70, 57, 0.35);
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.history-detail-gua {
  height: 100%;
  min-height: 248px;
  gap: 8px;
}

.history-detail-moving {
  gap: 8px;
  min-height: 156px;
  height: 100%;
}

.history-detail-moving-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0.5px solid rgba(197, 160, 89, 0.32);
  transform: rotate(45deg);
}

.history-detail-moving-icon .material-symbols-outlined {
  transform: rotate(-45deg);
  color: #e9c176;
}

.history-detail-gua-label {
  margin: 0;
  color: #c5a059;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.history-detail-gua-title {
  margin: 4px 0 10px;
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
  color: #e5e2e1;
  letter-spacing: 0.04em;
}

#view-history-detail .hexagram {
  max-width: 148px;
  margin: 0 auto;
}

#view-history-detail .ritual-hexagram {
  width: 132px;
}

#view-history-detail .line-tag {
  display: none;
}

#view-history-detail .ritual-hexagram .hex-line {
  margin: 8px 0;
  gap: 0;
  justify-content: center;
}

#view-history-detail .ritual-hexagram .segments {
  width: 132px;
  margin: 0 auto;
  grid-template-columns: 1fr 14px 1fr;
  gap: 8px;
}

#view-history-detail .ritual-hexagram .segment {
  height: 11px;
  border-radius: 6px;
  background: #e9c176;
  box-shadow: none;
}

#view-history-detail .ritual-hexagram .segment.solid {
  width: auto;
}

#view-history-detail .ritual-hexagram .segment.broken {
  width: auto;
}

#view-history-detail .ritual-hexagram .segment.gap {
  width: auto;
  background: transparent;
}

#view-history-detail .ritual-hexagram .hex-line.active .segment {
  background: #e9c176;
  box-shadow: none;
}

#view-history-detail .ritual-hexagram .hex-line.active .segment.broken {
  background: #e9c176;
}

.history-detail-bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.history-detail-card {
  border-radius: 0;
  border: 0.5px solid rgba(78, 70, 57, 0.35);
  background: #20201f;
  box-shadow: none;
  padding: 16px;
  grid-column: span 6;
}

.history-detail-card-full {
  grid-column: 1 / -1;
  background: #1c1b1b;
}

.history-detail-bento .history-detail-card:nth-child(2) {
  grid-column: span 7;
}

.history-detail-bento .history-detail-card:nth-child(3) {
  grid-column: span 5;
}

.history-detail-card h4 {
  margin: 0 0 10px;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: #e9c176;
}

.history-detail-text {
  margin: 0;
  color: #d1c5b4;
  line-height: 1.85;
}

.history-detail-list {
  margin: 0;
  padding-left: 14px;
  display: grid;
  gap: 8px;
  color: #d1c5b4;
  line-height: 1.7;
}

.detail-actions-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.detail-actions-row .status-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 960px) {
  .history-detail-gua-grid {
    grid-template-columns: 1fr;
  }

  .history-detail-bento,
  .history-detail-card,
  .history-detail-bento .history-detail-card:nth-child(2),
  .history-detail-bento .history-detail-card:nth-child(3) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .history-detail-panel {
    padding: 12px;
  }

  .history-detail-question {
    font-size: 24px;
  }

  .history-detail-meta {
    justify-content: flex-start;
  }

  .detail-actions-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Profile Page Fidelity Pass (_6) ===== */
#view-profile .content-grid {
  max-width: 760px;
}

#view-profile .profile-head {
  margin-bottom: 16px;
}

#view-profile .profile-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 10px;
  font-size: 36px;
  background: #2a2a2a;
}

#view-profile .profile-id-row h3 {
  font-size: 30px;
  letter-spacing: 0.08em;
}

#view-profile .profile-id-row .small-note {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
}

#view-profile .profile-highlight-grid {
  margin-bottom: 14px;
  gap: 1px;
}

#view-profile .profile-highlight {
  padding: 18px 14px;
}

.profile-recent-title {
  margin-bottom: 10px;
}

.profile-recent-meta {
  margin: 0 0 10px;
  color: #9a8f80;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.profile-recent-meta strong {
  color: #d1c5b4;
  font-weight: 500;
}

.profile-meta-split {
  opacity: 0.65;
}

.profile-recent-body {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.profile-recent-gua {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.profile-gua-line {
  height: 1px;
  background: rgba(197, 160, 89, 0.58);
}

.profile-gua-line.broken {
  background: transparent;
  display: flex;
  justify-content: space-between;
}

.profile-gua-line.broken span {
  width: 44%;
  height: 1px;
  background: rgba(197, 160, 89, 0.58);
}

.profile-recent-content {
  display: grid;
  gap: 10px;
}

.profile-recent-question-line {
  padding: 8px 0;
}

.profile-recent-question-line strong {
  color: #e5e2e1;
  font-weight: 500;
}

.profile-recent-pairs {
  display: grid;
  gap: 8px;
}

.profile-recent-pairs p {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(78, 70, 57, 0.35);
}

.profile-recent-pairs p:last-child {
  border-bottom: 0;
}

.profile-recent-pairs span {
  color: #9a8f80;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
}

.profile-recent-pairs strong {
  color: #e9c176;
  font-weight: 600;
}

@media (max-width: 720px) {
  #view-profile .profile-icon {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }

  #view-profile .profile-id-row h3 {
    font-size: 24px;
  }

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

  .profile-recent-gua {
    width: 56px;
    margin: 0 auto 2px;
  }
}

/* ===== Auth Page Fidelity Pass (_1/_2) ===== */
.auth-manuscript {
  background:
    linear-gradient(180deg, rgba(42, 42, 42, 0.6), rgba(28, 27, 27, 0.9)),
    #1c1b1b;
}

.auth-ritual {
  width: 52px;
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.auth-ritual-line {
  height: 2px;
  background: rgba(197, 160, 89, 0.72);
}

.auth-ritual-line.broken {
  background: transparent;
  display: flex;
  justify-content: space-between;
}

.auth-ritual-line.broken span {
  width: 42%;
  height: 2px;
  background: rgba(197, 160, 89, 0.72);
}

.auth-hero-note {
  margin: 6px 0 0;
  color: rgba(154, 143, 128, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
}

#auth-app .auth-panel-head {
  text-align: center;
}

#auth-app .auth-icon {
  margin: 0 auto 16px;
}

#auth-app .wide-btn {
  position: relative;
}

#auth-app .wide-btn::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 4px;
  height: 4px;
  background: rgba(255, 127, 115, 0.95);
}

.auth-divider {
  margin: 16px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 0.5px;
  background: rgba(78, 70, 57, 0.5);
}

.auth-divider span {
  color: rgba(154, 143, 128, 0.72);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.auth-switch-row {
  display: block;
  margin-top: 0;
}

.auth-switch-btn {
  width: 100%;
  min-height: 44px;
  letter-spacing: 0.06em;
}

@media (max-width: 720px) {
  .auth-ritual {
    margin-bottom: 14px;
  }

  .auth-hero-note {
    font-size: 9px;
  }
}

/* ===== Divination Entry Fidelity Pass (_3) ===== */
#view-divination .page-intro {
  text-align: center;
  margin: 18px 0 20px;
}

#view-divination .page-intro .eyebrow {
  margin-bottom: 6px;
}

#view-divination .page-title {
  font-size: clamp(44px, 5.8vw, 62px);
  line-height: 1.16;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

#view-divination .page-copy {
  margin: 0;
  color: #b5c8df;
  font-size: 18px;
  letter-spacing: 0.08em;
  font-weight: 300;
  font-style: italic;
}

.divination-entry-card {
  max-width: 760px;
  margin: 0 auto;
}

.divination-head {
  margin-bottom: 14px;
}

.divination-head h3 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: #e5e2e1;
}

.divination-field-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

#view-divination .field .label {
  margin-top: 4px;
}

#view-divination .field .input {
  border-bottom-color: rgba(78, 70, 57, 0.55);
}

#view-divination .field .input:focus {
  border-bottom-color: #e9c176;
}

#view-divination .textarea {
  min-height: 104px;
}

.divination-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.divination-actions > button {
  width: 100%;
}

@media (max-width: 720px) {
  #view-divination .page-title {
    font-size: 48px;
    letter-spacing: 0.1em;
  }

  #view-divination .page-copy {
    font-size: 16px;
  }

  .divination-head h3 {
    font-size: 24px;
  }
}

/* ===== Divination Desktop Adaptation Hotfix (2026-04-15) ===== */
#view-divination .page-intro,
#view-divination .content-grid.single-column {
  width: min(100%, 860px);
  margin-left: auto;
  margin-right: auto;
}

#view-divination .page-intro {
  margin-top: 18px;
  margin-bottom: 22px;
}

#view-divination .page-copy {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

#view-divination .divination-entry-card {
  width: 100%;
  max-width: none;
}

#view-divination .divination-field-grid {
  gap: 12px;
}

@media (min-width: 961px) {
  #view-divination .divination-entry-card {
    padding: 24px 28px 20px;
  }

  #view-divination .divination-field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  #view-divination .divination-field-grid + .label {
    margin-top: 14px;
  }
}

@media (max-width: 960px) {
  #view-divination .page-intro,
  #view-divination .content-grid.single-column {
    width: 100%;
  }

  #view-divination .divination-entry-card {
    max-width: 760px;
  }
}

/* ===== Mobile Title Bar Hidden ===== */
@media (max-width: 720px) {
  .topbar {
    position: static;
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .topbar-left,
  .topbar-right,
  .topbar .brand-block {
    display: none;
  }

  .view-page {
    margin-top: 10px;
  }
}
