:root {
  --forest: #163a2c;
  --forest-2: #24553f;
  --moss: #7e9f72;
  --clay: #d56548;
  --amber: #e6a936;
  --sand: #c9aa78;
  --paper: #f4ede2;
  --paper-2: #fffaf1;
  --ink: #282319;
  --muted: #6f685d;
  --line: rgba(40, 35, 25, .14);
  --shadow: 0 20px 60px rgba(20, 43, 32, .18);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  height: 100%;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, rgba(230, 169, 54, .28), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 100%, rgba(36, 85, 63, .25), transparent 50%),
    #0f1a14;
  font-family: "Nunito", "Noto Sans SC", system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(6px, env(safe-area-inset-top))
    max(6px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    max(6px, env(safe-area-inset-left));
}

button, input, select { font: inherit; }

a { color: inherit; }

/* 电脑 / 电视 16:9 满屏课件框 */
.journal-shell {
  width: min(98vw, calc((100dvh - 12px) * 16 / 9));
  height: min(calc(100dvh - 12px), calc(98vw * 9 / 16));
  max-width: min(98vw, calc((100dvh - 12px) * 16 / 9));
  max-height: min(calc(100dvh - 12px), calc(98vw * 9 / 16));
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .55)),
    repeating-linear-gradient(0deg, transparent 0 26px, rgba(80, 65, 43, .035) 27px),
    var(--paper);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(126, 159, 114, .25);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.journal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: clamp(10px, 1.2vw, 16px) clamp(14px, 1.8vw, 22px);
  color: #fff;
  background:
    linear-gradient(115deg, rgba(22, 58, 44, .98), rgba(36, 85, 63, .92)),
    var(--forest);
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  color: var(--forest);
  background: var(--amber);
  font-size: 1.75rem;
  box-shadow: inset 0 0 0 4px var(--forest);
}

.journal-header h1 {
  margin: 0;
  font-family: "Fraunces", "Noto Serif SC", serif;
  font-size: clamp(1.35rem, 2.7vw, 2.2rem);
  line-height: 1.05;
}

.journal-header p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, .76);
  font-size: .86rem;
}

.header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.header-link, .field-btn, .tab-btn {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.header-link {
  display: inline-flex;
  align-items: center;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  background: rgba(255, 255, 255, .09);
  font-size: .82rem;
  font-weight: 800;
}

.header-link:hover, .field-btn:hover, .tab-btn:hover { transform: translateY(-2px); }

.journal-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 241, .82);
  scrollbar-width: none;
}

.journal-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: 0 0 auto;
  padding: 9px 17px;
  border: 1px solid var(--line);
  color: var(--forest);
  background: #fff;
  font-weight: 900;
}

.tab-btn.is-active {
  color: #fff;
  border-color: var(--clay);
  background: var(--clay);
  box-shadow: 0 7px 18px rgba(213, 101, 72, .25);
}

.journal-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.journal-view {
  display: none;
  padding: clamp(12px, 1.6vw, 28px);
  flex: 1 1 auto;
  min-height: 0;
}
.journal-view.is-active {
  display: flex;
  flex-direction: column;
  animation: rise .35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--clay);
  font-size: .74rem;
  font-weight: 1000;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.view-heading {
  margin: 0;
  color: var(--forest);
  font-family: "Fraunces", "Noto Serif SC", serif;
  font-size: clamp(1.7rem, 3.4vw, 3rem);
  line-height: 1.08;
}

.view-lead {
  max-width: min(920px, 100%);
  margin: 6px 0 14px;
  color: var(--muted);
  line-height: 1.55;
  font-size: clamp(.9rem, 1.15vw, 1.05rem);
}

.specimen-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.05fr);
  gap: clamp(12px, 1.8vw, 28px);
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.specimen-photo, .story-photo {
  overflow: hidden;
  min-height: 0;
  height: 100%;
  border: 6px solid #fff;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 54, 40, .16);
  transform: rotate(-0.6deg);
}

.specimen-photo img, .story-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #e8efe6;
}

.specimen-notes, .story-copy {
  position: relative;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid rgba(74, 60, 41, .16);
  border-radius: 22px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(213, 101, 72, .16) 32px, transparent 33px),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(40, 35, 25, .075) 31px),
    var(--paper-2);
}

.specimen-index {
  display: inline-flex;
  padding: 5px 10px;
  border: 1px solid var(--sand);
  border-radius: 999px;
  color: var(--forest);
  background: #fff8e8;
  font-size: .78rem;
  font-weight: 900;
}

