/* =====================================================================
   GIAO DIỆN "TỐI GIẢN MỀM MẠI KIỂU MONTESSORI" — chọn 28/11/2026 từ docs/demo/giao-dien-gemini-10.html
   (Gemini 4 Hydrogen thiết kế). Gỗ sồi, pastel trầm tự nhiên, khối tròn mềm, ít kích thích thị giác.
   Mỗi chủ đề có màu riêng qua --c (topics.js); nền khối = --c pha với giấy, viền = --c nhạt.
   Đổi giao diện: thay <link> theme-*.css trong index.html (giữ lại theme-dat-set.css).
   ===================================================================== */
:root {
  --bg: #F3EDE2;          /* vải lanh */
  --paper: #FAF6EE;
  --tray: #EFE7D8;
  --wood: #E6D5BC;
  --wood-mid: #D1B897;
  --wood-dark: #AE8E67;
  --ink: #443B31;
  --muted: #75685A;
  --card: #FDFBF7;
  --line: #E5D7C3;
  --good: #7E9C70;        /* xanh xô thơm */
  --good-bg: #DCE6D5;
  --bad: #C9917A;         /* đất nung, không đỏ gắt */
  --accent: #CFA969;      /* vàng đất */
  --r: 28px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Nunito", ui-rounded, system-ui, sans-serif;
  --tile: 0 6px 0 rgba(174, 142, 103, .28), 0 10px 20px -8px rgba(74, 58, 39, .12);
  --tile-press: 0 2px 0 rgba(174, 142, 103, .28);
  --shadow: var(--tile);
}

body {
  background:
    radial-gradient(circle at 12% 14%, rgba(220, 230, 213, .65) 0%, transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(243, 229, 200, .7) 0%, transparent 40%),
    radial-gradient(circle at 50% 92%, rgba(220, 231, 236, .55) 0%, transparent 45%),
    var(--bg);
  background-attachment: fixed;
  font-weight: 600;
}

.tb-title, .topic-name, .game-name, .prompt-text, .xname, .modal-card h2, .card h2, .chip, .bin-name, .act-name {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
}
.topbar { background: transparent; backdrop-filter: none; }

/* Khối gỗ dùng chung: viền mảnh, đáy gỗ, ấn xuống thì lún */
.icon-btn, .chip, .game, .prompt, .choice, .xcard, .bin, .yn, .act, .side, .seq, .count-field,
.card, .link-btn, .btn, .big-btn, .nav, .speak, .mcard > span {
  border: 2px solid var(--line);
  box-shadow: var(--tile);
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.icon-btn:active, .chip:active, .game:active, .choice:active, .bin:active, .yn:active, .act:active, .side:active,
.link-btn:active, .btn:active, .big-btn:active, .nav:active, .speak:active, .topic:active {
  transform: translateY(4px);
  box-shadow: var(--tile-press);
}
.icon-btn, .nav, .speak, .big-btn { border-radius: 50%; background: var(--tray); border-color: rgba(174, 142, 103, .38); }
.icon-btn { width: 56px; height: 56px; }
.big-btn { border-radius: 50%; }

/* Ô chủ đề: khay màu pastel trầm + đĩa tròn đựng hình */
.topics { gap: 14px; }
.topic {
  background: color-mix(in srgb, var(--c) 30%, var(--paper));
  border: 2px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: var(--r);
  box-shadow: var(--tile);
  transition: transform .2s ease, box-shadow .2s ease;
}
.topic-icon {
  display: grid; place-items: center;
  width: clamp(76px, min(26vw, 17vh), 148px); aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 252, 246, .78);
  border: 1.5px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 2px 5px rgba(130, 108, 82, .12);
  font-size: clamp(40px, min(13vw, 9vh), 76px);
  filter: none;
}
.topic-icon .art-img { width: 82%; height: 82%; filter: drop-shadow(0 5px 6px rgba(74, 58, 39, .16)); }
.topic-name { font-size: clamp(18px, 4.6vw, 24px); }
.topic-stars { background: rgba(255, 252, 246, .85); color: var(--muted); box-shadow: none; border: 1.5px solid var(--line); }

