@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --page: #f7f4fc;
  --surface: #ffffff;
  --surface-soft: #f0eafb;
  --ink: #261a3b;
  --muted: #685f75;
  --line: #e6ddf0;
  --brand: #6945a1;
  --brand-strong: #503078;
  --gold: #dba954;
  --shadow: 0 16px 40px rgba(63, 36, 91, .09);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #181222;
  --surface: #241a31;
  --surface-soft: #352642;
  --ink: #f9f4ff;
  --muted: #c3b8ce;
  --line: #483653;
  --brand: #c29afa;
  --brand-strong: #dec4ff;
  --gold: #f2cb80;
  --shadow: 0 16px 40px rgba(0, 0, 0, .15);
}

* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; min-width: 280px; background: var(--page); color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
[v-cloak] { display: none; }

.app-shell { width: min(100%, 740px); min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.topbar { min-height: 74px; display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--brand-strong); color: #fff0c5; font-size: 24px; flex: none; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.3; }
.brand-copy strong { font-size: 15px; letter-spacing: -.025em; }
.eyebrow { display: block; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.icon-button { margin-left: auto; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--ink); font-size: 28px; line-height: 1; }

.hero { position: relative; overflow: hidden; min-height: 276px; padding: 32px 30px; border-radius: 28px; background: radial-gradient(circle at 83% 20%, #815bbb 0, transparent 38%), linear-gradient(135deg, #39235d, #64408f); color: #fff; box-shadow: var(--shadow); }
.hero .eyebrow { color: #efcf91; }
.hero h1 { position: relative; z-index: 1; max-width: 440px; margin: 11px 0 12px; font-size: clamp(25px, 5vw, 39px); font-weight: 800; line-height: 1.14; letter-spacing: -.045em; }
.hero p { position: relative; z-index: 1; max-width: 400px; margin-bottom: 20px; color: #e9dff2; font-size: 14px; line-height: 1.55; }
.hero-orb { position: absolute; right: -42px; top: -68px; width: 248px; height: 248px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; box-shadow: 0 0 0 27px rgba(255,255,255,.055), 0 0 0 54px rgba(255,255,255,.035); transform: rotate(-20deg); }
.hero-orb span:first-child { position: absolute; top: 96px; left: 78px; color: #f7d792; font-size: 95px; line-height: 1; }
.hero-orb span:last-child { position: absolute; top: 124px; left: 167px; color: #faebd2; font-size: 31px; }
.issue-chip { position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 28px; padding: 5px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(255,255,255,.11); font-size: 11px; font-weight: 700; }

.state-card { margin-top: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); color: var(--muted); }
.loading-state { display: flex; align-items: center; gap: 12px; }
.loading-state img { width: 34px; height: 34px; border-radius: 9px; }
.state-card strong { display: block; color: var(--ink); margin-bottom: 6px; }
.state-card p { margin-bottom: 14px; }
.suggested-sign { display: flex; width: 100%; align-items: center; gap: 14px; margin-top: 18px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow); }
.suggested-symbol { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--surface-soft); color: var(--brand); font-size: 30px; }
.suggested-symbol .zodiac-icon { width: 32px; height: 32px; }
.suggested-sign small, .suggested-sign strong { display: block; }
.suggested-sign small { color: var(--muted); font-size: 11px; }
.suggested-sign strong { font-size: 17px; }
.arrow { margin-left: auto; color: var(--brand); font-size: 23px; }
.sign-section { margin-top: 24px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 13px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.section-heading span { color: var(--muted); font-size: 11px; }
.zodiac-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zodiac-card { display: flex; min-width: 0; min-height: 91px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 9px 3px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 700; box-shadow: 0 4px 14px rgba(52,31,74,.035); transition: transform .16s, border-color .16s; }
.zodiac-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.zodiac-icon { display: block; width: 40px; height: 40px; object-fit: contain; }
.zodiac-symbol { width: 38px; height: 38px; }

.reading { padding-top: 12px; }
.story-arrival { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 5px 12px; margin-top: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.story-arrival button { padding: 0; border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 800; text-align: left; }
.archive-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); color: var(--muted); font-size: 12px; }
.archive-notice button { padding: 0; border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 800; }
.back-link { padding: 7px 0; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 800; }
.reading-header { display: flex; align-items: center; gap: 16px; margin: 20px 0; }
.reading-symbol { display: grid; place-items: center; width: 74px; height: 74px; flex: none; border: 1px solid var(--line); border-radius: 23px; background: var(--surface); color: var(--brand); font-family: Georgia, serif; font-size: 48px; box-shadow: var(--shadow); }
.reading-symbol .zodiac-icon { width: 54px; height: 54px; }
.reading-header h1 { margin: 4px 0 0; font-size: clamp(27px, 6vw, 38px); letter-spacing: -.04em; }
.reading-card { overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 25px; background: var(--surface); box-shadow: var(--shadow); }
.planet-line { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 19px; padding: 7px 11px; border-radius: 99px; background: var(--surface-soft); color: var(--brand-strong); font-size: 12px; font-weight: 700; }
.planet-line span { color: var(--gold); font-size: 17px; }
.anime-feature { display: flex; align-items: center; gap: 18px; }
.character-image, .image-fallback { width: 112px; height: 112px; flex: none; border-radius: 18px; background: var(--surface-soft); object-fit: cover; }
.image-fallback { display: grid; place-items: center; color: var(--gold); font-size: 72px; }
.anime-copy { min-width: 0; }
.anime-copy h2 { overflow-wrap: anywhere; margin: 6px 0 6px; font-size: clamp(17px, 4vw, 23px); line-height: 1.2; letter-spacing: -.035em; }
.anime-copy p { margin: 0; color: var(--muted); font-size: 13px; }
.prediction-text { margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.75; }
.reading-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 19px; }
.reading-actions button { width: 100%; }
.reading-actions button:only-child { grid-column: 1 / -1; }
.primary-button, .secondary-button { min-height: 46px; padding: 10px 16px; border-radius: 14px; font-size: 13px; font-weight: 800; }
.primary-button { border: 1px solid var(--brand-strong); background: var(--brand-strong); color: #fff; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--brand-strong); }
.notice { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.week-card { margin-top: 24px; padding: 19px; border: 1px solid var(--line); border-radius: 23px; background: var(--surface); box-shadow: var(--shadow); }
.week-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.week-heading h2 { margin: 5px 0 7px; font-size: 21px; letter-spacing: -.035em; }
.week-heading p { max-width: 410px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.week-count { display: flex; flex: none; width: 69px; height: 69px; flex-direction: column; align-items: center; justify-content: center; border-radius: 20px; background: linear-gradient(135deg, #553078, #8460b3); color: #fff; line-height: 1.1; }
.week-count strong { font-size: 26px; }
.week-count span { color: #f0dcff; font-size: 11px; font-weight: 700; }
.week-navigation { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 11px; color: var(--ink); font-size: 12px; font-weight: 800; text-align: center; }
.week-navigation button { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--brand); font-size: 19px; }
.week-navigation button:disabled { opacity: .35; cursor: default; }
.week-progress { height: 7px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.week-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b61bb, #edbd77); transition: width .2s ease; }
.week-list { display: grid; gap: 8px; margin-top: 15px; }
.week-entry { display: flex; min-width: 0; width: 100%; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--ink); text-align: left; }
.week-entry.is-current { border-color: var(--brand); background: var(--surface-soft); }
.week-entry:disabled { cursor: default; opacity: .82; }
.week-day { display: flex; width: 36px; flex: none; flex-direction: column; align-items: center; color: var(--muted); line-height: 1.2; }
.week-day strong { font-size: 11px; }
.week-day small { margin-top: 2px; color: var(--ink); font-size: 15px; font-weight: 800; }
.week-entry img, .week-mystery { width: 49px; height: 49px; flex: none; border-radius: 11px; object-fit: cover; }
.week-mystery { display: grid; place-items: center; background: var(--surface-soft); color: var(--brand); font-size: 25px; }
.week-entry-copy { min-width: 0; flex: 1; }
.week-entry-copy strong, .week-entry-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-entry-copy strong { font-size: 12px; }
.week-entry-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.week-entry-arrow { flex: none; color: var(--brand); font-size: 17px; }
.week-note { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.week-retry { padding: 0; border: 0; background: none; color: var(--brand); font-size: inherit; font-weight: 800; text-decoration: underline; }
.week-share-button { width: 100%; min-height: 46px; margin-top: 16px; padding: 10px 13px; border: 0; border-radius: 14px; background: var(--brand-strong); color: #fff; font-size: 12px; font-weight: 800; }
.week-share-button:disabled { opacity: .65; cursor: wait; }
.return-card { position: relative; display: flex; gap: 14px; overflow: hidden; margin-top: 22px; padding: 20px; border: 1px solid rgba(162, 114, 207, .25); border-radius: 22px; background: linear-gradient(125deg, var(--surface-soft), var(--surface)); }
.return-card-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: none; border-radius: 14px; background: var(--brand-strong); color: #f3d694; font-size: 29px; }
.return-card-copy { position: relative; z-index: 1; min-width: 0; }
.return-card h2 { margin: 6px 0 7px; font-size: 17px; line-height: 1.25; letter-spacing: -.025em; }
.return-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.return-card .streak-label { margin-top: 10px; color: var(--brand); font-weight: 800; }
.favorite-button { min-height: 40px; margin-top: 13px; padding: 8px 13px; border: 1px solid var(--brand); border-radius: 12px; background: var(--surface); color: var(--brand); font-size: 12px; font-weight: 800; }
.other-apps-link { display: flex; justify-content: space-between; width: 100%; margin-top: 25px; padding: 16px 0; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font-size: 13px; font-weight: 700; text-align: left; }
.other-apps-link span { color: var(--brand); }

.app-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 34px; padding: 19px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.app-footer a { color: var(--brand); font-weight: 700; text-decoration: none; }
.modal-overlay { position: fixed; z-index: 10; inset: 0; display: grid; align-items: end; justify-items: center; padding: 16px 0 0; background: rgba(13, 9, 22, .54); }
.apps-dialog { width: min(100%, 600px); max-height: min(85dvh, 730px); overflow-y: auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: var(--shadow); }
.story-dialog { width: min(100%, 550px); max-height: min(94dvh, 900px); overflow-y: auto; padding: 20px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: var(--shadow); }
.story-description { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.story-preview { display: block; width: auto; max-width: 100%; height: min(56dvh, 500px); margin: 0 auto; border-radius: 15px; box-shadow: 0 12px 28px rgba(34, 17, 55, .17); }
.story-loading { display: grid; place-items: center; min-height: 220px; color: var(--muted); font-size: 13px; }
.story-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 16px; }
.story-actions a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.story-link-row { display: flex; gap: 8px; margin-top: 12px; }
.story-link-input { min-width: 0; flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--ink); font: inherit; font-size: 12px; }
.story-link-row button { flex: none; }
.story-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
@media (max-width: 340px) { .story-link-row { flex-wrap: wrap; } .story-link-row button { width: 100%; } }
@media (max-width: 520px) { .reading-actions { grid-template-columns: minmax(0, 1fr); } }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.app-link { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.app-link img { width: 48px; height: 48px; flex: none; border-radius: 13px; object-fit: cover; }
.app-link span:nth-child(2) { min-width: 0; flex: 1; }
.app-link strong, .app-link small { display: block; }
.app-link strong { font-size: 13px; }
.app-link small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.app-link > span:last-child { color: var(--brand); font-size: 20px; }
:root[data-theme="dark"] .brand-mark { background: #58347c; }
:root[data-theme="dark"] .primary-button { color: #261a3b; }
:root[data-theme="dark"] .zodiac-icon { filter: brightness(1.5); }

@media (max-width: 390px) {
  .app-shell { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .hero { padding: 27px 23px; min-height: 260px; }
  .hero-orb { right: -110px; }
  .zodiac-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .character-image, .image-fallback { width: 92px; height: 92px; }
  .reading-card { padding: 16px; }
  .week-card { padding: 15px; }
  .week-entry { gap: 8px; padding: 6px 8px; }
  .week-entry img, .week-mystery { width: 44px; height: 44px; }
}
@media (min-width: 600px) {
  .app-shell { padding-left: 32px; padding-right: 32px; }
  .zodiac-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .apps-dialog { border-radius: 24px; margin-bottom: 7vh; }
  .story-dialog { border-radius: 24px; margin-bottom: 3vh; }
  .modal-overlay { align-items: end; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
