/* Page styles for oracle.html (I Ching oracle).
   Loaded before the shared layers (tokens.css … responsive.css), where the
   inline <style> used to be, so the cascade order is unchanged. */

* {
  box-sizing: border-box;
}
html {
  color-scheme: light;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--qice-ink);
  background: radial-gradient(
      circle at 8% 0,
      rgba(11, 107, 92, 0.12),
      transparent 28rem
    ),
    radial-gradient(
      circle at 96% 32%,
      rgba(180, 130, 45, 0.1),
      transparent 25rem
    ),
    linear-gradient(180deg, #fbfaf7 0, var(--qice-bg) 62%, #f2f2ed 100%);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei",
    system-ui, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}

.shell {
  width: min(
    var(--qice-shell-max),
    calc(100% - (var(--qice-page-gutter) * 2))
  );
  margin: 0 auto;
  padding: var(--qice-header-top) 0 64px;
}

.topbar {
  display: grid;
  min-height: 95px;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid rgba(217, 221, 216, 0.88);
  border-radius: var(--qice-radius-md);
  background: rgba(255, 255, 255, 0.91);
  box-shadow: var(--qice-shadow-sm);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  justify-self: start;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(11, 107, 92, 0.18);
  border-radius: 15px;
  background: #f7f4ea;
  box-shadow: 0 7px 18px rgba(31, 107, 91, 0.16);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.16);
}

