/* ============================================
   Learn Chinese Characters - yiqidao.com/hanzi/
   ============================================ */

:root {
  --primary: #FF6B35;
  --primary-light: #FF8F5E;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --bg: #FFF9F0;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --border: #DFE6E9;
  --success: #00B894;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Header ---- */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(255,107,53,0.3);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: #fff;
}

.site-logo .logo-icon {
  font-size: 2rem;
}

.site-logo .logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.site-logo .logo-sub {
  font-size: 0.75rem;
  opacity: 0.9;
  font-weight: 400;
}

nav { display: flex; gap: 0.2rem; flex-wrap: wrap; justify-content: center; }
nav a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition: background 0.2s;
  white-space: nowrap;
}

nav a:hover { background: rgba(255,255,255,0.15); }
nav a.active { background: rgba(255,255,255,0.2); font-weight: 800; }

/* ---- Hero Section ---- */
.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

.hero .emoji-row {
  font-size: 2rem;
  margin-top: 1rem;
  letter-spacing: 0.3rem;
}

/* ---- Character Grid ---- */
.char-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.char-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem 0.8rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.char-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.2s;
}

.char-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.char-card:hover::before { opacity: 1; }

.char-card .hanzi {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  display: block;
  margin-bottom: 0.3rem;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
}

.char-card .pinyin {
  font-size: 0.95rem;
  color: var(--secondary);
  font-weight: 700;
}

.char-card .meaning {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

.char-card .lesson-num {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.65rem;
  color: var(--text-light);
  opacity: 0.5;
}

/* ---- Character Detail Page ---- */
.char-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.char-header {
  text-align: center;
  margin-bottom: 2rem;
}

.char-header .big-char {
  font-size: clamp(5rem, 15vw, 10rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  text-shadow: 4px 4px 0 rgba(255,107,53,0.1);
}

.char-header .pinyin-big {
  font-size: 1.8rem;
  color: var(--secondary);
  font-weight: 700;
  margin-top: 0.3rem;
}

.char-header .meaning-big {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* ---- Action Buttons ---- */
.action-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: #e55a2b;
  transform: scale(1.05);
}

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

.btn-secondary:hover {
  background: #3dbdb5;
  transform: scale(1.05);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

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

/* ---- Info Cards ---- */
.info-section {
  margin: 2rem 0;
}

.info-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.info-card p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.info-card .highlight {
  background: linear-gradient(transparent 60%, rgba(255,230,109,0.4) 60%);
  font-weight: 700;
}

/* ---- Stroke Animation ---- */
.stroke-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 1.5rem;
}

.stroke-box svg {
  max-width: 280px;
  width: 100%;
  height: auto;
}

.stroke-box .stroke-label {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.8rem;
}

.stroke-controls {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

/* ---- Words Section ---- */
.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
}

.word-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s;
}

.word-item:hover { transform: scale(1.03); }

.word-item .word-hanzi {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
}

.word-item .word-pinyin {
  font-size: 0.85rem;
  color: var(--secondary);
  font-weight: 600;
}

.word-item .word-english {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ---- Quiz Section ---- */
.quiz-box {
  background: linear-gradient(135deg, #fff5e6, #fff0f0);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  margin: 2rem 0;
}

.quiz-box h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.quiz-options {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-opt {
  font-size: 2.5rem;
  padding: 0.8rem 1.2rem;
  background: var(--card-bg);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
}

.quiz-opt:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.quiz-opt.correct {
  border-color: var(--success);
  background: #e6fff5;
}

.quiz-opt.wrong {
  border-color: #e74c3c;
  background: #ffe6e6;
}

/* ---- Navigation ---- */
.char-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  gap: 1rem;
}

.char-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  border-radius: 50px;
  background: rgba(255,107,53,0.08);
  transition: background 0.2s;
}

.char-nav a:hover { background: rgba(255,107,53,0.15); }

.char-nav .back-link {
  background: var(--secondary);
  color: #fff;
}

.char-nav .back-link:hover { background: #3dbdb5; }

/* ---- Breadcrumb ---- */
.breadcrumb {
  max-width: 900px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.85rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* ---- Footer ---- */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  margin-top: 3rem;
}

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeInUp 0.5s ease forwards;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.7rem;
  }
  .char-card { padding: 0.8rem 0.5rem; }
  .char-card .hanzi { font-size: 2.2rem; }
  .info-card { padding: 1rem; }
  .action-bar { gap: 0.6rem; }
  .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
  .header-inner { flex-wrap: wrap; justify-content: center; }
}
