/* 日历弹窗样式 */
.calendar-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-popup-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.calendar-popup-panel {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  min-width: 320px;
  max-width: 96vw;
  padding: 0 0 16px 0;
  animation: popupIn 0.18s cubic-bezier(0.4, 1.4, 0.6, 1) both;
}
.calendar-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0 18px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.calendar-popup-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  transition: background 0.2s;
}
.calendar-popup-close:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--brand);
}
.calendar-popup-content {
  margin: 0 18px;
}
@keyframes popupIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
:root {
  --bg: #0f172a; /* slate-900 */
  --card: #111827; /* gray-900 */
  --muted: #94a3b8; /* slate-400 */
  --text: #e5e7eb; /* gray-200 */
  --brand: #6366f1; /* indigo-500 */
  --brand-600: #5458f7;
  --success: #22c55e; /* green-500 */
  --warn: #f59e0b; /* amber-500 */
  --danger: #ef4444; /* red-500 */
  --surface: #0b1220;
  --stroke: #1f2937;
  --card-glow: 0 6px 24px rgba(99, 102, 241, 0.15);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(#1a2140 10%, var(--bg) 50%);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px env(safe-area-inset-top);
  gap: 8px;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.85),
    rgba(15, 23, 42, 0.65) 40%,
    rgba(15, 23, 42, 0)
  );
  backdrop-filter: blur(8px);
}
.header-left,
.header-right {
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-center {
  text-align: center;
  flex: 1;
}
.month-title {
  font-weight: 700;
  letter-spacing: 0.5px;
}
.subtitle-btn {
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.2s;
}
.subtitle-btn:hover,
.subtitle-btn:focus {
  color: var(--brand);
}
.subtitle-btn i {
  font-size: 16px;
  color: var(--brand);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active {
  transform: translateY(1px);
}

.content {
  padding: 8px 16px 80px; /* bottom space for ad bar */
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px;
  margin: 12px 0;
  box-shadow: var(--card-glow);
}

.calendar-card {
  padding: 8px 12px 12px;
}
.calendar-header,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekday {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}

.calendar-grid .day {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-weight: 600;
  user-select: none;
}
.day.out,
.day.disabled {
  opacity: 0.35;
}
.day.today {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
.day.selected {
  background: linear-gradient(
    180deg,
    rgba(99, 102, 241, 0.25),
    rgba(99, 102, 241, 0.12)
  );
  border-color: rgba(99, 102, 241, 0.6);
}
.day:active {
  transform: translateY(1px);
}

.word-card {
  padding: 16px;
}
.word-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
}
.word-main {
  min-width: 0;
}
.word-en {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.word-phonetic {
  color: var(--muted);
  margin-top: 2px;
  font-size: 13px;
}
.word-zh {
  margin-top: 8px;
  color: #cbd5e1;
  line-height: 1.55;
}

.word-ex {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  font-style: italic;
}
.word-ex:empty {
  display: none;
}

.word-actions {
  display: flex;
  gap: 8px;
}
.word-actions.word-actions-row {
  margin-top: 12px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
}
.pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 600;
}
.pill-btn.primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
  border-color: transparent;
}
.pill-btn.primary:active {
  transform: translateY(1px);
}
.pill-btn[disabled] {
  opacity: 0.5;
}

.state-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
}
.badge.playing {
  border-color: #60a5fa;
  color: #bfdbfe;
}
.badge.recording {
  border-color: #f59e0b;
  color: #ffedd5;
}
.badge.processing {
  border-color: #c4b5fd;
  color: #ede9fe;
}
.badge.success {
  border-color: #22c55e;
  color: #dcfce7;
}
.badge.warn {
  border-color: #f59e0b;
  color: #fffbeb;
}
.badge.error {
  border-color: #ef4444;
  color: #fee2e2;
}

.score {
  display: flex;
  align-items: center;
  gap: 10px;
}
.score .num {
  font-weight: 800;
  font-size: 20px;
}
.score.good .num {
  color: var(--success);
}
.score.ok .num {
  color: var(--warn);
}
.score.bad .num {
  color: var(--danger);
}

.reading-card .section-title {
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reading-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reading-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  color: var(--text);
}
.reading-list a .link-host {
  color: var(--muted);
  font-size: 12px;
}
.reading-list .empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.ad-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0),
    rgba(15, 23, 42, 0.5) 10%,
    rgba(15, 23, 42, 0.85)
  );
}
.ad-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ad-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
}
.ad-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-text .ad-title {
  font-weight: 800;
  letter-spacing: 0.2px;
}
.ad-text .ad-desc {
  font-size: 12px;
  color: var(--muted);
}
.ad-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ad-cta {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  color: white;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

.safe-bottom-space {
  height: 86px;
}

/* Small devices: 仅在极小屏（<=320px）隐藏按钮文字，避免普遍设备误伤 */
@media (max-width: 320px) {
  .word-en {
    font-size: 24px;
  }
  .pill-btn span {
    display: none;
  }
}
