:root {
  --ink: #15171c;
  --muted: #697386;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --line: #e3e8f0;
  --blue: #2260d6;
  --green: #64a800;
  --orange: #df7d00;
  --purple: #7b3fc8;
  --cyan: #12a9bd;
  --gold: #f4b321;
  --danger: #df354a;
  --shadow: 0 18px 44px rgba(24, 39, 75, 0.12);
  --soft-shadow: 0 10px 28px rgba(24, 39, 75, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  color: var(--ink);
  background: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.prototype-stage {
  width: 100%;
  min-height: 100dvh;
  position: relative;
  background: #fff;
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.user-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.user-avatar.signed {
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 10px 24px rgba(34, 96, 214, 0.22);
}

.micro-label,
.card-kicker,
.mini-stat span,
.route-status,
.term-group,
.template-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.app-view {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: hidden;
  padding: 22px 22px 104px;
  background: #fff;
}

.topbar,
.story-topbar {
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin-bottom: 18px;
}

.topbar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
}

.story-topbar {
  display: flex;
  justify-content: space-between;
}

.avatar {
  width: 44px;
  height: 44px;
}

.topbar h2,
.story-topbar h2 {
  min-width: 0;
  margin: 0;
  font-size: 21px;
  text-align: center;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #f0f2f5;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.bell {
  position: relative;
}

.bell::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--danger);
}

.section-title {
  margin: 30px 0 14px;
  font-size: 28px;
  line-height: 1.12;
}

.drag-rail-shell {
  position: relative;
  isolation: isolate;
}

.drag-rail-shell::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  bottom: 0;
  z-index: 1;
  width: 54px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), #fff 72%);
}

.drag-rail {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

.drag-rail.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.drag-rail button {
  transition: transform 0.12s ease;
}

.drag-rail.is-dragging button {
  transform: scale(0.98);
}

.rail-nudge {
  position: absolute;
  top: 50%;
  right: 0;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(24, 39, 75, 0.18);
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.rail-nudge.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.story-rail {
  display: flex;
  gap: 18px;
  margin: 8px -22px 26px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0 64px 8px 22px;
  scroll-padding-inline: 22px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.story-rail::-webkit-scrollbar {
  display: none;
}

.story-rail-shell .rail-nudge {
  transform: translateY(calc(-50% - 18px));
}

.story-chip {
  flex: 0 0 88px;
  padding: 0;
  background: transparent;
  scroll-snap-align: start;
  text-align: center;
}

.story-thumb {
  width: 82px;
  height: 82px;
  margin: 0 auto 8px;
  border: 4px solid var(--ring, var(--blue));
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
}

.story-thumb img,
.lesson-art img,
.hero-art img,
.term-art img,
.story-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-chip span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.recent-card,
.daily-quiz,
.progress-card,
.route-card,
.lesson-card,
.term-card,
.ask-panel,
.plan-panel,
.template-card,
.template-detail,
.dashboard-card,
.opportunity-intro,
.opportunity-card,
.sector-breakdown,
.holding-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--soft-shadow);
}

.recent-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-left: 6px solid var(--green);
}

.lesson-art {
  height: 74px;
  border-radius: 20px;
  overflow: hidden;
  background: #eef3fb;
}

.recent-card h3,
.daily-quiz h3,
.lesson-card h3,
.route-card h3,
.plan-panel h3,
.template-detail h3 {
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1.18;
}

.progress-line,
.mini-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress-line span,
.mini-progress span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--accent, var(--blue));
  transition: width 0.25s ease;
}

.daily-quiz {
  margin-top: 24px;
  padding: 24px;
  color: #fff;
  border: 0;
  background:
    linear-gradient(135deg, #7b3fc8, #4b22a2),
    var(--purple);
}

.daily-quiz p,
.daily-quiz .micro-label {
  color: rgba(255, 255, 255, 0.78);
}

.daily-quiz .primary-pill {
  width: 100%;
  margin-top: 18px;
  color: var(--purple);
  background: #fff;
}

.primary-pill,
.secondary-pill,
.black-pill {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 850;
}

.primary-pill {
  color: #fff;
  background: var(--blue);
}

.secondary-pill {
  color: var(--blue);
  background: #edf3ff;
}

.black-pill {
  color: #fff;
  background: #050505;
}

.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.progress-card {
  padding: 18px;
}

.progress-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(84px, 132px));
  justify-content: center;
  gap: 0;
  padding: 10px 10px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.tab-button {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid;
  gap: 4px;
  justify-items: center;
  color: #a0a7b4;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.tab-button > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  white-space: nowrap;
}

.tab-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: inherit;
  font-size: 17px;
  font-weight: 900;
}

.tab-button.active {
  color: var(--ink);
}

.tab-button.active .tab-icon {
  color: #fff;
  background: var(--ink);
}

.search-row,
.chat-input {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0 18px;
}

.search-row input,
.chat-input input,
.form-grid select,
.form-grid input[type="number"],
.form-grid input[type="range"],
.checkin-form input[type="number"],
.term-search {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  padding: 0 16px;
  background: #f0f2f5;
  color: var(--ink);
  outline: none;
}

