:root {
  --ink: #08090c;
  --ink-soft: #11141c;
  --navy: #1a2238;
  --gold: #c6a972;
  --gold-bright: #f0cf7a;
  --ivory: #f6f0e4;
  --muted: #b9b4aa;
  --turquoise: #63c7c3;
  --line: rgba(198, 169, 114, .24);
  --shadow: 0 24px 80px rgba(0, 0, 0, .46);
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ivory);
  background:
    radial-gradient(circle at 85% 10%, rgba(67, 54, 121, .22), transparent 30rem),
    radial-gradient(circle at 12% 32%, rgba(35, 121, 117, .12), transparent 25rem),
    var(--ink);
  line-height: 1.6;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; background: var(--ivory); color: var(--ink); padding: .7rem 1rem; }
.skip-link:focus { top: 1rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: .75rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 12, .86);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: .8rem; border: 0; background: transparent; text-align: left; cursor: pointer; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-bright); }
.brand small, .brand strong { display: block; }
.brand small { color: var(--gold); font: 600 .68rem/1.2 Arial, sans-serif; letter-spacing: .2em; }
.brand strong { font-size: clamp(.9rem, 2vw, 1.08rem); }
.top-actions { display: flex; align-items: center; gap: .6rem; }
.icon-button { min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 1.5rem; cursor: pointer; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: .75rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.button:hover, .button:focus-visible, .icon-button:hover, .icon-button:focus-visible { border-color: var(--gold); transform: translateY(-1px); }
.button-primary { color: #16110a; border-color: var(--gold-bright); background: linear-gradient(135deg, #f4dc98, #b89048); font-weight: 700; }
.button-quiet { color: var(--ivory); background: rgba(255,255,255,.025); }
.button-link { color: var(--gold-bright); }

.search-panel { position: sticky; top: 76px; z-index: 19; padding: 1rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); background: #101119; }
.search-panel label { display: block; margin-bottom: .35rem; color: var(--gold); font: 700 .72rem Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.search-row { display: flex; gap: .75rem; }
.search-row input { width: min(100%, 740px); min-height: 52px; padding: .75rem 1rem; color: var(--ivory); border: 1px solid var(--line); border-radius: 12px; background: var(--ink); }

main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }
.hero { position: relative; display: grid; grid-template-columns: minmax(220px, .8fr) 1.4fr; align-items: center; gap: clamp(2rem, 6vw, 6rem); min-height: 70vh; padding: clamp(3rem, 9vw, 8rem) 0; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 8% 4%; z-index: -1; border: 1px solid var(--line); border-radius: 50%; transform: rotate(-7deg); }
.hero-orbit { position: relative; display: grid; place-items: center; aspect-ratio: 1; width: min(100%, 360px); margin: auto; border: 1px solid var(--gold); border-radius: 50%; box-shadow: 0 0 80px rgba(198,169,114,.12), inset 0 0 60px rgba(198,169,114,.08); }
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; inset: 12%; border: 1px solid var(--line); border-radius: 50%; }
.hero-orbit::after { inset: 28%; border-color: var(--gold); }
.hero-orbit span { color: var(--gold-bright); font-size: clamp(4rem, 12vw, 8rem); line-height: 1; text-shadow: 0 0 35px rgba(240,207,122,.32); }
.eyebrow { margin: 0 0 .45rem; color: var(--gold); font: 700 .72rem/1.4 Arial, sans-serif; letter-spacing: .18em; }
h1, h2 { margin: 0; line-height: 1.08; font-weight: 500; }
h1 { max-width: 800px; font-size: clamp(2.5rem, 6vw, 5.5rem); }
h1 em { color: var(--gold-bright); font-style: normal; }
.hero-copy > p:not(.eyebrow) { max-width: 620px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }

.dashboard { padding: 2rem 0 6rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.section-heading h2, .privacy-section h2 { font-size: clamp(2rem, 4vw, 3.4rem); }
.progress-summary { text-align: right; }
.progress-summary span { display: block; color: var(--gold-bright); font-size: 2rem; line-height: 1; }
.progress-summary small { color: var(--muted); }
.progress-track { height: 4px; margin: 1.4rem 0 2rem; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--turquoise), var(--gold-bright)); transition: width .4s ease; }
.filter-status { min-height: 1.4rem; color: var(--muted); }
.meji-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.meji-card { position: relative; min-height: 230px; padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(26,34,56,.65), rgba(8,9,12,.92)); text-align: left; overflow: hidden; cursor: pointer; box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.meji-card::after { content: ""; position: absolute; right: -48px; bottom: -48px; width: 130px; height: 130px; border: 1px solid rgba(198,169,114,.18); border-radius: 50%; }
.meji-card:hover, .meji-card:focus-visible { border-color: var(--gold); transform: translateY(-3px); }
.meji-card .card-number { color: var(--gold); font: 700 .72rem Arial, sans-serif; letter-spacing: .15em; }
.meji-card h3 { margin: 2rem 0 .35rem; color: var(--ivory); font-size: 1.55rem; font-weight: 500; }
.meji-card p { margin: 0; color: var(--muted); }
.card-progress { position: absolute; left: 1.25rem; right: 1.25rem; bottom: 1.1rem; display: flex; align-items: center; gap: .65rem; color: var(--muted); font: .72rem Arial, sans-serif; }
.card-progress i { flex: 1; height: 3px; background: rgba(255,255,255,.09); border-radius: 9px; overflow: hidden; }
.card-progress i span { display: block; height: 100%; background: var(--turquoise); }