.specimen-word {
  margin: 10px 0 0;
  color: var(--forest);
  font-family: "Fraunces", serif;
  font-size: clamp(1.8rem, 4.2vw, 3.6rem);
  line-height: .96;
}

.specimen-zh {
  margin: 6px 0 12px;
  color: var(--clay);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  font-weight: 900;
}

.phoneme-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 20px;
}

.phoneme {
  min-width: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(36, 85, 63, .24);
  border-radius: 11px;
  color: var(--forest);
  background: rgba(126, 159, 114, .13);
  text-align: center;
  font-weight: 900;
}

.example {
  padding: 14px 16px;
  border-left: 5px solid var(--amber);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, .72);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

.example small { display: block; margin-top: 4px; color: var(--muted); }

.field-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.field-btn {
  padding: 10px 17px;
  color: #fff;
  background: var(--forest);
  font-weight: 900;
}

.field-btn.secondary { color: var(--forest); border: 1px solid var(--line); background: #fff; }
.field-btn.clay { background: var(--clay); }

.word-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: auto;
  padding: 4px 2px 8px;
  flex: 0 0 auto;
}

.word-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, .7);
  cursor: pointer;
  font-weight: 800;
}

.word-chip.is-active { color: #fff; border-color: var(--forest); background: var(--forest); }

.story-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.05fr);
  gap: clamp(12px, 1.8vw, 28px);
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.story-photo {
  min-height: 0;
  transform: rotate(.6deg);
}

.story-photo img {
  object-fit: cover;
}

.story-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.story-number {
  color: var(--clay);
  font-weight: 1000;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.story-en {
  margin: 16px 0 10px;
  color: var(--forest);
  font-family: "Fraunces", "Noto Serif SC", serif;
  font-size: clamp(1.6rem, 3.2vw, 2.7rem);
  line-height: 1.25;
}

.story-zh { margin: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.story-focus { margin-top: 18px; color: var(--clay); font-size: .84rem; font-weight: 900; }

.science-grid, .portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.science-card, .portal-card {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 10px 24px rgba(30, 51, 40, .08);
}

.science-card img {
  width: 100%;
  height: 125px;
  border-radius: 14px;
  object-fit: cover;
}

.science-card h3, .portal-card h3 { margin: 14px 0 5px; color: var(--forest); }
.science-card p, .portal-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.55; }

.portal-card {
  display: flex;
  flex-direction: column;
  min-height: 190px;
  text-decoration: none;
}

.portal-card .portal-icon { font-size: 2rem; }
.portal-card .portal-go { margin-top: auto; padding-top: 16px; color: var(--clay); font-weight: 1000; }

.journal-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 250, 241, .86);
  font-size: .72rem;
}

.journal-footer strong { color: var(--forest); }

@media (pointer: coarse) and (max-width: 1024px), (max-width: 820px) {
  body {
    display: block;
    padding: 0;
    background:
      radial-gradient(circle at 16% 12%, rgba(230, 169, 54, .22), transparent 22rem),
      radial-gradient(circle at 88% 78%, rgba(36, 85, 63, .22), transparent 28rem),
      #d8c9b2;
  }
  .journal-shell {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .specimen-layout, .story-layout { grid-template-columns: 1fr; }
  .specimen-photo, .story-photo { transform: none; height: auto; min-height: min(52vw, 360px); }
  .specimen-photo img, .story-photo img { height: auto; min-height: min(52vw, 360px); object-fit: cover; }
  .science-grid, .portal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .journal-header { padding: 14px; }
  .brand-mark { width: 46px; height: 46px; flex-basis: 46px; }
  .journal-header p { display: none; }
  .header-actions .header-link:not(:first-child) { display: none; }
  .journal-view { padding: 18px 14px 88px; }
  .journal-tabs {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    justify-content: space-around;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 25px rgba(22, 58, 44, .14);
  }
  .tab-btn { flex: 1; padding: 8px 6px; font-size: .76rem; }
  .science-grid, .portal-grid { grid-template-columns: 1fr; }
  .specimen-photo { min-height: 240px; }
  .story-photo { min-height: 220px; }
  .journal-footer { display: none; }
}

@media print {
  .journal-header, .journal-tabs, .journal-footer, .field-actions, .word-strip { display: none !important; }
  body { display: block; padding: 0; background: #fff; }
  .journal-shell {
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }
}
