/* ============ Lango Student Player ============ */
:root {
  --bg1: #eef2ff;
  --bg2: #e7f9f3;
  --card: #ffffff;
  --ink: #1d2440;
  --muted: #6b7390;
  --line: #e5e9f5;
  --accent: #5b5ff1;
  --accent-soft: #eef0ff;
  --teal: #16b79e;
  --good: #1fa463;
  --good-soft: #e3f7ec;
  --bad: #e5484d;
  --bad-soft: #fdebec;
  --warn: #f5a524;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(29, 36, 64, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg1) 0%, var(--bg2) 100%) fixed;
}
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-weight: 800; font-size: 1.05rem; color: var(--ink); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.top-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: 0.85rem;
}

/* ---------- buttons ---------- */
.btn {
  border: none; cursor: pointer; border-radius: 14px;
  padding: 10px 20px; font-size: 1rem; font-weight: 700;
  transition: transform 0.06s ease, box-shadow 0.15s ease, opacity 0.15s;
  background: var(--accent-soft); color: var(--accent);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(91, 95, 241, 0.35); }
.btn-lg { padding: 13px 26px; font-size: 1.1rem; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }
.btn-teal { background: var(--teal); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }

/* ---------- views / layout ---------- */
.view { animation: fadein 0.25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page { max-width: 980px; margin: 0 auto; padding: 26px 18px 60px; }
.page-head h1 { margin: 0 0 4px; font-size: 1.6rem; }
.page-head p { margin: 0 0 20px; }

/* ---------- login ---------- */
.login-wrap { max-width: 420px; margin: 40px auto; padding: 0 18px; }
.login-hero { text-align: center; margin-bottom: 18px; }
.login-hero h1 { font-size: 1.5rem; margin: 8px 0 4px; }
.login-hero p { color: var(--muted); margin: 0; }
.mascot { font-size: 64px; line-height: 1; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px;
}
.login-panel { display: flex; flex-direction: column; gap: 8px; }
.login-panel label { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-top: 8px; }
.login-panel input {
  border: 2px solid var(--line); border-radius: 12px; padding: 11px 14px;
  font-size: 1rem; outline: none; transition: border-color 0.15s;
}
.login-panel input:focus { border-color: var(--accent); }
.login-panel .btn-lg { margin-top: 14px; }
.advanced { margin: 8px 0; font-size: 0.85rem; color: var(--muted); }
.advanced summary { cursor: pointer; font-weight: 700; }
.advanced input { width: 100%; margin-top: 4px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; }

/* ---------- status / toast / overlay ---------- */
.status {
  border-radius: 12px; padding: 10px 14px; font-size: 0.92rem; margin-top: 10px;
  background: var(--accent-soft); color: var(--accent); word-break: break-word;
}
.status.error { background: var(--bad-soft); color: var(--bad); }
.status.ok { background: var(--good-soft); color: var(--good); }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 0.9rem; z-index: 200; box-shadow: var(--shadow); animation: fadein 0.2s ease;
}
.overlay {
  position: fixed; inset: 0; background: rgba(255, 255, 255, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 150;
}
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- course grid ---------- */
.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px;
}
.guest-course-prompt {
  grid-column: 1 / -1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.guest-course-prompt .muted { margin: 0; flex: 1 1 220px; }
.course-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease; border: 2px solid transparent;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(29, 36, 64, 0.13); border-color: var(--accent); }
.course-banner {
  height: 118px; display: flex; align-items: center; justify-content: center;
  font-size: 44px; position: relative; color: #fff;
}
.banner-img { width: 100%; height: 100%; object-fit: cover; }
.course-banner .level-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255, 255, 255, 0.92); color: var(--ink);
  border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 0.8rem;
}
.course-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-body h3 { margin: 0; font-size: 1.08rem; }
.course-body .desc {
  margin: 0; color: var(--muted); font-size: 0.88rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.4em;
}
.course-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 3px 10px; font-size: 0.75rem; font-weight: 700;
}
.chip.teal { background: #e0f7f2; color: var(--teal); }
.course-progress-row { margin-top: auto; display: flex; align-items: center; gap: 10px; }
.course-progress-row .progress-track { flex: 1; }
.progress-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--teal)); transition: width 0.4s ease; }
.progress-label { font-size: 0.78rem; color: var(--muted); font-weight: 700; white-space: nowrap; }

