/* style.css - light, child-friendly, bilingual (EN / ZH) - INHANA 英翰 branding (orange & white) */

:root {
  --bg: #fff9f0;
  --card: #ffffff;
  --text: #2a2118;
  --muted: #6b6156;
  --hint: #9a8f83;
  --border: #f0e6d8;
  /* INHANA brand palette: orange & white (from official logo) */
  --brand-orange: #f39c00;
  --brand-orange-d: #e08600;
  --brand-orange-bg: #fff3dd;
  --brand-soft: #fbe9c8;
  --primary: #ef8b00;
  --primary-d: #d47600;
  --primary-h: #ffb347;
  --good: #1d9e75;
  --good-bg: #e3f6ee;
  --close: #b97900;
  --close-bg: #fff3d6;
  --again: #d8443a;
  --again-bg: #fde9e8;
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- language visibility ---- */
body.lang-en .zh { display: none !important; }
body.lang-zh .en { display: none !important; }
.brand-text .en, .brand-text .zh,
.hero-title .en, .hero-title .zh { display: inline-block; }
.hero-title .zh { display: block; }

/* ---- top bar (white with orange accents) ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: #ffffff;
  border-bottom: 3px solid var(--brand-orange);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo-img { height: 46px; width: auto; display: block; }
.brand-center { position: absolute; left: 50%; transform: translateX(-50%); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .en { font-weight: 700; font-size: 16px; color: var(--brand-orange-d); }
.brand-text .zh { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; position: relative; }

.lang-switch { display: inline-flex; border: 1.5px solid var(--brand-orange); border-radius: 999px; overflow: hidden; }
.lang-switch button {
  border: 0; background: transparent; padding: 6px 10px; cursor: pointer;
  font-size: 12px; color: var(--muted);
}
.lang-switch button.active { background: var(--brand-orange); color: #ffffff; }

.link-btn {
  display: inline-block; padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--brand-orange); color: var(--brand-orange-d); font-size: 13px;
  background: #ffffff; font-weight: 600;
}
.link-btn:hover { background: var(--brand-orange-bg); text-decoration: none; }

/* ---- brand footer (company info on every page) ---- */
.brand-footer {
  margin-top: 40px;
  background: var(--brand-orange);
  color: #ffffff;
  padding: 26px 20px 30px;
  font-size: 13px;
  text-align: center;
}
.brand-footer .bf-logo-chip {
  display: inline-block; background: #ffffff; border-radius: 12px;
  padding: 8px 16px; margin-bottom: 10px;
}
.brand-footer .bf-logo-img { height: 44px; width: auto; display: block; }
.brand-footer .bf-tagline { margin: 2px 0 12px; font-size: 13px; color: #ffffff; }
.brand-footer .bf-tagline .bf-name { font-weight: 800; letter-spacing: .02em; }
.brand-footer .bf-badge {
  display: inline-block; margin: 0 auto 14px; padding: 5px 14px;
  border: 1.5px solid #ffffff; border-radius: 999px;
  color: #ffffff; font-size: 12px; letter-spacing: .03em;
}
.brand-footer .bf-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin-bottom: 10px; }
.brand-footer .bf-links a, .brand-footer .bf-links span { color: #ffffff; }
.brand-footer .bf-links a { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.brand-footer .bf-links a:hover { color: var(--brand-orange-bg); }
.brand-footer .bf-fine { font-size: 11.5px; color: rgba(255,255,255,.85); }

/* ---- layout ---- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---- home hero ---- */
.hero { text-align: center; margin-bottom: 26px; }
.hero-title { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.hero-title .zh { font-size: 16px; color: var(--muted); font-weight: 500; margin-top: 4px; }
.hero-sub { font-size: 14px; color: var(--muted); max-width: 620px; margin: 0 auto; }
.hero-sub .zh { display: block; margin-top: 2px; }

/* ---- poem grid ---- */
.poem-grid { display: block; } /* container for folder-grid / level view */
.poem-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: box-shadow .15s, transform .1s; color: var(--text);
}
.poem-card:hover { box-shadow: 0 6px 18px rgba(31,35,48,.10); text-decoration: none; transform: translateY(-2px); }
.card-stage { font-size: 11px; font-weight: 600; color: var(--brand-orange-d); text-transform: uppercase; letter-spacing: .04em; }
.card-title { font-size: 17px; font-weight: 700; }
.card-title-zh { font-size: 13px; color: var(--muted); }
.card-author { font-size: 13px; color: var(--muted); }
.card-desc { font-size: 13px; color: var(--text); opacity: .85; flex: 1; }
.card-go { font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 6px; }

/* ---- practice page ---- */
.practice .poem-head { text-align: center; margin-bottom: 18px; }
.poem-stage { font-size: 12px; font-weight: 600; color: var(--brand-orange-d); text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.poem-title { font-size: 24px; font-weight: 700; margin: 4px 0 2px; }
.poem-author { font-size: 14px; color: var(--muted); margin: 0; }
.poem-desc { font-size: 14px; color: var(--muted); margin: 6px 0 0; }

.poem-text {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 24px; font-size: 19px; line-height: 1.9; text-align: center;
  margin: 0 0 18px; white-space: pre-wrap;
}
.w { padding: 1px 2px; border-radius: 4px; transition: background .2s; }
.w.good { background: var(--good-bg); color: var(--good); font-weight: 600; }
.w.close { background: var(--close-bg); color: var(--close); }
.w.again { background: var(--again-bg); color: var(--again); text-decoration: underline wavy var(--again); }

.status { text-align: center; font-size: 15px; font-weight: 600; min-height: 22px; margin: 4px 0 14px; }
.status.info { color: var(--primary); }
.status.warn { color: var(--again); }

.controls { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 22px; }

.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; font-weight: 600; padding: 12px 20px; transition: background .12s, opacity .12s;
  font-family: inherit;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-secondary { background: var(--card); color: var(--primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: #eef2fb; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: #f0f2f7; }

.mic-btn { display: inline-flex; align-items: center; gap: 10px; }
.mic-icon {
  width: 16px; height: 16px; border-radius: 5px; background: #fff; opacity: .9;
  box-shadow: inset 0 0 0 2px transparent; position: relative;
  /* simple mic shape */
  background: #fff;
}
.mic-icon::before {
  content: ""; position: absolute; top: 3px; left: 5px; width: 6px; height: 8px;
  border-radius: 3px; background: var(--primary);
}
.mic-icon::after {
  content: ""; position: absolute; top: 12px; left: 4px; width: 8px; height: 2px;
  border-radius: 2px; background: var(--primary);
}
.stop-btn { background: #e53e3e; color: #fff; }
.stop-btn:hover { background: #c53030; }
.stop-btn::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  background: #fff; border-radius: 2px; margin-right: 8px; vertical-align: middle;
}

/* ---- result ---- */
.result { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.result-title { font-size: 18px; margin: 0 0 14px; }
.score-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.score-ring {
  width: 92px; height: 92px; border-radius: 50%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; border: 4px solid var(--border);
  color: var(--muted); flex-shrink: 0;
}
.score-ring span { font-size: 26px; font-weight: 800; line-height: 1; }
.score-ring .score-unit { font-size: 11px; font-weight: 500; color: var(--hint); }
.score-ring.good { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.score-ring.close { border-color: var(--close); color: var(--close); background: var(--close-bg); }
.score-ring.again { border-color: var(--again); color: var(--again); background: var(--again-bg); }
.score-msg { font-size: 18px; font-weight: 700; }

.legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.close { background: var(--close-bg); color: var(--close); }
.chip.again { background: var(--again-bg); color: var(--again); }

.practise { border-top: 1px solid var(--border); padding-top: 14px; }
.practise-label { font-size: 14px; font-weight: 600; margin: 0 0 8px; color: var(--muted); }
.practise-empty { font-size: 14px; color: var(--good); font-weight: 600; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip { font-size: 14px; font-weight: 600; padding: 5px 11px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); }
.word-chip.close { background: var(--close-bg); color: var(--close); border-color: var(--close-bg); }
.word-chip.again { background: var(--again-bg); color: var(--again); border-color: var(--again-bg); }

/* ---- admin ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--hint); margin: 0 0 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { font-size: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.textarea { resize: vertical; min-height: 140px; line-height: 1.6; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.saved-note { font-size: 13px; color: var(--good); font-weight: 600; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.error { color: var(--again); font-size: 13px; margin: 8px 0 0; }
.gate-card { max-width: 400px; margin: 60px auto; text-align: center; }
.gate-card h2 { text-align: left; }
.gate-card .input { width: 100%; margin-bottom: 12px; }

.poem-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.poem-row:last-child { border-bottom: 0; }
.poem-row-title { font-weight: 600; font-size: 14px; }
.poem-row-meta { font-size: 12px; color: var(--hint); }
.poem-row-actions { display: flex; gap: 8px; }

.file-btn { position: relative; overflow: hidden; display: inline-block; cursor: pointer; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(20,24,38,.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: var(--radius); padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-card h2 { margin-top: 0; }

/* ---- setup guide ---- */
.guide h1 { font-size: 22px; margin: 0 0 8px; }
.guide .hint { margin-bottom: 18px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 18px 38px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px;
  border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.steps h3 { margin: 0 0 4px; font-size: 15px; }
.steps p { margin: 0 0 4px; font-size: 14px; }
.steps ul { margin: 6px 0; padding-left: 20px; }
.steps li { font-size: 14px; }
code { background: #eef0f5; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.callout { background: #eef4ff; border: 1px solid #d7e3fb; border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 16px; }
.callout.warn { background: #fff6e9; border-color: #f3e2c0; }
.callout h3 { margin: 0 0 6px; font-size: 14px; }
.callout p, .callout li { font-size: 13px; margin: 2px 0; }
.callout ul { padding-left: 18px; margin: 4px 0; }

/* ---- responsive ---- */
@media (max-width: 600px) {
  .hero-title { font-size: 22px; }
  .poem-text { font-size: 17px; padding: 18px 16px; }
  .btn { font-size: 14px; padding: 11px 16px; }
  .top-actions { gap: 6px; }
  .link-btn { padding: 6px 9px; font-size: 12px; }
  .chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; }
}

/* ================================================================
   FLOATING CHATBOT
   ================================================================ */
.chat-bubble {
  position: fixed; bottom: 24px; right: 24px;
  width: 62px; height: 62px; border-radius: 50%;
  background: #ffffff; border: 3px solid var(--brand-orange);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(224,134,0,.4);
  z-index: 1000; transition: transform .15s, box-shadow .15s;
  overflow: hidden;
}
.chat-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(224,134,0,.55); }
.chat-bubble img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.chat-bubble svg { width: 26px; height: 26px; color: var(--brand-orange); }

.chat-panel {
  position: fixed; bottom: 24px; right: 24px;
  width: 360px; max-width: calc(100vw - 32px);
  height: 460px; max-height: calc(100vh - 48px);
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 8px 32px rgba(20,24,38,.18);
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 1001; opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none; transition: opacity .2s, transform .2s;
}
.chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--brand-orange); color: #fff;
}
.chat-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 2px solid #ffffff; background: #ffffff; flex: none;
}
.chat-title { font-size: 14px; font-weight: 700; flex: 1; }
.chat-close {
  background: rgba(255,255,255,.2); border: 0; color: #fff; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.chat-close:hover { background: rgba(255,255,255,.35); }

.chat-log {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.chat-msg {
  max-width: 82%; padding: 9px 13px; border-radius: 13px; font-size: 14px; line-height: 1.45;
  word-wrap: break-word;
}
.chat-msg.user {
  align-self: flex-end; background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot {
  align-self: flex-start; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-msg.thinking { display: flex; gap: 4px; align-self: flex-start; }
.chat-msg.thinking .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--hint);
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-msg.thinking .dot:nth-child(2) { animation-delay: .15s; }
.chat-msg.thinking .dot:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%,60%,100% { opacity: .3; } 30% { opacity: 1; } }

.chat-msg.audio-msg { display: flex; align-items: center; gap: 10px; }
.chat-play-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--good); color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform .1s;
}
.chat-play-btn:hover { transform: scale(1.1); }
.chat-replay { font-size: 12px; color: var(--muted); }

.chat-input-row {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--card);
}
.chat-input {
  flex: 1; border: 1px solid var(--border); border-radius: 22px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text);
  outline: none;
}
.chat-input:focus { border-color: var(--primary); }
.chat-send {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send:hover { background: var(--primary-d); }

/* ================================================================
   ATTEMPT HISTORY
   ================================================================ */
.history-section { margin-top: 22px; }
.history-title {
  font-size: 15px; font-weight: 700; color: var(--muted); margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.history-clear { font-size: 12px; color: var(--again); cursor: pointer; border: 0; background: none; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-card {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: box-shadow .15s;
}
.history-card:hover { box-shadow: 0 2px 8px rgba(20,24,38,.06); }
.history-score {
  width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800;
  flex-shrink: 0; color: var(--muted);
}
.history-score.good { border-color: var(--good); color: var(--good); background: var(--good-bg); }
.history-score.close { border-color: var(--close); color: var(--close); background: var(--close-bg); }
.history-score.again { border-color: var(--again); color: var(--again); background: var(--again-bg); }
.history-info { flex: 1; min-width: 0; }
.history-date { font-size: 13px; font-weight: 600; color: var(--text); }
.history-words { font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-delta {
  font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 6px; flex-shrink: 0;
}
.history-delta.up { color: var(--good); background: var(--good-bg); }
.history-delta.down { color: var(--again); background: var(--again-bg); }
.history-delta.flat { color: var(--muted); background: #f0f2f7; }

/* ================================================================
   IMPROVED FEEDBACK REPORT
   ================================================================ */
.report-words { margin-top: 16px; }
.report-words-title {
  font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.report-words-title .badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--again-bg); color: var(--again);
}
.report-word-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.report-word {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 14px; border-radius: 10px; min-width: 70px;
  border: 2px solid var(--border); background: var(--card);
}
.report-word.good { border-color: var(--good); background: var(--good-bg); }
.report-word.close { border-color: var(--close); background: var(--close-bg); }
.report-word.again { border-color: var(--again); background: var(--again-bg); }
.report-word .word-text { font-size: 15px; font-weight: 700; }
.report-word .word-score { font-size: 11px; font-weight: 600; opacity: .8; }
.report-word .word-play {
  border: 0; background: rgba(0,0,0,.08); border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  margin-top: 4px; font-size: 11px;
}
.report-word .word-play:hover { background: rgba(0,0,0,.15); }

.report-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 14px;
}
.report-stat {
  text-align: center; padding: 12px; border-radius: var(--radius-sm); background: var(--bg);
}
.report-stat .stat-num { font-size: 24px; font-weight: 800; }
.report-stat .stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.report-stat.good .stat-num { color: var(--good); }
.report-stat.close .stat-num { color: var(--close); }
.report-stat.again .stat-num { color: var(--again); }

/* ---- small screens: keep header usable ---- */
@media (max-width: 640px) {
  .brand-center { position: static; transform: none; }
  .brand-logo-img { height: 34px; }
  .topbar { flex-wrap: wrap; }
  .brand-footer .bf-links { flex-direction: column; gap: 6px; }
}

/* ---- level folders (home page) ---- */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.folder-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 20px 16px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(31,35,48,.05);
  transition: transform .15s ease, box-shadow .15s ease;
  overflow: hidden;
}
.folder-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(239,139,0,.16);
  border-color: var(--primary);
}
/* the little folder tab */
.folder-tab {
  position: absolute; top: 0; left: 20px;
  width: 64px; height: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-h));
  border-radius: 0 0 8px 8px;
}
.folder-count {
  position: absolute; top: 14px; right: 16px;
  min-width: 30px; height: 30px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  border-radius: 999px; font-size: 13px; font-weight: 700;
}
.folder-name {
  margin-top: 8px;
  font-size: 19px; font-weight: 700; color: var(--text);
}
.folder-sub {
  font-size: 12px; font-weight: 600; color: var(--primary);
  letter-spacing: .03em; margin-top: 2px;
}
.folder-desc {
  font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.45;
}
.folder-preview {
  font-size: 12px; color: var(--hint); margin-top: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.folder-open {
  margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--primary);
}

/* ---- breadcrumb + level view ---- */
.crumbs {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 18px; font-size: 13px;
}
.crumbs a { color: var(--primary); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { color: var(--hint); }
.crumbs strong { color: var(--text); font-weight: 700; }
.level-head { margin-bottom: 18px; }
.level-title { margin: 0 0 4px; font-size: 24px; color: var(--text); }
.level-desc { margin: 0; font-size: 13.5px; color: var(--muted); }
.poem-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.card-kind {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--primary-h);
  border-radius: 999px; padding: 3px 10px;
  align-self: flex-start;
}


/* ---- responsive multi-column grids (folders + poem cards) ---- */
.folder-grid {
  grid-template-columns: repeat(2, 1fr);
}
.poem-grid-inner {
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 1100px) {
  .folder-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 960px) {
  .poem-grid-inner { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .folder-grid { grid-template-columns: 1fr; }
  .poem-grid-inner { grid-template-columns: 1fr; }
}

/* ---- user chip (topbar sign in/out) ---- */
.user-chip {
  display: flex; align-items: center; gap: 8px;
}
.user-chip-name {
  font-size: 13px; font-weight: 700; color: var(--ink, #333);
  background: #fff4e5; border: 1px solid #ffd9a8;
  border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}
.user-chip-btn {
  font-size: 12.5px; font-weight: 600; color: #b35c00;
  background: #fff; border: 1.5px solid var(--primary, #ef8b00);
  border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.user-chip-btn:hover { background: var(--primary, #ef8b00); color: #fff; }

/* ---- sign-in overlay ---- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(40, 30, 20, 0.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-overlay.visible { display: flex; }
.auth-box {
  background: #fff; border-radius: 20px;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  padding: 32px 30px; width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto; text-align: center;
}
.auth-logo img { width: 76px; height: 76px; object-fit: contain; border-radius: 16px; }
.auth-title { font-size: 22px; margin: 14px 0 4px; color: #33302c; }
.auth-sub { font-size: 13.5px; color: #8a8378; margin: 0 0 18px; }
.auth-users {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
}
.auth-user-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px 12px; border: 1.5px solid #ffe0b8; border-radius: 14px;
  background: #fffaf3; cursor: pointer; transition: transform .12s, border-color .12s;
  font-family: inherit;
}
.auth-user-card:hover { transform: translateY(-2px); border-color: var(--primary, #ef8b00); }
.auth-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--primary, #ef8b00); color: #fff;
  font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.auth-name { font-size: 14px; font-weight: 700; color: #444; }
.auth-new-btn { width: 100%; }
.auth-prompt { font-size: 14.5px; font-weight: 600; color: #555; margin: 6px 0 12px; }
.auth-input {
  width: 100%; box-sizing: border-box; font-size: 16px; padding: 11px 14px;
  border: 1.5px solid #e4ddd2; border-radius: 12px; margin-bottom: 10px;
  text-align: center; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--primary, #ef8b00); }
.auth-error { color: #d03030; font-size: 13px; min-height: 18px; margin: 2px 0 8px; }
.auth-adopt {
  display: block; text-align: left; font-size: 12.5px; color: #77705f;
  background: #fff8ec; border: 1px dashed #e8d4ae; border-radius: 10px;
  padding: 9px 11px; margin: 4px 0 10px; cursor: pointer;
}
.auth-adopt input { margin-right: 4px; }
.auth-legacy-note { font-size: 12px; color: #9a927f; margin-top: 14px; }
.auth-box .btn { margin-top: 8px; width: 100%; }
.auth-box .btn-ghost { margin-top: 6px; }

/* ---- stopwatch + stop button group ---- */
.stop-group {
  display: flex; align-items: center; gap: 14px;
  animation: pa-pulse 1.6s ease-in-out infinite;
}
@keyframes pa-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .82; }
}
.stopwatch {
  font-variant-numeric: tabular-nums;
  font-size: 20px; font-weight: 800; color: #d03030;
  background: #fff; border: 2px solid #ffd0d0; border-radius: 999px;
  padding: 8px 16px; white-space: nowrap;
}

/* ---- recording player in the result panel ---- */
.rec-section { margin: 14px 0 4px; }
.rec-label { font-size: 13px; font-weight: 700; color: #8a8378; margin: 0 0 6px; }
#recPlayer { width: 100%; max-width: 460px; height: 40px; }

/* ---- replay button on history cards ---- */
.history-play {
  font-size: 12px; font-weight: 700; color: #b35c00;
  background: #fff4e5; border: 1.5px solid #ffd9a8;
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
  white-space: nowrap; align-self: center;
}
.history-play:hover { background: var(--primary, #ef8b00); color: #fff; }
.history-play:disabled { opacity: .5; cursor: wait; }

/* ---- recordings drawer (DeepSeek-style side panel) ---- */
.rec-tab { font-weight: 700; }
.rec-scrim {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(30, 25, 18, 0.4);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.rec-scrim.visible { opacity: 1; pointer-events: auto; }
.rec-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1101;
  width: min(380px, 92vw); background: #fff;
  box-shadow: -12px 0 40px rgba(0,0,0,.18);
  transform: translateX(102%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
.rec-drawer.open { transform: translateX(0); }
.rec-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 12px; border-bottom: 1px solid #f0e7da;
}
.rec-drawer-title { font-size: 18px; font-weight: 800; color: #33302c; }
.rec-drawer-close {
  border: none; background: none; font-size: 26px; line-height: 1;
  color: #a89e8c; cursor: pointer; padding: 2px 6px;
}
.rec-drawer-close:hover { color: var(--primary, #ef8b00); }
.rec-drawer-sub {
  font-size: 13px; color: #8a8378; padding: 10px 20px 0;
}
.rec-drawer-list { flex: 1; overflow-y: auto; padding: 12px 20px 24px; }
.rec-empty { color: #9a927f; font-size: 14px; text-align: center; margin-top: 40px; }
.rec-group { margin-bottom: 18px; }
.rec-group-title {
  font-size: 14px; font-weight: 800; color: #55504a;
  margin: 10px 0 6px; padding-bottom: 4px;
  border-bottom: 2px solid #fff1df;
}
.rec-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 10px;
}
.rec-row:hover { background: #fff8ec; }
.rec-score {
  font-size: 14px; font-weight: 800; min-width: 36px; text-align: center;
  border-radius: 999px; padding: 3px 0; color: #fff;
}
.rec-score.good { background: #2e9e44; }
.rec-score.close { background: #e6a300; }
.rec-score.again { background: #d04545; }
.rec-date { flex: 1; font-size: 12.5px; color: #8a8378; }

/* ---- chatbot: report button + word label ---- */
.chat-report-btn {
  font-size: 12.5px; font-weight: 700; color: #b35c00;
  background: #fff4e5; border: 1.5px solid #ffd9a8;
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.chat-report-btn:hover { background: var(--primary, #ef8b00); color: #fff; }
.chat-report-btn:disabled { opacity: .65; cursor: default; }
.report-wrap { margin-top: -4px; }
.chat-word-label { font-size: 13.5px; font-weight: 700; color: #444; }

/* ---- admin safeguarding rows ---- */
.sub-head { font-size: 14px; font-weight: 800; color: #55504a; margin: 16px 0 8px; }
.report-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff8ec; border: 1px solid #ffe3ba; border-radius: 12px;
  padding: 10px 14px; margin-bottom: 8px;
}
.report-word { font-weight: 800; color: #b35c00; }
.report-meta { flex: 1; font-size: 12.5px; color: #8a8378; }
.report-row .btn { padding: 6px 14px; font-size: 13px; }
.approved-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef8ee; border: 1.5px solid #bfe3bf;
  border-radius: 999px; padding: 5px 8px 5px 14px; margin: 0 6px 6px 0;
  font-size: 13px; font-weight: 700; color: #2e7d32;
}
.approved-remove {
  border: none; background: #cfe8cf; color: #2e7d32;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 14px; line-height: 1; cursor: pointer;
}
.approved-remove:hover { background: #2e7d32; color: #fff; }

/* ---- quick edit (discreet footer pencil + panel) ---- */
.qedit-link {
  position: absolute; right: 10px; bottom: 8px;
  border: none; background: none; color: #cfc6b6;
  font-size: 13px; cursor: pointer; opacity: .55;
}
.qedit-link:hover { opacity: 1; color: var(--primary, #ef8b00); }
.brand-footer { position: relative; }
.qedit-scrim {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(30, 25, 18, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.qedit-box {
  background: #fff; border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 620px; max-height: 88vh; overflow-y: auto;
  padding: 22px 24px;
}
.qedit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.qedit-title { font-size: 18px; font-weight: 800; color: #33302c; }
.qedit-close { border: none; background: none; font-size: 24px; color: #a89e8c; cursor: pointer; }
.qedit-note { font-size: 12.5px; color: #8a8378; margin: 4px 0 14px; }
.qedit-field { display: block; margin-bottom: 12px; }
.qedit-field > span { display: block; font-size: 12.5px; font-weight: 700; color: #6b6455; margin-bottom: 4px; }
.qedit-select, .qedit-input {
  width: 100%; box-sizing: border-box; font-size: 15px;
  padding: 9px 12px; border: 1.5px solid #e4ddd2; border-radius: 10px;
  font-family: inherit;
}
.qedit-text {
  width: 100%; box-sizing: border-box; font-size: 14.5px; line-height: 1.5;
  padding: 10px 12px; border: 1.5px solid #e4ddd2; border-radius: 10px;
  font-family: inherit; resize: vertical; white-space: pre-wrap;
}
.qedit-input:focus, .qedit-text:focus, .qedit-select:focus { outline: none; border-color: var(--primary, #ef8b00); }
.qedit-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.qedit-msg { font-size: 13px; font-weight: 700; color: #2e7d32; }

/* ---- admin: live Azure connection badge ---------------------------------- */
.azure-badge {
  display: block; margin: 0 0 12px; padding: 10px 14px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  font-size: 13.5px; line-height: 1.5; font-weight: 600;
  background: #faf7f2; color: var(--muted);
}
.azure-badge.ok {
  background: var(--good-bg); border-color: var(--good); color: var(--good);
}
.azure-badge.warn {
  background: var(--close-bg); border-color: var(--close); color: var(--close);
}
.azure-badge.checking { font-weight: 500; }
