:root {
  color-scheme: light;
  --navy: #102343;
  --navy-2: #19365f;
  --ink: #18233a;
  --muted: #6f7888;
  --cream: #fffaf1;
  --paper: #ffffff;
  --canvas: #f3f4ed;
  --coral: #ff765f;
  --coral-dark: #e85643;
  --mint: #56cfac;
  --mint-dark: #229e7c;
  --gold: #ffc857;
  --line: #e5e7de;
  --shadow: 0 18px 50px rgba(16, 35, 67, .12);
  --shadow-small: 0 8px 20px rgba(16, 35, 67, .10);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 94px; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(86, 207, 172, .13), transparent 31rem),
    radial-gradient(circle at 86% 13%, rgba(255, 118, 95, .12), transparent 28rem),
    var(--canvas);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
.ambient { position: fixed; pointer-events: none; z-index: -1; border-radius: 50%; filter: blur(1px); opacity: .45; }
.ambient-one { width: 220px; height: 220px; background: rgba(255, 200, 87, .18); left: -80px; top: 42%; }
.ambient-two { width: 280px; height: 280px; background: rgba(86, 207, 172, .14); right: -140px; top: 67%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 78px;
  padding: 10px max(24px, calc((100% - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(243, 244, 237, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(16, 35, 67, .08);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { border-radius: 15px; box-shadow: 0 5px 16px rgba(16, 35, 67, .22); }
.brand span { display: grid; line-height: 1.12; }
.brand strong { font-size: 16px; letter-spacing: -.02em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.sync-status { display: flex; align-items: center; gap: 7px; margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.sync-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(86, 207, 172, .16); }
.sync-status.offline i { background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 118, 95, .15); }
.icon-button { width: 42px; height: 42px; border: 1px solid rgba(16, 35, 67, .1); border-radius: 14px; background: rgba(255, 255, 255, .72); cursor: pointer; font-size: 18px; transition: transform .18s ease, background .18s ease; }
.icon-button:hover { transform: translateY(-2px); background: white; }

main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.hero { min-height: 570px; padding: 66px 0 78px; display: grid; grid-template-columns: 1.04fr .96fr; gap: 60px; align-items: center; }
.hero-copy h1 { max-width: 650px; margin: 12px 0 20px; font-size: clamp(48px, 6.2vw, 82px); line-height: .96; letter-spacing: -.065em; color: var(--navy); }
.hero-copy h1 em { color: var(--coral); font-style: normal; }
.hero-copy p { max-width: 540px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.eyebrow { display: inline-block; color: var(--mint-dark); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.eyebrow.coral { color: var(--coral-dark); }
.eyebrow.mint { color: var(--mint-dark); }
.eyebrow.gold { color: #b77a00; }
.eyebrow.dark { color: rgba(255,255,255,.68); }
.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button { min-height: 49px; padding: 0 21px; display: inline-flex; justify-content: center; align-items: center; border: 0; border-radius: 15px; cursor: pointer; font-weight: 850; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px) scale(.99); }
.button.primary { color: white; background: var(--coral); box-shadow: 0 9px 0 #d74c3b, 0 16px 24px rgba(255, 118, 95, .22); margin-bottom: 9px; }
.button.primary:active { box-shadow: 0 5px 0 #d74c3b, 0 10px 18px rgba(255, 118, 95, .2); }
.button.ghost { color: var(--navy); background: rgba(255, 255, 255, .65); border: 1px solid rgba(16,35,67,.10); }
.button.light { color: var(--navy); background: white; box-shadow: 0 7px 0 rgba(6, 18, 37, .25); }
.button.wide { width: 100%; }
.button[disabled] { opacity: .56; cursor: default; transform: none; }

.level-card { position: relative; padding: 26px; color: white; background: linear-gradient(145deg, var(--navy-2), var(--navy)); border: 1px solid rgba(255,255,255,.08); border-radius: 34px; box-shadow: 0 28px 70px rgba(16, 35, 67, .27); overflow: hidden; }
.level-card::before { content: ""; position: absolute; width: 270px; height: 270px; border-radius: 50%; right: -110px; top: -140px; background: rgba(86, 207, 172, .13); }
.level-card::after { content: "✦"; position: absolute; right: 23px; top: 18px; color: var(--gold); font-size: 28px; transform: rotate(14deg); }
.level-emblem { position: absolute; left: 26px; top: 26px; width: 118px; height: 118px; padding: 7px; border-radius: 29px; background: linear-gradient(145deg, var(--gold), #fff0b0); box-shadow: 0 12px 28px rgba(0,0,0,.28); transform: rotate(-3deg); }
.level-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 22px; }
.level-content { min-height: 146px; padding-left: 142px; display: flex; flex-direction: column; justify-content: center; }
.level-kicker { color: rgba(255,255,255,.60); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.level-content > strong { font-size: 58px; line-height: 1; color: var(--gold); }
.xp-row { margin: 10px 0 8px; display: flex; justify-content: space-between; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 800; }
.progress-track { height: 9px; border-radius: 10px; background: rgba(255,255,255,.12); overflow: hidden; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #a3f1d9); box-shadow: 0 0 15px rgba(86, 207, 172, .5); transition: width .5s ease; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.11); padding-top: 20px; }
.hero-stats div { display: grid; text-align: center; border-right: 1px solid rgba(255,255,255,.11); }
.hero-stats div:last-child { border: 0; }
.hero-stats b { font-size: 21px; color: white; }
.hero-stats span { margin-top: 3px; color: rgba(255,255,255,.52); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.notify-banner { margin-bottom: 95px; min-height: 136px; padding: 24px 28px; display: grid; grid-template-columns: auto 1fr auto; gap: 21px; align-items: center; color: white; background: linear-gradient(120deg, #e95745, var(--coral) 55%, #ff8d72); border-radius: 26px; box-shadow: 0 18px 40px rgba(232, 86, 67, .23); }
.notify-banner.enabled { background: linear-gradient(120deg, #1e9676, var(--mint)); }
.notify-icon { position: relative; width: 66px; height: 66px; display: grid; place-items: center; border-radius: 21px; background: rgba(255,255,255,.18); font-size: 31px; }
.notify-icon i { position: absolute; right: 3px; top: 3px; width: 12px; height: 12px; background: var(--gold); border-radius: 50%; border: 3px solid var(--coral); }
.notify-banner.enabled .notify-icon i { border-color: var(--mint-dark); }
.notify-banner h2 { margin: 4px 0 5px; font-size: 22px; letter-spacing: -.03em; }
.notify-banner p { margin: 0; color: rgba(255,255,255,.78); font-size: 13px; }

.content-section { padding: 0 0 104px; }
.section-heading { margin-bottom: 27px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading h2 { margin: 7px 0 5px; color: var(--navy); font-size: clamp(31px, 4vw, 46px); letter-spacing: -.045em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.ring-stat { --progress: 0deg; width: 76px; height: 76px; flex: 0 0 76px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--coral) var(--progress), #e1e3db 0); position: relative; }
.ring-stat::before { content: ""; position: absolute; inset: 7px; background: var(--canvas); border-radius: 50%; }
.ring-stat span { position: relative; z-index: 1; color: var(--navy); font-size: 15px; font-weight: 900; }

.quest-list { display: grid; gap: 13px; }
.quest-card { min-height: 116px; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; background: rgba(255,255,255,.84); border: 1px solid rgba(16,35,67,.07); border-radius: 22px; box-shadow: var(--shadow-small); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.quest-card:hover { transform: translateY(-2px); }
.quest-card.complete { background: rgba(238, 253, 247, .86); border-color: rgba(86,207,172,.34); }
.quest-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; background: #f0f1eb; font-size: 31px; box-shadow: inset 0 -3px 0 rgba(16,35,67,.05); }
.quest-card.complete .quest-icon { background: rgba(86,207,172,.17); }
.quest-info h3 { margin: 0 0 6px; font-size: 17px; letter-spacing: -.02em; }
.quest-info p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.quest-meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 8px; border-radius: 7px; background: #f1f2ed; color: var(--muted); font-size: 10px; font-weight: 850; }
.pill.reward { color: #986500; background: #fff3c8; }
.quest-control { display: flex; align-items: center; gap: 8px; }
.quest-check, .counter-button { border: 0; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.quest-check { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; color: transparent; background: #e9ebe5; box-shadow: inset 0 -3px 0 rgba(16,35,67,.09); font-size: 23px; font-weight: 900; }
.quest-check:hover, .counter-button:hover { transform: scale(1.05); }
.quest-check.checked { color: white; background: var(--mint); box-shadow: inset 0 -3px 0 #34af8d; }
.counter { display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 16px; background: #f0f1ec; }
.counter-button { width: 38px; height: 38px; border-radius: 12px; background: white; color: var(--navy); font-size: 21px; font-weight: 900; box-shadow: 0 3px 8px rgba(16,35,67,.09); }
.counter-button.plus { color: white; background: var(--coral); }
.counter-value { min-width: 31px; text-align: center; font-size: 14px; font-weight: 900; }

.campaign-score { display: flex; align-items: center; gap: 10px; }
.campaign-score strong { color: var(--mint-dark); font-size: 45px; line-height: 1; }
.campaign-score span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.event-list { position: relative; display: grid; gap: 17px; }
.event-card { background: rgba(255,255,255,.87); border: 1px solid rgba(16,35,67,.08); border-radius: 24px; box-shadow: var(--shadow-small); overflow: hidden; }
.event-card[open] { box-shadow: var(--shadow); }
.event-card.today { border: 2px solid var(--coral); }
.event-card.done { border-color: rgba(86,207,172,.5); }
.event-card summary { list-style: none; padding: 20px 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; cursor: pointer; }
.event-card summary::-webkit-details-marker { display: none; }
.event-date { width: 61px; min-height: 64px; padding: 8px 3px; display: grid; place-items: center; align-content: center; border-radius: 17px; background: var(--navy); color: white; line-height: 1; }
.event-date strong { font-size: 25px; }
.event-date span { margin-top: 5px; color: rgba(255,255,255,.62); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.event-card.today .event-date { background: var(--coral); }
.event-card.done .event-date { background: var(--mint-dark); }
.event-title-row { min-width: 0; }
.event-title-row h3 { margin: 0 0 5px; font-size: 18px; letter-spacing: -.02em; }
.event-title-row p { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-badge { padding: 7px 10px; border-radius: 10px; color: var(--muted); background: #eff0eb; font-size: 10px; font-weight: 900; letter-spacing: .07em; white-space: nowrap; text-transform: uppercase; }
.status-badge.today { color: #b83324; background: #ffe0da; }
.status-badge.done { color: #147659; background: #d9f7ed; }
.event-body { padding: 0 22px 24px; }
.event-flavor { margin: 0 0 17px; padding: 15px 17px; color: var(--muted); background: #f5f5f0; border-left: 4px solid var(--gold); border-radius: 10px; font-size: 13px; line-height: 1.5; }
.event-progress-line { height: 7px; margin-bottom: 17px; border-radius: 8px; background: #e5e7e0; overflow: hidden; }
.event-progress-line i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint-dark), var(--mint)); border-radius: inherit; }
.event-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.event-item { min-height: 49px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #e5e7df; border-radius: 13px; background: white; text-align: left; cursor: pointer; color: var(--ink); }
.event-item i { width: 23px; height: 23px; flex: 0 0 23px; display: grid; place-items: center; border: 2px solid #d3d7ce; border-radius: 8px; color: transparent; font-style: normal; font-weight: 900; }
.event-item span { font-size: 12px; line-height: 1.3; }
.event-item.checked { background: #edf9f5; border-color: rgba(86,207,172,.38); color: #557069; }
.event-item.checked i { border-color: var(--mint); background: var(--mint); color: white; }
.event-item.checked span { text-decoration: line-through; }

.achievements-section { padding-bottom: 80px; }
.achievement-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.achievement-card { min-height: 190px; padding: 19px; position: relative; display: flex; flex-direction: column; background: rgba(255,255,255,.86); border: 1px solid rgba(16,35,67,.08); border-radius: 21px; overflow: hidden; }
.achievement-card.locked { filter: grayscale(.7); opacity: .58; }
.achievement-card.unlocked { border-color: rgba(255,200,87,.6); box-shadow: 0 12px 28px rgba(255,200,87,.13); }
.achievement-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 17px; background: #efefea; font-size: 27px; }
.achievement-card.unlocked .achievement-icon { background: #fff0ba; box-shadow: inset 0 -3px 0 rgba(183,122,0,.12); }
.achievement-card h3 { margin: 17px 0 6px; font-size: 15px; }
.achievement-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.lock-label { margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.achievement-card.unlocked .lock-label { color: #a06e07; }

footer { min-height: 118px; padding: 24px max(24px, calc((100% - 1180px) / 2)); display: flex; align-items: center; gap: 12px; color: white; background: var(--navy); }
footer img { border-radius: 13px; }
footer div { display: grid; }
footer strong { font-size: 14px; }
footer div span { margin-top: 3px; color: rgba(255,255,255,.48); font-size: 10px; }
.footer-motto { margin-left: auto; color: rgba(255,255,255,.55); font-size: 12px; }

dialog { width: min(440px, calc(100% - 28px)); padding: 32px; border: 0; border-radius: 27px; color: var(--ink); background: var(--cream); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10, 24, 48, .68); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 14px; top: 12px; width: 37px; height: 37px; border: 0; border-radius: 50%; background: #e9ebe4; color: var(--navy); cursor: pointer; font-size: 24px; }
.dialog-icon { width: 67px; height: 67px; display: grid; place-items: center; border-radius: 21px; background: #dff7ef; font-size: 34px; }
dialog h2 { margin: 20px 0 8px; color: var(--navy); font-size: 27px; letter-spacing: -.035em; }
dialog p, dialog li { color: var(--muted); font-size: 14px; line-height: 1.55; }
dialog ol { margin: 20px 0 25px; padding-left: 22px; }
dialog li { margin: 8px 0; padding-left: 4px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 28px); padding: 13px 18px; color: white; background: var(--navy); border-radius: 14px; box-shadow: 0 12px 35px rgba(16,35,67,.3); font-size: 13px; font-weight: 750; transform: translate(-50%, 130px); opacity: 0; transition: .28s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--coral-dark); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 15px; border-radius: 2px; animation: fall 1.7s ease-in forwards; }
@keyframes fall { to { transform: translate(var(--drift), 110vh) rotate(720deg); opacity: .8; } }
.skeleton-card { height: 116px; border-radius: 22px; background: linear-gradient(90deg, rgba(255,255,255,.55), white, rgba(255,255,255,.55)); background-size: 200% 100%; animation: shimmer 1.1s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
noscript { display: block; padding: 20px; text-align: center; color: white; background: var(--coral-dark); }

.mode-toggle {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(16, 35, 67, .12);
  border-radius: 8px;
  color: #fffaf1;
  background: #6f1d34;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}
.mode-toggle[aria-pressed="true"] { background: #153f35; }

.intro-loader[hidden], .romance-app[hidden] { display: none; }
.intro-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  color: white;
  background: #080a0e;
}
.intro-loader video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(8, 10, 14, .82), rgba(8, 10, 14, 0) 46%);
  pointer-events: none;
}
.intro-progress {
  position: absolute;
  left: 50%;
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  z-index: 1;
  width: min(620px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 12px 14px 13px;
  border-top: 1px solid rgba(247, 205, 126, .42);
  border-bottom: 1px solid rgba(247, 205, 126, .2);
  background: rgba(8, 10, 14, .68);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .3);
  backdrop-filter: blur(8px);
}
.intro-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}
.intro-progress-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.intro-progress-copy strong {
  flex: 0 0 auto;
  color: #f7cd7e;
  font-size: 12px;
}
.intro-progress-track {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, .2);
}
.intro-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #8f2945, #f7cd7e, #5fa48f);
  transition: width .12s linear;
}
.intro-start {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 7px 0 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, .14);
  color: #fff6e6;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}
.intro-start[hidden] { display: none; }
.intro-loader.leaving { opacity: 0; pointer-events: none; transition: opacity .42s ease; }
body.intro-active { overflow: hidden; }

body.romance-mode {
  color: #f8ecd6;
  background:
    linear-gradient(180deg, rgba(5, 9, 12, .92), rgba(16, 7, 13, .96)),
    #10070d;
}
body.romance-mode .guild-shell, body.romance-mode .ambient { display: none; }
body.romance-mode .topbar {
  color: #f8ecd6;
  background: rgba(11, 18, 18, .84);
  border-bottom-color: rgba(247, 205, 126, .2);
}
body.romance-mode .brand small, body.romance-mode .sync-status { color: rgba(248, 236, 214, .64); }
body.romance-mode .icon-button {
  color: #f8ecd6;
  border-color: rgba(247, 205, 126, .22);
  background: rgba(255, 250, 241, .08);
}

.romance-app {
  width: 100%;
  margin: 0;
  padding-bottom: 80px;
}
.romance-inner {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}
.romance-hero {
  min-height: 620px;
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 36px;
  align-items: end;
  padding: 56px 0 44px;
}
.romance-hero-copy {
  padding: 38px 0 22px;
}
.romance-hero h1 {
  max-width: 720px;
  margin: 12px 0 16px;
  color: #f7cd7e;
  font-size: 62px;
  line-height: 1.02;
  letter-spacing: 0;
}
.romance-hero p {
  max-width: 640px;
  margin: 0;
  color: rgba(248, 236, 214, .77);
  font-size: 18px;
  line-height: 1.65;
}
.romance-hero-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }
.button.romance-primary {
  color: #190b11;
  background: #f7cd7e;
  box-shadow: 0 7px 0 #a46728, 0 18px 34px rgba(247, 205, 126, .14);
}
.button.romance-secondary {
  color: #f8ecd6;
  border: 1px solid rgba(247, 205, 126, .25);
  background: rgba(255, 250, 241, .08);
}
.romance-portrait {
  min-height: 510px;
  display: grid;
  align-content: end;
  border: 1px solid rgba(247, 205, 126, .26);
  border-radius: 8px;
  overflow: hidden;
  background: #1b1014;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}
.romance-portrait img {
  width: 100%;
  height: 390px;
  object-fit: cover;
}
.portrait-caption {
  padding: 18px;
  border-top: 1px solid rgba(247, 205, 126, .18);
  background: rgba(9, 14, 16, .92);
}
.portrait-caption strong { display: block; color: #f7cd7e; font-size: 17px; }
.portrait-caption span { display: block; margin-top: 6px; color: rgba(248, 236, 214, .62); font-size: 12px; line-height: 1.45; }

.campaign-status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 54px;
}
.status-tile {
  min-height: 92px;
  padding: 15px;
  border: 1px solid rgba(247, 205, 126, .18);
  border-radius: 8px;
  background: rgba(255, 250, 241, .07);
}
.status-tile b { display: block; color: #f7cd7e; font-size: 26px; line-height: 1; }
.status-tile span { display: block; margin-top: 8px; color: rgba(248, 236, 214, .6); font-size: 11px; font-weight: 850; text-transform: uppercase; }

.romance-band {
  padding: 64px 0;
  border-top: 1px solid rgba(247, 205, 126, .12);
}
.romance-band h2 {
  margin: 7px 0 10px;
  color: #f7cd7e;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: 0;
}
.romance-band > .romance-inner > p, .band-copy {
  max-width: 720px;
  margin: 0 0 28px;
  color: rgba(248, 236, 214, .68);
  line-height: 1.65;
}
.campaign-grid {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  gap: 18px;
  align-items: start;
}
.chapter-panel, .side-panel, .relic-slot, .message-panel, .photo-memory {
  border: 1px solid rgba(247, 205, 126, .18);
  border-radius: 8px;
  background: rgba(255, 250, 241, .075);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .18);
}
.chapter-panel { padding: 22px; }
.chapter-panel.locked { opacity: .56; filter: grayscale(.42); }
.chapter-panel > h3 { margin: 0 0 14px; color: #f7cd7e; font-size: 20px; }
.chapter-title {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}
.chapter-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #190b11;
  background: #f7cd7e;
  font-size: 24px;
  font-weight: 900;
}
.chapter-title h3 { margin: 0; color: #fff7e8; font-size: 23px; line-height: 1.2; }
.chapter-title p { margin: 5px 0 0; color: rgba(248, 236, 214, .62); font-size: 13px; line-height: 1.4; }
.chapter-badge {
  padding: 7px 9px;
  border-radius: 8px;
  color: #f7cd7e;
  background: rgba(247, 205, 126, .11);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.story-quote {
  margin: 20px 0;
  padding: 17px;
  border-left: 4px solid #8d2f45;
  border-radius: 8px;
  color: rgba(248, 236, 214, .78);
  background: rgba(13, 21, 18, .66);
  line-height: 1.65;
}
.task-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.task-chip {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(247, 205, 126, .18);
  border-radius: 8px;
  color: #f8ecd6;
  background: rgba(255, 250, 241, .06);
  cursor: pointer;
  text-align: left;
}
.task-chip:disabled, .map-node:disabled { cursor: default; }
.task-chip.done {
  color: #10251e;
  border-color: rgba(116, 207, 153, .46);
  background: #9ee0b5;
}
.chapter-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.chapter-note { margin: 15px 0 0; color: rgba(248, 236, 214, .58); font-size: 12px; line-height: 1.5; }
.side-stack { display: grid; gap: 14px; }
.side-panel { padding: 18px; }
.side-panel h3 { margin: 0 0 10px; color: #f7cd7e; font-size: 18px; }
.side-panel p { margin: 0; color: rgba(248, 236, 214, .68); font-size: 13px; line-height: 1.55; }
.familiar-orb {
  width: 112px;
  height: 112px;
  margin: 4px auto 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(247, 205, 126, .42);
  border-radius: 50%;
  color: #f7cd7e;
  background: #1d1115;
  box-shadow: inset 0 0 26px rgba(247, 205, 126, .16), 0 0 26px rgba(116, 207, 153, .12);
  font-size: 48px;
}
.familiar-orb.awake { color: #9ee0b5; box-shadow: inset 0 0 30px rgba(116, 207, 153, .24), 0 0 34px rgba(116, 207, 153, .24); }
.mini-form { margin-top: 13px; display: grid; gap: 9px; }
.mini-form input, .mini-form select, .mini-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(247, 205, 126, .22);
  border-radius: 8px;
  color: #fff7e8;
  background: rgba(0, 0, 0, .18);
}
.mini-form textarea { resize: vertical; min-height: 86px; }

.map-list { display: grid; gap: 10px; }
.map-node {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(247, 205, 126, .15);
  border-radius: 8px;
  background: rgba(255, 250, 241, .06);
}
.map-node.locked { opacity: .5; }
.map-node.done { border-color: rgba(116, 207, 153, .36); background: rgba(116, 207, 153, .12); }
.map-node i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #190b11;
  background: #f7cd7e;
  font-style: normal;
  font-weight: 900;
}
.map-node strong { color: #fff7e8; font-size: 14px; }
.map-node span { color: rgba(248, 236, 214, .6); font-size: 11px; }

.dice-stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 20px;
  border: 1px solid rgba(247, 205, 126, .18);
  border-radius: 8px;
  background: rgba(13, 21, 18, .66);
}
.dice-face {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #190b11;
  background: linear-gradient(145deg, #fff6dd, #dba85d);
  box-shadow: inset -8px -10px 0 rgba(119, 72, 30, .26), 0 18px 28px rgba(0, 0, 0, .3);
  font-size: 56px;
  font-weight: 950;
}
.dice-face.rolling { animation: dice-roll .72s ease; }
@keyframes dice-roll {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(24deg) scale(1.08); }
  70% { transform: rotate(-18deg) scale(.96); }
  100% { transform: rotate(0deg) scale(1); }
}
.dice-stage h3 { margin: 0 0 7px; color: #f7cd7e; }
.dice-stage p { margin: 0 0 14px; color: rgba(248, 236, 214, .68); line-height: 1.5; }

.inventory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.relic-slot { min-height: 182px; padding: 16px; display: flex; flex-direction: column; }
.relic-slot.locked { opacity: .68; }
.relic-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #f7cd7e;
  background: rgba(247, 205, 126, .1);
  font-size: 28px;
}
.relic-slot h3 { margin: 14px 0 7px; color: #fff7e8; font-size: 16px; }
.relic-slot p { margin: 0; color: rgba(248, 236, 214, .62); font-size: 12px; line-height: 1.45; }
.relic-slot small { margin-top: auto; padding-top: 12px; color: rgba(247, 205, 126, .74); font-size: 10px; font-weight: 900; text-transform: uppercase; }

.message-list, .side-quest-list { display: grid; gap: 10px; }
.message-panel { padding: 15px; }
.message-panel strong { color: #fff7e8; }
.message-panel p { margin: 7px 0 0; color: rgba(248, 236, 214, .68); line-height: 1.5; }

.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.photo-memory { min-height: 170px; overflow: hidden; }
.photo-memory img { width: 100%; height: 150px; object-fit: cover; display: block; }
.photo-memory figcaption { padding: 10px; color: rgba(248, 236, 214, .66); font-size: 11px; line-height: 1.35; }
.final-scene {
  padding: 24px;
  border: 1px solid rgba(247, 205, 126, .22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(111, 29, 52, .38), rgba(21, 63, 53, .44));
}
.final-scene h3 { margin: 0 0 12px; color: #f7cd7e; font-size: 26px; }
.final-cast { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.final-cast span { padding: 8px 10px; border-radius: 8px; background: rgba(255, 250, 241, .1); }

/* Romantic mode */
.mode-toggle {
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 3px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(16, 35, 67, .12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(16, 35, 67, .12);
}
.mode-toggle[aria-pressed="true"] { background: #F7E9F2; }
.mode-toggle svg {
  width: 24px;
  height: 24px;
  display: block;
  color: #4B2E58;
}

.intro-loader::after { display: none; }
.intro-progress {
  bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
  width: min(620px, calc(100% - 32px));
  height: 3px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: rgba(255, 255, 255, .3);
  box-shadow: none;
  backdrop-filter: none;
}
.intro-progress > i {
  display: block;
  width: 0;
  height: 100%;
  background: #FFFFFF;
  transition: width .12s linear;
}
.intro-progress-copy, .intro-progress-track { display: contents; }
.intro-start {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.intro-skip {
  position: absolute;
  z-index: 4;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(44px, calc(36px + env(safe-area-inset-bottom)));
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  color: #FFFFFF;
  background: rgba(0, 0, 0, .34);
  backdrop-filter: blur(8px);
  cursor: pointer;
  animation: intro-skip-in .2s ease-out;
}
.intro-skip svg { width: 22px; height: 22px; }
.intro-skip[hidden] { display: none; }
@keyframes intro-skip-in {
  from { opacity: 0; transform: translateY(6px); }
}
.intro-loader { touch-action: manipulation; }

body.romance-mode {
  --romance-bg: #FFF7FA;
  --romance-card: #F7E9F2;
  --romance-primary: #7A4C8E;
  --romance-primary-hover: #654074;
  --romance-dark: #4B2E58;
  --romance-pink: #D989A5;
  --romance-peach: #F3B28D;
  --romance-gold: #D9A461;
  --romance-text: #3F2A3E;
  --romance-muted: #806A7C;
  --romance-line: #E8D3E1;
  --romance-white: #FFFFFF;
  color: var(--romance-text);
  background: var(--romance-bg);
}
body.romance-mode .guild-shell,
body.romance-mode .ambient,
body.romance-mode .sync-status,
body.romance-mode #install-button,
body.romance-mode #header-notify-button {
  display: none;
}
body.romance-mode .topbar {
  color: var(--romance-text);
  background: rgba(255, 247, 250, .94);
  border-bottom-color: var(--romance-line);
}
body.romance-mode .brand small { color: var(--romance-muted); }
body.romance-mode .brand img { box-shadow: 0 5px 16px rgba(75, 46, 88, .16); }

.romance-app {
  width: 100%;
  min-height: calc(100vh - 78px);
  margin: 0;
  padding: 0 0 calc(78px + env(safe-area-inset-bottom));
  color: var(--romance-text);
  background: var(--romance-bg);
}
.romance-shell {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}
.romance-view-heading {
  padding: 34px 0 24px;
  border-bottom: 1px solid var(--romance-line);
}
.romance-view-heading > span,
.section-mini-heading > span,
.profile-summary > div > span,
.final-scene > span {
  color: var(--romance-primary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}
.romance-view-heading h1 {
  margin: 7px 0 4px;
  color: var(--romance-dark);
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: 0;
}
.romance-view-heading p {
  margin: 0;
  color: var(--romance-muted);
  font-size: 14px;
}
.romance-view {
  display: grid;
  gap: 26px;
  padding: 28px 0 48px;
}
.romance-section {
  display: grid;
  gap: 16px;
}
.section-mini-heading h2 {
  margin: 5px 0 0;
  color: var(--romance-dark);
  font-size: 24px;
  letter-spacing: 0;
}

.button.romance-primary,
.button.romance-secondary {
  min-height: 46px;
  border-radius: 8px;
  box-shadow: none;
}
.button.romance-primary {
  color: var(--romance-white);
  background: var(--romance-primary);
}
.button.romance-primary:hover { background: var(--romance-primary-hover); }
.button.romance-secondary {
  color: var(--romance-primary);
  border: 1px solid var(--romance-line);
  background: var(--romance-white);
}
.button.romance-secondary:hover {
  color: var(--romance-white);
  background: var(--romance-primary-hover);
}
.button.romance-danger {
  min-height: 46px;
  border: 1px solid var(--romance-pink);
  border-radius: 8px;
  color: var(--romance-dark);
  background: #FFFFFF;
  box-shadow: none;
}
.button.romance-danger:hover {
  color: #FFFFFF;
  background: var(--romance-pink);
}

.romance-bottom-nav {
  position: fixed;
  z-index: 40;
  left: 0;
  bottom: 0;
  width: 100%;
  min-height: 70px;
  padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  border: 0;
  border-top: 1px solid var(--romance-line);
  border-radius: 0;
  background: var(--romance-white);
  box-shadow: 0 -8px 28px rgba(75, 46, 88, .12);
  transform: none;
}
.romance-bottom-nav button {
  min-width: 0;
  min-height: 56px;
  padding: 5px 2px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  color: var(--romance-muted);
  background: transparent;
  cursor: pointer;
}
.romance-bottom-nav button:hover { color: var(--romance-primary-hover); }
.romance-bottom-nav button.active {
  color: var(--romance-dark);
  background: var(--romance-card);
}
.romance-bottom-nav i {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-style: normal;
  line-height: 1;
}
.romance-bottom-nav .lucide {
  width: 22px;
  height: 22px;
  display: block;
}
.romance-bottom-nav span {
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.romance-shell-familiar {
  width: 100%;
  max-width: none;
}
.romance-shell-familiar .romance-view-heading {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}
.romance-shell-familiar .romance-view {
  padding: 0;
}
.familiar-stage {
  min-height: calc(100dvh - 247px);
  padding: 16px 20px 20px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #F7E9F2 0%, #FFF7FA 72%, #F3B28D 160%);
}
.familiar-companion {
  --familiar-scale: 1;
  position: relative;
  width: 270px;
  height: 256px;
  animation: familiar-idle 3.8s ease-in-out infinite;
}
.familiar-shadow {
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 156px;
  height: 24px;
  border-radius: 50%;
  background: rgba(75, 46, 88, .16);
  transform: translateX(-50%);
  animation: familiar-shadow 3.8s ease-in-out infinite;
}
.familiar-tail {
  position: absolute;
  z-index: 0;
  right: 16px;
  bottom: 8px;
  width: 102px;
  height: 152px;
  border: 3px solid var(--romance-dark);
  border-radius: 70% 70% 78% 34%;
  background: var(--romance-pink);
  transform: rotate(24deg);
  transform-origin: 24px 130px;
  animation: familiar-tail 2.9s ease-in-out infinite;
}
.familiar-creature {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  width: 178px;
  height: 194px;
  border: 3px solid var(--romance-dark);
  border-radius: 48% 48% 42% 42%;
  background: var(--romance-primary);
  transform: translateX(-50%);
}
.familiar-ear {
  position: absolute;
  z-index: 0;
  top: -54px;
  width: 68px;
  height: 78px;
  background: var(--romance-primary);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.familiar-ear b {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 34px;
  height: 48px;
  background: var(--romance-pink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
}
.familiar-ear-left { left: 2px; transform: rotate(-12deg); }
.familiar-ear-right { right: 2px; transform: rotate(12deg); }
.familiar-face {
  position: absolute;
  z-index: 3;
  top: 37px;
  left: 50%;
  display: flex;
  gap: 9px;
  transform: translateX(-50%);
}
.familiar-eye {
  position: relative;
  width: 49px;
  height: 54px;
  display: block;
  overflow: hidden;
  border: 3px solid var(--romance-dark);
  border-radius: 50%;
  background: var(--romance-white);
  transform-origin: center;
  animation: familiar-blink 5.2s ease-in-out infinite;
}
.familiar-eye b {
  position: absolute;
  left: 13px;
  bottom: 6px;
  width: 24px;
  height: 30px;
  border-radius: 50%;
  background: var(--romance-dark);
}
.familiar-eye b::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 7px;
  height: 9px;
  border-radius: 50%;
  background: var(--romance-white);
}
.familiar-nose {
  position: absolute;
  top: 51px;
  left: 50%;
  width: 16px;
  height: 12px;
  border-radius: 50% 50% 60% 60%;
  background: var(--romance-dark);
  transform: translateX(-50%);
}
.familiar-smile {
  position: absolute;
  top: 60px;
  left: 50%;
  width: 38px;
  height: 19px;
  border-bottom: 4px solid var(--romance-white);
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
}
.familiar-belly {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 108px;
  height: 92px;
  border-radius: 50% 50% 42% 42%;
  background: var(--romance-card);
  transform: translateX(-50%);
}
.familiar-charm {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 59px;
  width: 24px;
  height: 24px;
  border: 3px solid var(--romance-white);
  background: var(--romance-gold);
  transform: translateX(-50%) rotate(45deg);
}
.familiar-arm {
  position: absolute;
  z-index: 2;
  bottom: 49px;
  width: 31px;
  height: 90px;
  border: 3px solid var(--romance-dark);
  border-radius: 50%;
  background: var(--romance-primary);
}
.familiar-arm-left { left: -17px; transform: rotate(16deg); }
.familiar-arm-right { right: -17px; transform: rotate(-16deg); }
.familiar-foot {
  position: absolute;
  z-index: 2;
  bottom: -15px;
  width: 67px;
  height: 35px;
  border: 3px solid var(--romance-dark);
  border-radius: 50%;
  background: var(--romance-peach);
}
.familiar-foot-left { left: 7px; transform: rotate(-6deg); }
.familiar-foot-right { right: 7px; transform: rotate(6deg); }
.familiar-name-form {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}
.familiar-name-form input {
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid var(--romance-line);
  border-radius: 0;
  color: var(--romance-dark);
  background: transparent;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.familiar-name-form input:focus {
  outline: 0;
  border-bottom-color: var(--romance-primary);
}
.familiar-name-form input::placeholder {
  color: var(--romance-muted);
  font-weight: 700;
}
.familiar-name-form button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--romance-white);
  background: var(--romance-primary);
  cursor: pointer;
}
.familiar-name-form button:hover { background: var(--romance-primary-hover); }
.familiar-name-form .lucide { width: 20px; height: 20px; }
.familiar-progress {
  width: min(520px, 100%);
  margin-top: -8px;
}
.familiar-progress-copy {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--romance-dark);
}
.familiar-progress-copy strong { font-size: 18px; }
.familiar-progress-copy span { color: var(--romance-muted); font-size: 12px; font-weight: 800; }
.familiar-progress-track {
  height: 18px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  background: var(--romance-white);
}
.familiar-progress-track i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: repeating-linear-gradient(135deg, var(--romance-primary) 0 12px, var(--romance-pink) 12px 24px);
  transition: width .35s ease;
}
.familiar-progress p {
  margin: 9px 0 0;
  color: var(--romance-muted);
  font-size: 13px;
  text-align: center;
}
@keyframes familiar-idle {
  0%, 100% { transform: translateY(0) rotate(-.5deg) scale(var(--familiar-scale)); }
  50% { transform: translateY(-9px) rotate(.5deg) scale(var(--familiar-scale)); }
}
@keyframes familiar-tail {
  0%, 100% { transform: rotate(20deg); }
  50% { transform: rotate(31deg); }
}
@keyframes familiar-shadow {
  0%, 100% { opacity: .76; transform: translateX(-50%) scaleX(1); }
  50% { opacity: .48; transform: translateX(-50%) scaleX(.84); }
}
@keyframes familiar-blink {
  0%, 44%, 48%, 100% { transform: scaleY(1); }
  46% { transform: scaleY(.08); }
}

.adventure-map {
  position: relative;
  min-height: 610px;
  padding: 18px 0;
  display: grid;
  gap: 16px;
  overflow: hidden;
}
.map-trail {
  position: absolute;
  z-index: 0;
  top: 34px;
  bottom: 34px;
  left: 50%;
  width: 3px;
  background: repeating-linear-gradient(to bottom, var(--romance-line) 0 10px, transparent 10px 18px);
  transform: translateX(-50%);
}
.map-node {
  position: relative;
  z-index: 1;
  width: min(72%, 680px);
  min-height: 76px;
  padding: 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  color: var(--romance-text);
  background: var(--romance-white);
  box-shadow: 0 8px 22px rgba(75, 46, 88, .08);
  cursor: pointer;
  text-align: left;
}
.map-node:nth-of-type(even) { justify-self: end; }
.map-node:nth-of-type(odd) { justify-self: start; }
.map-node:hover,
.map-node.selected {
  border-color: var(--romance-primary);
  box-shadow: 0 10px 28px rgba(122, 76, 142, .15);
}
.map-node.locked { opacity: .58; }
.map-node.done {
  border-color: var(--romance-pink);
  background: var(--romance-card);
}
.map-node i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--romance-white);
  background: var(--romance-primary);
  font-size: 15px;
  font-style: normal;
  font-weight: 900;
}
.map-node.done i { background: var(--romance-pink); }
.map-node strong {
  display: block;
  overflow: hidden;
  color: var(--romance-dark);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-node small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--romance-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-node b {
  color: var(--romance-primary);
  font-size: 10px;
  text-transform: uppercase;
}
.map-detail {
  padding: 22px;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  background: var(--romance-card);
}
.map-detail-title {
  display: flex;
  align-items: center;
  gap: 13px;
}
.map-detail-title > span {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 8px;
  color: var(--romance-dark);
  background: var(--romance-peach);
  font-size: 24px;
}
.map-detail-title small { color: var(--romance-primary); font-size: 10px; font-weight: 900; }
.map-detail h2 { margin: 3px 0 0; color: var(--romance-dark); font-size: 23px; letter-spacing: 0; }
.map-detail > p { color: var(--romance-muted); line-height: 1.55; }
.map-detail .map-route { color: var(--romance-primary); font-weight: 800; }
.map-task-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.map-task-tags span {
  padding: 7px 9px;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  color: var(--romance-text);
  background: var(--romance-white);
  font-size: 11px;
}
.map-dice-fab {
  position: fixed;
  z-index: 35;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--romance-line);
  border-radius: 50%;
  color: var(--romance-white);
  background: var(--romance-primary);
  box-shadow: 0 10px 26px rgba(75, 46, 88, .28);
  cursor: pointer;
}
.map-dice-fab:hover { background: var(--romance-primary-hover); }
.map-dice-fab .lucide { width: 27px; height: 27px; }

.romance-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}
.romance-modal-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(63, 42, 62, .58);
  backdrop-filter: blur(5px);
}
.romance-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  color: var(--romance-text);
  background: var(--romance-white);
  box-shadow: 0 24px 70px rgba(75, 46, 88, .32);
}
.romance-modal-close {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--romance-line);
  border-radius: 50%;
  color: var(--romance-dark);
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
}
.romance-modal-close .lucide { width: 20px; height: 20px; }
.romance-modal-panel .map-detail {
  padding: 28px;
  border: 0;
  background: var(--romance-white);
}
.romance-modal-panel .map-detail-title { padding-right: 48px; }
.completion-dialog,
.prize-dialog {
  padding: 34px 28px 28px;
  text-align: center;
}
.completion-dialog small,
.prize-dialog small {
  display: block;
  margin-top: 14px;
  color: var(--romance-primary);
  font-size: 10px;
  font-weight: 900;
}
.completion-dialog h2,
.prize-dialog h2 {
  margin: 7px 0 10px;
  color: var(--romance-dark);
  font-size: 28px;
  letter-spacing: 0;
}
.completion-dialog p,
.prize-dialog p {
  margin: 0 auto 18px;
  color: var(--romance-muted);
  line-height: 1.55;
}
.completion-dialog > strong {
  display: block;
  margin: 13px 0 20px;
  color: var(--romance-dark);
  font-size: 13px;
}
.completion-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--romance-white);
  background: var(--romance-pink);
}
.completion-mark .lucide { width: 30px; height: 30px; }
.completion-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.completion-photos img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border-radius: 6px;
  object-fit: cover;
}
.prize-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--romance-dark);
  background: var(--romance-card);
  font-size: 38px;
}
.photo-lightbox .romance-modal-panel {
  width: min(980px, 100%);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  border-color: rgba(255, 255, 255, .22);
  background: #211722;
}
.photo-lightbox figure { margin: 0; }
.photo-lightbox figure img {
  width: 100%;
  max-height: calc(100dvh - 84px);
  display: block;
  object-fit: contain;
}
.photo-lightbox figcaption {
  padding: 12px 58px 13px 16px;
  overflow: hidden;
  color: #FFFFFF;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-panel,
.side-panel,
.relic-slot,
.message-panel,
.photo-memory,
.dice-stage {
  border-color: var(--romance-line);
  border-radius: 8px;
  color: var(--romance-text);
  background: var(--romance-white);
  box-shadow: 0 8px 22px rgba(75, 46, 88, .07);
}
.side-panel { padding: 20px; }
.side-panel h3,
.dice-stage h3,
.relic-slot h3,
.message-panel strong {
  color: var(--romance-dark);
}
.side-panel p,
.dice-stage p,
.relic-slot p,
.message-panel p,
.chapter-note {
  color: var(--romance-muted);
}
.familiar-layout {
  display: grid;
  grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr);
  gap: 22px;
  align-items: start;
}
.familiar-orb {
  width: 144px;
  height: 144px;
  overflow: hidden;
  border: 1px solid var(--romance-line);
  color: var(--romance-primary);
  background: var(--romance-card);
  box-shadow: inset 0 0 30px rgba(122, 76, 142, .12);
  font-size: 52px;
}
.familiar-orb.awake { box-shadow: 0 10px 28px rgba(217, 137, 165, .22); }
.familiar-orb img { width: 100%; height: 100%; object-fit: cover; }
.message-list, .side-quest-list { display: grid; gap: 10px; }
.message-panel { padding: 15px; }
.message-panel p { line-height: 1.5; }

.mini-form input,
.mini-form select,
.mini-form textarea {
  border-color: var(--romance-line);
  border-radius: 8px;
  color: var(--romance-text);
  background: var(--romance-white);
}
.mini-form input:focus,
.mini-form select:focus,
.mini-form textarea:focus {
  outline: 2px solid rgba(122, 76, 142, .2);
  border-color: var(--romance-primary);
}

.dice-stage {
  grid-template-columns: auto minmax(0, 1fr);
  padding: 20px;
}
.dice-face {
  color: var(--romance-dark);
  background: var(--romance-gold);
  box-shadow: inset -7px -8px 0 rgba(75, 46, 88, .14);
}
.dice-screen {
  position: relative;
  min-height: min(610px, calc(100dvh - 250px));
  padding: 26px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--romance-card), var(--romance-bg));
}
.dice-back {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--romance-line);
  border-radius: 50%;
  color: var(--romance-dark);
  background: var(--romance-white);
  cursor: pointer;
}
.dice-back .lucide { width: 21px; height: 21px; }
.dice-chapter {
  color: var(--romance-primary);
  font-size: 10px;
  font-weight: 900;
}
.dice-tap-zone {
  width: min(420px, 100%);
  min-height: 250px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.interactive-die {
  width: 154px;
  height: 154px;
  display: grid;
  place-items: center;
  border: 2px solid var(--romance-dark);
  border-radius: 22px;
  color: var(--romance-dark);
  background: var(--romance-gold);
  box-shadow: inset -12px -14px 0 rgba(75, 46, 88, .12), 0 20px 38px rgba(75, 46, 88, .2);
  font-size: 74px;
  font-weight: 950;
  user-select: none;
}
.interactive-die.spinning { animation: charged-die var(--dice-speed) linear infinite; }
@keyframes charged-die {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(92deg) scale(1.07); }
  50% { transform: rotate(184deg) scale(.95); }
  75% { transform: rotate(276deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}
.dice-power {
  width: min(440px, 100%);
  padding: 15px;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  background: var(--romance-white);
}
.dice-power > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--romance-primary);
  font-size: 10px;
  font-weight: 900;
}
.dice-power-track {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--romance-line);
}
.dice-power-track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--romance-pink);
  transition: width .16s ease;
}
.dice-power p {
  margin: 9px 0 0;
  color: var(--romance-muted);
  font-size: 12px;
  text-align: center;
}
.dice-screen-empty {
  color: var(--romance-muted);
  text-align: center;
}
.dice-screen-empty > span .lucide { width: 54px; height: 54px; }
.dice-screen-empty h2 {
  margin: 0;
  color: var(--romance-dark);
  font-size: 23px;
  letter-spacing: 0;
}
.dice-screen-empty .button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dice-screen-empty .lucide { width: 18px; height: 18px; }
.inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.relic-slot { min-width: 0; background: var(--romance-card); }
.relic-slot.locked { opacity: 1; background: var(--romance-white); }
.relic-icon {
  color: var(--romance-primary);
  background: rgba(217, 137, 165, .18);
}
.relic-slot small { color: var(--romance-primary); }

.chronicle-status {
  min-height: 74px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--romance-line);
  border-bottom: 1px solid var(--romance-line);
}
.chronicle-status span { color: var(--romance-primary); font-size: 34px; font-weight: 900; }
.chronicle-status p { margin: 0; color: var(--romance-muted); }
.photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.photo-memory {
  position: relative;
  min-width: 0;
  min-height: 210px;
  margin: 0;
  background: var(--romance-card);
}
.photo-memory img { height: 180px; }
.photo-open {
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.photo-open img { transition: transform .2s ease; }
.photo-open:hover img { transform: scale(1.025); }
.photo-memory figcaption {
  color: var(--romance-muted);
  background: var(--romance-white);
}
.photo-memory.locked { background: var(--romance-dark); }
.photo-memory.locked img {
  filter: grayscale(1) brightness(.2);
  opacity: .76;
}
.photo-memory.locked figcaption {
  color: var(--romance-line);
  background: var(--romance-dark);
}
.photo-lock {
  position: absolute;
  z-index: 2;
  top: 78px;
  left: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  color: var(--romance-white);
  background: rgba(75, 46, 88, .76);
  font-size: 24px;
  transform: translateX(-50%);
}
.chronicle-actions {
  margin-top: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.chronicle-quest-form {
  margin: 0;
  grid-template-columns: minmax(0, 1fr) auto;
}

.profile-summary {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--romance-line);
  border-bottom: 1px solid var(--romance-line);
  background: var(--romance-card);
}
.profile-summary img {
  width: 116px;
  height: 116px;
  flex: 0 0 116px;
  border: 1px solid var(--romance-line);
  border-radius: 8px;
  object-fit: cover;
}
.profile-summary h2 { margin: 6px 0; color: var(--romance-dark); font-size: 30px; letter-spacing: 0; }
.profile-summary p { margin: 0; color: var(--romance-muted); }
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: 20px;
  align-items: start;
}
.profile-settings { display: grid; gap: 10px; }
.final-scene {
  padding: 24px;
  border-color: var(--romance-line);
  background: var(--romance-card);
}
.final-scene h3 { color: var(--romance-dark); }
.final-scene p { color: var(--romance-muted); }
.final-cast span {
  color: var(--romance-text);
  background: var(--romance-white);
}
.toast {
  border-radius: 8px;
}
body.romance-mode .toast {
  bottom: calc(78px + env(safe-area-inset-bottom));
  color: var(--romance-white);
  background: var(--romance-dark);
}

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; gap: 38px; }
  .hero-copy { text-align: center; }
  .hero-copy p { margin-inline: auto; }
  .hero-buttons { justify-content: center; }
  .level-card { width: min(560px, 100%); margin: 0 auto; }
  .achievement-grid { grid-template-columns: repeat(2, 1fr); }
  .notify-banner { grid-template-columns: auto 1fr; }
  .notify-banner .button { grid-column: 1 / -1; }
  .profile-layout { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .topbar { height: 68px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand img { width: 43px; height: 43px; }
  .brand strong { font-size: 14px; }
  .brand small, .sync-status span { display: none; }
  .sync-status { margin-right: 2px; }
  .mode-toggle { width: 42px; height: 42px; min-height: 42px; padding: 3px; }
  .mode-toggle svg { width: 22px; height: 22px; }
  main { width: min(100% - 28px, 1180px); }
  body.romance-mode main.romance-app { width: 100%; }
  .hero { min-height: auto; padding: 45px 0 65px; }
  .hero-copy h1 { font-size: clamp(45px, 14vw, 67px); }
  .hero-copy p { font-size: 15px; }
  .hero-buttons .button { flex: 1; min-width: 145px; padding-inline: 12px; }
  .level-card { padding: 20px; border-radius: 26px; }
  .level-emblem { left: 20px; top: 21px; width: 90px; height: 90px; border-radius: 23px; }
  .level-emblem img { border-radius: 17px; }
  .level-content { min-height: 118px; padding-left: 105px; }
  .level-content > strong { font-size: 48px; }
  .notify-banner { margin-bottom: 76px; padding: 21px; grid-template-columns: auto 1fr; gap: 14px; border-radius: 22px; }
  .notify-icon { width: 55px; height: 55px; border-radius: 17px; font-size: 26px; }
  .notify-banner h2 { font-size: 18px; }
  .notify-banner p { display: none; }
  .content-section { padding-bottom: 80px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 34px; }
  .section-heading p { display: none; }
  .ring-stat { width: 65px; height: 65px; flex-basis: 65px; }
  .quest-card { min-height: 106px; padding: 15px; grid-template-columns: auto 1fr auto; gap: 12px; }
  .quest-icon { width: 54px; height: 54px; border-radius: 17px; font-size: 27px; }
  .quest-info h3 { font-size: 14px; }
  .quest-info p { display: none; }
  .quest-meta { margin-top: 7px; }
  .quest-check { width: 44px; height: 44px; border-radius: 14px; }
  .counter { flex-direction: column-reverse; gap: 4px; padding: 5px; }
  .counter-button { width: 34px; height: 31px; }
  .counter-value { min-width: auto; font-size: 11px; }
  .event-card summary { padding: 15px; gap: 11px; }
  .event-date { width: 52px; min-height: 57px; border-radius: 15px; }
  .event-title-row h3 { font-size: 15px; }
  .event-title-row p { font-size: 10px; }
  .status-badge { padding: 6px 7px; font-size: 8px; }
  .event-body { padding: 0 15px 18px; }
  .event-items { grid-template-columns: 1fr; }
  .achievement-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .achievement-card { min-height: 178px; padding: 15px; }
  .achievement-card h3 { font-size: 13px; }
  footer { padding: 24px 18px calc(24px + env(safe-area-inset-bottom)); }
  .footer-motto { display: none; }
  .intro-progress {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100% - 20px);
  }
  .intro-skip {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(34px, calc(28px + env(safe-area-inset-bottom)));
  }
  .romance-shell { width: min(100% - 24px, 1080px); }
  .romance-view-heading { padding: 25px 0 18px; }
  .romance-view-heading h1 { font-size: 32px; }
  .romance-view { gap: 20px; padding-top: 20px; }
  .romance-bottom-nav { width: 100%; bottom: 0; padding-inline: 5px; }
  .romance-bottom-nav span { font-size: 9px; }
  .romance-shell.romance-shell-familiar { width: 100%; }
  .romance-shell-familiar .romance-view-heading { width: calc(100% - 24px); }
  .familiar-stage {
    min-height: calc(100dvh - 214px);
    padding: 14px 18px 24px;
    gap: 11px;
  }
  .familiar-companion {
    --familiar-scale: .88;
    width: 250px;
    height: 276px;
    margin: -10px 0;
  }
  .familiar-shadow { bottom: 16px; }
  .familiar-tail { bottom: 42px; }
  .familiar-creature { bottom: 34px; }
  .adventure-map { min-height: auto; }
  .map-trail { left: 21px; transform: none; }
  .map-node,
  .map-node:nth-of-type(even),
  .map-node:nth-of-type(odd) { width: 100%; justify-self: stretch; }
  .map-node { grid-template-columns: 44px minmax(0, 1fr); }
  .map-node b { grid-column: 2; }
  .map-detail { padding: 17px; }
  .map-detail h2 { font-size: 19px; }
  .romance-modal { padding-inline: 12px; }
  .romance-modal-panel .map-detail,
  .completion-dialog,
  .prize-dialog { padding: 24px 18px 20px; }
  .romance-modal-panel .map-detail-title { padding-right: 42px; }
  .completion-dialog h2,
  .prize-dialog h2 { font-size: 23px; }
  .map-dice-fab {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
  }
  .task-grid, .inventory-grid { grid-template-columns: 1fr; }
  .dice-stage { grid-template-columns: 1fr; }
  .dice-face { width: 92px; height: 92px; font-size: 48px; }
  .dice-screen {
    min-height: calc(100dvh - 230px);
    padding: 22px 14px;
  }
  .dice-tap-zone { min-height: 230px; }
  .interactive-die { width: 132px; height: 132px; font-size: 62px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-memory { min-height: 164px; }
  .photo-memory img { height: 132px; }
  .photo-lock { top: 50px; }
  .chronicle-actions { grid-template-columns: 1fr; }
  .chronicle-quest-form { grid-template-columns: 1fr; }
  .profile-summary { align-items: flex-start; }
  .profile-summary img { width: 84px; height: 84px; flex-basis: 84px; }
  .profile-summary h2 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
