@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #2b2b2b;
  --muted: #a1a1a1;
  --line: #e9e9e9;
  --bubble: #eeeeee;
  --blue: #3369ff;
  --pink: #ff5c8d;
  --purple: #6b5cff;
  --green: #1ea672;
  --entity: #d62b2b;
  --shadow: 5px 4px 20px rgba(0, 0, 0, 0.13);
  --screen-count: 4;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: 'Nunito', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
  background: var(--bg);
  padding: 14px;
  display: grid;
  place-items: center;
}

.phone {
  position: relative;
  width: min(420px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  margin: 0 auto;
  border-radius: 40px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.carousel {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: pan-y;
}

.carousel-track {
  height: 100%;
  display: flex;
  width: calc(var(--screen-count) * 100%);
  transform: translateX(-25%);
}

.screen {
  width: calc(100% / var(--screen-count));
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.screen-header {
  padding: 30px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.screen-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.screen-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.screen-title--blue h1 {
  color: var(--blue);
}

.screen-title--pink h1 {
  color: var(--pink);
}

.screen-title--purple h1 {
  color: var(--purple);
}

.screen-title--green h1 {
  color: var(--green);
}

.screen-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-block;
  position: relative;
}

.screen-icon--robot {
  background: rgba(51, 105, 255, 0.12);
}

.screen-icon--flower {
  background: rgba(255, 92, 141, 0.12);
}

.screen-icon--grapes {
  background: rgba(107, 92, 255, 0.12);
}

.screen-icon--leaf {
  background: rgba(30, 166, 114, 0.12);
}

.screen-icon::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 7px;
  background: currentColor;
  opacity: 0.18;
}

.screen-title--blue .screen-icon {
  color: var(--blue);
}
.screen-title--pink .screen-icon {
  color: var(--pink);
}
.screen-title--purple .screen-icon {
  color: var(--purple);
}
.screen-title--green .screen-icon {
  color: var(--green);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 32px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.screen-divider {
  height: 1px;
  background: var(--line);
}

.screen-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.screen-body--center {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px 26px 8px;
  overflow: auto;
}

.screen--idioms .screen-body--center {
  display: block;
  text-align: center;
  padding: 34px 26px 12px;
  overflow-y: auto;
}

.chat-window {
  overflow-y: auto;
  padding: 18px 22px 8px;
  height: 100%;
}

.message {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.message.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1.962px 1.962px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.04);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--blue);
}

.bubble {
  max-width: 84%;
  padding: 18px 18px;
  line-height: 1.45;
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}

.message.bot .bubble {
  background: var(--bubble);
  color: #505050;
  border-radius: 25px 25px 25px 0;
}

.message.user .bubble {
  background: var(--blue);
  color: #fff;
  border-radius: 25px 0 25px 25px;
}

.card-meta {
  margin: 0 0 22px;
  font-size: 14px;
  color: #6b6b6b;
  font-weight: 500;
}

.card-question-zh {
  margin: 0 0 26px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--pink);
}

.card-question-en {
  margin: 0;
  color: #8a8a8a;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  max-width: 260px;
}

.screen-footer {
  padding: 14px 22px calc(22px + env(safe-area-inset-bottom));
}

.footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pill {
  height: 56px;
  width: 100%;
  border: none;
  border-radius: 30px;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 22px;
}

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

.pill-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background: currentColor;
  mask: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M3.4 20.2c-.4.2-.9.1-1.2-.2-.3-.3-.4-.8-.2-1.2L4 12 1 5.2c-.2-.4-.1-.9.2-1.2.3-.3.8-.4 1.2-.2l19 8c.4.2.7.6.7 1s-.3.8-.7 1l-19 8zM5.6 12l-1 2.3L18.2 12 4.6 9.7l1 2.3z\" fill=\"black\"/></svg>') center / contain no-repeat;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M3.4 20.2c-.4.2-.9.1-1.2-.2-.3-.3-.4-.8-.2-1.2L4 12 1 5.2c-.2-.4-.1-.9.2-1.2.3-.3.8-.4 1.2-.2l19 8c.4.2.7.6.7 1s-.3.8-.7 1l-19 8zM5.6 12l-1 2.3L18.2 12 4.6 9.7l1 2.3z\" fill=\"black\"/></svg>') center / contain no-repeat;
}

.footer-actions[data-accent='blue'] .pill-icon {
  color: var(--blue);
}
.footer-actions[data-accent='pink'] .pill-icon {
  color: var(--pink);
}
.footer-actions[data-accent='purple'] .pill-icon {
  color: var(--purple);
}
.footer-actions[data-accent='green'] .pill-icon {
  color: var(--green);
}

.carousel-dots {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
  padding: 6px 10px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  opacity: 0.3;
  transform: scale(1);
  transition: opacity 160ms ease, transform 160ms ease;
}

.dot.is-active {
  opacity: 1;
  transform: scale(1.15);
}

.dot--blue {
  background: var(--blue);
}
.dot--pink {
  background: var(--pink);
}
.dot--purple {
  background: var(--purple);
}

.dot--green {
  background: var(--green);
}

.screen-body--plan {
  padding: 18px 18px 10px;
  overflow-y: auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.plan-summary {
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(30, 166, 114, 0.16), rgba(30, 166, 114, 0.06));
  border: 1px solid rgba(30, 166, 114, 0.14);
  padding: 18px 18px 16px;
  box-shadow: 0 10px 26px rgba(30, 166, 114, 0.08);
}