.category-pills,
.tag-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.category-pills {
  padding-right: 70px;
}

.category-pills::-webkit-scrollbar,
.tag-row::-webkit-scrollbar {
  display: none;
}

.category-rail-shell {
  margin-right: -22px;
}

.category-rail-shell .rail-nudge {
  transform: translateY(-50%);
}

.category-pill,
.tag,
.question-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 2px solid var(--accent, var(--line));
  border-radius: 999px;
  padding: 0 16px;
  color: var(--accent, var(--muted));
  background: #fff;
  font-weight: 800;
}

.category-pill.active {
  color: #fff;
  background: var(--accent, var(--blue));
}

.learning-group {
  margin-top: 22px;
}

.group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.group-heading::before {
  content: "";
  width: 6px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent);
}

.group-heading h3 {
  margin: 0;
  font-size: 24px;
}

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

.lesson-card {
  width: 100%;
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  text-align: left;
  border-left: 6px solid var(--accent);
}

.lesson-card h3 {
  font-size: 19px;
}

.lesson-card p {
  margin-bottom: 10px;
  font-size: 14px;
}

.new-badge,
.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.route-card {
  padding: 18px;
  margin-top: 14px;
}

.route-card.locked {
  opacity: 0.76;
  background: #f8fafc;
}

.route-card.recommended {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent), transparent 72%), var(--soft-shadow);
}

.assessment-card {
  padding: 20px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.quiz-option {
  width: 100%;
  min-height: 58px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  color: var(--ink);
  background: #f4f7fb;
  text-align: left;
  font-weight: 800;
}

.course-hero {
  margin: 6px 0 22px;
  padding: 18px;
  border-radius: 28px;
  color: #fff;
  background: var(--accent);
}

.course-hero .lesson-art {
  height: 150px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.28);
}

.course-hero p,
.course-hero .micro-label {
  color: rgba(255, 255, 255, 0.82);
}

.course-map {
  position: relative;
  min-height: 460px;
  padding: 10px 0 22px;
}

.course-map::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 50px;
  left: 50%;
  width: 78%;
  transform: translateX(-50%);
  border: 8px solid #d8d8d8;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 140px;
  opacity: 0.92;
  pointer-events: none;
}

.chapter-node {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 34px 0;
  padding: 0;
  background: transparent;
  text-align: left;
}

.chapter-node:nth-child(even) {
  flex-direction: row-reverse;
  text-align: right;
}

.node-dot {
  flex: 0 0 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: #efefef;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.04);
  font-size: 27px;
  font-weight: 900;
}

.chapter-node.active .node-dot,
.chapter-node.done .node-dot {
  color: #fff;
  background: var(--accent);
}

.chapter-node strong {
  display: block;
  font-size: 19px;
}

.chapter-panel,
.challenge-panel,
.flash-panel,
.search-panel,
.story-card,
.ask-answer {
  padding: 18px;
  border-radius: 26px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.chapter-panel {
  margin-top: 18px;
}

.challenge-panel {
  margin: 16px 0 26px;
  background: #fff3f4;
  border-color: rgba(223, 53, 74, 0.24);
}

.challenge-panel.unlocked {
  background: #f2fff8;
  border-color: rgba(36, 163, 107, 0.24);
}

.mini-quiz {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mini-question {
  padding: 14px;
  border-radius: 18px;
  background: #f8fafc;
}

.mini-question button {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
  padding: 10px 12px;
}

.mini-question button.selected {
  color: #fff;
  background: var(--accent);
}

.flash-panel {
  overflow: hidden;
}

.term-art {
  height: 190px;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 18px;
}

.flash-card {
  min-height: 250px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  background: #ededed;
  transition: transform 0.32s ease, background 0.32s ease;
}

.flash-card.revealed {
  background: #f5f0ff;
  transform: rotateY(0deg);
}

.flash-card strong {
  display: block;
  margin: 12px 0;
  font-size: 42px;
}

.term-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-panel {
  margin-top: 18px;
}

.empty-state {
  margin: 16px 0 0;
  padding: 18px;
  border-radius: 22px;
  color: var(--muted);
  background: #f7f9fc;
}

.term-results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.term-card {
  padding: 16px;
  text-align: left;
}

.ask-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 16px 8px 12px;
}

.ask-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 999px;
  color: #fff;
  background: #111;
  font-size: 28px;
  font-weight: 900;
}

.ask-hero h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.ask-hero p {
  max-width: 300px;
  margin: 8px auto 0;
  color: #6b7280;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.active-tag {
  height: 36px;
  margin-top: 4px;
  overflow: hidden;
  color: #2f9f6b;
  font-size: 30px;
  font-weight: 950;
  line-height: 36px;
}

.active-tag span {
  display: grid;
  animation: activeTagFlip 10s cubic-bezier(0.76, 0, 0.24, 1) infinite;
}

