/* Bé khám phá truyện */
/* Tranh truyện (ô vuông); chưa có file tranh → nền màu chủ đề + nhân vật 3D */
.st-pic { position: relative; display: grid; place-items: center; aspect-ratio: 1; width: 100%; border-radius: 20px; overflow: hidden; background: #fff; }
.st-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-fb { display: none; gap: 4%; align-items: center; justify-content: center; }
.st-pic.fb { background: radial-gradient(circle at 50% 35%, #fff, color-mix(in srgb, var(--c) 30%, #fff)); }
.st-pic.fb .st-fb { display: flex; }
.st-pic.big { width: clamp(220px, 54vmin, 440px); box-shadow: 0 8px 0 var(--card-edge), 0 16px 28px rgba(40, 80, 140, .16); }
.st-pic.big .st-fb .pic.lg { --s: clamp(90px, 20vmin, 160px); }
.st-pic.mid { width: clamp(110px, 24vmin, 190px); }
.st-pic.mini { width: clamp(64px, 12vmin, 96px); border-radius: 12px; opacity: .55; transition: opacity .3s, transform .3s; }
.st-pic.mini.cur { opacity: 1; transform: scale(1.1); }
.st-pic.mini .pic.lg, .st-pic.mid .pic.lg { --s: 40%; }

/* Kệ truyện */
.st-themes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.st-theme { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px 4px 6px; min-height: 52px; color: var(--d); white-space: nowrap; }
.st-theme.on { color: #fff; }
.st-theme b { font-size: clamp(14px, 2.2vmin, 18px); }
/* 6 truyện = 2 hàng × 3 cột; bề rộng kệ tính theo chiều cao để luôn vừa màn */
.st-shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 2vmin, 18px); width: min(760px, 100%, calc((100vh - 300px) * 1.2)); }
.st-book { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 8px 6px; animation: pop .4s ease backwards; animation-delay: calc(var(--k) * .06s); }
.st-book b { font-size: clamp(13px, 2.2vmin, 18px); line-height: 1.15; text-align: center; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.3em; }
.st-done { display: flex; gap: 4px; }
.st-done i { width: 10px; height: 10px; border-radius: 50%; background: #d9e3f0; }
.st-done i.on { background: var(--good); }
.st-empty { color: #2c5d86; font-weight: 700; }

/* Một truyện: bìa + 5 hoạt động */
.story-hub .main { flex-direction: row; gap: clamp(16px, 4vmin, 40px); }
.st-cover { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; }
.st-cover .st-pic.big { width: clamp(200px, 44vmin, 360px); box-shadow: none; }
.st-cover b { font-size: clamp(20px, 3.6vmin, 30px); text-align: center; }
.st-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(380px, 100%); }
.st-act { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 72px; text-align: left; animation: pop .4s ease backwards; animation-delay: calc(var(--k) * .06s); }
.st-act:first-child { grid-column: 1 / -1; }
.st-act small { font-size: clamp(14px, 2.4vmin, 18px); font-weight: 700; color: var(--ink); line-height: 1.2; }
.st-act.on { box-shadow: 0 7px 0 #22a454, 0 0 0 4px var(--good); }

/* Hoạt động */
.st-text { margin: 0; max-width: min(560px, 92%); text-align: center; color: var(--ink-soft); font-size: clamp(14px, 2.4vmin, 18px); line-height: 1.45; }
.st-recap { display: flex; gap: 10px; }
.st-opts, .st-tray, .st-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(10px, 2.2vmin, 18px); }
.st-opt, .st-card { padding: 6px; animation: pop .4s ease backwards; }
.st-opt.sel { box-shadow: 0 8px 0 #22a454, 0 0 0 6px var(--good); }
.st-card { touch-action: none; cursor: grab; }
.st-card.dragging { position: relative; z-index: 30; animation: none; box-shadow: 0 18px 30px rgba(40, 80, 140, .3); }
.st-card.wrong { animation: shake .45s ease; }
.st-slot { position: relative; width: clamp(110px, 24vmin, 190px); aspect-ratio: 1; border: 4px dashed #c3cfdf; border-radius: 20px; display: grid; place-items: center; }
.st-slot i { font: 800 clamp(28px, 6vmin, 48px) var(--font); font-style: normal; color: #c3cfdf; }
.st-slot.on { border: 0; animation: pop .35s ease; }
.st-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(460px, 100%); }
.st-roleopt { display: flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 72px; text-align: left; }
.st-roleopt small { font-size: clamp(14px, 2.4vmin, 18px); font-weight: 700; color: var(--ink); line-height: 1.2; }
.st-roleopt.sel { box-shadow: 0 7px 0 #22a454, 0 0 0 5px var(--good); }
.st-roleopt.own small { color: #7c3aed; }
.st-role .main, .st-guess .main { gap: clamp(8px, 1.6vmin, 14px); }
.st-role .st-pic.big { width: clamp(180px, 36vmin, 300px); }

/* điện thoại xoay ngang: tranh truyện vừa chiều cao, ẩn dòng chữ dưới tranh (Gấu Mì đã đọc, bong bóng đã hiện) */
@media (orientation: landscape) and (max-height: 520px) {
  .st-pic.big { width: min(54vmin, 52vh); }
  .st-read .st-text { display: none; }
  /* chủ đề một hàng, 6 truyện một hàng */
  .st-themes { flex-wrap: nowrap; gap: 5px; max-width: 100%; }
  /* chỉ hình biểu tượng; chủ đề đang chọn hiện thêm tên */
  .st-theme { min-height: 44px; min-width: 56px; justify-content: center; padding: 2px 8px; }
  .st-theme b { display: none; font-size: 13px; }
  .st-theme.on b { display: inline; }
  .st-theme .pic.sm { --s: 28px; }
  .st-shelf { grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .st-book { padding: 4px 4px 3px; border-radius: 14px; }
  .st-book b { font-size: 11px; }
  .story-hub .st-cover .st-pic.big { width: 46vh; }
  .st-acts { width: min(340px, 100%); gap: 8px; }
  .st-act { min-height: 56px; padding: 6px 8px; }
  .st-act small { font-size: 13px; }
  .st-pic.mid, .st-slot { width: min(24vmin, 34vh); }
  .st-pic.mini { width: 14vh; }
}
@media (orientation: portrait) {
  .st-shelf { width: min(100%, calc((100vh - 470px) * 1.25)); gap: 8px; }
  .st-book { padding: 5px 5px 4px; border-radius: 16px; }
  .st-book b { font-size: 12px; }
  .st-theme { min-height: 46px; padding: 3px 10px 3px 5px; }
  .story-hub .main { flex-direction: column; }
  .st-pic.big { width: min(78vw, 40vh); }
  .st-cover .st-pic.big { width: min(56vw, 28vh); }
  .st-pic.mid, .st-slot { width: min(27vw, 15vh); }
  .st-theme b { font-size: 13px; }
}
