/* ================================================================
   Palavras com Vivi — 巴西葡萄牙语单词记忆 App
   设计语言：编辑式排版 + 巴西国旗黄绿点缀 + 暖米白底色
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* 巴西国旗 + 编辑式米色 */
  --bg: #FFF8F0;
  --bg-card: #FFFFFF;
  --bg-soft: #FDF4E6;
  --ink: #1A1A1A;
  --ink-soft: #4A4A4A;
  --ink-muted: #8A8A8A;
  --line: #E8DECE;
  --line-soft: #F0E8D8;

  /* 巴西色调 */
  --brazil-green: #009C3B;
  --brazil-green-dark: #00642B;
  --brazil-yellow: #FFDF00;
  --brazil-yellow-dark: #E5C700;
  --brazil-blue: #002776;
  --accent-red: #C0392B;
  --accent-red-soft: #FDEDEC;

  /* 状态色 */
  --success: var(--brazil-green);
  --warning: #E67E22;
  --danger: var(--accent-red);

  /* 字体 */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', Menlo, monospace;

  /* 间距 */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(at 10% 0%, rgba(255, 223, 0, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 100%, rgba(0, 156, 59, 0.06) 0px, transparent 50%);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 16px; /* 防 iOS 自动缩放 */
}

/* ================================================================
   布局：顶栏 + 主区 + 底部 Tab
   ================================================================ */
.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 248, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.topbar-title .accent {
  color: var(--brazil-green);
  font-style: italic;
  font-weight: 400;
}
.topbar-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* 主区 */
.main {
  flex: 1;
  padding: 20px 20px 100px;
}

/* 底部 Tab */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  padding: 10px 4px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
  letter-spacing: 0.03em;
}
.tab.active {
  color: var(--brazil-green);
}
.tab-icon {
  font-size: 20px;
  line-height: 1;
}

/* ================================================================
   通用组件
   ================================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brazil-green);
  color: white;
}
.btn-primary:hover { background: var(--brazil-green-dark); }
.btn-secondary {
  background: var(--bg-soft);
  color: var(--ink);
  border-color: var(--line);
}
.btn-yellow {
  background: var(--brazil-yellow);
  color: var(--brazil-blue);
}
.btn-danger {
  background: var(--accent-red);
  color: white;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-full { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; }

input.input, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-card);
  font-size: 16px;
  transition: border-color 0.15s;
}
input.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--brazil-green);
}

label.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

/* 章节标题 */
.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 28px 0 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-title .count {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 2px 8px;
  background: var(--bg-soft);
  border-radius: 20px;
}

/* ================================================================
   首页：每日仪表盘
   ================================================================ */
.hero {
  position: relative;
  padding: 24px 20px;
  background: linear-gradient(135deg, var(--brazil-green) 0%, var(--brazil-green-dark) 100%);
  color: white;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.hero::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  background: var(--brazil-yellow);
  opacity: 0.15;
  border-radius: 50%;
}
.hero-date {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 6px;
}
.hero-greeting {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  font-style: italic;
  margin-bottom: 14px;
  line-height: 1.2;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  position: relative;
  z-index: 1;
}
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
}
.hero-stat-label {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 4px;
  letter-spacing: 0.04em;
}

/* 打卡条 */
.streak-strip {
  display: flex;
  gap: 6px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  margin-bottom: 16px;
  justify-content: space-between;
}
.streak-day {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
}
.streak-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-soft);
  margin: 4px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1.5px solid var(--line);
}
.streak-day.done .streak-dot {
  background: var(--brazil-green);
  border-color: var(--brazil-green);
  color: white;
}
.streak-day.today .streak-dot {
  border-color: var(--brazil-yellow);
  border-width: 2px;
}

/* ================================================================
   单词卡片
   ================================================================ */
.word-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.word-card-status {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brazil-green);
}
.word-card.needs-review .word-card-status { background: var(--accent-red); }
.word-card.mastered .word-card-status { background: var(--brazil-yellow); }

