:root {
  --orange: #ff8a1c;
  --sun: #ffd84d;
  --green: #48a868;
  --mint: #e8f8df;
  --cream: #fff8e8;
  --ink: #28322b;
  --muted: #66736b;
  --line: #eadfbe;
  --white: #ffffff;
  --shadow: 0 14px 30px rgba(89, 75, 36, .14);
  --radius: 8px;
  font-family: "Arial", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 216, 77, .32), transparent 30%),
    linear-gradient(180deg, #fffdf4 0%, #f0fbeb 100%);
}

button, input, select, textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.mascot-mini {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sun);
  border: 2px solid #f0ad26;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a, .btn, .chip {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.nav a {
  padding: 9px 11px;
  color: var(--ink);
  background: #fff4ce;
  font-weight: 700;
}

.nav a:hover, .btn:hover, .chip:hover {
  transform: translateY(-1px);
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(14px, 4vw, 42px) 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr);
  gap: 26px;
  align-items: center;
  min-height: 68vh;
}

.hero h1 {
  margin: 0 0 14px;
  color: #2f6f42;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 760px;
  color: #4c5f51;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.65;
}

.hero-art {
  position: relative;
  min-height: 360px;
}

.giraffe {
  position: absolute;
  right: 16px;
  bottom: 0;
  width: min(310px, 82vw);
  height: 350px;
}

.giraffe .neck {
  position: absolute;
  left: 118px;
  bottom: 78px;
  width: 86px;
  height: 250px;
  border-radius: 44px 44px 20px 20px;
  background: #f5be46;
  border: 5px solid #ae7430;
}

.giraffe .head {
  position: absolute;
  left: 76px;
  top: 10px;
  width: 170px;
  height: 122px;
  border-radius: 70px 76px 58px 58px;
  background: #f5be46;
  border: 5px solid #ae7430;
}

.giraffe .ear {
  position: absolute;
  top: 20px;
  width: 44px;
  height: 58px;
  border-radius: 50%;
  background: #f7d274;
  border: 4px solid #ae7430;
}

.giraffe .ear.left { left: 48px; transform: rotate(-25deg); }
.giraffe .ear.right { left: 220px; transform: rotate(25deg); }

.giraffe .horn {
  position: absolute;
  top: -16px;
  width: 14px;
  height: 48px;
  border-radius: 12px;
  background: #ae7430;
}

.giraffe .horn.left { left: 118px; }
.giraffe .horn.right { left: 182px; }

.giraffe .eye {
  position: absolute;
  top: 56px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #243027;
}

.giraffe .eye.left { left: 124px; }
.giraffe .eye.right { left: 178px; }

.giraffe .snout {
  position: absolute;
  left: 122px;
  top: 83px;
  width: 78px;
  height: 44px;
  border-radius: 42px;
  background: #ffe3a0;
  border: 3px solid #ae7430;
}

.spot {
  position: absolute;
  border-radius: 50%;
  background: #9a632b;
}

.spot.one { left: 118px; top: 145px; width: 28px; height: 34px; }
.spot.two { left: 165px; top: 188px; width: 25px; height: 25px; }
.spot.three { left: 133px; top: 246px; width: 34px; height: 30px; }
.spot.four { left: 93px; top: 48px; width: 23px; height: 20px; }

.phone-bubble {
  position: absolute;
  left: 0;
  bottom: 54px;
  display: grid;
  place-items: center;
  width: 138px;
  height: 104px;
  border-radius: 34px 34px 34px 10px;
  background: var(--green);
  color: var(--white);
  font-size: 54px;
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
}

h2 {
  margin: 0;
  color: #2f6f42;
  font-size: clamp(28px, 4vw, 42px);
}

h3 {
  margin: 0 0 12px;
  color: #ad5d08;
  font-size: 24px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.panel, .card, .dialogue-card, .practice-item, .result-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 20px;
}

.lesson-button {
  display: block;
  min-height: 120px;
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid #f0c458;
  border-radius: var(--radius);
  background: linear-gradient(160deg, #fff8d8, #e8f8df);
}

.lesson-button strong {
  display: block;
  margin-bottom: 8px;
  color: #2f6f42;
  font-size: 22px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--white);
  background: var(--orange);
  font-weight: 800;
}

.btn.secondary { background: var(--green); }
.btn.light { color: var(--ink); background: var(--sun); }

.chip {
  padding: 8px 12px;
  color: #315b3b;
  background: var(--mint);
  border: 1px solid #b8dfae;
  font-weight: 800;
}

.lesson-layout {
  display: grid;
  gap: 26px;
}

.dialogue-list {
  display: grid;
  gap: 12px;
}

.dialogue-card {
  padding: 16px;
  border-left: 8px solid var(--orange);
}

.english-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.english {
  color: #1f4f31;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.5;
}

.zh {
  margin-top: 4px;
  color: #5b655d;
  font-size: 18px;
  line-height: 1.55;
}

.speaker {
  color: #ce6509;
}

.sound {
  flex: 0 0 auto;
  min-width: 46px;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: var(--sun);
  cursor: pointer;
  font-size: 20px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.word-card {
  min-height: 190px;
  perspective: 900px;
  cursor: pointer;
}

.word-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 190px;
  transition: transform .45s;
  transform-style: preserve-3d;
}

.word-card.flipped .word-inner {
  transform: rotateY(180deg);
}

.word-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 18px;
  border: 2px solid #f0c458;
  border-radius: var(--radius);
  background: #fff9dd;
  backface-visibility: hidden;
  box-shadow: var(--shadow);
}

.word-face.back {
  background: #e8f8df;
  border-color: #91ca82;
  transform: rotateY(180deg);
}

.word {
  color: #2f6f42;
  font-size: 28px;
  font-weight: 900;
}

.pos {
  display: inline-flex;
  width: max-content;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--orange);
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

th, td {
  padding: 14px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

th {
  background: #ffe78c;
  color: #345b37;
  font-size: 18px;
}

.practice-list {
  display: grid;
  gap: 14px;
}

.practice-item {
  padding: 16px;
}

.practice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

input[type="text"], select {
  width: min(520px, 100%);
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid #e1c46a;
  border-radius: var(--radius);
  background: #fffef8;
}

.choice {
  padding: 10px 12px;
  border: 2px solid #d9e6b8;
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
}

.feedback {
  margin-top: 10px;
  min-height: 28px;
  font-weight: 900;
}

.ok { color: #268349; }
.bad { color: #d84a1b; }

.sort-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.sort-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 2px solid #f0c458;
  border-radius: var(--radius);
  background: #fff9dd;
}

.teacher-on .answer, .show-answer {
  display: inline-block;
}

.answer {
  display: none;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: #e8f8df;
  color: #265d37;
  font-weight: 800;
}

.projection {
  font-size: 125%;
}

.projection .english { font-size: 28px; }
.projection .zh { font-size: 23px; }

.result-panel {
  padding: 18px;
  margin-top: 18px;
  border-left: 8px solid var(--green);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(16px, 4vw, 48px);
  color: #526256;
  background: #fff9dd;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-art {
    min-height: 300px;
  }

  .giraffe {
    left: 50%;
    right: auto;
    transform: translateX(-50%) scale(.82);
    transform-origin: bottom center;
  }

  .footer {
    flex-direction: column;
  }
}

@media print {
  .topbar, .footer, .toolbar, .sound, .no-print {
    display: none !important;
  }

  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .panel, .card, .dialogue-card, .practice-item, table {
    box-shadow: none;
    break-inside: avoid;
  }
}