.active-tag b {
  display: block;
  height: 36px;
  color: var(--theme-color, #2f9f6b);
  font: inherit;
}

@keyframes activeTagFlip {
  0%, 20% { transform: translateY(0); }
  25%, 45% { transform: translateY(-36px); }
  50%, 70% { transform: translateY(-72px); }
  75%, 95% { transform: translateY(-108px); }
  100% { transform: translateY(0); }
}

.question-cloud {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 12px -22px 12px;
  padding: 0 0 2px;
  overflow: hidden;
}

.question-cloud::before,
.question-cloud::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 26px;
  pointer-events: none;
}

.question-cloud::before {
  left: 0;
  background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));
}

.question-cloud::after {
  right: 0;
  background: linear-gradient(270deg, #fff, rgba(255, 255, 255, 0));
}

.question-row {
  display: block;
  overflow-x: hidden;
  overscroll-behavior-x: contain;
  padding: 0;
  scroll-padding-inline: 28px;
  scroll-behavior: smooth;
  scroll-snap-type: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.question-row.drag-rail {
  touch-action: pan-x;
}

.question-row::-webkit-scrollbar {
  display: none;
}

.question-track {
  display: flex;
  width: max-content;
  animation: questionMarquee var(--marquee-duration, 28s) linear infinite;
  will-change: transform;
}

.question-track-group {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 4px;
}

.question-row.row-2 .question-track {
  animation-direction: reverse;
}

.question-row:hover .question-track,
.question-row:focus-within .question-track,
.question-row.is-dragging .question-track,
.question-cloud:active .question-track {
  animation-play-state: paused;
}

@keyframes questionMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.question-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  font-size: 15px;
  font-weight: 850;
  scroll-snap-align: start;
  white-space: nowrap;
}

.question-chip:active {
  transform: scale(0.98);
}

.ask-model-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-width: 300px;
  margin: 0 auto 14px;
  padding: 6px;
  border: 1px solid #eef1f5;
  border-radius: 20px;
  background: #f0f2f5;
}

.ask-model-button {
  min-width: 0;
  display: grid;
  gap: 1px;
  justify-items: center;
  padding: 8px 8px;
  border: 0;
  border-radius: 15px;
  color: #647084;
  background: transparent;
}

.ask-model-button strong {
  color: inherit;
  font-size: 14px;
  font-weight: 950;
}

.ask-model-button span {
  color: inherit;
  font-size: 10px;
  font-weight: 800;
}

.ask-model-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.ask-input-dock {
  position: sticky;
  bottom: -34px;
  z-index: 18;
  margin: 18px -10px -34px;
  padding: 12px 0 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 14%, #fff);
}

.ask-input-dock .chat-input {
  margin: 0;
  padding: 10px;
  border-radius: 22px;
  background: #d8d8d8;
}

.ask-input-dock .chat-input input {
  min-height: 56px;
  border: 1px solid #d7dce3;
  border-radius: 16px;
  background: #f6f7f9;
  font-size: 15px;
  font-weight: 800;
}

.chat-input button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  color: #fff;
  background: #174b38;
  font-size: 18px;
}

.chat-input button:disabled {
  color: #aeb4bd;
  background: #edf0f3;
  cursor: not-allowed;
}

.ask-safe-footer {
  margin: 7px 6px 0;
  color: #9aa1ad;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.ai-answer-text,
.ask-loading,
.ask-error {
  margin-bottom: 12px;
  white-space: pre-line;
}

.ask-loading {
  color: var(--muted);
  font-weight: 800;
}

.ask-error {
  color: var(--danger);
  font-weight: 850;
}

.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.56);
}

.story-viewer[hidden] {
  display: none !important;
}

.story-phone {
  width: min(430px, 100vw);
  height: min(860px, 100dvh);
  overflow-y: auto;
  padding: 18px 0 0;
  color: #fff;
  background: var(--story-bg, var(--orange));
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
}

.story-topbar {
  min-height: 44px;
  margin: 0;
  padding: 0 16px;
}

.story-topbar h2 {
  min-width: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: 17px;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-topbar .icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: #fff;
  background: rgba(16, 20, 27, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
}

.story-progress {
  display: grid;
  grid-template-columns: repeat(var(--count, 5), 1fr);
  gap: 6px;
  margin: 8px 16px 18px;
}

.story-progress span {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.story-progress span.done {
  background: rgba(255, 255, 255, 0.58);
}

.story-progress span.current {
  background: #fff;
}

.story-hero-pad {
  padding: 0 16px;
}

.story-hero-card {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08)),
    rgba(17, 24, 39, 0.14);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.story-hero-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-content {
  display: grid;
  gap: 16px;
  padding: 12px 18px 104px;
}

.story-tag {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: #fff;
  background: rgba(15, 23, 42, 0.48);
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(14px);
}

.story-phone h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 7vw, 28px);
  line-height: 1.18;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.story-rich-body {
  display: grid;
  gap: 13px;
}

.story-rich-body p,
.story-rich-body li {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.68;
}

.story-rich-body ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

