/* =============================================================
   AI cho Trẻ em vùng cao — giao diện
   Thiết kế lại: hiện đại, thân thiện máy tính bảng trong lớp học.
   - Chữ lớn, nút lớn, đọc được trong ánh sáng yếu.
   - Không dùng phông chữ ngoài (phần mềm chạy ngoại tuyến).
   - Nhẹ nhàng: bo góc to, đổ bóng mềm, chuyển động ngắn.
   - Kính trọng ai cần ít chuyển động (prefers-reduced-motion).
   ============================================================= */

:root {
  --green-950: #0d2a4a;
  --green-900: #123c5e;
  --green-800: #075e68;
  --green-700: #00807a;
  --green-600: #0ea5a0;
  --green-100: #bff5e7;
  --green-50: #eefdf7;
  --ink: #16283c;
  --ink-soft: #46586c;
  --paper: #ffffff;
  --bg: #fff8e9;
  --line: #e2d5bb;
  --thread-red: #d81b60;
  --ochre: #ffcb2e;
  --flax: #fff4d4;
  --thread-pink: #ff3d8f;
  --thread-jade: #12d6a3;
  --amber-900: #8a3c00;
  --amber-100: #fff0bd;
  --red-700: #b3121b;
  --red-100: #ffe2e0;
  --blue-600: #1d5ff0;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(13, 42, 74, .09), 0 2px 8px rgba(13, 42, 74, .06);
  --shadow: 0 2px 6px rgba(13, 42, 74, .08), 0 10px 28px rgba(13, 42, 74, .10);
  --shadow-lg: 0 4px 12px rgba(13, 42, 74, .11), 0 22px 44px rgba(13, 42, 74, .13);
  --focus: #f59e0b;
  --grad-green: linear-gradient(135deg, var(--green-600), var(--green-800));
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    var(--ht-weave) repeat 0 0 / 192px 192px,
    radial-gradient(ellipse 900px 720px at 100% 300px, #b8f8dd, transparent 88%),
    radial-gradient(ellipse 760px 900px at -4% 820px, #ffd9a3, transparent 88%),
    radial-gradient(ellipse 680px 620px at 60% 100%, #ffd6e8, transparent 90%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
a { color: var(--green-700); }
::selection { background: #ffd76b; }

/* ---------------- header + điều hướng ---------------- */

.app-header {
  position: relative;
  z-index: 30;
  border-top: 4px solid var(--thread-pink);
  border-image: linear-gradient(90deg, var(--thread-pink) 0 25%, var(--ochre) 25% 50%, var(--thread-jade) 50% 75%, #ae9de8 75%) 1;
  background:
    repeating-linear-gradient(90deg, rgba(244, 233, 213, .02) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 620px 340px at 88% -30%, rgba(18, 214, 163, .30), transparent 70%),
    radial-gradient(ellipse 480px 300px at 6% 120%, rgba(255, 203, 46, .16), transparent 70%),
    linear-gradient(115deg, var(--green-950) 0%, #10456b 46%, #0a6f72 100%);
  color: var(--flax);
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 14px;
  background: var(--flax);
  padding: 7px;
  box-shadow: 0 0 0 1px var(--ochre), 0 0 0 5px rgba(216, 183, 121, .08);
}
.brand-text h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.3px; }
.tagline { margin: 5px 0 0; font-size: .85rem; color: #d8f2ee; }
.header-note { display: flex; align-items: center; gap: 14px; color: var(--ochre); font-size: .82rem; letter-spacing: .6px; }
.header-note-sub { display: block; margin-top: 3px; color: #d8f2ee; font-size: .76rem; letter-spacing: .2px; }
.thread-mark { width: 20px; height: 20px; border: 1px solid var(--ochre); transform: rotate(45deg); box-shadow: inset 0 0 0 5px var(--green-900), inset 0 0 0 6px var(--ochre); }

.main-nav {
  display: flex;
  width: 100%;
  gap: 5px;
  flex-wrap: wrap;
  padding: 14px 0 0;
  border-top: 1px solid rgba(244, 233, 213, .14);
}

.nav-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #e8e8dc;
  font: inherit;
  font-weight: 600;
  font-size: .86rem;
  padding: 10px 13px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .1s ease;
}
.nav-btn:hover { background: rgba(244, 233, 213, .1); color: #fff; }
.nav-btn:active { transform: scale(.97); }
.nav-btn.is-active {
  background: var(--ochre);
  color: var(--green-950);
  border-color: #ffe5a1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}
.nav-btn:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.ht-dai.ht-dai-dau-trang { height: 56px; box-shadow: 0 5px 18px rgba(0, 0, 0, .2); }

/* ---------------- banner cảnh báo ---------------- */

.banner {
  margin: 20px auto 0;
  max-width: 1192px;
  width: calc(100% - 40px);
  background: #f8efd9;
  color: #6b4b29;
  border: 1px solid #e2cfaa;
  border-left: 4px solid var(--ochre);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: .82rem;
}

/* ---------------- khung trang ---------------- */

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.view { display: none; }
.view.is-active {
  display: block;
  animation: view-in .26s ease both;
}
.view:not(#view-infographic), #info-editor {
  background: #fdf4e4;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 24px;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 3px rgba(64, 49, 26, .025), 0 8px 24px rgba(64, 49, 26, .035);
  padding: 24px;
  margin-bottom: 22px;
}

.panel-title { font-size: 1.12rem; color: var(--green-900); }
.panel > .panel-title { display: flex; align-items: baseline; gap: 12px; }
.panel > .panel-title::before { content: ""; flex: 0 0 8px; height: 8px; background: var(--thread-red); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--flax); }
.panel-subtitle { font-size: .96rem; color: var(--green-800); margin: 14px 0 6px; }

.hint { color: var(--ink-soft); font-size: .92rem; margin: 8px 0 0; }
.hint.tiny { font-size: .84rem; }
.hint.center { text-align: center; }

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------------- nút ---------------- */

.btn {
  appearance: none;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--green-700);
  background: var(--paper);
  color: var(--green-800);
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease,
              transform .08s ease, border-color .15s ease;
}
.btn:hover {
  background: var(--green-100);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(.99); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn.primary {
  background: linear-gradient(135deg, #e0245e, #c2185b);
  border-color: #b01450;
  color: #fffdf8;
  box-shadow: 0 4px 12px rgba(216, 27, 96, .28);
}
.btn.primary:hover { background: linear-gradient(135deg, #c81a52, #a30f49); box-shadow: 0 6px 18px rgba(216, 27, 96, .34); }

.btn.secondary { background: var(--green-100); }
.btn.ghost { border-color: var(--line); background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: #eef2ef; }

.btn.danger { border-color: #f3b3ad; color: var(--red-700); background: #fff5f4; }
.btn.danger:hover { background: #fdecea; }

.btn.small { min-height: 42px; padding: 6px 15px; font-size: .92rem; }
.btn.big { min-height: 64px; font-size: 1.25rem; padding: 12px 34px; border-radius: 14px; }
.btn.nav { min-width: 160px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none !important; }

/* =================== 1. BẢNG THẺ TỪ =================== */

.status-panel .status-line { font-size: 1.02rem; font-weight: 700; color: var(--green-900); }

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.group-card {
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  min-height: 128px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.group-card:hover {
  border-color: var(--green-700);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, var(--green-50), var(--paper));
}
.group-card:active { transform: translateY(-1px); }

.g-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
  border-radius: 14px;
  background: var(--green-100);
  margin-bottom: 8px;
}
.group-card .g-name { display: block; font-size: 1.12rem; font-weight: 800; color: var(--green-900); }
.group-card .g-count { display: block; font-size: .88rem; color: var(--ink-soft); margin-top: 4px; }

.tag-pending {
  align-self: flex-start;
  margin-top: 10px;
  background: var(--amber-100);
  color: var(--amber-900);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 11px;
}

.tag-user {
  align-self: flex-start;
  margin-top: 10px;
  background: var(--green-100);
  color: var(--green-900);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 11px;
}

.group-wrap { position: relative; }
.group-wrap .group-card { width: 100%; height: 100%; }
.group-wrap .del-sent {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  border-left: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  line-height: 1.5;
}
.group-wrap .del-sent:hover { background: #fdecea; }

#cards-empty { margin-top: 4px; }
#cards-add { margin-top: 18px; }
#cards-edit { margin-top: 18px; }
.stage-del { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.stage-del .btn { min-height: 40px; }

.gc-acts {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.gc-act {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--green-800);
  border-radius: 999px;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.gc-act:hover { background: var(--green-50); border-color: var(--green-600); transform: translateY(-1px); }
.gc-act.danger:hover { background: #fdecea; border-color: var(--red-600); color: var(--red-700); }
.group-card.user {
  border-style: dashed;
  background: linear-gradient(180deg, var(--green-50), var(--paper));
}

.gc-edit {
  min-height: 128px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}
.gc-edit input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--paper);
}
.gc-edit input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.gc-edit-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.gc-btn {
  appearance: none;
  font: inherit;
  font-size: .88rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.gc-btn.ok { border: 0; background: var(--green-700); color: #fff; }
.gc-btn.ok:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.gc-btn.cancel { border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.gc-btn.cancel:hover { background: var(--green-50); }
.gc-edit-msg { font-size: .84rem; font-weight: 600; margin: 0; }

/* ---- sân khấu thẻ ---- */

.stage-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.stage-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stage-group { font-weight: 800; color: var(--green-900); }
.stage-progress { color: var(--ink-soft); font-size: .92rem; }

.stage-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--green-100);
  overflow: hidden;
  margin: 0 0 18px;
}
.stage-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--grad-green);
  transition: width .3s ease;
}

.flashcard {
  display: grid;
  grid-template-columns: minmax(250px, 360px) 1fr;
  gap: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.photo-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(45deg, #f3f7f4, #f3f7f4 12px, #eef3ef 12px, #eef3ef 24px);
  border: 2px dashed #c9d8cf;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.photo-placeholder { text-align: center; color: var(--ink-soft); font-size: .94rem; padding: 12px; }
.photo-placeholder small { font-size: .8rem; opacity: .8; }
.photo-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.card-stt {
  display: inline-block;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 800;
  font-size: .88rem;
  padding: 4px 13px;
  border-radius: 999px;
}

/* hàng nút “Thẻ trước / Thẻ sau” nằm cạnh caption “Thẻ x / y” */
.card-nav-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.card-nav-row .card-stt { flex: 1; text-align: center; }
.card-nav-row .btn.nav { flex: 0 1 auto; min-width: 0; white-space: nowrap; padding: 7px 14px; }

.card-word {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--green-900);
  margin: 12px 0 6px;
}

.card-meta { margin: 10px 0 4px; }
.meta-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.meta-row dt { flex: 0 0 160px; color: var(--ink-soft); font-size: .92rem; }
.meta-row dd { margin: 0; font-weight: 600; }

.pending-tag {
  display: inline-block;
  background: var(--amber-100);
  color: var(--amber-900);
  border: 1px dashed #e8b23c;
  border-radius: 8px;
  padding: 2px 10px;
  font-size: .88rem;
  font-weight: 700;
}

.stage-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }

/* =================== 2. BẢNG CHẤM BÀI NÓI =================== */

.speak-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 18px;
  align-items: start;
}

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip-btn {
  appearance: none;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}
.chip-btn:hover { background: var(--green-100); }
.chip-btn:active { transform: scale(.97); }
.chip-btn.is-active { background: var(--grad-green); border-color: transparent; color: #fff; box-shadow: 0 3px 10px rgba(20, 108, 67, .3); }

.sentence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.sentence-list li { display: flex; background: var(--paper); border-bottom: 1px solid var(--line); }
.sentence-list li:last-child { border-bottom: 0; }
.sentence-item {
  flex: 1;
  text-align: left;
  font: inherit;
  font-size: .98rem;
  background: transparent;
  border: 0;
  padding: 13px 14px;
  min-height: 54px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: baseline;
  transition: background .12s ease;
}
.del-sent {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--red-700);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 14px;
}
.del-sent:hover { background: #fdecea; }
.sentence-item:hover { background: var(--green-50); }
.sentence-item.is-active {
  background: var(--green-100);
  box-shadow: inset 4px 0 0 var(--green-700);
  font-weight: 700;
}
.sentence-item .lv {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 1px 7px;
  background: #eef2ef;
  color: var(--ink-soft);
}
.sentence-item .lv.de { background: #dcfce7; color: #166534; }
.sentence-item .lv.via { background: #e0f2fe; color: #075985; }
.sentence-item .lv.kho { background: var(--amber-100); color: var(--amber-900); }
.sentence-item .src { margin-left: auto; font-size: .72rem; color: var(--ink-soft); }
.sentence-item .del { margin-left: auto; border: 0; background: none; color: var(--red-700); cursor: pointer; font-size: .9rem; padding: 0 4px; }

.custom-details { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.custom-details summary { cursor: pointer; font-weight: 700; color: var(--green-900); }
.custom-details textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  resize: vertical;
  background: var(--green-50);
}
.custom-details textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.custom-row { display: flex; gap: 8px; margin-top: 8px; }
.custom-row select {
  font: inherit;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  background: var(--paper);
}

.radio-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .93rem;
}
.radio-row:hover { background: #f6f9f7; }
.radio-row input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--green-700); }

.endpoint-box { margin-top: 6px; padding: 14px; background: #f6f9f7; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.field-label { display: block; font-size: .86rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.story-pages-label { margin-top: 14px; }

/* ô nhập chữ trong mọi form (thẻ, nhóm, truyện, tên dân tộc…) */
input:not([type]),
input[type="text"],
input[type="url"] {
  font: inherit;
  font-size: .95rem;
  padding: 10px 12px;
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  width: 100%;
  max-width: 480px;
}
input:not([type]):focus-visible,
input[type="text"]:focus-visible,
input[type="url"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
.custom-row input { max-width: none; flex: 1 1 200px; }
.endpoint-row { display: flex; gap: 8px; flex-wrap: wrap; }
.endpoint-row input {
  flex: 1 1 220px;
  font: inherit;
  font-size: .92rem;
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  background: var(--paper);
}
.msg-ok { color: var(--green-700); font-weight: 600; }
.msg-err { color: var(--red-700); font-weight: 600; }

.practice-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.story-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 800;
  font-size: .86rem;
  border-radius: 999px;
  padding: 6px 15px;
}

.sentence {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.5;
  margin: 14px 0;
  color: var(--ink);
  padding: 18px 20px;
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.word {
  appearance: none;
  font: inherit;
  font-weight: inherit;
  background: transparent;
  border: 0;
  border-bottom: 4px solid transparent;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  padding: 2px 5px;
  transition: background .12s ease;
}
.word:hover { background: var(--green-100); }
.word.on {
  background: #dcfce7;
  border-bottom-color: var(--green-700);
  color: var(--green-900);
}
.word:focus-visible { outline: 3px solid var(--focus); }

.record-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.record-status { font-size: .92rem; color: var(--ink-soft); }
.record-status.is-live { color: var(--red-700); font-weight: 700; }

.result-line { min-height: 1.4em; font-size: .95rem; color: var(--green-900); font-weight: 600; margin: 10px 0; }

.decision-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.session-list { list-style: none; margin: 8px 0; padding: 0; }
.session-list li {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: .93rem;
  align-items: baseline;
}
.session-list .t { color: var(--ink-soft); font-variant-numeric: tabular-nums; flex: 0 0 52px; }
.session-list .c { flex: 1; }
.session-list .d { margin-left: auto; font-size: .82rem; color: var(--green-800); font-weight: 700; }

/* =================== 3. VỀ DỰ ÁN =================== */

.table-wrap { overflow-x: auto; }
.report-table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.report-table th, .report-table td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.report-table th { background: var(--green-100); color: var(--green-900); font-size: .88rem; }
.report-table tr:nth-child(even) td { background: #fafcfb; }

.state { display: inline-block; font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.state.ok { background: #dcfce7; color: #166534; }
.state.warn { background: var(--amber-100); color: var(--amber-900); }
.state.off { background: var(--red-100); color: var(--red-700); }

.principles { padding-left: 22px; }
.principles li { margin-bottom: 8px; }
.principles .note { display: block; color: var(--ink-soft); font-size: .88rem; }

.stop-list li { margin-bottom: 8px; }

/* =================== chân trang =================== */

.app-footer {
  border-top: 8px solid var(--green-900);
  border-image: var(--ht-khung) 24 / 8px 0 0 / 0 round;
  background: var(--green-950);
  padding: 24px max(24px, calc((100vw - 1192px) / 2));
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  color: #c7dadd;
  font-size: .8rem;
}

.net-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.net-status .dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.net-status.is-off .dot { background: var(--green-700); }
.net-status.is-on .dot { background: var(--blue-600); }

/* =================== 4. GIA SƯ BỎ TÚI + KHO TÀNG BẢN LÀNG =================== */

/* danh sách câu hỏi */
.sentence-item .q-txt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sentence-item .lv.mon { background: #e6f0ea; color: var(--green-800); }

/* khối thêm câu hỏi của thầy/cô */
.practice-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.custom-details input {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  margin-top: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--green-50);
}
.custom-details input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.custom-details select {
  font: inherit;
  padding: 7px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 44px;
  width: 100%;
  background: var(--paper);
}
.practice-add-grid .field-label { margin-bottom: 0; }

/* màn hình làm bài */
.q-options { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.q-opt {
  appearance: none;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  text-align: left;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.q-opt:hover { border-color: var(--green-700); background: var(--green-50); }
.q-opt:active { transform: scale(.99); }
.q-opt.is-correct { background: #dcfce7; border-color: var(--green-700); color: var(--green-900); }
.q-opt.is-wrong { background: #fdecea; border-color: var(--red-400); color: var(--red-700); }

.hint-box { margin: 8px 0; }
.hint-step {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  margin: 6px 0;
  background: var(--amber-100);
  border-left: 4px solid #e8b23c;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .98rem;
  color: var(--amber-900);
  align-items: baseline;
}
.hint.tiny { font-size: .88rem; color: var(--ink-soft); }

/* truyện */
.story-card { min-height: 120px; }
.story-art {
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
}
.story-art svg { display: block; width: 100%; height: auto; max-height: 320px; }
.story-art svg rect, .story-art svg circle, .story-art svg path, .story-art svg polygon,
.story-art svg line { shape-rendering: geometricPrecision; }
.story-art img.story-photo { display: block; width: auto; max-width: 100%; max-height: 320px; margin: 0 auto; border-radius: 12px; }

/* soạn truyện (thêm/sửa truyện thầy/cô) */
.story-pages { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.story-page-row { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; background: #f6f9f7; }
.story-page-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: .9rem; color: var(--green-900); margin-bottom: 8px; }
.story-page-head .has-img { font-size: .8rem; font-weight: 700; color: var(--green-700); }
.story-page-head .has-img:not(:first-child) { color: var(--ink-soft); }
.story-page-row textarea { width: 100%; font: inherit; font-size: .95rem; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); resize: vertical; }
.story-page-row textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.story-page-preview { display: block; max-width: 180px; max-height: 140px; border-radius: 10px; margin-top: 10px; border: 1px solid var(--line); }

/* =================== in ấn (đường phi kĩ thuật số) =================== */

#print-area { display: none; }

@media print {
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; font-family: Arial, sans-serif; color: #000; }

  .p-head { font-size: 14pt; margin-bottom: 4mm; }
  .p-note { font-size: 9pt; color: #333; margin-bottom: 5mm; }
  .p-group-title { font-size: 13pt; margin: 6mm 0 3mm; break-after: avoid; }

  .p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
  .p-card {
    border: 1.2pt solid #000;
    border-radius: 3mm;
    padding: 4mm;
    break-inside: avoid;
    display: flex;
    gap: 4mm;
    align-items: center;
  }
  .p-card img { width: 24mm; height: 18mm; object-fit: contain; border: .6pt solid #999; }
  .p-card .n { font-size: 9pt; color: #333; }
  .p-card .w { font-size: 20pt; font-weight: 700; margin: 1mm 0; }
  .p-card .e { font-size: 9pt; }
  .p-sent-group { margin-bottom: 6mm; break-inside: avoid; }
  .p-sent-group h3 { font-size: 12pt; margin-bottom: 2mm; }
  .p-sent-group ol { font-size: 12pt; line-height: 1.7; padding-left: 6mm; }

  /* phiếu luyện tập (Gia Sư Bỏ Túi) */
  .p-question { margin-bottom: 4mm; break-inside: avoid; padding: 3mm; border: .8pt solid #999; border-radius: 2mm; }
  .p-question .n { font-size: 10pt; font-weight: 700; }
  .p-question .w { font-size: 13pt; margin: 1.5mm 0; line-height: 1.5; }
  .p-question .e { font-size: 10pt; color: #222; margin-bottom: 2mm; }
  .p-question .ans { font-size: 10pt; margin-top: 1.5mm; }

  /* truyện (Kho Tàng Bản Làng) */
  .p-story-page { margin-bottom: 5mm; break-inside: avoid; border: .8pt solid #999; border-radius: 2mm; padding: 3mm; }
  .p-story-page .art { margin-bottom: 2mm; }
  .p-story-page .art svg { display: block; width: 100%; height: auto; max-height: 60mm; }
  .p-story-page .txt { font-size: 12pt; line-height: 1.6; }

  /* infographic "Bản Sắc Quê Em": in đúng khung, vừa trang */
  .p-info { text-align: center; }
  .p-info-img { width: 100%; height: auto; max-height: 262mm; object-fit: contain; }
  @page { margin: 12mm; }
}

/* =================== responsive =================== */

@media (max-width: 900px) {
  .flashcard { grid-template-columns: 1fr; }
  .speak-layout { grid-template-columns: 1fr; }
  .meta-row dt { flex-basis: 130px; }
  .btn.nav { min-width: 0; flex: 1; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  main { padding: 18px 16px 36px; }
  .panel { padding: 20px 16px; }
  .header-inner { padding: 20px 16px 14px; gap: 18px; }
  .brand { gap: 11px; }
  .brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
  .brand-text h1 { font-size: 1.16rem; }
  .tagline { font-size: .73rem; }
  .main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .nav-btn { display: flex; align-items: center; justify-content: center; padding: 8px 5px; font-size: .78rem; min-height: 44px; line-height: 1.4; text-align: center; }
  .ht-dai.ht-dai-dau-trang { height: 40px; }
  .view:not(#view-infographic), #info-editor { padding: 14px; border-radius: 18px; }
  .banner { width: calc(100% - 32px); margin-top: 16px; padding: 10px 12px; font-size: .79rem; }
  .card-word { font-size: 2.4rem; }
  .card-nav-row { gap: 6px; }
  .card-nav-row .btn.nav { flex: 1; min-width: 0; padding: 8px 6px; font-size: .88rem; }
  .card-nav-row .card-stt { flex: 1; }
}

/* Kính trọng người cần ít chuyển động */
.health-item .q-txt { font-weight: 800; }
.health-block { background:#fff; border:1px solid #e7ecef; border-radius:10px; padding:10px 12px; white-space:pre-wrap; }
.health-ul { margin:6px 0 10px 18px; }
.search-row { gap:8px; flex-wrap:wrap; }
.search-row input { flex:1; min-width:200px; }

/* =================== 5b. SỨC KHỎE trẻ em (bệnh + cây thuốc) =================== */
.health-warn {
  border: 1.5px solid #eab308;
  background: #fffbeb;
  color: #713f12;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: .92rem;
  line-height: 1.55;
}
.health-head { display: flex; gap: 14px; align-items: center; margin: 10px 0 4px; flex-wrap: wrap; }
.health-head h3 { margin: 0; font-size: 1.3rem; color: var(--green-900); }
.health-head .hint { margin: 2px 0 0; }

/* lưới danh sách: thẻ bệnh / cây thuốc */
.health-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  max-height: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 10px;
}
.health-grid li {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.health-grid .health-item { align-items: center; min-height: 64px; padding: 10px 12px; }
.health-txt { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.health-txt .q-txt { overflow-wrap: anywhere; }
.health-txt .src { margin-left: 0; font-size: .74rem; }

/* icon / ảnh cây */
.health-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f2f7f4;
}
.health-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  background: #eef2ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.health-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.health-thumb-lg { width: 128px; height: 128px; border-radius: 16px; }
.health-credit { font-size: .78rem; margin: 4px 0 0; }
.health-credit a { color: var(--green-700); }

#health-detail h4 { margin: 14px 0 6px; font-size: 1rem; color: var(--green-900); }
#health-detail .health-block + .health-block { margin-top: 6px; }

/* chips lọc nhóm bệnh: dấu chấm màu nhóm + nền nhóm khi chọn */
#health-nhom .chip-btn::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip, #999);
  margin-right: 7px;
  vertical-align: middle;
}
#health-nhom .chip-btn.is-active {
  background: var(--chip, var(--green-700));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(20, 108, 67, .25);
}
.chip-btn.related-chip { border-style: dashed; }

/* phóng to ảnh cây thuốc: bấm vào ảnh để xem lớn */
.health-thumb.zoomable { cursor: zoom-in; }
.health-thumb-lg.zoomable {
  border: 0;
  padding: 0;
  cursor: zoom-in;
  position: relative;
}
.health-thumb-lg.zoomable:active { transform: scale(.98); }
.health-zoom {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 18, 13, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.health-zoom[hidden] { display: none; }
.health-zoom img {
  max-width: 96vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  cursor: default;
}
.health-zoom-close {
  position: fixed;
  top: 14px;
  right: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .92);
  color: #14261c;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.health-zoom-close:hover { background: #fff; }

/* =================== 6. BẢN SẮC QUÊ EM (infographic) =================== */

.culture-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 26px 40px;
  padding: 36px 40px 30px;
  overflow: hidden;
  border: 1px solid #e7d3a8;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 3px 0 #f0dfbd, 0 18px 40px rgba(13, 42, 74, .10);
}
.culture-hero::before { content: ""; position: absolute; inset: 0 0 0 47%; background: linear-gradient(150deg, #c9fbe8, #e8fff7 55%, #ffe9c9); clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%); pointer-events: none; z-index: -1; }
.culture-hero::after { content: ""; position: absolute; inset: auto 0 0; height: 8px; background: repeating-linear-gradient(90deg, var(--thread-red) 0 32px, var(--ochre) 32px 64px, var(--green-700) 64px 96px, var(--green-950) 96px 128px); pointer-events: none; }
.culture-copy { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; color: var(--thread-red); font-size: .67rem; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 24px; flex: 0 0 24px; background: var(--ht-hoa) center / contain no-repeat; }
.culture-title { font-family: "Times New Roman", Georgia, serif; font-size: clamp(3.3rem, 4.9vw, 4.4rem); font-weight: 700; letter-spacing: -1.2px; color: var(--green-950); line-height: 1.04; margin-bottom: 20px; }
.culture-title span { position: relative; display: table; color: var(--thread-red); }
.culture-title span::after { content: ""; position: absolute; left: 0; right: -12px; bottom: 1px; height: 11px; border-radius: 2px; background: var(--ochre); transform: rotate(-2deg); z-index: -1; }
.culture-lead { margin: 12px 0; color: #06635f; font-size: 1.03rem; font-weight: 700; }
.culture-hero .hint { max-width: 440px; color: var(--ink-soft); line-height: 1.8; font-size: .9rem; }
.culture-start { display: inline-flex; align-items: center; gap: 30px; margin-top: 22px; padding: 13px 22px; min-height: 50px; border: 1px solid #9c1147; border-radius: 12px; background: var(--thread-red); color: #fff; text-decoration: none; font-size: .9rem; font-weight: 800; box-shadow: 0 4px 0 #9c1147, 0 10px 22px rgba(216, 27, 96, .22); transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.culture-start:hover { background: #bb1553; transform: translateY(-2px); box-shadow: 0 6px 0 #9c1147, 0 14px 26px rgba(216, 27, 96, .26); }
.culture-start:active { transform: translateY(2px); box-shadow: 0 2px 0 #9c1147; }
.culture-start:focus-visible { outline: 3px solid var(--green-950); outline-offset: 5px; }
.culture-start span { font-size: 1.3rem; line-height: 1; }
.culture-tags { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 22px 0 0; color: #2c5b56; font-size: .73rem; }
.culture-tags span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: var(--green-700); transform: rotate(45deg); vertical-align: 1px; }
.culture-hero .status-line { grid-column: 1 / -1; border-top: 1px dashed #b5cdbb; padding-top: 14px; font-size: .74rem; font-weight: 400; line-height: 1.7; color: #476255; }
.culture-landscape { position: relative; min-width: 0; text-align: center; padding: 15px 14px 16px; border: 1px solid #0d283e; border-radius: 20px; background: #0f4c75; box-shadow: 7px 8px 0 var(--ochre), 0 16px 28px rgba(13, 60, 90, .20); transform: rotate(1.5deg); }
.culture-landscape::before { content: ""; position: absolute; inset: 6px; border: 1px dashed rgba(255, 242, 206, .4); border-radius: 15px; pointer-events: none; }
.culture-landscape::after { content: ""; position: absolute; top: -20px; right: -16px; width: 55px; height: 55px; background: #fff4d1 var(--ht-hoa) center / 44px no-repeat; border: 2px solid #0f4c75; border-radius: 50%; transform: rotate(12deg); }
.landscape-label { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--flax); font-size: .65rem; letter-spacing: 2.5px; text-transform: uppercase; }
.landscape-label::before, .landscape-label::after { content: ""; width: 28px; height: 1px; background: var(--ochre); }
.culture-landscape svg { width: 100%; height: auto; display: block; border-radius: 16px; }
.landscape-caption { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 14px; color: var(--flax); font-size: .66rem; letter-spacing: .4px; }
.landscape-palette { display: inline-flex; gap: 4px; }
.landscape-palette i { display: block; width: 8px; height: 8px; background: var(--ochre); transform: rotate(45deg); }
.landscape-palette i:first-child { background: var(--thread-pink); }
.landscape-palette i:last-child { background: var(--thread-jade); }
.creation-panel { padding: 28px; border-radius: 22px; scroll-margin-top: 20px; }
.creation-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
.creation-heading .panel-title { display: flex; align-items: center; gap: 12px; margin: 0; }
.creation-heading .hint { margin: 0; font-size: .8rem; }
.step-number { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; background: #193854; color: var(--ochre); border-radius: 10px; font-size: .83rem; font-variant-numeric: tabular-nums; box-shadow: 3px 3px 0 #f1c36c; }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.tpl-card {
  --card-accent: #e0a800;
  --card-wash: #fff3c9;
  position: relative;
  overflow: hidden;
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, var(--card-wash), #fffdf8 80%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 8px rgba(25, 54, 84, .03);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tpl-card:nth-child(3n + 2) { --card-accent: #0e9f96; --card-wash: #d3fbf2; }
.tpl-card:nth-child(3n) { --card-accent: #e0245e; --card-wash: #ffe0ea; }
.tpl-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--card-accent); }
.tpl-card::after { content: ""; position: absolute; top: 20px; right: 20px; width: 28px; height: 28px; background: var(--ht-hoa) center / contain no-repeat; opacity: .75; }
.tpl-card:hover { border-color: var(--card-accent); transform: translateY(-4px); box-shadow: 0 10px 20px rgba(25, 54, 84, .12); }
.tpl-card:active { transform: translateY(-1px); }
.tpl-card:focus-visible, .group-card:focus-visible, .theme-chip:focus-visible { outline: 3px solid var(--thread-red); outline-offset: 3px; }
.tpl-emoji { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(25, 54, 84, .1); border-radius: 13px; background: var(--paper); font-size: 1.65rem; margin-bottom: 10px; }
.tpl-name { font-size: 1.08rem; font-weight: 800; color: var(--green-900); }
.tpl-meta { font-size: .75rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tpl-mota { font-size: .85rem; color: var(--ink-soft); margin-top: 4px; }

.theme-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.theme-chip {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: .92rem;
  transition: border-color .14s ease, transform .1s ease, box-shadow .14s ease;
}
.theme-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.theme-chip.is-active { border-color: var(--green-700); color: var(--green-900); box-shadow: 0 0 0 2px var(--green-100); }
.theme-swatch { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.8); }

.chat-log {
  margin-top: 12px;
  max-height: 340px;
  overflow-y: auto;
  background: #f6f9f7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-row { display: flex; }
.chat-row.me { justify-content: flex-end; }
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  font-size: .94rem;
  line-height: 1.5;
}
.chat-row.me .chat-bubble { background: var(--green-700); color: #fff; border-color: transparent; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 6px; }
.chat-chip {
  appearance: none;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--green-700);
  background: var(--paper);
  color: var(--green-800);
  border-radius: 999px;
  padding: 6px 13px;
  min-height: 38px;
  transition: background .12s ease, transform .08s ease;
}
.chat-chip:hover { background: var(--green-100); }
.chat-chip:active { transform: scale(.97); }
.chat-input-row { display: flex; gap: 8px; margin-top: 12px; }
.chat-input-row input { flex: 1; max-width: none; }

.info-toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.info-tool { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.info-tool select {
  font: inherit;
  font-size: .95rem;
  padding: 8px 12px;
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.info-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.info-preview-panel { position: sticky; top: 20px; }
.info-canvas-wrap {
  background:
    repeating-linear-gradient(45deg, #f3f7f4, #f3f7f4 14px, #eef3ef 14px, #eef3ef 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  justify-content: center;
}
#info-canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 72vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.info-muc { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px; }
.info-muc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; color: var(--green-900); font-size: .96rem; margin-bottom: 8px; }

.info-field { margin-bottom: 12px; }
.info-field-row { display: flex; gap: 8px; align-items: flex-start; }
.info-field-row input, .info-field-row textarea { flex: 1; max-width: none; }
.info-field textarea {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--green-50);
  resize: vertical;
}
.info-field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.info-sug-btn { white-space: nowrap; }

.info-slot {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: #f6f9f7;
}
.info-slot-thumb {
  width: 92px;
  height: 69px;
  flex: 0 0 92px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .74rem;
  color: var(--ink-soft);
  text-align: center;
}
.info-slot-thumb img, .info-slot-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.info-slot-body { display: flex; flex-direction: column; gap: 6px; }
.info-slot-label { font-weight: 700; color: var(--ink); font-size: .92rem; }
.info-slot-body .custom-row { margin-top: 0; }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; max-height: 460px; overflow-y: auto; }
.lib-item {
  appearance: none;
  cursor: pointer;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.lib-item:hover { border-color: var(--green-700); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.lib-item svg { width: 100%; height: auto; display: block; }
.lib-name { font-size: .76rem; font-weight: 700; color: var(--ink-soft); padding: 6px 8px; text-align: left; }

.suggest-pop {
  z-index: 60;
  width: 300px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: .9rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggest-item:hover { background: var(--green-100); }

/* ---------------- Về dự án ---------------- */
.ve-da-mo-dau p { font-size: 1.02rem; line-height: 1.65; }
.ve-da-diem { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.ve-da-diem li { display: flex; gap: 12px; align-items: flex-start; background: var(--green-50); border: 1px solid var(--green-100); border-radius: 12px; padding: 12px 14px; }
.ve-da-diem li > span { font-size: 1.6rem; line-height: 1; }
.ve-da-diem strong { display: block; margin-bottom: 2px; }
.ve-da-the { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.ve-da-the > div { border: 1px solid var(--line); border-left: 5px solid var(--green-700); border-radius: 10px; padding: 10px 14px; font-size: .95rem; background: #fffdf6; }
.ve-da-the b { display: block; color: var(--green-800); font-size: 1.02rem; margin-bottom: 2px; }
.nhom-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.nhom-the { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--paper); box-shadow: var(--shadow-sm); }
.nhom-chu { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--green-800); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.25rem; box-shadow: inset 0 -4px 0 var(--thread-red); }
.nhom-ten { font-weight: 700; font-size: 1.05rem; color: var(--green-900); }
.nhom-vai { color: var(--ink-soft); font-size: .9rem; }
.nhom-dv { color: var(--ink-soft); font-size: .85rem; font-style: italic; }
.nhom-lh { grid-column: 1 / -1; margin: 4px 0 0; }

@media (max-width: 900px) {
  .info-layout { grid-template-columns: 1fr; }
  .info-preview-panel { position: static; }
  .header-note { display: none; }
  .tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .culture-hero { padding: 28px; gap: 20px; }
}

@media (max-width: 700px) {
  .culture-hero { grid-template-columns: 1fr; padding: 28px 24px 34px; gap: 30px; }
  .culture-title { font-size: 3.5rem; }
  .culture-landscape { width: min(100%, 340px); margin: 0 auto; padding-top: 34px; }
  .culture-landscape::before { width: 80px; height: 80px; top: -10px; right: -10px; }
  .culture-landscape::after { width: 44px; height: 44px; bottom: 26px; }
  .culture-tags { gap: 9px 14px; font-size: .68rem; }
  .culture-lead { font-size: 1rem; }
  .eyebrow { font-size: .59rem; letter-spacing: 1px; gap: 8px; }
  .eyebrow::before { width: 18px; height: 18px; flex-basis: 18px; }
  .creation-heading .panel-title { font-size: 1rem; }
  .creation-heading .hint { font-size: .76rem; }
  .landscape-caption { font-size: .65rem; letter-spacing: .5px; }
}

@media (max-width: 620px) {
  .tpl-grid { grid-template-columns: 1fr; }
  .group-grid { grid-template-columns: minmax(0, 1fr); }
  .health-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-input-row input { min-width: 0; }
  .info-field-row { flex-wrap: wrap; }
  .info-field-row input, .info-field-row textarea { min-width: 0; }
}

@media print {
  .panel > .panel-title::before { display: none; }
  .view.is-active { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}