.word-lemma {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.word-pos {
  font-family: var(--font-body);
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border-radius: 4px;
  font-style: italic;
  text-transform: lowercase;
  font-weight: 500;
  letter-spacing: 0.05em;
}
.word-ipa {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 400;
}
.word-meaning-zh {
  font-size: 17px;
  color: var(--ink);
  margin-top: 8px;
  line-height: 1.4;
}
.word-meaning-en {
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 2px;
}

.word-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin: 14px 0;
  background: var(--bg-soft);
}

.word-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.word-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.example {
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  margin-bottom: 6px;
  border-left: 3px solid var(--brazil-yellow);
}
.example-pt {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}
.example-zh {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.similar {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-red-soft);
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.similar-word {
  font-weight: 600;
  color: var(--accent-red);
  font-family: var(--font-display);
  font-size: 15px;
}

/* 动词变位卡片 */
.conjug-card {
  background: linear-gradient(135deg, #FFF9DB 0%, #FFEEBA 100%);
  border: 1px solid var(--brazil-yellow-dark);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}
.conjug-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brazil-blue);
  margin-bottom: 6px;
}
.conjug-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  margin: 4px 0;
}
.conjug-key {
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 70px;
}
.conjug-val {
  flex: 1;
}

/* ================================================================
   复习卡片（大尺寸交互卡片）
   ================================================================ */
.review-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  text-align: center;
  margin-bottom: 16px;
}
.review-mode {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brazil-green);
  margin-bottom: 8px;
}
.review-progress {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 24px;
}
.review-prompt {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  word-break: break-word;
}
.review-prompt.large-pt {
  font-style: italic;
  color: var(--brazil-green-dark);
}
.review-hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  font-style: italic;
}
.review-options {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}
.review-option {
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  font-size: 15px;
  transition: all 0.12s;
  cursor: pointer;
}
.review-option:hover {
  border-color: var(--brazil-green);
  background: white;
}
.review-option.correct {
  background: var(--brazil-green);
  color: white;
  border-color: var(--brazil-green);
}
.review-option.wrong {
  background: var(--accent-red);
  color: white;
  border-color: var(--accent-red);
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}
.review-actions .btn-lg { padding: 16px 12px; font-size: 15px; }

.cloze-sentence {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.5;
  font-weight: 500;
}
.cloze-word {
  color: var(--accent-red);
  font-weight: 700;
  font-style: italic;
}

/* 录音按钮 */
.mic-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--brazil-green);
  color: white;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
  box-shadow: 0 6px 20px rgba(0, 156, 59, 0.35);
  transition: transform 0.15s;
}
.mic-button:active { transform: scale(0.95); }
.mic-button.recording {
  background: var(--accent-red);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(192, 57, 43, 0.5); }
  50% { box-shadow: 0 6px 28px rgba(192, 57, 43, 0.9); }
}

.speaker-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brazil-yellow);
  color: var(--brazil-blue);
  font-size: 22px;
  margin: 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 223, 0, 0.4);
}

/* ================================================================
   过滤标签
   ================================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink-soft);
}
.filter-chip.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

/* ================================================================
   登录页
   ================================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(at 0% 0%, rgba(255, 223, 0, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(0, 156, 59, 0.12) 0px, transparent 50%),
    var(--bg);
}
.auth-logo {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  line-height: 1;
}
.auth-logo .pt { color: var(--brazil-green); font-style: italic; font-weight: 400; }
.auth-tagline {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 36px;
  letter-spacing: 0.02em;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================================================================
   Toast & Modal
   ================================================================ */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 600px;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  animation: slide-up 0.25s ease-out;
}
@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* 加载 */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--ink-muted);
  font-size: 14px;
  gap: 8px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--brazil-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-sub { font-size: 13px; }

/* 周报图表 */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 12px 0;
}
.bar {
  flex: 1;
  background: linear-gradient(180deg, var(--brazil-green) 0%, var(--brazil-green-dark) 100%);
  border-radius: 6px 6px 0 0;
  position: relative;
  min-height: 4px;
}
.bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--ink-muted);
}

@media (max-width: 380px) {
  .review-prompt { font-size: 28px; }
  .hero-stat-num { font-size: 26px; }
}
