:root {
  color-scheme: light;
  --paper: #f4f2ec;
  --paper-strong: #fbfaf6;
  --ink: #182721;
  --muted: #647069;
  --line: #d9d3c6;
  --night: #071713;
  --night-soft: #10251f;
  --green: #20382f;
  --green-soft: #e5eee7;
  --red: #9d3f34;
  --gold: #ad7c27;
  --gold-light: #f0c66d;
  --blue: #3d566f;
  --shadow: 0 18px 50px rgba(31, 42, 38, 0.12);
  --night-shadow: 0 28px 80px rgba(7, 23, 19, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(7, 23, 19, 0.95) 0, rgba(7, 23, 19, 0.82) 360px, transparent 361px),
    linear-gradient(90deg, rgba(32, 56, 47, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(32, 56, 47, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 32px 32px, 32px 32px, auto;
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body[data-view="home"] {
  overflow-x: hidden;
  background: #031916;
}

body[data-view="app"] {
  height: 100vh;
  height: 100svh;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(240, 198, 109, 0.12) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 26%, rgba(216, 238, 229, 0.16) 0 1px, transparent 1.5px),
    radial-gradient(circle at 34% 72%, rgba(240, 198, 109, 0.1) 0 1px, transparent 1.5px),
    linear-gradient(115deg, rgba(240, 198, 109, 0.05) 0 1px, transparent 1px 28%),
    linear-gradient(245deg, rgba(127, 176, 163, 0.07) 0 1px, transparent 1px 31%),
    linear-gradient(180deg, #020807 0%, #06221e 42%, #010303 100%);
  background-size: 180px 180px, 240px 240px, 210px 210px, auto, auto, auto;
}

body[data-view="app"][data-section="daily"],
body[data-view="app"][data-section="profiles"] {
  height: auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
}

body[data-view="app"]::before {
  content: "紫微        天机        太阳        太阴        乾        坤        命宫        卦";
  position: fixed;
  inset: 116px 0 auto;
  z-index: 0;
  pointer-events: none;
  color: rgba(240, 198, 109, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 7vw, 112px);
  font-weight: 900;
  line-height: 1.8;
  white-space: pre-wrap;
  text-align: center;
  transform: translateY(0);
  animation: app-glyph-drift 18s ease-in-out infinite alternate;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.shell {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1080px, calc(100vw - 32px));
  min-height: 74px;
  padding: 14px 18px;
  border: 1px solid rgba(240, 198, 109, 0.22);
  border-radius: 8px;
  background: rgba(6, 23, 19, 0.62);
  box-shadow: var(--night-shadow);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

body[data-view="app"] .topbar {
  position: sticky;
  top: 0;
  left: auto;
  width: min(1080px, 100vw);
  margin: 0 auto;
  border-radius: 0 0 8px 8px;
  transform: none;
}

.brand-lockup {
  display: grid;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-title {
  color: #fffaf0;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.12;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(240, 198, 109, 0.16);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.07);
}

.nav-link {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 250, 240, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.nav-link:hover,
.brand-lockup:hover .brand-title {
  color: var(--gold-light);
}

.nav-link.is-active {
  background: rgba(240, 198, 109, 0.16);
  color: var(--gold-light);
  box-shadow: inset 0 0 0 1px rgba(240, 198, 109, 0.18);
}

.language-control {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: rgba(255, 250, 240, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.language-control select {
  width: auto;
  min-width: 122px;
  min-height: 34px;
  border-color: rgba(240, 198, 109, 0.2);
  background: rgba(255, 253, 248, 0.94);
}

.kicker,
.section-kicker {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar .kicker {
  color: var(--gold-light);
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 240px;
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid rgba(240, 198, 109, 0.18);
  border-radius: 999px;
  background: rgba(229, 238, 231, 0.12);
  color: #e9f0ea;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill.is-error {
  background: rgba(157, 63, 52, 0.2);
  color: #ffd8ce;
}

.account-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(240, 198, 109, 0.24);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.08);
  color: #fff8da;
  font-size: 13px;
  font-weight: 800;
}

.account-button.is-account {
  background: rgba(240, 198, 109, 0.18);
  color: var(--gold-light);
}

.home-view {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(115deg, rgba(240, 198, 109, 0.06) 0 1px, transparent 1px 26%),
    linear-gradient(245deg, rgba(127, 176, 163, 0.08) 0 1px, transparent 1px 30%),
    #020807;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 28%, rgba(240, 198, 109, 0.14), transparent 34%),
    rgba(1, 3, 3, 0.68);
  backdrop-filter: blur(10px);
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid rgba(240, 198, 109, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(244, 242, 236, 0.92)),
    linear-gradient(135deg, rgba(240, 198, 109, 0.08), transparent 42%);
  box-shadow: 0 26px 80px rgba(1, 3, 3, 0.4);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(32, 56, 47, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--green);
  font-size: 22px;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid rgba(240, 198, 109, 0.26);
  border-radius: 8px;
  background: rgba(3, 25, 22, 0.08);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.is-active {
  background: linear-gradient(135deg, #052f2a, #0b5146);
  color: #fff8da;
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.is-active {
  display: grid;
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-logout {
  margin-top: 14px;
}

.home-view canvas,
.home-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.home-vignette {
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 8, 7, 0.5) 0%, rgba(2, 8, 7, 0.12) 38%, rgba(2, 8, 7, 0.82) 100%),
    linear-gradient(90deg, rgba(1, 3, 3, 0.58), rgba(3, 25, 22, 0) 32%, rgba(3, 25, 22, 0.12) 68%, rgba(1, 3, 3, 0.62));
}

.home-content {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 130px 22px 180px;
  text-align: center;
}

.home-copy {
  max-width: 780px;
}

.home-copy .home-eyebrow {
  margin: 0 0 12px;
  color: rgba(240, 198, 109, 0.78);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.home-copy h1 {
  max-width: 820px;
  color: #dfb84c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(68px, 9vw, 132px);
  font-weight: 900;
  line-height: 0.98;
  text-shadow:
    0 1px 0 rgba(255, 246, 193, 0.3),
    0 0 34px rgba(223, 184, 76, 0.2),
    0 20px 62px rgba(1, 3, 3, 0.58);
}

.home-copy p {
  max-width: 620px;
  margin: 22px auto 0;
  color: rgba(226, 239, 231, 0.86);
  font-size: 17px;
  line-height: 1.9;
  text-shadow: 0 10px 32px rgba(0, 0, 0, 0.3);
}

.home-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.home-action {
  min-width: 158px;
  min-height: 48px;
  padding: 0 20px;
}

.home-actions .primary-action {
  background: #fff8da;
  color: #06362f;
  box-shadow: 0 14px 36px rgba(5, 39, 35, 0.28);
}

.home-actions .secondary-action {
  border-color: rgba(255, 250, 240, 0.26);
  background: rgba(255, 250, 240, 0.08);
  color: #fffaf0;
}

.home-oracle {
  display: none;
}

.oracle-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(240, 198, 109, 0.34);
  border-radius: 999px;
  animation: oracle-spin 34s linear infinite;
}

.oracle-ring::before,
.oracle-ring::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(233, 240, 234, 0.16);
  border-radius: 999px;
}

.oracle-ring::after {
  inset: 27%;
  border-style: dashed;
}

.oracle-ring span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(240, 198, 109, 0.28);
  border-radius: 999px;
  background: rgba(7, 23, 19, 0.72);
  color: var(--gold-light);
  font-weight: 900;
}

.oracle-ring span:nth-child(1) {
  left: calc(50% - 19px);
  top: -19px;
}

.oracle-ring span:nth-child(2) {
  right: 11%;
  top: 11%;
}

.oracle-ring span:nth-child(3) {
  right: -19px;
  top: calc(50% - 19px);
}

.oracle-ring span:nth-child(4) {
  right: 11%;
  bottom: 11%;
}

.oracle-ring span:nth-child(5) {
  left: calc(50% - 19px);
  bottom: -19px;
}

.oracle-ring span:nth-child(6) {
  left: 11%;
  bottom: 11%;
}

.oracle-ring span:nth-child(7) {
  left: -19px;
  top: calc(50% - 19px);
}

.oracle-ring span:nth-child(8) {
  left: 11%;
  top: 11%;
}

.oracle-lines {
  position: absolute;
  inset: 29%;
  display: grid;
  align-content: center;
  gap: 13px;
}

.oracle-lines i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: #fffaf0;
  box-shadow: 0 0 18px rgba(240, 198, 109, 0.28);
  animation: oracle-line 2.8s ease-in-out infinite;
}

.oracle-lines i:nth-child(even) {
  background: linear-gradient(90deg, #fffaf0 0 42%, transparent 42% 58%, #fffaf0 58%);
}

.oracle-lines i:nth-child(2) {
  animation-delay: 0.12s;
}

.oracle-lines i:nth-child(3) {
  animation-delay: 0.24s;
}

.oracle-lines i:nth-child(4) {
  animation-delay: 0.36s;
}

.oracle-lines i:nth-child(5) {
  animation-delay: 0.48s;
}

.oracle-lines i:nth-child(6) {
  animation-delay: 0.6s;
}

.home-paths {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(980px, calc(100vw - 36px));
  padding: 0;
  transform: translateX(-50%);
}

.path-tile {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(240, 198, 109, 0.18);
  border-radius: 8px;
  background: rgba(2, 8, 7, 0.48);
  color: #fffaf0;
  text-align: left;
  backdrop-filter: blur(14px);
}

button.path-tile:hover {
  border-color: rgba(240, 198, 109, 0.48);
  background: rgba(255, 250, 240, 0.13);
}

.path-tile span {
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 900;
}

.path-tile strong {
  font-size: 19px;
  line-height: 1.25;
}

.path-tile small {
  color: rgba(255, 250, 240, 0.72);
  font-size: 13px;
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: start;
  align-content: start;
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100vw - 32px));
  height: calc(100vh - 90px);
  height: calc(100svh - 90px);
  margin: 14px auto 16px;
  overflow: auto;
  scroll-margin-top: 110px;
}

body[data-view="app"] .workspace {
  margin-top: 0;
  padding-top: 92px;
  height: calc(100vh - 16px);
  height: calc(100svh - 16px);
}

.profile-page,
.daily-page {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100vw - 32px));
  height: calc(100vh - 16px);
  height: calc(100svh - 16px);
  margin: 0 auto 16px;
  padding-top: 92px;
  padding-bottom: 34px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-view="app"][data-section="daily"] .daily-page,
body[data-view="app"][data-section="profiles"] .profile-page {
  height: auto;
  min-height: 100vh;
  min-height: 100svh;
  overflow: visible;
  overscroll-behavior: auto;
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-height: calc(100% - 16px);
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(360px, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
  min-height: calc(100% - 16px);
}

.panel,
.chart-area {
  border: 1px solid rgba(32, 56, 47, 0.18);
  border-radius: 8px;
  background: rgba(251, 250, 246, 0.93);
  box-shadow: var(--shadow);
}

.input-panel,
.report-panel,
.chart-area {
  max-height: 100%;
  overflow: auto;
}

body[data-view="app"] .panel,
body[data-view="app"] .chart-area {
  border-color: rgba(240, 198, 109, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(244, 242, 236, 0.92)),
    linear-gradient(135deg, rgba(240, 198, 109, 0.08), transparent 42%);
  box-shadow:
    0 24px 70px rgba(1, 3, 3, 0.32),
    0 0 0 1px rgba(216, 238, 229, 0.08) inset;
  backdrop-filter: blur(16px);
}

.panel {
  padding: 18px;
}

.panel-heading,
.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

body[data-view="app"] .panel-heading h2,
body[data-view="app"] .chart-header h2 {
  background: linear-gradient(90deg, var(--green) 0%, #b98122 42%, var(--green) 100%);
  background-size: 220% 100%;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 24px rgba(240, 198, 109, 0.16);
  animation: title-star-sheen 5.8s ease-in-out infinite;
}

body[data-view="app"] .section-kicker::before {
  content: "✦";
  margin-right: 6px;
  color: rgba(240, 198, 109, 0.76);
  animation: title-pulse 2.6s ease-in-out infinite;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

body[data-view="app"] .mode-switch {
  border-color: rgba(240, 198, 109, 0.26);
  background: rgba(3, 25, 22, 0.08);
}

.mode-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-button.is-active {
  background: var(--green);
  color: #fffdf8;
}

body[data-view="app"] .mode-button.is-active {
  background: linear-gradient(135deg, #052f2a, #0b5146);
  color: #fff8da;
  box-shadow: 0 8px 22px rgba(5, 47, 42, 0.22);
}

.mode-form {
  display: none;
}

.mode-form.is-active {
  display: grid;
}

.profile-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(173, 124, 39, 0.22);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

body[data-view="app"] .profile-block {
  border-color: rgba(240, 198, 109, 0.28);
  background:
    linear-gradient(135deg, rgba(240, 198, 109, 0.12), rgba(255, 253, 248, 0.76)),
    rgba(255, 253, 248, 0.72);
}

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-save {
  width: 100%;
}

.profile-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.profile-list-panel,
.profile-editor-panel,
.profile-preview-panel {
  max-height: 100%;
  overflow: auto;
}

.daily-control-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100svh - 110px);
  overflow: auto;
}

.daily-main-panel {
  min-height: 0;
  overflow: visible;
}

.daily-control-panel {
  display: grid;
  gap: 14px;
}

.daily-form {
  display: grid;
  gap: 12px;
}

.daily-main-panel {
  min-height: 0;
}

.daily-output {
  display: grid;
  gap: 16px;
}

.daily-empty,
.daily-hero,
.daily-card,
.daily-surround,
.daily-almanac,
.daily-ai-card {
  border: 1px solid rgba(240, 198, 109, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(247, 243, 233, 0.92)),
    linear-gradient(135deg, rgba(127, 176, 163, 0.08), transparent);
  box-shadow: var(--shadow);
}

.daily-empty {
  display: grid;
  gap: 8px;
  min-height: 220px;
  place-content: center;
  padding: 24px;
  text-align: center;
}

.daily-empty strong {
  color: var(--green);
  font-size: 20px;
}

.daily-empty p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.daily-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.daily-hero h2 {
  margin: 0;
  color: var(--green);
  font-size: 38px;
  line-height: 1.1;
}

.daily-hero span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.daily-score {
  display: grid;
  width: 112px;
  min-width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid rgba(173, 124, 39, 0.28);
  border-radius: 999px;
  background: #fff8df;
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

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

.daily-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
}

.daily-card h3,
.daily-surround h3,
.daily-almanac h3,
.daily-directions h3,
.daily-ai-card h3 {
  margin: 0;
  color: var(--green);
  font-size: 16px;
}

.daily-card p {
  margin: 0;
  color: #35413c;
  line-height: 1.65;
}

.daily-ai-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.daily-ai-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.daily-ai-output {
  color: #35413c;
  line-height: 1.72;
}

.daily-ai-output > *:first-child {
  margin-top: 0;
}

.daily-ai-output > *:last-child {
  margin-bottom: 0;
}

.daily-ai-output h3 {
  margin: 8px 0;
  color: var(--green);
  font-size: 15px;
}

.daily-ai-output p {
  margin: 0 0 10px;
}

.daily-ai-output blockquote {
  margin: 12px 0 0;
  padding-left: 12px;
  border-left: 3px solid rgba(173, 124, 39, 0.32);
  color: var(--muted);
  font-size: 12px;
}

.daily-ai-actions {
  display: flex;
  justify-content: flex-start;
}

.daily-ai-actions .secondary {
  min-width: 136px;
}

.daily-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.daily-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid rgba(32, 56, 47, 0.13);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.78);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.daily-chip.good {
  border-color: rgba(32, 112, 93, 0.18);
  background: #eaf5ec;
  color: #26705d;
}

.daily-chip.tough {
  border-color: rgba(157, 63, 52, 0.24);
  background: #fff0ee;
  color: var(--red);
}

.daily-surround {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.daily-surround-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.daily-surround-item {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(32, 56, 47, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.daily-surround-item strong {
  color: var(--green);
  font-size: 14px;
}

.daily-surround-item small {
  color: var(--muted);
  font-weight: 700;
}

.daily-almanac {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.daily-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.daily-section-heading small {
  color: var(--muted);
  font-weight: 800;
}

.almanac-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.almanac-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(32, 56, 47, 0.08);
}

.almanac-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.almanac-row b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.almanac-activity-grid,
.almanac-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.almanac-activity,
.almanac-pengzu {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(32, 56, 47, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.68);
}

.almanac-activity h4,
.almanac-pengzu h4 {
  margin: 0;
  color: var(--green);
  font-size: 14px;
}

.almanac-pengzu {
  grid-column: 1 / -1;
}

.almanac-pengzu p {
  margin: 0;
  color: #35413c;
  line-height: 1.65;
}

.almanac-advanced {
  display: grid;
  gap: 12px;
}

.daily-directions {
  display: grid;
  gap: 12px;
}

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

.direction-item {
  display: grid;
  gap: 5px;
  min-height: 74px;
  place-content: center;
  padding: 10px;
  border: 1px solid rgba(173, 124, 39, 0.16);
  border-radius: 8px;
  background: #fff8df;
  text-align: center;
}

.direction-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.direction-item b {
  color: var(--gold);
  font-size: 18px;
}

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

.profile-manager-list {
  display: grid;
  gap: 9px;
}

.profile-manager-item,
.profile-manager-empty {
  width: 100%;
  min-height: 62px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
}

body[data-view="app"] .profile-manager-item,
body[data-view="app"] .profile-manager-empty,
body[data-view="app"] .profile-preview {
  border-color: rgba(240, 198, 109, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 243, 233, 0.94)),
    linear-gradient(135deg, rgba(127, 176, 163, 0.08), transparent);
}

.profile-manager-item {
  display: grid;
  gap: 5px;
}

.profile-manager-item:hover,
.profile-manager-item.is-active {
  border-color: rgba(157, 63, 52, 0.5);
  background: #fbf0ed;
}

.profile-manager-item strong,
.profile-manager-empty strong {
  display: block;
  overflow: hidden;
  color: var(--green);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-manager-item small,
.profile-manager-empty small {
  color: var(--muted);
  line-height: 1.5;
}

.profile-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-actions .primary-action,
.profile-actions .secondary-action {
  flex: 1 1 170px;
}

.profile-preview {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.profile-preview > strong {
  color: var(--green);
  font-size: 18px;
  line-height: 1.35;
}

.profile-preview p {
  margin: 0;
  color: #35413c;
  line-height: 1.65;
}

.profile-preview-meta {
  display: grid;
  gap: 8px;
}

.profile-preview-meta div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 30px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(32, 56, 47, 0.09);
}

.profile-preview-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-preview-meta b {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.divination-note {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid rgba(173, 124, 39, 0.32);
  border-radius: 8px;
  background: #fbf6ea;
  color: var(--muted);
  line-height: 1.55;
}

body[data-view="app"] .divination-note {
  border-color: rgba(240, 198, 109, 0.36);
  background:
    linear-gradient(135deg, rgba(240, 198, 109, 0.14), rgba(255, 253, 248, 0.62)),
    rgba(255, 253, 248, 0.7);
}

.divination-note strong {
  color: var(--gold);
  font-size: 13px;
}

.divination-note p {
  margin: 0;
  font-size: 13px;
}

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

.coin-manual-details {
  border: 1px solid rgba(173, 124, 39, 0.22);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.62);
}

.coin-manual-details summary {
  min-height: 42px;
  padding: 11px 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.coin-manual-details .coin-grid {
  padding: 0 12px 12px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar .language-control {
  display: flex;
  grid-template-columns: none;
  align-items: center;
}

.full-span {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

input,
select {
  padding: 0 12px;
}

.topbar .language-control select {
  width: auto;
  min-width: 122px;
  min-height: 34px;
}

textarea {
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(61, 86, 111, 0.75);
  box-shadow: 0 0 0 3px rgba(61, 86, 111, 0.12);
}

.primary-action {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fffdf8;
  font-weight: 800;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-action {
  min-height: 46px;
  border: 1px solid rgba(32, 56, 47, 0.26);
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.secondary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.yijing-stage {
  margin: 0 0 18px;
}

.coin-toss-panel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  min-height: 430px;
  padding: 26px 24px 22px;
  border: 1px solid rgba(240, 198, 109, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 198, 109, 0.18), transparent 30%),
    radial-gradient(circle at 50% 42%, rgba(11, 81, 70, 0.16), transparent 48%),
    linear-gradient(145deg, rgba(255, 253, 248, 0.92), rgba(241, 235, 220, 0.88));
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 218, 0.5),
    0 26px 72px rgba(1, 3, 3, 0.22);
  overflow: hidden;
}

.coin-toss-panel::before,
.coin-toss-panel::after {
  content: "";
  position: absolute;
  inset: 42px;
  pointer-events: none;
  border: 1px solid rgba(173, 124, 39, 0.18);
  border-radius: 999px;
}

.coin-toss-panel::after {
  inset: 88px;
  border-style: dashed;
  opacity: 0.72;
  animation: coin-orbit 18s linear infinite;
}

.coin-stage-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: min(560px, 100%);
  min-height: 300px;
  perspective: 900px;
}

.coin-disc {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  padding: 0;
  border: 3px solid rgba(105, 70, 23, 0.7);
  border-radius: 999px;
  appearance: none;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 237, 169, 0.7), transparent 28px),
    radial-gradient(circle at 70% 78%, rgba(52, 85, 58, 0.28), transparent 24px),
    radial-gradient(circle at center, rgba(255, 219, 120, 0.2), transparent 52px),
    conic-gradient(from 18deg, #5f3817, #c98b35, #7d4c1b, #e0ac50, #6f461d, #b9782c, #5f3817);
  color: #3f2a14;
  box-shadow:
    inset 0 0 0 7px rgba(61, 39, 16, 0.34),
    inset 0 0 0 11px rgba(218, 151, 57, 0.26),
    inset 0 8px 18px rgba(255, 225, 139, 0.44),
    inset 0 -14px 26px rgba(45, 29, 13, 0.38),
    0 5px 0 rgba(76, 48, 18, 0.82),
    0 0 0 11px rgba(240, 198, 109, 0.08),
    0 22px 54px rgba(5, 47, 42, 0.28);
  transform-style: preserve-3d;
  transform: rotateX(0) rotateY(0);
  will-change: transform;
}

.coin-disc > * {
  position: relative;
  z-index: 2;
}

.coin-disc::before {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  border: 1px dashed rgba(240, 198, 109, 0.58);
  border-radius: 999px;
  animation: coin-orbit 9s linear infinite;
}

.coin-disc::after {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 240, 177, 0.42), transparent 24px),
    radial-gradient(circle at 62% 72%, rgba(35, 81, 60, 0.18), transparent 18px),
    conic-gradient(from 90deg, rgba(62, 41, 18, 0.28), rgba(255, 225, 139, 0.12), rgba(62, 41, 18, 0.28));
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 146, 0.28),
    inset 0 0 0 18px rgba(73, 45, 17, 0.08);
}

.coin-hole {
  position: absolute;
  inset: 43px;
  z-index: 4;
  border: 2px solid rgba(75, 47, 18, 0.74);
  border-radius: 3px;
  background:
    linear-gradient(135deg, rgba(1, 3, 3, 0.88), rgba(6, 35, 29, 0.76)),
    #031916;
  box-shadow:
    inset 2px 2px 4px rgba(0, 0, 0, 0.68),
    0 1px 0 rgba(255, 221, 136, 0.32);
}

.coin-face-text {
  position: absolute;
  z-index: 5;
  color: rgba(54, 34, 12, 0.88);
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 1px 0 rgba(255, 225, 139, 0.3),
    0 -1px 0 rgba(44, 27, 10, 0.28);
}

.coin-face-top {
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.coin-face-right {
  top: 50%;
  right: 19px;
  transform: translateY(-50%);
}

.coin-face-bottom {
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
}

.coin-face-left {
  top: 50%;
  left: 19px;
  transform: translateY(-50%);
}

.coin-side-label {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(64, 42, 16, 0.36);
  border-radius: 999px;
  background: rgba(255, 237, 170, 0.64);
  color: rgba(62, 39, 14, 0.88);
  font-size: 14px;
  font-weight: 900;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.36);
}

.coin-disc.is-yin {
  background:
    radial-gradient(circle at 32% 25%, rgba(223, 232, 226, 0.48), transparent 28px),
    radial-gradient(circle at 68% 74%, rgba(29, 73, 55, 0.26), transparent 26px),
    conic-gradient(from 30deg, #3e4f45, #8f9a88, #50685d, #c0b57e, #4c6358, #778571, #3e4f45);
  color: #1f3029;
}

.coin-disc.is-yin .coin-face-text {
  color: rgba(29, 48, 40, 0.86);
}

.coin-disc.is-yin .coin-side-label {
  background: rgba(222, 232, 225, 0.72);
  color: rgba(31, 48, 41, 0.9);
}

.coin-disc.is-spinning {
  animation: coin-flight 1120ms cubic-bezier(0.18, 0.76, 0.16, 1);
}

.coin-disc.is-cast {
  animation: coin-settle 680ms ease-out;
}

.coin-progress {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: 520px;
  text-align: center;
}

.coin-progress strong {
  color: var(--green);
  font-size: 18px;
}

body[data-view="app"] .coin-progress strong {
  color: #0b5146;
}

.coin-progress small {
  color: var(--muted);
  line-height: 1.45;
}

.coin-record {
  display: grid;
  gap: 8px;
}

.coin-record-orbit {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.coin-record-item {
  min-height: 42px;
  padding: 7px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8f4ea;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.coin-record-orbit .coin-record-item {
  position: absolute;
  display: grid;
  place-items: center;
  width: 86px;
  min-height: 58px;
  padding: 8px;
  pointer-events: auto;
  box-shadow: 0 12px 28px rgba(31, 42, 38, 0.1);
  transform: translate(-50%, -50%);
}

.coin-record-orbit .coin-record-item:nth-child(1) {
  left: 50%;
  top: 94%;
}

.coin-record-orbit .coin-record-item:nth-child(2) {
  left: 18%;
  top: 72%;
}

.coin-record-orbit .coin-record-item:nth-child(3) {
  left: 18%;
  top: 28%;
}

.coin-record-orbit .coin-record-item:nth-child(4) {
  left: 82%;
  top: 28%;
}

.coin-record-orbit .coin-record-item:nth-child(5) {
  left: 82%;
  top: 72%;
}

.coin-record-orbit .coin-record-item:nth-child(6) {
  left: 50%;
  top: 6%;
}

body[data-view="app"] .coin-record-item {
  border-color: rgba(240, 198, 109, 0.18);
  background: rgba(3, 25, 22, 0.06);
}

.coin-record-item.is-filled {
  border-color: rgba(32, 56, 47, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

body[data-view="app"] .coin-record-item.is-filled {
  border-color: rgba(11, 81, 70, 0.28);
  background: linear-gradient(180deg, rgba(229, 238, 231, 0.94), rgba(240, 198, 109, 0.12));
}

.coin-record-item.is-yin {
  background: linear-gradient(180deg, rgba(229, 238, 231, 0.74), rgba(216, 238, 229, 0.2));
}

.coin-record-item.is-next {
  border-color: rgba(173, 124, 39, 0.7);
  box-shadow: inset 0 0 0 2px rgba(173, 124, 39, 0.08);
}

body[data-view="app"] .coin-record-item.is-next {
  border-color: rgba(240, 198, 109, 0.78);
  box-shadow:
    inset 0 0 0 2px rgba(240, 198, 109, 0.1),
    0 0 18px rgba(240, 198, 109, 0.14);
}

.coin-toss-action {
  width: min(240px, 100%);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.history-block,
.source-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 800;
}

.profile-block-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.history-list,
.source-list {
  display: grid;
  gap: 9px;
}

.history-item,
.source-item {
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf8;
  color: var(--ink);
  text-align: left;
}

body[data-view="app"] .history-item,
body[data-view="app"] .source-item,
body[data-view="app"] .report-output,
body[data-view="app"] .hexagram-visual,
body[data-view="app"] .hexagram-detail,
body[data-view="app"] .palace {
  border-color: rgba(240, 198, 109, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 243, 233, 0.94)),
    linear-gradient(135deg, rgba(127, 176, 163, 0.08), transparent);
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

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

.history-item:hover,
.history-item.is-active {
  border-color: rgba(157, 63, 52, 0.5);
  background: #fbf0ed;
}

.history-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-delete {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(157, 63, 52, 0.26);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.74);
  color: var(--red);
  font-size: 17px;
  line-height: 1;
}

.history-delete:hover {
  border-color: rgba(157, 63, 52, 0.58);
  background: rgba(157, 63, 52, 0.1);
}

.history-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item small,
.source-item small {
  color: var(--muted);
}

.chart-area {
  min-height: 100%;
  padding: 18px;
}

body[data-view="app"] .chart-area {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(244, 242, 236, 0.9)),
    linear-gradient(90deg, rgba(240, 198, 109, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(127, 176, 163, 0.08) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
}

.chart-header {
  align-items: start;
}

.chart-meta {
  max-width: 320px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.palace-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.chart-area.is-yijing .palace-board {
  margin-top: 16px;
}

.hexagram-board {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: start;
}

.hexagram-visual,
.hexagram-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  overflow: hidden;
}

.hexagram-visual {
  align-self: start;
  line-height: 0;
}

.hexagram-visual img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hexagram-placeholder {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(173, 124, 39, 0.12), transparent 42%),
    linear-gradient(180deg, #fffdf8, #f7f3e9);
}

.hexagram-placeholder-symbol {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border: 1px solid rgba(173, 124, 39, 0.35);
  border-radius: 999px;
  color: rgba(173, 124, 39, 0.72);
  font-size: 42px;
  font-weight: 900;
}

.hexagram-detail {
  display: grid;
  gap: 14px;
  min-height: 260px;
  padding: 16px;
}

.hexagram-name {
  margin: 0;
  color: var(--green);
  font-size: 24px;
  line-height: 1.2;
}

body[data-view="app"] .hexagram-name {
  color: #0b5146;
  text-shadow: 0 0 18px rgba(240, 198, 109, 0.16);
}

.coin-lines {
  display: grid;
  gap: 8px;
}

.coin-line {
  display: grid;
  grid-template-columns: 42px 1fr 44px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.yao {
  position: relative;
  height: 12px;
}

.yao::before,
.yao::after {
  content: "";
  position: absolute;
  top: 3px;
  height: 6px;
  border-radius: 999px;
  background: var(--green);
}

.yao.yang::before {
  left: 0;
  right: 0;
}

.yao.yang::after {
  display: none;
}

.yao.yin::before {
  left: 0;
  width: calc(50% - 8px);
}

.yao.yin::after {
  right: 0;
  width: calc(50% - 8px);
}

.yao.pending::before {
  left: 0;
  right: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(100, 112, 105, 0.42),
    rgba(100, 112, 105, 0.42) 8px,
    transparent 8px,
    transparent 14px
  );
}

.yao.pending::after {
  display: none;
}

.hexagram-notes {
  margin: 0;
  color: #35413c;
  line-height: 1.65;
  white-space: pre-wrap;
}

.palace {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 166px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf8 0%, #f7f3e9 100%);
  overflow: hidden;
}

.palace.is-ming {
  border-color: rgba(157, 63, 52, 0.7);
  box-shadow: inset 0 0 0 2px rgba(157, 63, 52, 0.08);
}

.palace.is-shen {
  border-color: rgba(173, 124, 39, 0.7);
}

.palace-top,
.palace-flags,
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.palace-top strong {
  min-width: 0;
  color: var(--green);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.palace-top small {
  flex: 0 0 auto;
  color: var(--muted);
}

.palace-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 33px;
  margin: 10px 0;
}

.star-chip {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

body[data-view="app"] .star-chip {
  border: 1px solid rgba(32, 56, 47, 0.1);
  background: rgba(229, 238, 231, 0.86);
}

body[data-view="app"] .star-chip.major {
  border-color: rgba(173, 124, 39, 0.18);
  background: rgba(250, 237, 204, 0.9);
  color: #8c631f;
}

.star-chip.major {
  background: #f5e5df;
  color: var(--red);
}

.palace-notes {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.palace-flags {
  justify-content: flex-start;
  min-height: 24px;
  margin-top: 10px;
}

.flag {
  padding: 3px 7px;
  border-radius: 999px;
  background: #ece6d8;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.palace-empty {
  opacity: 0.72;
}

.report-output {
  min-height: 220px;
  max-height: 52vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: #26322d;
  line-height: 1.72;
}

.report-output > *:first-child {
  margin-top: 0;
}

.report-output > *:last-child {
  margin-bottom: 0;
}

.report-output h3 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 18px;
  line-height: 1.35;
}

.report-output h4 {
  margin: 16px 0 8px;
  color: var(--blue);
  font-size: 15px;
}

.report-output p {
  margin: 0 0 12px;
}

.report-output ul,
.report-output ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.report-output li {
  margin: 5px 0;
}

.report-output blockquote {
  margin: 14px 0;
  padding: 9px 12px;
  border-left: 3px solid var(--gold);
  background: #f8f4ea;
  color: var(--muted);
}

.report-output code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #ece6d8;
  color: var(--red);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.report-output strong {
  color: var(--green);
}

@keyframes coin-spin {
  0% {
    transform: rotateY(0) translateY(0);
  }
  45% {
    transform: rotateY(540deg) translateY(-8px);
  }
  100% {
    transform: rotateY(1080deg) translateY(0);
  }
}

@keyframes coin-flight {
  0% {
    filter: brightness(1);
    transform: translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1);
  }

  18% {
    filter: brightness(1.18);
    transform: translate3d(-20px, -74px, 120px) rotateX(190deg) rotateY(310deg) rotateZ(-12deg) scale(1.1);
  }

  44% {
    filter: brightness(1.35);
    transform: translate3d(28px, -168px, 220px) rotateX(620deg) rotateY(760deg) rotateZ(18deg) scale(1.22);
  }

  72% {
    filter: brightness(1.08);
    transform: translate3d(-10px, -48px, 74px) rotateX(1040deg) rotateY(1160deg) rotateZ(-8deg) scale(1.05);
  }

  100% {
    filter: brightness(1);
    transform: translate3d(0, 0, 0) rotateX(1440deg) rotateY(1440deg) rotateZ(0deg) scale(1);
  }
}

@keyframes coin-settle {
  0% {
    transform: translateY(0) scale(1);
  }

  42% {
    transform: translateY(4px) scale(0.96);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes coin-orbit {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes title-star-sheen {
  0%,
  100% {
    background-position: 0% 50%;
    filter: drop-shadow(0 0 0 rgba(240, 198, 109, 0));
  }

  50% {
    background-position: 100% 50%;
    filter: drop-shadow(0 0 8px rgba(240, 198, 109, 0.18));
  }
}

@keyframes title-pulse {
  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}

@keyframes app-glyph-drift {
  from {
    transform: translate3d(-2%, 0, 0);
  }

  to {
    transform: translate3d(2%, 18px, 0);
  }
}

@keyframes oracle-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes oracle-line {
  0%,
  100% {
    opacity: 0.72;
    transform: translateX(0);
  }

  50% {
    opacity: 1;
    transform: translateX(8px);
  }
}

.source-count {
  color: var(--muted);
  font-size: 13px;
}

.source-item {
  display: grid;
  gap: 7px;
}

.source-item strong {
  color: var(--blue);
  font-size: 13px;
}

.source-item p {
  margin: 0;
  color: #35413c;
  font-size: 13px;
  line-height: 1.55;
}

.disclaimer {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(157, 63, 52, 0.35);
  border-radius: 8px;
  background: #fff8f5;
  color: var(--red);
  box-shadow: var(--shadow);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 340px) 1fr;
  }

  .profile-layout {
    grid-template-columns: minmax(260px, 320px) 1fr;
  }

  .daily-layout {
    grid-template-columns: 1fr;
  }

  .profile-preview-panel {
    grid-column: 1 / -1;
  }

  .report-panel {
    grid-column: 1 / -1;
  }

  .report-output {
    max-height: none;
  }
}

@media (max-width: 820px) {
  .shell {
    width: 100%;
    padding-top: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    top: 10px;
    width: calc(100vw - 20px);
  }

  body[data-view="app"] .topbar {
    top: 0;
    width: 100vw;
    margin: 0;
    border-radius: 0 0 8px 8px;
  }

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

  .nav-links {
    width: 100%;
  }

  .nav-link {
    flex: 1;
  }

  h1 {
    font-size: 25px;
  }

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

  .home-content {
    min-height: 100vh;
    min-height: 100svh;
    padding: 154px 20px 330px;
  }

  .home-copy h1 {
    font-size: 58px;
  }

  .home-copy p {
    font-size: 16px;
  }

  .home-oracle {
    display: none;
  }

  .home-paths {
    grid-template-columns: 1fr;
    bottom: 14px;
    width: min(420px, calc(100vw - 28px));
  }

  .path-tile {
    min-height: 84px;
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 720px);
    height: calc(100vh - 174px);
    height: calc(100svh - 174px);
    margin: 12px auto;
  }

  body[data-view="app"] .workspace {
    margin-top: 0;
    padding-top: 148px;
    height: calc(100vh - 12px);
    height: calc(100svh - 12px);
  }

  .profile-page,
  .daily-page {
    width: min(100vw - 20px, 720px);
    height: calc(100vh - 12px);
    height: calc(100svh - 12px);
    padding-top: 148px;
  }

  body[data-view="app"][data-section="daily"] .daily-page,
  body[data-view="app"][data-section="profiles"] .profile-page {
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    overflow: visible;
  }

  .profile-layout,
  .daily-layout {
    grid-template-columns: 1fr;
  }

  .profile-list-panel,
  .profile-editor-panel,
  .profile-preview-panel,
  .daily-control-panel,
  .daily-main-panel {
    position: static;
    max-height: none;
  }

  .daily-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-score {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 56px;
    border-radius: 8px;
  }

  .daily-card-grid,
  .daily-surround-grid,
  .almanac-summary,
  .almanac-activity-grid,
  .almanac-advanced-grid,
  .direction-grid {
    grid-template-columns: 1fr;
  }

  .chart-area {
    min-height: auto;
  }

  .coin-toss-panel {
    min-height: 380px;
    padding: 20px 14px;
  }

  .coin-stage-orbit {
    min-height: 260px;
  }

  .coin-disc {
    width: 96px;
    height: 96px;
  }

  .coin-hole {
    inset: 34px;
  }

  .coin-face-text {
    font-size: 18px;
  }

  .coin-face-top {
    top: 14px;
  }

  .coin-face-right {
    right: 15px;
  }

  .coin-face-bottom {
    bottom: 14px;
  }

  .coin-face-left {
    left: 15px;
  }

  .coin-side-label {
    right: 8px;
    bottom: 8px;
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .coin-record-orbit .coin-record-item {
    width: 74px;
    min-height: 52px;
    font-size: 11px;
  }

  .chart-header,
  .panel-heading {
    flex-direction: column;
  }

  .chart-meta {
    max-width: none;
    text-align: left;
  }

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

  .hexagram-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .form-grid,
  .coin-grid,
  .profile-form-grid,
  .profile-edit-form,
  .palace-board {
    grid-template-columns: 1fr;
  }

  .profile-preview-meta div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .palace {
    min-height: 142px;
  }

  .coin-record {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-actions {
    display: grid;
  }

  .home-action {
    width: 100%;
  }

  .home-copy h1 {
    font-size: 46px;
  }

  .home-content {
    padding: 166px 18px 300px;
  }

  .home-copy p {
    font-size: 15px;
    line-height: 1.72;
  }

  .path-note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .oracle-ring,
  .oracle-lines i,
  .coin-disc::before,
  body[data-view="app"]::before,
  body[data-view="app"] .panel-heading h2,
  body[data-view="app"] .chart-header h2,
  body[data-view="app"] .section-kicker::before,
  .coin-disc.is-spinning {
    animation: none;
  }
}