.story-highlight {
  color: #ffe08a;
  font-weight: 950;
}

.story-bottom-bar {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 12px;
  margin: 4px -18px -104px;
  padding: 12px 18px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.18) 18%, rgba(0, 0, 0, 0.26));
}

.story-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.story-chip-row span {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 12px;
  color: #667085;
  background: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 900;
}

.story-cta {
  width: 100%;
  min-height: 56px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.plan-panel {
  padding: 18px;
  margin-top: 14px;
}

.plan-login-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
  padding: 12px;
  border-radius: 18px;
  background: #f6f7fb;
}

.plan-login-note p {
  margin: 3px 0 0;
  color: #3c4657;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.plan-login-note .secondary-pill {
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 13px;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: #3c4657;
  font-size: 13px;
  font-weight: 850;
}

.asset-fieldset {
  border: 0;
  padding: 0;
  margin: 2px 0;
}

.asset-fieldset legend {
  margin-bottom: 8px;
  color: #3c4657;
  font-size: 13px;
  font-weight: 850;
}

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

.asset-choice {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #f0f2f5;
  color: #3c4657;
  font-size: 12px;
  font-weight: 850;
}

.asset-choice.active {
  color: var(--blue);
  background: #edf3ff;
  box-shadow: inset 0 0 0 1px rgba(34, 96, 214, 0.18);
}

.asset-choice input {
  accent-color: var(--blue);
}

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

.plan-metric-grid.compact {
  margin-top: 8px;
}

.plan-metric-grid span {
  padding: 12px;
  border-radius: 18px;
  background: #f6f7fb;
}

.risk-profile-card {
  margin: 14px 0;
  padding: 14px;
  border-radius: 20px;
  background: #f6f9ff;
  box-shadow: inset 0 0 0 1px rgba(34, 96, 214, 0.12);
}

.risk-profile-card h4 {
  margin: 4px 0 6px;
}

.risk-profile-card p {
  margin-bottom: 8px;
  color: #4a5668;
  line-height: 1.55;
}

.risk-profile-card .plan-metric-grid {
  margin-bottom: 0;
}

.risk-adjustment {
  padding: 9px 10px;
  border-radius: 14px;
  background: #fff4de;
  color: #7b4b00 !important;
  font-size: 12px;
  font-weight: 850;
}

.plan-metric-grid em,
.allocation-row span,
.allocation-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.plan-metric-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 19px;
}

.allocation-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.allocation-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border-radius: 18px;
  background: #f6f7fb;
}

.allocation-row strong {
  display: block;
  margin-bottom: 4px;
}

.allocation-row b {
  min-width: 48px;
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
}

.plan-ai-text {
  white-space: pre-line;
  color: #344054;
  line-height: 1.72;
}

.savings-checkin-panel {
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fff8ec);
}

.checkin-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 14px;
  align-items: center;
}

.checkin-head h3 {
  margin: 4px 0 5px;
}

.checkin-head p {
  color: var(--muted);
  line-height: 1.55;
}

.piggy-scene {
  position: relative;
  min-height: 132px;
  display: grid;
  place-items: center;
}

.piggy-bank {
  position: relative;
  width: 126px;
  height: 86px;
}

.pig-body {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 98px;
  height: 58px;
  border-radius: 44px 48px 38px 42px;
  background: linear-gradient(145deg, #ff93b9, #f25b93);
  box-shadow: inset -10px -8px 0 rgba(190, 38, 93, 0.18), 0 14px 24px rgba(242, 91, 147, 0.18);
}

.pig-face {
  position: absolute;
  right: 4px;
  bottom: 22px;
  width: 42px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffa6c9, #f46ba1);
}

.pig-ear {
  position: absolute;
  right: 30px;
  bottom: 58px;
  width: 22px;
  height: 24px;
  border-radius: 70% 25% 70% 25%;
  background: #f46ba1;
  transform: rotate(24deg);
}

.pig-nose {
  position: absolute;
  right: 0;
  bottom: 34px;
  width: 24px;
  height: 18px;
  border-radius: 999px;
  background: #ffc2d8;
  box-shadow: inset 7px 0 0 rgba(190, 38, 93, 0.1);
}

.pig-eye {
  position: absolute;
  right: 30px;
  bottom: 48px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #243042;
}

.pig-leg {
  position: absolute;
  bottom: 5px;
  width: 18px;
  height: 16px;
  border-radius: 0 0 8px 8px;
  background: #d94b82;
}

.leg-left { left: 30px; }
.leg-right { left: 78px; }

.pig-slot {
  position: absolute;
  left: 42px;
  bottom: 62px;
  width: 40px;
  height: 7px;
  border-radius: 999px;
  background: #8d2755;
}

.piggy-coin {
  position: absolute;
  top: 2px;
  left: 52%;
  width: 20px;
  height: 20px;
  z-index: 2;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe082, #f4b321);
  box-shadow: inset -3px -3px 0 rgba(177, 115, 0, 0.24);
  opacity: 0;
}

.coin-b { left: 38%; animation-delay: 0.08s; }

.piggy-scene.is-celebrating .piggy-coin {
  animation: pigCoinDrop 0.82s ease both;
}

.piggy-scene.is-celebrating .pig-bank,
.piggy-scene.is-celebrating .piggy-bank {
  animation: pigBounce 0.48s ease both;
}

.pig-progress {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffe3b7;
}

.pig-progress span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f4b321, #f97316);
}

