/* 一年级数学学习站 — 儿童友好样式 */
:root {
  --bg: #fff8f0;
  --card: #ffffff;
  --primary: #ff8c42;
  --primary-dark: #e6732a;
  --secondary: #6ec6ff;
  --success: #4caf50;
  --error: #ef5350;
  --text: #333333;
  --muted: #888888;
  --shadow: 0 4px 16px rgba(255, 140, 66, 0.15);
  --radius: 20px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Heiti SC", sans-serif;
}

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

html { font-size: 18px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* ===== 顶栏 ===== */
.header {
  background: linear-gradient(135deg, #ff8c42, #ffb347);
  color: white;
  padding: 1rem 1.25rem;
  text-align: center;
  box-shadow: 0 2px 12px rgba(255, 140, 66, 0.3);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.header .subtitle {
  font-size: 0.85rem;
  opacity: 0.95;
  margin-top: 0.25rem;
}

.header a.back {
  display: inline-block;
  margin-top: 0.5rem;
  background: rgba(255,255,255,0.25);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.header a.back:hover { background: rgba(255,255,255,0.4); }

/* ===== 布局 ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* ===== 家长提示条 ===== */
.tip-strip {
  background: #fff3e0;
  border: 2px dashed #ffb347;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: #8a5a20;
}

.tip-strip strong { color: var(--primary-dark); }

/* ===== 单元卡片网格 ===== */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.unit-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 140px;
}

.unit-card:hover, .unit-card:focus {
  transform: translateY(-3px);
  border-color: var(--primary);
  outline: none;
}

.unit-card .emoji {
  font-size: 2rem;
  line-height: 1;
}

.unit-card h2 {
  font-size: 1.1rem;
  color: var(--text);
}

.unit-card p {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}

.unit-card .go {
  display: inline-block;
  margin-top: 0.25rem;
  background: var(--primary);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  align-self: flex-start;
}

.unit-card:nth-child(2n) .go { background: #6ec6ff; }
.unit-card:nth-child(3n) .go { background: #81c784; }
.unit-card:nth-child(4n) .go { background: #ba68c8; }
.unit-card:nth-child(5n) .go { background: #ff8a80; }

/* ===== 练习页 ===== */
.teach-box {
  background: #e3f2fd;
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  border-left: 6px solid var(--secondary);
}

.teach-box h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: #1565c0;
}

.teach-box p, .teach-box ul {
  font-size: 0.95rem;
  color: #37474f;
}

.teach-box ul { padding-left: 1.25rem; margin-top: 0.35rem; }

.practice-panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.progress-bar .score {
  background: #e8f5e9;
  color: var(--success);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
}

.question {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 1.5rem 0;
  letter-spacing: 0.08em;
  min-height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.question.word-problem {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-align: left;
  justify-content: flex-start;
  padding: 0 0.5rem;
}

.question .blank {
  display: inline-block;
  min-width: 2.5rem;
  border-bottom: 4px solid var(--primary);
  margin: 0 0.15rem;
}

/* 选项按钮 */
.choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.choice-btn {
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 72px;
  min-height: 72px;
  padding: 0.6rem 1rem;
  border: 3px solid #ffe0c2;
  border-radius: 16px;
  background: #fffaf5;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: scale(1.05);
}

.choice-btn:disabled { cursor: default; opacity: 0.85; }

.choice-btn.correct {
  background: #c8e6c9;
  border-color: var(--success);
  color: #2e7d32;
}

.choice-btn.wrong {
  background: #ffcdd2;
  border-color: var(--error);
  color: #c62828;
}

/* 输入答题（钟表、应用题等） */
.answer-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.answer-input {
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  width: 120px;
  text-align: center;
  padding: 0.5rem;
  border: 3px solid #ffe0c2;
  border-radius: 14px;
  outline: none;
}

.answer-input:focus { border-color: var(--primary); }

.btn {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary {
  background: #eceff1;
  color: #546e7a;
}

.btn-secondary:hover:not(:disabled) { background: #cfd8dc; }

.actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.feedback {
  min-height: 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0.75rem 0;
}

.feedback.ok { color: var(--success); }
.feedback.bad { color: var(--error); }

/* 图形展示 */
.shape-demo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.shape-box {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shape-rect {
  width: 90px;
  height: 55px;
  background: #64b5f6;
  border-radius: 4px;
}

.shape-square {
  width: 70px;
  height: 70px;
  background: #81c784;
  border-radius: 4px;
}

.shape-triangle {
  width: 0;
  height: 0;
  border-left: 45px solid transparent;
  border-right: 45px solid transparent;
  border-bottom: 78px solid #ffb74d;
  background: transparent;
}

.shape-circle {
  width: 70px;
  height: 70px;
  background: #e57373;
  border-radius: 50%;
}

/* 时钟简易画布 */
.clock-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.clock-wrap canvas {
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 100%;
}

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 1.5rem 1rem 2rem;
}

/* 响应式 */
@media (max-width: 480px) {
  html { font-size: 16px; }
  .question { font-size: 1.7rem; }
  .question.word-problem { font-size: 1.15rem; }
  .choice-btn {
    min-width: 60px;
    min-height: 60px;
    font-size: 1.25rem;
  }
  .units-grid { grid-template-columns: 1fr; }
}

@media (min-width: 768px) and (orientation: landscape) {
  .container { padding: 1.5rem 2rem; }
}