.brand-name {
  display: block;
  font-family: "Songti TC", "Noto Serif TC", serif;
  color: #173a32;
  font-size: clamp(22px, 3vw, 31px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-tagline {
  display: block;
  margin-top: 3px;
  color: var(--qice-muted);
  font-size: 13px;
}

.nav {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-self: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid #d7e2dd;
  border-radius: 999px;
  background: #f7faf8;
}
.nav a {
  display: inline-flex;
  min-width: 142px;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 999px;
  color: var(--qice-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}
.nav a:hover {
  color: var(--qice-brand-dark);
  background: var(--qice-brand-soft);
}
.nav a[aria-current="page"] {
  color: #fff;
  background: var(--qice-brand);
}
.member-link {
  display: inline-flex;
  min-height: 42px;
  grid-column: 3;
  align-items: center;
  justify-content: center;
  justify-self: end;
  padding: 9px 16px;
  border: 1px solid #b9d8ce;
  border-radius: 13px;
  color: var(--qice-brand);
  background: #fff;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}
.member-link:hover,
.member-link:focus-visible {
  border-color: var(--qice-brand);
  outline: none;
}

main {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.hero {
  display: flex;
  min-height: 220px;
  align-items: end;
  margin-bottom: 26px;
  padding: 34px 42px 38px;
  border: 1px solid rgba(116, 128, 119, 0.24);
  border-radius: 24px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.88),
    rgba(231, 241, 236, 0.72)
  );
  box-shadow: var(--qice-shadow-sm);
}
.hero-copy {
  min-width: 0;
  width: min(860px, 100%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--qice-brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.eyebrow::before {
  width: 24px;
  height: 1px;
  background: currentColor;
  content: "";
}

h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-family: "Songti TC", "Noto Serif TC", serif;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: 0.025em;
  white-space: nowrap;
}
.hero-description {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--qice-muted);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.8;
  white-space: normal;
}

.experience {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 328px;
  overflow: hidden;
  border: 1px solid rgba(116, 128, 119, 0.3);
  border-radius: 28px;
  background: var(--qice-surface);
  box-shadow: var(--qice-shadow-md);
}

.workspace {
  min-width: 0;
  padding: clamp(26px, 4vw, 48px);
}
.guide {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px 30px;
  color: #eaf5f1;
  background: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.08),
      transparent 44%
    ),
    var(--qice-brand-dark);
}
.guide h2 {
  margin-bottom: 12px;
  color: #fff;
  font-family: "Songti TC", serif;
  font-size: 23px;
}
.guide p {
  color: rgba(234, 245, 241, 0.76);
  font-size: 14px;
  line-height: 1.7;
}
.guide-rule {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.guide small {
  display: block;
  color: rgba(234, 245, 241, 0.62);
  line-height: 1.7;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 38px;
  padding: 0;
  list-style: none;
  counter-reset: oracle-step;
}
.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: #8a908b;
  background: #f4f3ee;
  font-size: 12px;
  font-weight: 700;
  counter-increment: oracle-step;
}
.steps li::before {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #cfd2cb;
  border-radius: 50%;
  font-size: 11px;
  content: counter(oracle-step);
}
.steps li[data-state="active"] {
  color: var(--qice-brand-dark);
  background: var(--qice-brand-soft);
}
.steps li[data-state="active"]::before {
  border-color: var(--qice-brand);
  color: #fff;
  background: var(--qice-brand);
}

.section-heading {
  margin-bottom: 22px;
}
.section-heading span {
  color: var(--qice-brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
}
.section-heading h2 {
  margin: 7px 0 8px;
  font-family: "Songti TC", serif;
  font-size: clamp(24px, 4vw, 34px);
}
.section-heading p {
  margin-bottom: 0;
  color: var(--qice-muted);
  line-height: 1.65;
}

.choice-grid {
  display: grid;
  gap: 12px;
}
.oracle-category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.oracle-question-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.oracle-choice {
  min-height: 98px;
  padding: 18px 20px;
  border: 1px solid var(--qice-line);
  border-radius: 16px;
  color: var(--qice-ink);
  background: #fffefb;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s,
    background 0.14s;
}
.oracle-choice:hover,
.oracle-choice:focus-visible {
  border-color: var(--qice-brand);
  outline: 0;
  background: #f8fcfa;
  box-shadow: 0 0 0 3px rgba(11, 107, 92, 0.11);
  transform: translateY(-1px);
}
.oracle-choice strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Songti TC", serif;
  font-size: 20px;
}
.oracle-choice span {
  color: var(--qice-muted);
  font-size: 12px;
}
.oracle-category {
  display: flex;
  min-height: 108px;
  flex-direction: column;
  justify-content: center;
  padding: 15px;
}
.oracle-category strong {
  font-size: 18px;
}
.oracle-category span {
  line-height: 1.5;
}
.oracle-question {
  min-height: 70px;
  font-weight: 650;
  line-height: 1.55;
}

.back-button {
  margin-top: 18px;
  padding: 8px 0;
  border: 0;
  color: var(--qice-brand);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.cast-panel {
  padding: 28px;
  border: 1px solid rgba(180, 130, 45, 0.28);
  border-radius: 20px;
  text-align: center;
  background: linear-gradient(145deg, #fffdf7, var(--qice-premium-soft));
}
.cast-symbol {
  display: block;
  margin-bottom: 10px;
  color: var(--qice-premium);
  font-family: serif;
  font-size: 42px;
}
.cast-panel h2 {
  font-family: "Songti TC", serif;
  font-size: 27px;
}
.selected-question {
  max-width: 580px;
  margin: 0 auto 24px;
  color: #5f584b;
  line-height: 1.7;
}
.primary-button,
.primary-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border: 1px solid var(--qice-brand);
  border-radius: 12px;
  color: #fff;
  background: var(--qice-brand);
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(11, 107, 92, 0.2);
}
.primary-button:hover,
.primary-link:hover {
  border-color: var(--qice-brand-dark);
  background: var(--qice-brand-dark);
}
.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}
.primary-link[aria-disabled="true"] {
  border-color: var(--qice-line);
  color: var(--qice-muted);
  background: #f0f1ed;
  box-shadow: none;
  cursor: not-allowed;
}

.status {
  min-height: 24px;
  margin: 22px 0 0;
  color: var(--qice-muted);
  font-size: 13px;
  line-height: 1.6;
}
.status[data-kind="error"] {
  color: var(--qice-danger);
}
.status[data-kind="success"] {
  color: var(--qice-brand);
}

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.result-meta {
  margin-bottom: 7px;
  color: var(--qice-muted);
  font-size: 13px;
}
.result-header h2 {
  margin-bottom: 8px;
  font-family: "Songti TC", serif;
  font-size: clamp(26px, 4vw, 38px);
}
.result-question {
  margin-bottom: 0;
  color: var(--qice-muted);
  line-height: 1.65;
}
.tone-badge {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  color: #785816;
  background: var(--qice-premium-soft);
  font-size: 13px;
  font-weight: 800;
}

.hexagram-result {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--qice-line);
  border-radius: 18px;
  background: #fbfbf7;
  text-align: center;
}
.hexagram-result strong,
.hexagram-result > span:not(.arrow) {
  font-family: "Songti TC", serif;
  font-size: clamp(21px, 4vw, 29px);
}
.arrow {
  color: var(--qice-premium);
  font-size: 26px;
}
.reading-note {
  margin: 16px 0 0;
  color: var(--qice-muted);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
}

.public-answer-card {
  margin-top: 22px;
  padding: 20px 22px;
  border: 1px solid rgba(11, 107, 92, 0.2);
  border-radius: 17px;
  background: #f9fcfa;
}
.public-answer-card h3 {
  margin-bottom: 9px;
  font-family: "Songti TC", serif;
  font-size: 21px;
}
.public-answer-card p {
  margin: 0;
  color: #49564f;
  line-height: 1.8;
}
.classical-text {
  margin-top: 13px !important;
  padding-top: 12px;
  border-top: 1px solid var(--qice-line);
  color: var(--qice-muted) !important;
  font-size: 13px;
}