@keyframes pigCoinDrop {
  0% { transform: translateY(-18px) scale(0.7) rotate(0deg); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(62px) scale(1) rotate(240deg); opacity: 0; }
}

@keyframes pigBounce {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-5px); }
}

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

.checkin-stats span,
.checkin-preview,
.checkin-record {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(244, 179, 33, 0.16);
}

.checkin-stats span {
  padding: 12px;
}

.checkin-stats em,
.checkin-record span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.checkin-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 19px;
}

.checkin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.checkin-form label {
  display: grid;
  gap: 7px;
  color: #3c4657;
  font-size: 13px;
  font-weight: 850;
}

.checkin-preview {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 12px;
  color: #3c4657;
  font-size: 13px;
  font-weight: 850;
}

.checkin-preview.is-warning {
  color: #9f1239;
  background: #fff1f2;
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.16);
}

.checkin-records {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.checkin-records h4 {
  margin: 0 0 2px;
}

.checkin-record {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
}

.checkin-record b {
  min-width: 74px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #7c2d12;
  background: #ffedd5;
  font-size: 12px;
}

.checkin-record b.is-empty {
  color: #9f1239;
  background: #ffe4e6;
}

.plan-result ul {
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.template-list,
.dashboard-list {
  display: grid;
  gap: 12px;
}

.template-card {
  width: 100%;
  padding: 16px;
  text-align: left;
}

.template-card.active {
  border-color: var(--gold);
}

.template-detail {
  margin-top: 16px;
  padding: 18px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut {
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: inherit;
  background: #fff;
}

.story-poll {
  display: grid;
  gap: 12px;
  margin: 18px 0 24px;
}

.poll-option {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 8px 12px;
  align-items: center;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  text-align: left;
}

.poll-option.selected {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.24);
}

.poll-option strong {
  font-size: 17px;
  font-weight: 950;
}

.poll-option em {
  justify-self: end;
  font-style: normal;
  font-weight: 900;
}

.poll-bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.poll-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  transition: width 0.24s ease;
}

.story-chart {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
}

.story-chart-title {
  color: #fff;
  font-size: 15px;
  font-weight: 950;
}

.story-chart-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 850;
}

.story-chart-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.story-chart-track i {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: #fff;
}

.story-source {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.5;
}

.donut strong {
  position: relative;
  z-index: 1;
  font-size: 20px;
}

.ratio-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.ratio-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.ratio-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.ratio-track span {
  display: block;
  height: 100%;
  width: var(--value);
  background: var(--accent);
}

.dashboard-card {
  padding: 18px;
}

.dashboard-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.opportunity-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 14px;
  padding: 16px;
}

.opportunity-intro h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.opportunity-ai-chip {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--ink);
  background: #f2f4f8;
  font-size: 12px;
  font-weight: 900;
}

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

.opportunity-card {
  width: 100%;
  min-height: 164px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
  align-items: center;
  padding: 18px 14px 18px 18px;
  color: var(--ink);
  text-align: left;
}

.opportunity-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.opportunity-copy > strong {
  font-size: 21px;
  line-height: 1.15;
}

.opportunity-gain {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  font-size: 24px;
  font-weight: 950;
}

.opportunity-gain em {
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  font-weight: 700;
}

.positive {
  color: #df354a;
}

.negative {
  color: #2f9f6b;
}

.opportunity-changes {
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.opportunity-changes span {
  display: grid;
  grid-template-columns: 48px 58px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.opportunity-changes em,
.opportunity-changes b {
  font-style: normal;
  font-weight: 800;
}

.opportunity-updated {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sector-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sector-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--sector-color), #121722 22%);
  background: color-mix(in srgb, var(--sector-color), #fff 88%);
  font-size: 11px;
  font-weight: 900;
}

.sector-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--sector-color);
}

.opportunity-ring {
  position: relative;
  width: 118px;
  height: 118px;
  justify-self: end;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--ring-gradient));
  box-shadow: inset 0 0 0 2px #fff;
}

.opportunity-ring::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 999px;
  background: #fff;
}

.opportunity-ring img {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(24, 39, 75, 0.2);
}

.opportunity-ring.large {
  width: 230px;
  height: 230px;
  margin: 12px auto 16px;
}

.opportunity-ring.large::after {
  inset: 44px;
}

.opportunity-ring.large img {
  width: 126px;
  height: 126px;
}

.sector-orb {
  position: absolute;
  z-index: 3;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--sector-color);
  font-size: 11px;
  font-weight: 950;
  box-shadow: 0 5px 12px rgba(24, 39, 75, 0.16);
}

