/* ==========================================================================
   Science Reader - 1:1 Pixel-Accurate Mobile Styles
   Matches kids.classmagic.cn clean educational aesthetics
   ========================================================================== */

:root {
  --primary-navy: #153258;
  --navy-badge: #143265;
  --gold-badge-bg: #d1a843;
  --gold-badge-text: #2a2007;
  --active-sentence-bg: #ded29f;
  --active-sentence-text: #1f2937;
  --inactive-sentence-text: #8792a2;
  --card-bg: #ffffff;
  --page-bg: #c9ced4;
  --phone-bg: #eceff2;
  --border-color: #d1d9e2;
  --pill-active-bg: #e2e8f0;
  --pill-inactive-text: #4a5568;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background-color: var(--page-bg);
  color: #1a202c;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  margin: 0;
}

/* Mobile Frame Wrapper (looks like native phone on desktop, 100% on real mobile) */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--phone-bg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top App Bar */
.top-app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--phone-bg);
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.top-app-bar .btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  color: #4a5568;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.top-app-bar .center-title-box {
  text-align: center;
}

.center-title-box .app-bar-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  line-height: 1.2;
}

.center-title-box .app-bar-domain {
  font-size: 11px;
  color: #718096;
}

/* Header Banner Card */
.header-banner-card {
  margin: max(16px, env(safe-area-inset-top)) 14px 10px;
  background: #dfe5eb;
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.badge-day {
  background-color: var(--navy-badge);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.badge-category {
  background-color: var(--gold-badge-bg);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
}

.header-main-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-navy);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 13px;
  color: #536479;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tabs Navigation */
.tabs-nav-bar {
  display: flex;
  margin: 4px 14px 10px;
  background-color: #dbe2e9;
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background-color: #ecf1f6;
  color: #1a365d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Audio Player Section Card */
.player-box-card {
  margin: 0 14px 12px;
  background: #dfe5eb;
  border-radius: 18px;
  padding: 14px 16px 12px;
}

.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 6px;
}

.btn-ctrl-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #c2cdd8;
  background: #e9eef3;
  color: #4a5568;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}

.btn-ctrl-circle:active {
  background: #d1d9e2;
  transform: scale(0.96);
}

.btn-play-main {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--navy-badge);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(20, 50, 101, 0.3);
  transition: transform 0.15s;
}

.btn-play-main:active {
  transform: scale(0.94);
}

.btn-play-main svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.btn-pill-ctrl {
  background: #e9eef3;
  border: 1px solid #b8c5d3;
  color: #1e3a8a;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pill-ctrl.active-loop {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

/* Audio Timeline */
.timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.time-text {
  font-size: 11px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
}

.scrubber-track {
  flex: 1;
  position: relative;
  height: 6px;
  background: #cbd5e1;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.scrubber-progress {
  height: 100%;
  background: #64748b;
  border-radius: 3px;
  width: 0%;
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1e3a8a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: none;
}

/* Main Content Area */
.tab-content-area {
  flex: 1;
  padding: 0 14px 24px;
}

/* Read Tab: Reading Text */
.reading-text-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sentence-card {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 20px;
  line-height: 1.45;
  color: var(--inactive-sentence-text);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: "Georgia", "Cambria", serif;
  letter-spacing: 0.2px;
}

.sentence-card.active {
  background-color: var(--active-sentence-bg);
  color: var(--active-sentence-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sentence-card.played {
  color: #4b5563;
}

/* Keyword Chip Styling */
.word-chip {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.word-chip:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.chip-purple {
  background-color: #ebe4f5;
  border-color: #d1c4e9;
}

.chip-green {
  background-color: #e2f1ec;
  border-color: #b2dfdb;
}

.chip-yellow {
  background-color: #fef3c7;
  border-color: #fde68a;
}

.chip-blue {
  background-color: #e0f2fe;
  border-color: #bae6fd;
}

/* Regular clickable words for lookup */
.word-lookup {
  cursor: pointer;
  border-radius: 3px;
  transition: background-color 0.15s;
}

.word-lookup:hover {
  text-decoration: underline dotted #1e3a8a;
}

/* Bottom Hint Note */
.bottom-hint-note {
  margin-top: 18px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  padding: 10px;
}

/* Answers Tab */
.answers-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.answers-tip-card {
  background-color: #ded29f;
  color: #4a3d12;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.exercise-card {
  background-color: #dfe5eb;
  border-radius: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.exercise-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 12px;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: #1f2937;
}

.exercise-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exercise-q {
  font-weight: 500;
  color: #1f2937;
}

.exercise-a {
  color: #1e3a8a;
  font-weight: 600;
  padding-left: 12px;
}

/* Parent Guide Tab */
.parent-guide-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-step-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 16px;
  border-left: 4px solid #16a34a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.guide-step-title {
  font-size: 15px;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 8px;
}

.guide-step-body {
  font-size: 13px;
  color: #374151;
  line-height: 1.55;
}

/* Modal Bottom Sheet (Dictionary Drawer) */
.dict-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  display: none;
  justify-content: center;
  align-items: flex-end;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.dict-modal-overlay.open {
  display: flex;
  opacity: 1;
}

.dict-modal-sheet {
  width: 100%;
  max-width: 480px;
  background-color: #ffffff;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 18px 20px 24px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dict-modal-overlay.open .dict-modal-sheet {
  transform: translateY(0);
}

.dict-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dict-word-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dict-btn-speak {
  background: #e0f2fe;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #0284c7;
}

.dict-phonetic {
  font-size: 14px;
  color: #64748b;
  font-weight: 400;
}

.dict-meaning-box {
  background-color: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.dict-pos-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.dict-meaning-text {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

.dict-en-def {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.dict-close-btn {
  width: 100%;
  padding: 10px;
  background: #f1f5f9;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
}