.plan-summary-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: #4e7f6c;
  letter-spacing: 0.06em;
}

.plan-summary-range {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
  color: #166147;
}

.plan-summary-count {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #4f7063;
}

.plan-list {
  display: grid;
  gap: 10px;
  align-content: start;
  padding-bottom: 8px;
}

.plan-empty {
  border-radius: 20px;
  border: 1px dashed rgba(30, 166, 114, 0.22);
  background: #f7fffb;
  padding: 18px 16px;
  color: #65877a;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.plan-day {
  display: grid;
  gap: 8px;
}

.plan-day-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #5c6d66;
  letter-spacing: 0.02em;
}

.plan-item {
  border-radius: 20px;
  border: 1px solid rgba(30, 166, 114, 0.08);
  background: #fff;
  box-shadow: 0 8px 22px rgba(25, 50, 38, 0.05);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.plan-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-item-time {
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
}

.plan-item-delete {
  border: none;
  background: #f3f4f4;
  color: #70847b;
  border-radius: 999px;
  min-width: 48px;
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.plan-item-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  color: #264137;
}

.plan-item-details {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: #70807a;
}

.plan-status {
  margin: 0;
  font-size: 13px;
  color: #75867f;
}

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

.idiom-word {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--purple);
}

.idiom-story {
  margin: 0 auto;
  width: min(100%, 290px);
  display: grid;
  gap: 16px;
  text-align: left;
  padding-bottom: 6px;
  align-content: start;
}

.idiom-section {
  border-radius: 22px;
  padding: 15px 16px 16px;
  border: 1px solid rgba(107, 92, 255, 0.08);
  box-shadow: 0 10px 24px rgba(40, 26, 90, 0.06);
  min-height: fit-content;
  height: auto;
}

.idiom-section--story {
  background: linear-gradient(180deg, rgba(107, 92, 255, 0.16), rgba(107, 92, 255, 0.07));
  border-color: rgba(107, 92, 255, 0.14);
}

.idiom-section--meaning {
  background: linear-gradient(180deg, rgba(134, 121, 255, 0.11), rgba(134, 121, 255, 0.05));
  border-color: rgba(107, 92, 255, 0.1);
}

.idiom-section--origin {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.045), rgba(0, 0, 0, 0.025));
  border-color: rgba(0, 0, 0, 0.06);
}

.idiom-section-label {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.idiom-section--story .idiom-section-label {
  color: var(--purple);
}

.idiom-section--meaning .idiom-section-label {
  color: #7d6cf8;
}

.idiom-section--origin .idiom-section-label {
  color: #8a8a8a;
}

.idiom-section-content {
  font-size: 14px;
  line-height: 1.65;
  color: #555;
  font-weight: 600;
}

.idiom-section--story .idiom-section-content {
  color: #49405f;
  font-size: 15px;
  line-height: 1.72;
}

.idiom-section--origin .idiom-section-content {
  color: #767676;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 500;
}

.entity {
  color: var(--entity);
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
}

.modal.is-hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  z-index: 0;
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(420px, 100vw);
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.16);
}

.modal-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

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

.modal-form input,
.modal-form textarea {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  padding: 12px 12px;
  font-size: 16px;
  font-family: inherit;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  color: #666;
  font-size: 12px;
  font-weight: 500;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.btn-ghost,
.btn-primary {
  border: none;
  border-radius: 14px;
  height: 44px;
  font-size: 14px;
  font-weight: 700;
}

.btn-ghost {
  background: #f2f2f2;
  color: #555;
}

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

@media (max-width: 380px) {
  body {
    padding: 10px;
  }
  .screen-header {
    padding: 26px 18px 16px;
  }
  .screen-footer {
    padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
  }
  .footer-actions {
    gap: 12px;
  }
  .pill {
    padding: 0 14px 0 18px;
  }
}
.manual-form {
  display: grid;
  gap: 8px;
  border-radius: 14px;
  border: 1px dashed rgba(234, 90, 53, 0.35);
  background: #fff8f3;
  padding: 10px;
}

.manual-form.is-hidden {
  display: none;
}

.manual-form label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--soft-ink);
}

.manual-form textarea {
  resize: vertical;
  min-height: 52px;
}

.panel-idioms {
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.idiom-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.idiom-toolbar p {
  margin: 0;
  font-size: 12px;
  color: var(--soft-ink);
}

.idiom-list {
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: grid;
  gap: 10px;
}

.idiom-item {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fffefb;
  padding: 10px 12px;
}

.idiom-word {
  margin: 0 0 4px;
  font-size: 24px;
  font-family: 'Ma Shan Zheng', cursive;
  color: #413247;
}

.idiom-story {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.idiom-chain-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--soft-ink);
}

.entity {
  color: var(--entity);
  font-weight: 700;
}

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

@keyframes drift {
  from {
    transform: translateY(-2px);
  }
  to {
    transform: translateY(6px);
  }
}

@media (max-width: 420px) {
  body {
    padding: 10px;
  }

  .app-shell {
    min-height: calc(100vh - 20px);
    border-radius: 18px;
  }

  .app-header h1 {
    font-size: 22px;
  }

  .card-question-zh {
    font-size: 21px;
  }

  .idiom-word {
    font-size: 22px;
  }
}