.opportunity-ring.large .sector-orb {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.orb-1 { right: 12px; top: 22px; }
.orb-2 { right: 14px; bottom: 22px; }
.orb-3 { left: 28px; bottom: 8px; }
.orb-4 { left: 10px; top: 48px; }
.orb-5 { left: 44px; top: 8px; }

.opportunity-detail {
  padding-bottom: 16px;
}

.opportunity-detail-ring {
  display: grid;
  justify-items: center;
  margin: 6px 0 14px;
}

.opportunity-detail-ring > span {
  color: var(--muted);
  font-weight: 800;
}

.opportunity-detail-ring > strong {
  margin-top: 2px;
  font-size: 34px;
  line-height: 1.1;
}

.opportunity-alert {
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1f3f6;
}

.opportunity-alert span {
  color: var(--muted);
  font-weight: 900;
}

.opportunity-alert p {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
}

.opportunity-alert strong {
  white-space: nowrap;
  font-size: 13px;
}

.opportunity-alert em {
  font-style: normal;
}

.sector-breakdown {
  margin-bottom: 14px;
  padding: 16px;
}

.sector-breakdown h3 {
  margin-bottom: 12px;
}

.sector-bars {
  display: grid;
  gap: 10px;
}

.sector-bar-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.sector-bar-row i {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.sector-bar-row b {
  display: block;
  width: var(--bar);
  height: 100%;
  border-radius: inherit;
  background: var(--sector-color);
}

.sector-bar-row strong {
  color: var(--ink);
  text-align: right;
}

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

.holding-row {
  position: relative;
  padding: 16px;
}

.holding-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: center;
}

.holding-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--sector-color);
  font-size: 16px;
  font-weight: 950;
}

.holding-head h3 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.1;
}

.holding-head h3 em {
  font-style: normal;
  font-weight: 850;
}

.holding-head p {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 850;
}

.logic-button {
  height: 34px;
  border: 1px solid #9aa2ad;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.holding-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.holding-metrics span {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.holding-metrics span:first-child {
  border-left: 0;
  padding-left: 0;
}

.holding-metrics em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.holding-metrics strong {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.15;
}

.holding-badge {
  display: inline-flex;
  margin-top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  color: color-mix(in srgb, var(--sector-color), #111827 18%);
  background: color-mix(in srgb, var(--sector-color), #fff 86%);
  font-size: 11px;
  font-weight: 900;
}

.opportunity-learn {
  width: min(220px, 100%);
  margin: 18px auto 0;
}

.logic-viewer {
  align-items: end;
}

.logic-sheet-backdrop {
  position: absolute;
  inset: 0;
}

.logic-sheet {
  position: relative;
  width: min(430px, 100%);
  max-height: min(78vh, 680px);
  overflow-y: auto;
  padding: 18px;
  border-radius: 26px 26px 0 0;
  background: #fff;
  box-shadow: 0 -22px 54px rgba(15, 23, 42, 0.2);
  animation: sheetRise 0.22s ease-out both;
}

.logic-sheet-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.logic-sheet-header h2 {
  margin: 3px 0 0;
  font-size: 22px;
}

.logic-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.logic-summary strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
}

.logic-summary p {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
}

.logic-sections {
  display: grid;
  gap: 12px;
}

.logic-point {
  padding: 14px;
  border-radius: 18px;
  background: #f5f7fb;
}

.logic-point span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 950;
}

.logic-point p {
  margin: 0;
  color: #475266;
  font-size: 14px;
  line-height: 1.65;
}

.logic-sheet .black-pill {
  width: 100%;
  margin-top: 16px;
}

.auth-sheet .secondary-pill.full {
  width: 100%;
  margin-top: 10px;
}

.auth-copy {
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.55;
}

.auth-copy.is-warning {
  color: #9f1239;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  padding: 0 14px;
  background: #f0f2f5;
  color: var(--ink);
  outline: none;
}

.auth-pending-card {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f7f9fc;
  color: var(--ink);
  font-size: 14px;
}

.auth-pending-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-switch-button {
  color: #174ea6;
  background: #e8f0ff;
}

.plain-auth-button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
}

.profile-summary,
.profile-hero-top {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.profile-summary {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 18px;
  background: #f7f9fc;
}

.profile-summary p,
.profile-hero-top p,
.sync-note {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--avatar-color, var(--blue));
  font-size: 20px;
  font-weight: 950;
}

.sync-badge {
  justify-self: end;
  padding: 6px 8px;
  border-radius: 999px;
  color: #506074;
  background: #edf1f6;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.sync-badge.synced {
  color: #187a50;
  background: #e8f8ef;
}

.sync-badge.syncing {
  color: #8a6400;
  background: #fff4cc;
}

.sync-badge.error {
  color: var(--danger);
  background: #fff0f2;
}

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

.profile-grid span {
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: #f5f7fb;
}

.profile-grid em {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.profile-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.2;
}

