:root {
  color-scheme: light;
  --page: #ffffff;
  --background: #f4f4f4;
  --text: #262a30;
  --muted: #545b66;
  --line: #e0e0e0;
  --strong-line: #2c3035;
  --link: #254f8d;

  /* emotion palette */
  --angry: #cf4a45;
  --sad: #3f6fb0;
  --happy: #d8941a;
  --surprise: #8a5cd1;
  --fear: #9d4675;
  --disgust: #557a2b;
  --calm: #2fa37a;
  --neutral: #8a9099;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  width: min(1180px, calc(100% - 56px));
  margin: 30px auto;
  padding-bottom: 40px;
}

/* ---------- header ---------- */
.project-header {
  margin: 0 0 34px;
  padding: 54px 60px 46px;
  background: var(--page);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.07);
  text-align: center;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 16px;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.12;
  font-weight: 750;
}

.subtitle {
  max-width: 820px;
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.project-intro {
  text-align: justify;
  text-align-last: left;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  font-size: 15px;
  font-weight: 650;
}
.page-nav a {
  padding: 7px 16px;
  background: var(--background);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.page-nav a:hover { background: #ebeef3; text-decoration: none; }

/* ---------- sections ---------- */
.demo-section {
  margin-top: 30px;
  padding: 44px 48px 50px;
  background: var(--page);
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.07);
}
.demo-section:first-of-type { margin-top: 0; }

.sec-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--strong-line);
  border-radius: 999px;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.18;
  font-weight: 720;
}