.entry-view { padding: 2.5rem 0 6rem; }
.back-link { min-height: 48px; margin-bottom: 1rem; border: 0; background: transparent; color: var(--gold-bright); cursor: pointer; }
.entry-hero { max-width: 1120px; margin: 0 auto 1.5rem; }
.entry-hero button { position: relative; display: block; width: 100%; padding: 0; border: 1px solid rgba(198,169,114,.42); border-radius: 20px; background: #07070a; overflow: hidden; cursor: zoom-in; box-shadow: var(--shadow); }
.entry-hero img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: contain; }
.entry-hero button span { position: absolute; right: 1rem; bottom: 1rem; padding: .45rem .8rem; border: 1px solid rgba(240,207,122,.48); border-radius: 999px; color: var(--ivory); background: rgba(8,9,12,.82); backdrop-filter: blur(8px); font: 700 .72rem Arial, sans-serif; letter-spacing: .06em; }
.entry-hero figcaption { padding: .65rem .25rem 0; color: var(--muted); font-size: .86rem; text-align: center; }
.entry-card { max-width: 860px; margin: auto; padding: clamp(1.3rem, 5vw, 4rem); border: 1px solid var(--line); border-radius: 24px; background: rgba(17,20,28,.82); box-shadow: var(--shadow); }
.entry-header { display: grid; grid-template-columns: 72px 1fr; gap: 1.25rem; align-items: start; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.entry-number { display: grid; place-items: center; width: 72px; aspect-ratio: 1; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-bright); font-size: 1.5rem; }
.entry-header h2 { color: var(--gold-bright); font-size: clamp(2.4rem, 6vw, 4.5rem); }
.entry-summary { color: var(--muted); font-size: 1.1rem; }
.reading-note { display: flex; gap: .9rem; margin: 2rem 0; padding: 1rem 1.2rem; border-left: 2px solid var(--turquoise); background: rgba(99,199,195,.06); }
.reading-note span { color: var(--turquoise); }
.reading-note p { margin: 0; }
.question-field { display: block; margin: 0 0 2rem; }
.question-field > span { display: block; margin-bottom: .65rem; font-size: 1.12rem; }
textarea { width: 100%; min-height: 150px; resize: vertical; padding: 1rem; color: var(--ivory); border: 1px solid var(--line); border-radius: 12px; background: rgba(5,6,9,.72); line-height: 1.6; }
textarea:focus { outline: 2px solid rgba(99,199,195,.45); border-color: var(--turquoise); }
.action-card { margin: 2rem 0; padding: 1.2rem 1.4rem; border: 1px solid rgba(198,169,114,.35); border-radius: 14px; background: rgba(198,169,114,.06); }
.action-card p:last-child { margin-bottom: 0; }
.notes-field > span { display: block; margin-bottom: .65rem; color: var(--gold-bright); font-size: 1.2rem; }
.save-status { min-height: 1.5rem; margin: .8rem 0 1.5rem; color: var(--turquoise); font: .78rem Arial, sans-serif; }
.entry-navigation { display: flex; justify-content: space-between; gap: .75rem; }