.profile-hero-card {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.profile-hero-card .primary-pill {
  margin-top: 14px;
}

.dashboard-profile-grid {
  margin-bottom: 14px;
}

.recent-question-list {
  margin-top: 14px;
  padding: 16px;
  border-radius: 24px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.recent-question-list h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

.recent-question-list p {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f5f7fb;
  color: #4b5565;
  font-size: 13px;
}

.hero-art {
  height: 170px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 26px;
}

.safe-note {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 16px;
  color: #6a5860;
  background: #fff7e6;
  font-size: 13px;
}

@media (max-width: 860px) {
  .app-view {
    width: 100%;
  }

  .bottom-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  .app-view {
    padding: 18px 16px 98px;
  }

  .story-rail {
    margin-right: -16px;
  }

  .lesson-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .story-phone h1 {
    font-size: 33px;
  }

  .opportunity-card {
    grid-template-columns: minmax(0, 1fr) 104px;
    padding: 16px 12px 16px 14px;
  }

  .opportunity-ring {
    width: 100px;
    height: 100px;
  }

  .opportunity-ring::after {
    inset: 19px;
  }

  .opportunity-ring img {
    width: 62px;
    height: 62px;
  }

  .opportunity-copy > strong {
    font-size: 19px;
  }

  .opportunity-gain {
    font-size: 22px;
  }

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

  .holding-metrics span:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }
}

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

  .question-track {
    animation: none !important;
    transform: none !important;
  }
}

/* V3 lesson core */
.bottom-tabs.hidden {
  display: none;
}

.coin-balance {
  min-width: 72px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  color: var(--ink);
  background: #f7f3e4;
  font-weight: 900;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 72px;
}

.coin-balance span,
.coin-toast span,
.settlement-coins span {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe082, #f4b321);
  box-shadow: inset -3px -3px 0 rgba(177, 115, 0, 0.24);
}

.coin-toast {
  position: absolute;
  right: 28px;
  top: 72px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #1e293b;
  background: #fff7d1;
  border: 1px solid #ffe08a;
  box-shadow: var(--shadow);
  font-weight: 900;
  animation: coinFly 0.88s ease both;
}

@keyframes coinFly {
  0% { transform: translateY(24px) scale(0.78); opacity: 0; }
  35% { transform: translateY(0) scale(1.08); opacity: 1; }
  100% { transform: translateY(-28px) scale(0.92); opacity: 0; }
}

.lesson-reader {
  min-height: 100dvh;
  margin: -22px calc(50% - 50vw) -104px;
  padding: 16px max(22px, calc((100vw - 640px) / 2)) 34px;
  background: #fff;
  position: relative;
}

.reader-topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 14px;
  align-items: center;
  padding: 12px 0 22px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.reader-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: #f1f4f8;
  font-size: 22px;
  font-weight: 900;
}

.reader-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.reader-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #050505;
  transition: width 0.22s ease;
}

.reader-segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(8px, 1fr);
  gap: 6px;
  align-items: center;
}

.reader-segment {
  height: 7px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.reader-segment.done,
.reader-segment.current {
  background: #050505;
}

.reader-segment.current {
  position: relative;
}

.reader-segment.current::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.38);
  animation: segmentPulse 1.1s ease-in-out infinite alternate;
}

@keyframes segmentPulse {
  from { opacity: 0.15; transform: translateX(-55%); }
  to { opacity: 0.55; transform: translateX(55%); }
}

.reader-page,
.quiz-page,
.settlement-page {
  width: 100%;
  max-width: 640px;
  min-height: calc(100dvh - 112px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 18px;
}

.reader-page h1 {
  margin: 18px 0 24px;
  font-size: clamp(24px, 3vw, 28px);
  line-height: 1.18;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.reader-page h2,
.quiz-page h2,
.settlement-page h2 {
  margin: 18px 0 18px;
  font-size: clamp(22px, 3vw, 27px);
  line-height: 1.2;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.reader-page h3 {
  margin: 30px 0 12px;
  font-size: 20px;
  line-height: 1.3;
}

.reader-page p,
.quiz-page p,
.settlement-page p {
  color: #515b69;
  font-size: 17px;
  line-height: 1.86;
  overflow-wrap: anywhere;
}

.reader-hero {
  width: min(100%, 560px);
  max-width: 560px;
  overflow: visible;
  margin: 12px auto 32px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

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

.reader-hero-inline {
  width: 100%;
  max-width: 560px;
  background: transparent;
}

.reader-image-stack {
  display: grid;
  gap: 18px;
  margin: 18px 0 30px;
}

.reader-image-stack .reader-hero {
  width: 100%;
  margin: 0;
  justify-self: center;
}

.reader-hero-phone {
  width: min(100%, 360px);
  max-width: 360px;
  background: transparent;
}

.reader-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 30px;
}

.reader-meta span,
.key-chip-row span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 86%);
  font-size: 13px;
  font-weight: 900;
}

mark {
  padding: 0 2px;
  color: var(--danger);
  background: transparent;
  font-weight: 900;
}

.key-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 24px;
}

.reader-continue {
  width: 100%;
  margin-top: auto;
  min-height: 62px;
  font-size: 18px;
}