/* ---------- player ---------- */
.player-page { max-width: 780px; }
.mother-switch {
  display: flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700;
  color: var(--muted);
}
.mother-switch select {
  font: inherit; font-weight: 700; color: var(--ink);
  border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff;
  max-width: min(100%, 280px);
}
.course-title { margin: 0; font-size: 1.3rem; }
.section-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.section-chip {
  border: 2px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.section-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.section-chip.done { border-color: var(--teal); color: var(--teal); }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress-track { flex: 1; height: 10px; }

.ex-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; min-height: 380px; display: flex; flex-direction: column;
}
.ex-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ex-type-badge {
  background: var(--accent-soft); color: var(--accent); font-weight: 800;
  padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; white-space: nowrap;
}
.ex-title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-body { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.ex-foot { display: flex; gap: 10px; margin-top: 18px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.ex-foot .spacer { flex: 1; }

/* question text & word */
.q-question { font-size: 1.25rem; font-weight: 700; line-height: 1.5; margin: 0; }
.q-question .blank { color: var(--accent); letter-spacing: 2px; }
.q-word { font-size: 1.7rem; font-weight: 800; }
.q-translation { color: var(--muted); font-size: 1rem; margin-top: 2px; }
.q-counter { color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.q-image { max-width: 100%; max-height: 220px; border-radius: 14px; align-self: center; box-shadow: var(--shadow); }

/* options */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .options-grid { grid-template-columns: 1fr; } }
.option {
  border: 2px solid var(--line); background: var(--card); border-radius: 14px;
  padding: 14px 16px; font-size: 1.05rem; font-weight: 700; cursor: pointer;
  text-align: left; transition: border-color 0.12s, background 0.12s, transform 0.06s;
  display: flex; align-items: center; gap: 10px; word-break: break-word;
}
.option .opt-letter {
  background: var(--accent-soft); color: var(--accent); border-radius: 10px;
  min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0;
}
.option:hover { border-color: var(--accent); }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.correct .opt-letter { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .opt-letter { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }

/* feedback */
.feedback { border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.feedback.good { background: var(--good-soft); color: var(--good); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }

/* text input exercises */
.text-input-row { display: flex; gap: 10px; }
.text-input-row input {
  flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: 1.1rem; outline: none;
}
.text-input-row input:focus { border-color: var(--accent); }

/* reordering */
.token-tray, .answer-row {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; align-items: center;
  border-radius: 14px; padding: 10px;
}
.answer-row { border: 2px dashed var(--line); background: #fafbff; }
.token {
  background: var(--accent-soft); color: var(--accent); border: none; cursor: pointer;
  border-radius: 10px; padding: 9px 14px; font-size: 1.05rem; font-weight: 700;
}
.token:hover { background: #dfe3ff; }
.answer-row .token { background: var(--accent); color: #fff; }

/* matching */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item {
  border: 2px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 12px; font-size: 0.98rem; font-weight: 700; cursor: pointer;
  transition: border-color 0.12s, background 0.12s; text-align: left; word-break: break-word;
}
.match-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.match-item.locked { border-color: var(--good); background: var(--good-soft); cursor: default; opacity: 0.85; }
.match-item.shake { animation: shake 0.35s ease; border-color: var(--bad); background: var(--bad-soft); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* flashcards */
.flip-scene { perspective: 1200px; width: 100%; max-width: 420px; margin: 0 auto; }
.flip-card {
  position: relative; width: 100%; min-height: 260px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.5s;
}
.flip-card.flipped { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 18px;
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; text-align: center;
}
.flip-face.back { transform: rotateY(180deg); background: var(--accent-soft); border-color: var(--accent); }
.flip-face img { max-height: 110px; border-radius: 12px; }
.flip-word { font-size: 2rem; font-weight: 800; }
.flip-phonetic { color: var(--muted); }
.flip-example { font-size: 0.95rem; color: var(--ink); background: rgba(255,255,255,0.7); border-radius: 10px; padding: 6px 12px; }
.flash-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.dots { display: flex; gap: 6px; justify-content: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.on { background: var(--accent); }

/* pronunciation */
.ref-text { font-size: 1.5rem; font-weight: 800; text-align: center; line-height: 1.45; }
.record-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mic-btn {
  width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 34px;
  box-shadow: 0 8px 22px rgba(91, 95, 241, 0.4); transition: transform 0.1s, background 0.2s;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.recording { background: var(--bad); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); } 50% { box-shadow: 0 0 0 18px rgba(229, 72, 77, 0); } }
.rec-hint { color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.score-ring {
  width: 110px; height: 110px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; font-weight: 800; margin: 0 auto; position: relative; background: var(--line);
}
.score-ring::after { content: ""; position: absolute; inset: 9px; background: var(--card); border-radius: 50%; }
.score-ring span { position: relative; z-index: 1; }

/* chat */
.chat-wrap { display: flex; flex-direction: column; gap: 10px; }
.chat-scroll {
  display: flex; flex-direction: column; gap: 10px; max-height: 330px; overflow-y: auto;
  padding: 6px 4px; scroll-behavior: smooth;
}
.bubble {
  max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 1rem; line-height: 1.5;
  word-break: break-word; white-space: pre-wrap;
}
.bubble.assistant { background: var(--accent-soft); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble .bubble-sub { display: block; font-size: 0.8rem; opacity: 0.75; margin-top: 4px; }
.bubble-tools { display: flex; gap: 6px; margin-top: 4px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input {
  flex: 1; border: 2px solid var(--line); border-radius: 999px; padding: 11px 18px; font-size: 1rem; outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }
.chat-input-row .btn { border-radius: 999px; }
.starter-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* avatar */
.avatar-box {
  align-self: center; width: 150px; height: 150px; display: flex; align-items: center;
  justify-content: center; font-size: 60px;
}
.avatar-box svg, .avatar-box lottie-player, .avatar-box img { width: 100%; height: 100%; }

/* video */
.video-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.video-wrap video { width: 100%; display: block; max-height: 380px; }
.caption-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px 40px;
  text-align: center; pointer-events: none;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}
.caption-target { color: #fff; font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.caption-target .w.done { color: var(--warn); }
.caption-mother { color: #ffe9a8; font-size: 0.9rem; margin-top: 3px; }
.track-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.extra-panel { border-top: 1px dashed var(--line); padding-top: 10px; }
.extra-panel h4 { margin: 6px 0; }
.vocab-line { display: flex; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }

/* picture story */
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.story-area {
  width: 100%; min-height: 120px; border: 2px solid var(--line); border-radius: 14px;
  padding: 12px 14px; font-size: 1.05rem; font-family: inherit; outline: none; resize: vertical;
}
.story-area:focus { border-color: var(--accent); }

/* self introduction form */
.self-intro-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.self-intro-field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.95rem; }
.self-intro-field .si-input {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px;
  font-size: 1rem; font-family: inherit; outline: none; box-sizing: border-box;
}
.self-intro-field input.si-input { min-height: 44px; }
.self-intro-field .si-input:focus { border-color: var(--accent); }
.self-intro-output { margin-top: 16px; }
.self-intro-output.hidden { display: none; }
.intro-output { min-height: 140px; margin-top: 6px; }
.multi-select { display: flex; flex-direction: column; gap: 8px; }
.multi-opt { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* section / course complete */
.complete-box { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.complete-box .big { font-size: 64px; }
.complete-box h2 { margin: 0; }
.stars { font-size: 42px; letter-spacing: 6px; }
.score-summary { color: var(--muted); font-size: 1rem; }

/* speaker button */
.speaker-btn {
  border: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 8px 18px; font-size: 1rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: background 0.15s;
}
.speaker-btn:hover { background: #dfe3ff; }
.speaker-btn.playing { background: var(--accent); color: #fff; }
.speaker-btn.sm { padding: 5px 12px; font-size: 0.85rem; border-width: 1.5px; }

@media (max-width: 640px) {
  .ex-card { padding: 16px 14px; }
  .page { padding: 16px 12px 50px; }
  .course-grid { grid-template-columns: 1fr; }
}

/* buddies */
.buddy-entry-row {
  margin: 4px 0 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.btn-buddy {
  background: linear-gradient(135deg, #ff7ab8, #b45cff); color: #fff; border: none;
  border-radius: 999px; padding: 12px 22px; font-size: 1.05rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 16px rgba(180, 92, 255, 0.35);
}
.btn-buddy:hover { filter: brightness(1.06); }
.btn-dictionary {
  background: linear-gradient(135deg, #0d9488, #14b8a6); color: #fff; border: none;
  border-radius: 999px; padding: 12px 22px; font-size: 1.05rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
}
.btn-dictionary:hover { filter: brightness(1.06); }

/* dictionary test */
.dictionary-panel label { display: block; font-weight: 700; font-size: 0.9rem; margin: 12px 0 6px; }
.dictionary-panel input[type="text"],
.dictionary-panel select {
  width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 1.02rem; font-family: inherit; outline: none; background: #fff;
}
.dictionary-panel input[type="text"]:focus,
.dictionary-panel select:focus { border-color: var(--accent); }
.dictionary-lang-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 560px) { .dictionary-lang-row { grid-template-columns: 1fr; } }
.dictionary-add-row {
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.92rem; margin-top: 8px;
}
.dictionary-result {
  margin-top: 18px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.dict-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; margin-bottom: 12px; }
.dict-word { font-size: 1.55rem; font-weight: 800; margin: 0; color: #24224a; }
.dict-phonetic { color: var(--muted); font-size: 1.05rem; }
.dict-pos { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  color: #0d9488; background: #f0fdfa; border-radius: 999px; padding: 4px 10px; }
.dict-block { margin: 10px 0; line-height: 1.55; }
.dict-block strong { display: block; font-size: 0.78rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 4px; }
.dict-meta { margin-top: 14px; font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 14px; }
.dict-chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-weight: 700; }
.dict-translations { margin-top: 14px; }
.dict-translations summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.dict-trans-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.dict-trans-list li {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 0.92rem;
}
.buddy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.buddy-card {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px;
  cursor: pointer; font-family: inherit; transition: border-color 0.15s, transform 0.1s;
}
.buddy-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.buddy-avatar {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.buddy-avatar img { width: 100%; height: 100%; object-fit: cover; }
.buddy-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.buddy-name { font-weight: 800; font-size: 1.05rem; color: #24224a; }
.buddy-country { font-size: 0.8rem; color: var(--muted); }
.buddy-desc {
  font-size: 0.85rem; color: var(--muted);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.buddy-go { color: var(--muted); font-size: 1.6rem; font-weight: 700; }

/* buddy chat */
.buddy-chat-page { display: flex; flex-direction: column; min-height: 70vh; }
.buddy-chat-head { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.buddy-chat-icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.buddy-chat-title { font-weight: 800; font-size: 1.1rem; color: #24224a; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.buddy-voice-chip {
  flex-shrink: 0; font-size: 0.75rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 4px 10px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.buddy-transcript {
  flex: 1; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0;
}
.buddy-msg { display: flex; align-items: flex-end; gap: 8px; }
.buddy-msg.from-user { justify-content: flex-end; }
.buddy-msg.from-buddy { justify-content: flex-start; }
.buddy-bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 1.02rem; line-height: 1.5;
  background: var(--accent-soft); color: #24224a; white-space: pre-wrap; word-break: break-word;
}
.from-user .buddy-bubble { background: #e9ecff; }
.from-buddy .buddy-bubble { background: #ffeaf5; }
.buddy-input-row { display: flex; gap: 8px; }
.buddy-input-row input {
  flex: 1; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 1.02rem; font-family: inherit; outline: none;
}
.buddy-input-row input:focus { border-color: var(--accent); }
.buddy-hint { margin-top: 8px; font-size: 0.85rem; text-align: center; min-height: 1.2em; }

/* school info */
.school-info-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.school-info-tab {
  border: 2px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-weight: 700; font-size: 0.9rem; cursor: pointer; color: var(--muted);
}
.school-info-tab.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.school-info-header { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.school-info-logo {
  width: 72px; height: 72px; border-radius: 16px; object-fit: cover;
  border: 1px solid var(--line); background: #fff; flex-shrink: 0;
}
.school-info-name { margin: 0; font-size: 1.25rem; font-weight: 800; }
.school-info-body { line-height: 1.65; white-space: pre-wrap; }
.school-info-carousel {
  display: flex; align-items: center; gap: 8px; justify-content: center;
}
.school-info-carousel-img {
  max-width: 100%; max-height: 280px; border-radius: 16px; object-fit: cover;
  border: 1px solid var(--line);
}
.school-info-carousel-count { display: block; text-align: center; margin-top: 8px; }
.school-info-teachers {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px;
}
.school-info-teacher {
  background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px; text-align: center;
}
.school-info-teacher-photo-wrap { position: relative; display: inline-block; margin-bottom: 8px; }
.school-info-teacher-photo {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line);
}
.school-info-verified {
  position: absolute; right: -2px; bottom: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--teal); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.school-info-teacher-name { font-weight: 800; font-size: 0.95rem; }
.school-info-teacher-role { font-size: 0.82rem; margin-top: 2px; }
.school-info-contacts { display: flex; flex-direction: column; gap: 10px; }
.school-info-contact-row {
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.school-info-contact-kind { font-size: 0.78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.school-info-contact-value { margin-top: 4px; font-size: 1rem; word-break: break-word; }

.guest-prompt-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.flip-example-trans { margin-top: 6px; font-size: 0.92rem; text-align: center; }
.ex-json-panel {
  margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px;
}
.ex-json-panel summary { cursor: pointer; font-weight: 700; color: var(--muted); font-size: 0.88rem; }
.ex-json-actions { margin: 8px 0; }
.ex-json-pre {
  margin: 0; padding: 12px; border-radius: 12px; background: #0f172a; color: #e2e8f0;
  font-size: 0.72rem; line-height: 1.45; overflow: auto; max-height: 280px; white-space: pre-wrap;
  word-break: break-word;
}
.sr-only-copy {
  position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0;
}
.json-export-modal {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.json-export-modal.hidden { display: none; }
.json-export-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.json-export-dialog {
  position: relative; z-index: 1; width: min(920px, 100%); max-height: 90vh; display: flex;
  flex-direction: column; gap: 10px; padding: 18px;
}
.json-export-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.json-export-head h2 { margin: 0; font-size: 1.1rem; }
.json-export-area {
  flex: 1; min-height: 320px; width: 100%; font-family: ui-monospace, monospace; font-size: 0.72rem;
  line-height: 1.45; padding: 12px; border-radius: 12px; border: 2px solid var(--line); resize: vertical;
}
.json-export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-trans-host { margin: 8px 0 4px; }
.gen-trans-row { margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.gen-trans-btn { font-size: 0.82rem; }