.privacy-section { display: grid; grid-template-columns: 1fr 1.5fr auto; align-items: center; gap: 2rem; margin: 1rem 0 5rem; padding: 2rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.privacy-section p { color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem clamp(1rem,4vw,4rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }

dialog { width: min(92vw, 620px); padding: 0; color: var(--ivory); border: 1px solid var(--line); border-radius: 20px; background: var(--ink-soft); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(6px); }
.dialog-card { position: relative; padding: clamp(1.5rem, 5vw, 3rem); }
.dialog-card h2 { font-size: 2.1rem; }
.dialog-card > p:not(.eyebrow), .dialog-card li { color: var(--muted); }
.dialog-close { position: absolute; top: .75rem; right: .75rem; width: 46px; height: 46px; border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; }
.dialog-actions { display: grid; gap: .65rem; margin-top: 1.5rem; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.microcopy { min-height: 1.5rem; }
.image-dialog { width: min(98vw, 1500px); max-width: none; background: #050507; }
.image-dialog form { position: relative; margin: 0; padding: clamp(2.8rem, 5vw, 4rem) clamp(.5rem, 2vw, 1.5rem) 1rem; }
.image-dialog img { display: block; width: 100%; max-height: 82vh; object-fit: contain; }
.image-dialog p { margin: .8rem 0 0; color: var(--muted); text-align: center; }
.image-close { color: var(--ivory); }
noscript { display: block; padding: 1rem; background: #7b261d; text-align: center; }

@media (max-width: 900px) {
  .meji-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .privacy-section { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { min-height: 68px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand small { display: none; }
  .brand strong { max-width: 180px; line-height: 1.2; }
  .top-actions .button { width: 50px; padding: 0; font-size: 0; }
  .top-actions .button::after { content: "⇩"; font-size: 1.2rem; }
  .search-panel { top: 68px; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 3rem 0 5rem; text-align: center; }
  .hero-orbit { width: 210px; }
  .hero-copy > p { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .meji-card { min-height: 205px; padding: 1rem; }
  .meji-card h3 { margin-top: 1.2rem; font-size: 1.25rem; }
  .card-progress { left: 1rem; right: 1rem; }
  .entry-header { grid-template-columns: 54px 1fr; }
  .entry-number { width: 54px; }
  .entry-hero { margin-left: -.35rem; margin-right: -.35rem; }
  .entry-hero button { border-radius: 13px; }
  .entry-hero button span { right: .6rem; bottom: .6rem; }
  .entry-navigation { flex-direction: column-reverse; }
  footer { flex-direction: column; }
}
@media (max-width: 380px) {
  .meji-grid { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .search-panel, .hero, .dashboard, .privacy-section, footer, .back-link, .entry-navigation, .save-status, .entry-hero { display: none !important; }
  body { color: #171717; background: #fff; }
  main { width: 100%; }
  .entry-view { display: block !important; padding: 0; }
  .entry-card { max-width: none; padding: 0; border: 0; box-shadow: none; background: #fff; }
  .entry-header h2, .notes-field > span, .eyebrow { color: #6a5328; }
  .entry-summary, .reading-note, .action-card { color: #333; }
  textarea { min-height: 120px; color: #111; border-color: #aaa; background: #fff; }
}