.quiz-options-stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.reader-option {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 12px;
  align-items: center;
  padding: 18px 18px;
  border: 2px solid #e6eaf0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  font-size: 18px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(24, 39, 75, 0.05);
  overflow-wrap: anywhere;
}

.reader-option i {
  width: 26px;
  height: 26px;
  border: 3px solid #20242b;
  border-radius: 999px;
}

.reader-option.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 93%);
}

.reader-option.selected i {
  border-width: 8px;
  border-color: var(--accent);
}

.reader-option.right {
  border-color: #16a34a;
}

.reader-option.wrong {
  border-color: var(--danger);
  background: #fff6f6;
}

.reader-option:disabled,
.black-pill:disabled,
.match-chip:disabled {
  cursor: default;
  opacity: 0.52;
}

.quiz-submit-bar {
  margin-top: auto;
  padding-top: 22px;
}

.answer-sheet {
  margin-top: auto;
  position: sticky;
  bottom: -18px;
  z-index: 10;
  padding: 18px;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.12);
  animation: sheetRise 0.22s ease-out both;
}

@keyframes sheetRise {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.answer-sheet span {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-radius: 14px;
  padding: 0 14px;
  color: #fff;
  font-weight: 900;
}

.answer-sheet.correct span {
  background: #16a34a;
}

.answer-sheet.wrong span {
  background: var(--danger);
}

.answer-sheet p {
  margin: 14px 0 16px;
  font-size: 16px;
  line-height: 1.7;
}

.answer-sheet .black-pill,
.answer-sheet .secondary-pill {
  width: 100%;
  margin-top: 8px;
}

.settlement-page {
  align-items: center;
  text-align: center;
  justify-content: center;
}

.settlement-page h2 {
  font-size: 34px;
}

.trophy-card {
  width: min(280px, 78%);
  aspect-ratio: 1.2;
  overflow: hidden;
  margin: 26px auto;
  border-radius: 34px;
  background: #f7fbff;
  box-shadow: var(--soft-shadow);
}

.trophy-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.settlement-coins {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 18px;
  font-size: 44px;
  font-weight: 950;
}

.settlement-coins .coin-number {
  display: inline-block;
  min-width: 96px;
  color: var(--ink);
  animation: coinPop 0.78s ease-out both;
}

@keyframes coinPop {
  0% { transform: translateY(12px) scale(0.82); opacity: 0; }
  55% { transform: translateY(-4px) scale(1.12); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.match-page p {
  margin-top: 0;
}

.match-board {
  display: grid;
  gap: 12px;
  margin: 14px 0 18px;
}

.match-slot {
  width: 100%;
  min-height: 92px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 2px dashed color-mix(in srgb, var(--accent), white 48%);
  border-radius: 20px;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent), white 94%);
  text-align: left;
}

.match-slot.filled {
  border-style: solid;
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 39, 75, 0.08);
}

.match-slot strong {
  font-size: 18px;
  font-weight: 950;
}

.match-slot span {
  color: #5c6675;
  font-size: 14px;
  line-height: 1.55;
}

.match-slot em {
  justify-self: start;
  color: var(--accent);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.match-pool {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.match-chip {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 2px solid #e3e8f1;
  border-radius: 18px;
  color: #1e2530;
  background: #fff;
  text-align: left;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
  box-shadow: 0 8px 18px rgba(24, 39, 75, 0.05);
}

.match-chip.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 91%);
}

.match-handle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 84%);
  font-weight: 950;
}

.star-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 10px 0 28px;
}

.star-row button {
  color: #f6c642;
  background: transparent;
  font-size: 44px;
  line-height: 1;
  transform: scale(1);
}

.star-row button.active {
  color: #f4b321;
  text-shadow: 0 4px 10px rgba(244, 179, 33, 0.28);
}

.final-entry {
  margin: 22px 0;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.final-entry.locked {
  background: #f8fafc;
}

.final-entry .black-pill {
  width: 100%;
  margin-top: 10px;
}

.story-viewer[hidden] {
  display: none !important;
}

@media (max-width: 390px) {
  .plan-login-note {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-login-note .secondary-pill {
    width: 100%;
  }

  .checkin-head,
  .checkin-form {
    grid-template-columns: 1fr;
  }

  .piggy-scene {
    min-height: 118px;
  }

  .checkin-record {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .checkin-record b {
    justify-self: start;
  }

  .lesson-reader {
    margin: -18px calc(50% - 50vw) -98px;
    padding: 14px 16px 28px;
  }

  .reader-topbar {
    padding-bottom: 18px;
  }

  .reader-page h1 {
    font-size: 25px;
    line-height: 1.2;
  }

  .reader-page h2,
  .quiz-page h2 {
    font-size: 24px;
  }

  .reader-page p,
  .quiz-page p {
    font-size: 16px;
  }

  .reader-option {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .piggy-scene.is-celebrating .piggy-coin,
  .piggy-scene.is-celebrating .piggy-bank {
    animation: none;
  }
}