.result-detail {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  margin-top: 26px;
}
.line-diagram {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 15px;
  background: var(--qice-brand-soft);
}
.hexagram-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--qice-brand-dark);
}
.hexagram-line-glyph {
  font-family: monospace;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
.hexagram-line-label {
  color: var(--qice-muted);
  font-size: 10px;
}
.hexagram-line[data-moving="true"] .hexagram-line-glyph {
  color: var(--qice-premium);
}

.interpretation-card,
.locked-card {
  padding: 23px;
  border: 1px solid rgba(11, 107, 92, 0.2);
  border-radius: 17px;
  background: #f9fcfa;
}
.interpretation-card h3,
.locked-card h3 {
  margin-bottom: 10px;
  font-family: "Songti TC", serif;
  font-size: 21px;
}
.interpretation-card p {
  color: #49564f;
  line-height: 1.8;
}
.action-box {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--qice-premium);
  background: var(--qice-premium-soft);
}
.action-box strong {
  display: block;
  margin-bottom: 5px;
  color: #745716;
  font-size: 12px;
}
.action-box p {
  margin: 0;
  color: #4b4436;
}
.locked-card p {
  color: var(--qice-muted);
  line-height: 1.7;
}

.next-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--qice-line);
}
.next-step p {
  margin: 0;
  color: var(--qice-muted);
  font-size: 14px;
  line-height: 1.6;
}
.next-step-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--qice-brand-dark);
  font-family: "Songti TC", serif;
  font-size: 19px;
}
.next-step-copy span {
  display: block;
  color: var(--qice-muted);
  font-size: 13px;
  line-height: 1.6;
}
.oracle-handoff-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--qice-premium);
  color: #5b513b;
  background: var(--qice-premium-soft);
  font-size: 12px;
  line-height: 1.65;
}
.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.next-step-actions .primary-link,
.next-step-actions .secondary-button {
  margin: 0;
  min-height: 44px;
}
.next-step-actions .secondary-button {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  text-decoration: none;
}
.secondary-button {
  margin-top: 12px;
  padding: 9px 15px;
  border: 1px solid var(--qice-brand);
  border-radius: 10px;
  color: var(--qice-brand);
  background: #fff;
  cursor: pointer;
  font-weight: 750;
}
.secondary-button:hover {
  background: var(--qice-brand-soft);
}

.footnote {
  max-width: 760px;
  margin: 20px auto 0;
  color: #777d78;
  font-size: 12px;
  line-height: 1.75;
  text-align: center;
}

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

@media (max-width: 1040px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .nav {
    width: 100%;
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .nav a {
    flex: 1 1 0;
  }
  .member-link {
    grid-column: 2;
    grid-row: 1;
  }
  .hero-description {
    white-space: normal;
  }
}

@media (max-width: 880px) {
  h1 {
    white-space: normal;
  }
  .experience {
    grid-template-columns: 1fr;
  }
  .guide {
    order: 1;
    padding: 22px 24px;
  }
  .guide-rule,
  .guide small {
    display: none;
  }
  .guide p {
    margin-bottom: 0;
  }
  .hero {
    min-height: 0;
    padding: 28px 30px 30px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 14px, var(--qice-shell-max));
    padding-top: var(--qice-header-top);
  }
  .topbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 11px 12px;
    border-radius: 13px;
  }
  .brand {
    gap: 9px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
  .brand-name {
    font-size: 20px;
  }
  .nav {
    gap: 2px;
    padding: 3px;
  }
  .nav a {
    min-width: 0;
    min-height: 38px;
    padding: 8px 7px;
    font-size: 11px;
  }
  .member-link {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 12px;
  }
  .brand-tagline {
    display: none;
  }
  .hero {
    margin-bottom: 22px;
    padding: 24px 20px 26px;
  }
  h1 {
    font-size: 42px;
  }
  .workspace {
    padding: 22px 17px 28px;
  }
  .steps {
    gap: 5px;
    margin-bottom: 27px;
  }
  .steps li {
    justify-content: center;
    padding: 7px 5px;
    font-size: 10px;
  }
  .steps li::before {
    width: 20px;
    height: 20px;
  }
  .oracle-category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .oracle-question-grid {
    grid-template-columns: 1fr;
  }
  .result-header {
    display: block;
  }
  .tone-badge {
    display: inline-block;
    margin-bottom: 12px;
  }
  .hexagram-result {
    gap: 8px;
    padding: 18px 10px;
  }
  .hexagram-result strong,
  .hexagram-result > span:not(.arrow) {
    font-size: 20px;
  }
  .result-detail {
    grid-template-columns: 1fr;
  }
  .line-diagram {
    width: min(220px, 100%);
    margin: 0 auto;
  }
  .next-step {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .next-step-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .next-step-actions .primary-link,
  .next-step-actions .secondary-button {
    width: 100%;
  }
}

@media (max-width: 359px) {
  html {
    overflow-x: hidden;
  }
  body {
    min-width: 0;
  }
  .oracle-category-grid {
    grid-template-columns: 1fr;
  }
}