/* Hạt gỗ trang trí đầu trang chủ */
.home::before {
  content: ""; display: block; height: 16px; margin: 0 auto 14px; width: min(220px, 60%);
  background:
    radial-gradient(circle, #C9917A 7px, transparent 8px) 0 50% / 16.66% 100% no-repeat,
    radial-gradient(circle, #CFA969 7px, transparent 8px) 20% 50% / 16.66% 100% no-repeat,
    radial-gradient(circle, #96B089 7px, transparent 8px) 40% 50% / 16.66% 100% no-repeat,
    radial-gradient(circle, #93B0BD 7px, transparent 8px) 60% 50% / 16.66% 100% no-repeat,
    radial-gradient(circle, #C4918F 7px, transparent 8px) 80% 50% / 16.66% 100% no-repeat,
    radial-gradient(circle, #E3D3B9 7px, transparent 8px) 100% 50% / 16.66% 100% no-repeat,
    linear-gradient(rgba(174, 142, 103, .35), rgba(174, 142, 103, .35)) 50% 50% / 100% 3px no-repeat;
}

/* Thẻ trò chơi */
.game { background: var(--card); border-radius: var(--r); }
.game-icon {
  display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 22%, var(--paper));
  box-shadow: inset 0 2px 5px rgba(130, 108, 82, .12);
  font-size: 42px;
}
.game-icon .art-img { width: 84%; height: 84%; }
.game-stars { color: var(--accent); }

.chip { background: var(--card); }
.chip.on { background: color-mix(in srgb, var(--c) 35%, var(--paper)); border-color: color-mix(in srgb, var(--c) 70%, transparent); }
.preview .art { filter: drop-shadow(0 3px 4px rgba(74, 58, 39, .14)); }

/* Thanh tiến độ = hạt bàn tính */
.dots { position: relative; gap: 10px; padding: 6px 14px 12px; }
.dots i { width: 16px; height: 16px; background: #DFD3C0; border: 2px solid var(--paper); transition: transform .3s ease, background-color .3s ease; }
.dots i.now { background: var(--accent); transform: scale(1.2); }
.dots i.done { background: var(--good); }
.dots i.half { background: #E3C48F; }

/* Đề bài: khay vàng đất */
.prompt { background: #F3E5C8; border-color: rgba(207, 169, 105, .45); border-radius: 30px; }
.speak { background: var(--paper); border-color: var(--accent); box-shadow: 0 5px 0 rgba(182, 143, 81, .35); width: 60px; height: 60px; }

/* Lựa chọn: thẻ sáng, hình nằm trong giếng tròn */
.choice { background: var(--card); border: 2.5px solid var(--line); border-radius: 32px; }
.choice .art-img, .mface .art-img, .xcard .art-img, .sort-item .art-img, .scene .art-img { filter: drop-shadow(0 6px 8px rgba(74, 58, 39, .14)); }
.correct { border-color: var(--good) !important; background: var(--good-bg) !important; }
.choice.correct { box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 45%, transparent), var(--tile); }
.shake { border-color: var(--bad) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 35%, transparent), var(--tile) !important; }

.xcard { background: var(--card); border-radius: 34px; }
.xen { color: #8A7BA6; }
.nav { width: 72px; height: 72px; }
.mback { background: color-mix(in srgb, var(--c) 35%, var(--paper)); }
.mcard.matched .mface { background: var(--good-bg); box-shadow: 0 0 0 4px var(--good); }
.bin { background: var(--card); border-radius: 26px; }
.yn.yes { background: #DCE6D5; border-color: #B7CBAA; }
.yn.no { background: #EED9CF; border-color: #DDB9A8; }
.act-stop { background: #EED9CF; } .act-slow { background: #F1E9C8; } .act-go { background: #DCE6D5; }
.seq, .count-field, .side { background: var(--card); }
.seq-i.q { color: var(--wood-dark); border-color: var(--accent); }
.cnt.on { background: #F3E5C8; }
.cnt.on::after { background: var(--wood-dark); }
.tlight { background: linear-gradient(180deg, #6B5D4F, #4E4339); box-shadow: 0 6px 0 rgba(74, 58, 39, .35); }

.modal { background: rgba(68, 59, 49, .38); }
.modal-card { background: var(--paper); border: 2px solid var(--line); border-radius: 36px; box-shadow: 0 26px 56px -18px rgba(74, 58, 39, .3); }
.btn { background: color-mix(in srgb, var(--c, var(--accent)) 40%, var(--paper)); }
.btn.danger { background: #EED9CF; }
.result-stars span { color: #E5D7C3; }
.result-stars span.on { color: #E3B65A; text-shadow: 0 4px 0 #C49A45; }
.link-btn { background: var(--paper); }
.seg { background: var(--tray); }
.seg button.on { background: var(--paper); box-shadow: 0 2px 0 rgba(174, 142, 103, .3); }

@media (prefers-reduced-motion: no-preference) {
  .topic-icon .art-img { animation: breathe 4.5s ease-in-out infinite; }
  .topics .topic:nth-child(2n) .art-img { animation-delay: -2.2s; }
  @keyframes breathe { 50% { transform: translateY(-3px) scale(1.02); } }
}

/* Lời khen thoáng qua: khay gỗ xô thơm, êm */
.toast {
  color: var(--ink); font-family: var(--font-display); font-weight: 900;
  background: var(--good-bg); border: 2px solid #B7CBAA;
  box-shadow: 0 6px 0 rgba(126, 156, 112, .35), 0 16px 30px -10px rgba(74, 58, 39, .25);
}

/* ẢNH CÓ NỀN (29/11/2026): ảnh đất sét giờ là ô vuông nền trắng → ảnh LẤP ĐẦY thẻ, bo 4 góc; thẻ chứa ảnh
   không còn viền / giếng / nền riêng do web vẽ (tránh khung lồng khung). Đúng/sai báo bằng vòng sáng ngoài thẻ. */
.art-img img { border-radius: 18%; object-fit: contain; }
.art.art-img, .art-img { filter: none !important; }
.choice:has(> .art-img) { border: 0; background: #fff; padding: 0; border-radius: 28px; }
.choice > .art-img { width: 100%; height: 100%; }
.choice > .art-img img { border-radius: 0; }
.choice:has(> .art-img).correct { box-shadow: 0 0 0 5px var(--good), var(--tile); }
.choice:has(> .art-img).shake { box-shadow: 0 0 0 5px var(--bad), var(--tile) !important; }
.mface:has(> .art-img) { background: #fff; overflow: hidden; }
.mface > .art-img { width: 100%; height: 100%; }
.mface > .art-img img { border-radius: 0; }
.mcard.matched .mface:has(> .art-img) { background: #fff; }
.topic-icon:has(> .art-img), .game-icon:has(> .art-img) {
  background: none; border: 0; box-shadow: none; border-radius: 22%; overflow: hidden;
}
.topic-icon > .art-img, .game-icon > .art-img { width: 100%; height: 100%; animation: none; }
.topic-icon > .art-img img, .game-icon > .art-img img { border-radius: 22%; }
.topic:has(.topic-icon > .art-img) .topic-icon { box-shadow: 0 4px 10px -4px rgba(74, 58, 39, .25); }
.ncard .art-img img { border-radius: 14%; }
.xcard .art-img.big { width: 58cqi; height: 58cqi; }
@media (orientation: landscape) and (max-height: 560px) { .xcard .art-img.big { width: 40cqi; height: 40cqi; } }
