:root {
  --ink: #f3e6c8;
  --muted: #cbb894;
  --amber: #d4a017;
  --amber-2: #f0d48a;
  --wood: #140c08;
  --wood-2: #23160e;
  --paper: #efe0bc;
  --line: rgba(212, 160, 23, 0.38);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font-d: "Cormorant Garamond", "Times New Roman", serif;
  --font-b: "Be Vietnam Pro", "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-b);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    linear-gradient(180deg, #1a1009 0%, #100a07 40%, #0c0805 100%);
  min-height: 100%;
  line-height: 1.65;
}
img { max-width: 100%; display: block; }
a { color: var(--amber-2); text-decoration: none; }
a:hover { color: #fff6d8; }
h1, h2, h3, .brand strong, .cta-seal, .speech-name {
  font-family: var(--font-d);
  font-weight: 600;
  letter-spacing: 0.02em;
}
h1 { font-size: clamp(1.8rem, 6vw, 3rem); line-height: 1.15; margin: 0 0 0.6rem; }
h2 { font-size: clamp(1.3rem, 4vw, 2rem); }
.skip-link {
  position: absolute; left: -999px; top: 0;
}
.skip-link:focus { left: 12px; top: 12px; background: #000; color: #fff; padding: 8px 12px; z-index: 20; }

.site-header {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-t);
  background: linear-gradient(180deg, rgba(12,8,5,.92), rgba(12,8,5,.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-shell {
  display: flex; align-items: center; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .12em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; }
.brand-mark {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; color: var(--amber);
}
.nav-toggle, .icon-btn {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; min-height: 40px; min-width: 40px; padding: 0 12px; cursor: pointer;
}
.site-nav {
  display: none; flex-direction: column; gap: 8px;
  position: absolute; left: 0; right: 0; top: 100%;
  background: #160e09; padding: 12px 16px 16px; border-bottom: 1px solid var(--line);
}
.site-nav.is-open { display: flex; }
.nav-link { color: var(--ink); padding: 8px 0; }
.nav-link.is-active { color: var(--amber-2); }
.nav-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.nav-account {
  color: var(--ink);
  font-size: .9rem;
  padding: 8px 6px;
  white-space: nowrap;
}
.nav-account:hover { color: var(--amber-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  font-weight: 600; cursor: pointer; font-family: var(--font-b);
}
.btn-gold {
  background: linear-gradient(180deg, #e8c96a, #b8892a);
  color: #2a1b0a; border-color: #f0d48a;
}
.btn-ghost { background: transparent; color: var(--ink); }
.cta-seal {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: linear-gradient(180deg, #f0d48a, #c4962e);
  color: #2a1b0a; box-shadow: var(--shadow); font-size: 1.15rem;
}

.hero { position: relative; }
.hero-scene { position: relative; min-height: 72svh; overflow: hidden; }
.hero-photo { width: 100%; height: 72svh; object-fit: cover; object-position: center 20%; }
.smoke-layer {
  position: absolute; left: 8%; bottom: 18%; width: min(42vw, 220px); height: min(50vh, 280px);
  pointer-events: none; z-index: 2; mix-blend-mode: screen; opacity: .55;
}
.verse {
  position: absolute; top: 18%; color: #f7ecd0; font-family: var(--font-d);
  font-size: clamp(1.1rem, 3.4vw, 1.7rem); line-height: 1.45; text-shadow: 0 2px 10px #000;
  writing-mode: vertical-rl; letter-spacing: .18em;
}
.verse-left { left: 4%; }
.verse-right { right: 4%; }
.speech {
  position: absolute; right: 4%; top: 14%;
  max-width: min(78%, 340px); background: rgba(247, 232, 196, .92);
  color: #3a2a16; padding: 14px 16px; border-radius: 4px 18px 18px 18px;
  box-shadow: var(--shadow);
}
.speech-name { margin: 0 0 6px; color: #8a5a12; font-size: 1.05rem; }
.speech p { margin: 0; }
.hero .cta-seal { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; }
.trust-row {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  list-style: none; margin: 0; padding: 16px;
}
.trust-row li {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; color: var(--muted); font-size: .9rem;
}

.phones-wrap, .cards-4, .split-dark, .page-narrow, .page-wide, .consult, .result {
  width: min(1120px, calc(100% - 28px)); margin: 28px auto;
}
.phone-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 78%;
  gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px;
}
.device {
  scroll-snap-align: start; background: #1b120c; border: 1px solid var(--line);
  border-radius: 28px; padding: 18px 16px 22px; min-height: 360px;
  box-shadow: var(--shadow);
}
.device img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; margin: 8px 0; }
.mini-date, .mini-wheel, .mini-chart, .mini-gender {
  margin: 18px auto; text-align: center; font-family: var(--font-d); font-size: 1.6rem; color: var(--amber-2);
}
.mini-gender { display: flex; gap: 8px; justify-content: center; font-size: 1rem; }
.mini-gender span { border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; }
.step-legend { padding-left: 18px; color: var(--muted); }
.step-legend strong { color: var(--ink); display: block; }

.cards-4 { display: grid; gap: 14px; }
.story-card {
  display: block; color: var(--ink); background: #1a110c;
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.story-card img { height: 150px; width: 100%; object-fit: cover; }
.story-card h2, .story-card p { margin: 0; padding: 0 14px; }
.story-card h2 { padding-top: 12px; font-size: 1.35rem; }
.story-card p { padding-bottom: 16px; color: var(--muted); }

.split-dark { display: grid; gap: 28px; }
.article-list { list-style: none; padding: 0; }
.article-list a, .article-card {
  display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink);
}
.article-list span, .article-card p { display: block; color: var(--muted); }
.faq { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }

.site-footer {
  margin-top: 48px; border-top: 1px solid var(--line);
  padding: 28px 16px calc(28px + var(--safe-b)); background: #100a07;
}
.footer-grid { width: min(1120px, 100%); margin: 0 auto; display: grid; gap: 18px; }
.footer-grid a, .footer-grid p { display: block; color: var(--muted); }
.foot-title, .brand-foot { color: var(--amber-2); font-family: var(--font-d); font-size: 1.2rem; }
.copy { text-align: center; color: #8a7a60; }

.consult { display: grid; gap: 18px; }
.consult-master { position: relative; }
.consult-master img { width: 100%; max-height: 280px; object-fit: cover; object-position: 50% 18%; border-radius: 18px; }
.consult-master .speech { position: static; max-width: none; margin-top: -8px; }
.consult-panel, .auth-card, .admin-card, .paper {
  background: linear-gradient(180deg, #2a1d13, #1b120c);
  border: 1px solid var(--line); border-radius: 18px; padding: 18px;
}
.progress { color: var(--amber-2); letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
label, legend { display: block; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f0a07; color: var(--ink); padding: 8px 12px; font: inherit;
}
textarea { min-height: 120px; }
.date-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.seg { display: flex; gap: 10px; flex-wrap: wrap; border: 0; padding: 0; }
.seg label, .check { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.seg input, .check input, .hour-chip input { width: auto; min-height: 20px; }
.hour-wheel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hour-chip span {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  text-align: center;
}
.hour-chip input { position: absolute; opacity: 0; }
.hour-chip input:focus + span, .hour-chip input:checked + span {
  border-color: var(--amber); background: rgba(212,160,23,.12);
}
.hour-chip { position: relative; }
.hour-chip small { display: block; color: var(--muted); font-size: .75rem; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.form-error { color: #e7a08a; }
.form-ok { color: #b7d7a8; }
.hint, .disclaimer, .meta, .muted { color: var(--muted); }
.disclaimer {
  border-left: 3px solid var(--amber); padding: 8px 12px; background: rgba(212,160,23,.08);
}
.summary { line-height: 1.8; }
.badge {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--amber-2);
}

.chart-board { display: none; }
.palace-list { display: grid; gap: 10px; }
.palace-row, .palace {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #1a110c;
}
.palace-row h2, .palace h2 { margin: 0 0 6px; font-size: 1.15rem; }
.star-major { color: #f0d48a; }
.star-lucky { color: #d7e7b0; }
.star-sha { color: #e2b3a4; }
.pkg-grid, .article-grid { display: grid; gap: 14px; }
.pkg-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #1a110c; }
.price { font-family: var(--font-d); font-size: 1.8rem; color: var(--amber-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.prose p { margin: 0 0 1rem; }
.crumbs { color: var(--muted); font-size: .9rem; }
.plain-list { padding-left: 18px; }
.text-link { color: var(--amber-2); }

.audio-dock {
  position: fixed; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 20;
  display: flex; gap: 8px; align-items: center;
  background: rgba(16,10,7,.92); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
}
.audio-toggle { background: none; border: 0; color: var(--ink); cursor: pointer; font: inherit; }
.audio-toggle:disabled { color: var(--muted); cursor: not-allowed; }
.admin-body { display: grid; grid-template-columns: 1fr; }
.admin-side {
  display: flex; gap: 10px; overflow-x: auto; padding: 12px; border-bottom: 1px solid var(--line);
}
.admin-main { padding: 16px; }
.admin-stack { display: grid; gap: 16px; }
.admin-card legend { font-family: var(--font-d); color: var(--amber-2); font-size: 1.2rem; padding: 0 6px; }
.admin-card small { display: block; color: var(--muted); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table td, .table th { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; list-style: none; padding: 0; }
.stat-grid li { border: 1px solid var(--line); padding: 12px; border-radius: 12px; }
.log-box { overflow: auto; max-height: 240px; font-size: .8rem; background: #000; padding: 10px; }

@media (min-width: 800px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; flex-direction: row; position: static; background: none; border: 0; padding: 0; gap: 16px; }
  .hero-scene, .hero-photo { min-height: 78vh; height: 78vh; }
  .speech { right: 8%; top: 18%; }
  .hero .cta-seal { bottom: 36px; }
  .phone-rail { grid-auto-columns: 1fr; overflow: visible; }
  .cards-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .split-dark, .footer-grid, .pkg-grid, .article-grid { grid-template-columns: 1fr 1fr; }
  .consult { grid-template-columns: 0.9fr 1.1fr; align-items: start; }
  .consult-master img { max-height: 420px; }
  .footer-grid { grid-template-columns: 1.3fr 1fr 1fr 1.3fr; }
  .hour-wheel { grid-template-columns: repeat(4, 1fr); }
  .chart-board {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0;
  }
  .chart-board .palace-core { grid-column: 2 / 4; grid-row: 2 / 4; display: grid; place-items: center; text-align: center; }
  .chart-board .palace-void { display: none; }
  .palace-list { display: none; }
  .admin-body { grid-template-columns: 220px 1fr; }
  .admin-side { flex-direction: column; border-right: 1px solid var(--line); border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .smoke-layer { display: none; }
}

body.theme-dawn {
  --ink: #2b1c10; --muted: #6b5438; --wood: #f6ead0;
  background: #f3e6c8; color: #2b1c10;
}
body.theme-dawn .site-header, body.theme-dawn .site-footer, body.theme-dawn .consult-panel,
body.theme-dawn .device, body.theme-dawn .story-card, body.theme-dawn .pkg-card {
  background: #efe0bc; color: #2b1c10;
}
body.theme-dawn input, body.theme-dawn select, body.theme-dawn textarea { background: #fff8e8; color: #2b1c10; }