.section-note {
  max-width: 900px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.subhead {
  margin: 38px 0 16px;
  font-size: 20px;
  font-weight: 700;
}

/* ---------- tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap::-webkit-scrollbar { height: 10px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c4c8ce; border-radius: 999px; }

table {
  width: 100%;
  border-collapse: collapse;
}
/* keep columns from squeezing the audio bars → horizontal scroll on narrow widths */
#t1 table { min-width: 900px; }
#t3 table { min-width: 940px; }

th, td {
  padding: 16px 14px;
  font-size: 15.5px;
  line-height: 1.5;
  vertical-align: middle;
  text-align: center;
}
th {
  border-bottom: 2.5px solid var(--strong-line);
  font-weight: 720;
  white-space: nowrap;
}
td { border-bottom: 1px solid var(--line); }

.tcell-text {
  text-align: left;
  font-size: 16px;
  line-height: 1.55;
  min-width: 280px;
}
.idx { color: var(--muted); font-weight: 700; width: 42px; }

/* ---------- audio ---------- */
audio {
  width: 270px;
  min-width: 270px;
  max-width: 100%;
  height: 42px;
}
.col-audio { width: 286px; white-space: nowrap; }

/* ---------- T4 tier cards (text on top, 4 levels in a responsive row) ---------- */
.tier-card { padding: 22px 4px 24px; border-bottom: 1px solid var(--line); }
.tier-card:last-child { border-bottom: none; padding-bottom: 4px; }
.tier-head {
  display: flex; align-items: baseline; justify-content: center;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.tier-text { font-size: 17px; }
.tier-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 16px 20px; justify-items: center;
}
.tier-item { display: flex; flex-direction: column; align-items: center; gap: 9px; width: 100%; }
.tier-item audio { width: 100%; min-width: 0; max-width: 300px; }
.tier-lbl { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.sample-note { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.clip-source { color: var(--muted); font-size: 12px; }

/* ---------- emotion chips & highlights ---------- */
.chip {
  display: inline-block;
  padding: 2px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.chip.angry { background: var(--angry); }
.chip.sad { background: var(--sad); }
.chip.happy { background: var(--happy); }
.chip.surprise { background: var(--surprise); }
.chip.fear { background: var(--fear); }
.chip.disgust { background: var(--disgust); }
.chip.calm { background: var(--calm); }
.chip.neutral { background: var(--neutral); }

.hl {
  font-weight: 750;
  padding-bottom: 1px;
  border-bottom: 2.5px solid currentColor;
}
.hl.angry { color: var(--angry); }
.hl.sad { color: var(--sad); }
.hl.happy { color: var(--happy); }
.hl.surprise { color: var(--surprise); }
.hl.fear { color: var(--fear); }
.hl.disgust { color: var(--disgust); }
.hl.calm { color: var(--calm); }

/* T2 sentence halves — neutral two-tone just to mark the split (not emotion) */
.half { padding: 1px 3px; border-radius: 3px; }
.half-1 { background: #edeff2; box-shadow: inset 0 -2px 0 #c4c9d0; }
.half-2 { background: #f1efec; box-shadow: inset 0 -2px 0 #d4ccc0; }
.split-mark { color: var(--muted); font-weight: 700; padding: 0 6px; }

/* T2 swap cards: label (emotion path) sits ABOVE each audio bar */
.swap-card { padding: 26px 4px 28px; border-bottom: 1px solid var(--line); }
.swap-card:last-child { border-bottom: none; padding-bottom: 6px; }
.swap-text { font-size: 17px; line-height: 1.6; margin-bottom: 20px; text-align: center; }
.swap-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px 24px; align-items: end; justify-items: center;
}
.swap-item { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.swap-item audio { width: 100%; min-width: 0; max-width: 340px; }
.swap-lbl { display: flex; align-items: center; gap: 6px; min-height: 26px; }
.swap-lbl .arrow { color: var(--muted); font-weight: 800; }
.lbl-base { font-weight: 700; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; }
.target-lbl { font-size: 13px; font-weight: 700; color: var(--muted); }

/* T2 same-span multi-emotion coupling cards */
.coupling-card {
  padding: 26px 24px 28px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.coupling-card:last-child { margin-bottom: 0; }
.coupling-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.coupling-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.coupling-emotions { display: flex; gap: 6px; flex-wrap: wrap; }
.coupling-text {
  margin-bottom: 15px;
  font-size: 18px;
  line-height: 1.55;
  text-align: center;
}
.same-span-mark {
  padding: 3px 9px 4px;
  border-bottom: 3px solid #7b8794;
  background: #eef1f4;
  border-radius: 4px;
}
.coupling-requested {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
.coupling-requested-label {
  margin-right: 4px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.coupling-weight {
  margin-left: -4px;
  color: var(--muted);
  font-weight: 700;
}
.coupling-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px 18px;
  align-items: end;
}
.coupling-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 12px 14px;
  border: 1px solid #e8e9ec;
  border-radius: 8px;
  background: #fff;
}
.coupling-item audio { width: 100%; min-width: 0; max-width: 320px; }
.coupling-lbl {
  display: flex;
  align-items: center;
  min-height: 22px;
}
.coupling-control-label {
  color: var(--link);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

/* T1 same-sentence word-anchor cards */
.word-card {
  padding: 22px 24px 24px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.word-card:last-child { margin-bottom: 0; }
.word-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.word-card-kicker {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.word-card-text {
  margin-bottom: 18px;
  font-size: 18px;
  line-height: 1.55;
  text-align: center;
}
.word-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px 18px;
  align-items: end;
}
.word-clip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 12px 12px 14px;
  border: 1px solid #e8e9ec;
  border-radius: 8px;
  background: #fff;
}
.word-clip audio { width: 100%; min-width: 0; max-width: 320px; }
.word-clip-label { display: flex; align-items: center; min-height: 22px; }

/* gradient clause tint (T3 grad) */
.g1 { opacity: 0.55; }
.g2 { opacity: 0.78; }
.g3 { opacity: 1; font-weight: 700; }

/* ---------- T3.1 continuous slider card ---------- */
.slider-card {
  padding: 22px 26px 24px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.slider-card:last-child { margin-bottom: 0; }
.slider-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.slider-sentence { font-size: 18px; line-height: 1.5; }
.baseline-row {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; padding-bottom: 18px;
  border-bottom: 1px dashed var(--line);
}
.baseline-row .lbl {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--muted); min-width: 70px;
}
.scale-slider { max-width: 560px; }

.scale-slider { width: 100%; }
.scale-slider .head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.scale-slider .title { font-size: 14px; font-weight: 700; }
.slider-readout { font-size: 13px; font-weight: 700; color: var(--link); }

.slider-track {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
}
.slider-rail {
  position: absolute; left: 0; right: 0; height: 8px; border-radius: 999px;
  background: #e6e8ec; overflow: hidden;
}
.slider-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #9cc0ec, var(--link));
  transition: width 0.12s ease;
}
/* marked stops on the track (aligned with the thumb travel, inset by half-thumb) */
.slider-ticks { position: absolute; left: 11px; right: 11px; top: 50%; height: 0; }
.slider-ticks i {
  position: absolute; top: 0; transform: translate(-50%, -50%);
  width: 3px; height: 16px; border-radius: 2px;
  background: #aeb4bd;
}
.slider-input {
  position: relative;
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  height: 30px;
  cursor: pointer;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--link);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.slider-input::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--link);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.slider-ends {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 12.5px; color: var(--muted);
}
.slider-ends span { flex: 1; text-align: center; }
.slider-ends span:first-child { text-align: left; }
.slider-ends span:last-child { text-align: right; }
.slider-play {
  margin-top: 14px;
  padding: 9px 22px;
  font-size: 14px; font-weight: 700;
  color: #fff; background: var(--strong-line);
  border: none; border-radius: 999px; cursor: pointer;
}
.slider-play:hover { background: #000; }
.slider-play:disabled { background: #d9dde2; color: #606771; cursor: not-allowed; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .page { width: calc(100% - 24px); margin: 14px auto; }
  .project-header { padding: 34px 20px 36px; }
  .demo-section { padding: 32px 18px 40px; }
  .slider-card { grid-template-columns: 1fr; gap: 18px; }
  .coupling-grid { grid-template-columns: 1fr; }
  /* audio bars stay full-width; narrow viewports scroll the table horizontally */
}
