:root {
  --bg: #0E0E12;
  --card: #17171D;
  --chip: #1C1C23;
  --line: #24242C;
  --text: #FFFFFF;
  --muted: #A3A3AD;
  --accent: #FF4F87;
  --accent-soft: #FFC2D4;
  --ok: #4FD18B;
  --warn: #FFB547;
  --radius: 16px;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Prompt', system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  padding-bottom: calc(68px + var(--safe-b));
  -webkit-tap-highlight-color: transparent;
}
body.bare { padding-bottom: 0; }
a { color: inherit; }
a:hover { color: var(--accent-soft); }
img { max-width: 100%; }
h1 { font-size: 26px; font-weight: 800; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 20px; font-weight: 800; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.center { text-align: center; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.pre { white-space: pre-line; }

/* ปุ่ม */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 14px; border: 0;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.accent { background: var(--accent); color: #0E0E12; }
.btn.white { background: #fff; color: #0E0E12; }
.btn.ghost { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn.dark { background: #0E0E12; color: #fff; }
.btn.line { border: 2px solid #0E0E12; color: #0E0E12; background: transparent; }
.btn.danger { background: #3A1520; color: #FF8FA8; }
.btn.big { min-height: 54px; font-size: 17px; width: 100%; }
.btn:hover { filter: brightness(1.08); color: inherit; }
.btn.accent:hover, .btn.white:hover { color: #0E0E12; }
.btn[aria-pressed="true"] { background: var(--accent-soft); color: #0E0E12; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 10px 4px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--chip); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; text-decoration: none;
}
.icon-btn.off { opacity: 0.3; }
.badge { background: var(--accent); color: #0E0E12; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; }
.badge.alt { background: #fff; }
.badge.r18 { background: #0E0E12; color: #fff; border: 1px solid #fff; }
.chip { background: var(--chip); font-size: 13px; padding: 6px 12px; border-radius: 999px; text-decoration: none; white-space: nowrap; }
.chip.on { background: #fff; color: #0E0E12; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }

/* ส่วนหัว */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) var(--gutter) 10px; background: rgba(14, 14, 18, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.logo { display: flex; flex: none; }
.logo img { height: 32px; width: auto; display: block; }
.top-nav { display: none; }
.search { display: none; align-items: center; gap: 8px; background: var(--chip); border-radius: 12px; padding: 0 14px; height: 44px; color: var(--muted); }
.search input { background: transparent; border: 0; outline: none; color: #fff; width: 100%; font-size: 15px; }
.search.wide { display: flex; margin-bottom: 8px; }
.top .icon-btn { margin-left: auto; }
.announce { margin: 0; background: var(--accent); color: #0E0E12; text-align: center; font-weight: 600; padding: 8px var(--gutter); font-size: 14px; }

/* เมนูล่างบนมือถือ */
.bottom-nav {
  position: fixed; inset: auto 0 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14, 14, 18, 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--muted); text-decoration: none; min-height: 56px; }
.bottom-nav a.on { color: var(--accent); }

main { padding: 0 var(--gutter); max-width: 1280px; margin: 0 auto; }
.block { padding-top: 28px; }
.block.narrow { max-width: 640px; margin: 0 auto; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.more { color: var(--muted); font-size: 14px; }

/* ปก */
.cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover.ph { display: flex; align-items: flex-end; padding: 10px; }
.cover.ph span { font-weight: 900; font-size: 15px; line-height: 1.15; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.cover-box { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--card); }
.cover-box .badge { position: absolute; top: 8px; left: 8px; }
.cover-box .badge.r18 { left: auto; right: 8px; }
.thumb { width: 56px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; flex: none; background: var(--card); }
.thumb .cover.ph span { display: none; }

/* แบนเนอร์หน้าแรก */
.hero { margin: 14px calc(var(--gutter) * -1) 0; position: relative; }
.hero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 12px; padding: 0 var(--gutter); }
.hero-track::-webkit-scrollbar, .chips.scroll::-webkit-scrollbar, .continue-row::-webkit-scrollbar { display: none; }
.hero-slide { position: relative; flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 5; max-height: 72vh; border-radius: 22px; overflow: hidden; background: var(--card); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-bg.ph span { display: none; }
.hero-slide::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(14, 14, 18, 0.95) 0%, rgba(14, 14, 18, 0.4) 50%, rgba(14, 14, 18, 0) 75%); }
.hero-text { position: absolute; inset: auto 0 0; z-index: 1; padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.hero-text h2 { font-size: 30px; font-weight: 900; line-height: 1.1; letter-spacing: -0.5px; }
.hero-text p { margin: 0; color: rgba(255, 255, 255, 0.8); font-size: 14px; }
.hero-text .chips { margin: 0; }
.hero-text .chip { background: rgba(255, 255, 255, 0.16); }
.hero-dots { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.hero-dots a { width: 8px; height: 8px; border-radius: 4px; background: #3A3A44; }
.hero-dots a.on { width: 24px; background: var(--accent); }

/* อ่านต่อ */
.continue-row { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.continue-item { flex: 0 0 min(300px, 82%); display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 18px; padding: 10px; text-decoration: none; }
.continue-item b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-item small { color: var(--muted); font-size: 12px; }
.progress { height: 4px; border-radius: 2px; background: #2A2A33; margin-top: 6px; }
.progress div { height: 100%; border-radius: 2px; background: var(--accent); }

/* ตาราง/กริดเรื่อง */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
.card { text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.card b { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card small { font-size: 12px; color: var(--muted); }

.latest { display: grid; gap: 8px; }
.latest-item { display: flex; gap: 12px; align-items: center; text-decoration: none; padding: 6px; border-radius: 14px; }
.latest-item:hover { background: var(--card); }
.latest-item small, .rank small { display: block; color: var(--muted); font-size: 12px; }

.two { display: grid; gap: 28px; }
.shelf-row { display: grid; gap: 10px; }
.pick { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: 18px; background: var(--card); text-decoration: none; color: var(--muted); }
.pick .thumb { width: 64px; flex: none; }
.pick b { display: block; color: var(--text, #fff); font-size: 16px; }
.pick small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.pick .when { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank a { display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 4px; border-radius: 16px; background: #141419; text-decoration: none; }
.rank .no { width: 34px; text-align: center; font-weight: 900; font-style: italic; font-size: 26px; color: var(--muted); }
.rank .no.top { color: var(--accent); }
.genres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.genres a { background: var(--card); border-radius: 16px; padding: 16px; text-decoration: none; display: flex; flex-direction: column; min-height: 76px; justify-content: flex-end; }
.genres b { font-size: 18px; }
.genres small { color: var(--muted); }

.vote-banner { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; text-decoration: none; }
.vote-banner > span { color: var(--accent); }
.vote-banner small { display: block; color: var(--muted); }

.donate { margin-top: 32px; background: var(--accent); color: #0E0E12; border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.donate b { display: block; font-size: 22px; font-weight: 900; line-height: 1.2; }

.foot { margin-top: 40px; border-top: 1px solid var(--line); padding: 24px var(--gutter); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot nav a { color: var(--muted); font-size: 14px; padding: 10px 0; }
.foot nav a.strong { color: #fff; font-weight: 600; }

/* หน้าเรื่อง */
.series-head { display: grid; gap: 18px; padding-top: 18px; }
.series-cover { width: min(240px, 60%); aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; margin: 0 auto; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); }
.series-info h1 { font-size: 28px; font-weight: 900; margin: 6px 0 4px; }
.series-info p { margin: 6px 0; }
.synopsis { white-space: pre-line; color: rgba(255, 255, 255, 0.85); }
.series-info .row { margin-top: 14px; }
.next-ep { display: flex; align-items: center; gap: 8px; color: var(--accent-soft); }
.credit { color: var(--muted); font-size: 13px; }
.ep-list { list-style: none; margin: 0; padding: 0; }
.ep-list a { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 52px; }
.ep-list a.read { color: var(--muted); }
.ep-list a.here { color: var(--accent-soft); }
.ep-no { font-weight: 700; flex: none; }
.ep-list small { color: var(--muted); flex: none; }

/* หน้าอ่าน */
.reader { --bright: 1; min-height: 100vh; background: #000; }
.r-top, .r-bottom {
  position: fixed; inset-inline: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  background: rgba(14, 14, 18, 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform 0.25s ease;
}
.r-top { top: 0; padding: calc(8px + var(--safe-t)) 12px 8px; }
.r-bottom { bottom: 0; padding: 8px 12px calc(8px + var(--safe-b)); justify-content: space-between; }
.reader.hide-ui .r-top { transform: translateY(-110%); }
.reader.hide-ui .r-bottom { transform: translateY(110%); }
.r-title b, .r-title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title small { color: var(--muted); font-size: 12px; }
.r-mid { border: 0; color: inherit; font: inherit; cursor: pointer; display: flex; align-items: center; gap: 8px; text-decoration: none; background: var(--chip); padding: 0 18px; height: 44px; border-radius: 12px; }
.pages { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; padding-top: calc(60px + var(--safe-t)); }
.pages img { width: 100%; height: auto; display: block; background: #111; }
.reader.gap .pages { gap: 10px; }
.reader.warm .pages { filter: sepia(0.35) saturate(0.9); }
.dim { position: fixed; inset: 0; pointer-events: none; background: #000; opacity: calc(1 - var(--bright)); z-index: 15; }
.r-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 25; }
.r-progress div { height: 100%; width: 0; background: var(--accent); }
.preview-note { position: relative; z-index: 1; margin: calc(64px + var(--safe-t)) auto 0; max-width: 800px; background: var(--warn); color: #0E0E12; padding: 10px 14px; font-weight: 600; }
.preview-note + .pages { padding-top: 0; }
.r-end { max-width: 800px; margin: 0 auto; padding: 28px var(--gutter) calc(110px + var(--safe-b)); background: var(--bg); display: flex; flex-direction: column; gap: 16px; }
.r-end-actions { display: flex; gap: 10px; align-items: center; justify-content: center; }
.heart-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; background: var(--chip); color: #fff; min-height: 54px; padding: 0 22px; border-radius: 27px; font-size: 17px; font-weight: 700; }
.heart-btn[aria-pressed="true"] { color: var(--accent); }
.heart-btn[aria-pressed="true"] svg { fill: var(--accent); }
.heart-btn.pop svg { animation: pop 0.4s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }
.countdown-box { background: var(--card); border-radius: 18px; padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.countdown-box b { color: var(--accent); font-size: 20px; display: block; }
.comments h2 { margin-bottom: 12px; }
.comment-form { display: grid; gap: 8px; }
.comment-form input, .comment-form textarea, .form input, .form textarea, .form select {
  background: var(--chip); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; font-size: 16px;
}
.form-msg { margin: 0; font-size: 14px; color: var(--accent-soft); min-height: 1em; }
.comment-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 14px; }
.comment-list li { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.comment-list small { color: var(--muted); margin-left: 8px; font-size: 12px; }
.comment-list p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

.r-settings { background: var(--card); color: #fff; border: 0; border-radius: 22px 22px 0 0; width: 100%; max-width: 520px; margin: auto auto 0; padding: 22px 20px calc(22px + var(--safe-b)); }
.r-settings::backdrop { background: rgba(0, 0, 0, 0.5); }
.r-settings h2 { margin-bottom: 14px; }
.switch, .range { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch small { display: block; color: var(--muted); font-size: 12px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.range input { flex: 1; accent-color: var(--accent); }
.r-settings form { margin-top: 16px; }
.r-settings .btn { width: 100%; }
.r-eps { max-height: 75vh; display: none; flex-direction: column; }
.r-eps[open] { display: flex; }
.ep-thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; object-position: top; background: var(--chip); flex: none; }
.ep-name { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.r-eps .ep-list a { padding: 8px 4px; }
.r-eps .ep-list { overflow-y: auto; flex: 1; margin-bottom: 8px; }

.age-gate { position: fixed; inset: 0; z-index: 50; background: rgba(14, 14, 18, 0.97); display: flex; align-items: center; justify-content: center; padding: 24px; }
.age-gate > div { max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.age-gate b { font-size: 40px; font-weight: 900; color: var(--accent); }

.swipe-hint { position: fixed; top: 50%; z-index: 30; transform: translateY(-50%); background: var(--accent); color: #0E0E12; border-radius: 50%; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.swipe-hint.left { left: 12px; }
.swipe-hint.right { right: 12px; }

/* ชั้นหนังสือ โหวต */
.tabs { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 14px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 10px; border-radius: 10px; cursor: pointer; min-height: 44px; }
.tabs button[aria-selected="true"] { background: #fff; color: #0E0E12; font-weight: 700; }
.shelf-list { display: grid; gap: 8px; }
.push-box { background: var(--card); border-radius: 18px; padding: 18px; margin-top: 20px; }
.push-box p { margin: 6px 0 12px; }
.poll { display: grid; gap: 10px; margin-top: 16px; }
.poll-opt { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-height: 56px; color: #fff; }
button.poll-opt { cursor: pointer; }
button.poll-opt:hover { border-color: var(--accent); }
.poll-opt b { position: relative; flex: 1; }
.poll-opt span, .poll-opt small { position: relative; }
.poll-opt small { width: 100%; color: var(--muted); }
.poll-opt .bar { position: absolute; inset: 0 auto 0 0; background: rgba(255, 79, 135, 0.22); }
.poll-opt.mine { border-color: var(--accent); }
.prose p { color: rgba(255, 255, 255, 0.85); }
.prose h2 { margin-top: 24px; }

.install-link { display: inline-flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 12px; padding: 10px 16px; text-decoration: none; font-size: 14px; }
.install-link[hidden], .install-card[hidden] { display: none; }

/* การ์ดชวนติดตั้ง */
.install-card {
  margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(135deg, #2A1520, #17171D 70%); border: 1px solid #3A2030; border-radius: 18px; padding: 14px;
}
.install-card img { border-radius: 14px; flex: none; }
.install-card .grow { flex: 1 1 0; min-width: 170px; }
.install-card b { display: block; line-height: 1.3; }
.install-card small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.install-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.install-card .icon-btn { background: transparent; color: var(--muted); }
.r-end .install-card { margin-top: 0; }

/* หน้าสอนติดตั้ง */
.guide-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 18px; }
.guide-hero img { border-radius: 22px; box-shadow: 0 12px 40px rgba(255, 79, 135, 0.25); }
.guide-hero h1 { margin: 8px 0 0; }
.guide-hero p { margin: 0; }
.guide-hero .btn { margin-top: 10px; max-width: 360px; }
.guide-hero .btn[hidden], .installed-note[hidden], .inapp-warn[hidden], .guide-panel[hidden] { display: none; }
.installed-note { background: rgba(79, 209, 139, 0.15); color: var(--ok); padding: 10px 14px; border-radius: 12px; margin-top: 10px !important; }
.perks { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.perks li { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; }
.perks svg { color: var(--accent); flex: none; }
.inapp-warn { background: rgba(255, 181, 71, 0.12); border: 1px solid rgba(255, 181, 71, 0.4); border-radius: 18px; padding: 16px; margin-bottom: 20px; }
.inapp-warn b { color: var(--warn); }
.inapp-warn p { margin: 6px 0 10px; }
.steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; counter-reset: none; }
.steps li { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; line-height: 1.45; }
.step-no { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #0E0E12; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.step-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--chip); color: #4DA3FF; display: flex; align-items: center; justify-content: center; flex: none; }
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); background: #fff; color: #0E0E12; padding: 10px 18px; border-radius: 12px; z-index: 60; font-weight: 600; max-width: calc(100% - 32px); }

/* จอคอม */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
  .hero-slide { flex-basis: 80%; aspect-ratio: 16 / 9; }
}
@media (min-width: 960px) {
  :root { --gutter: 40px; }
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .top { gap: 28px; padding-block: 14px; }
  .logo img { height: 38px; }
  .top-nav { display: flex; gap: 4px; flex: 1; }
  .top-nav a { text-decoration: none; color: var(--muted); padding: 10px 14px; border-radius: 10px; }
  .top-nav a.on { color: #fff; background: var(--chip); font-weight: 600; }
  .search { display: flex; width: 260px; }
  .top .icon-btn { margin-left: 0; }
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hero { margin-inline: 0; }
  .hero-track { padding: 0; }
  .hero-slide { flex-basis: 100%; aspect-ratio: auto; height: 480px; }
  .hero-slide::after { background: linear-gradient(90deg, rgba(14, 14, 18, 0.9) 0%, rgba(14, 14, 18, 0.4) 55%, rgba(14, 14, 18, 0) 80%); }
  .hero-text { inset: 0 auto 0 0; max-width: 560px; justify-content: flex-end; padding: 44px 52px; }
  .hero-text h2 { font-size: 56px; }
  .hero-text p { font-size: 16px; }
  .two { grid-template-columns: 1fr 1fr; gap: 32px; }
  .latest { grid-template-columns: repeat(2, 1fr); }
  .donate { flex-direction: row; justify-content: space-between; align-items: center; padding: 28px 36px; }
  .donate b { font-size: 28px; }
  .foot { flex-direction: row; justify-content: space-between; align-items: center; padding-inline: 40px; }
  .series-head { grid-template-columns: 280px 1fr; gap: 40px; align-items: start; padding-top: 32px; }
  .series-cover { width: 100%; }
  .series-info h1 { font-size: 40px; }
  .toast { bottom: 24px; }
  .r-settings { margin: auto; border-radius: 22px; }
}

/* ---------- หลังบ้าน ---------- */
body.admin { padding-bottom: 40px; }
.admin .top { flex-wrap: wrap; }
.admin-nav { display: flex; gap: 4px; overflow-x: auto; order: 3; width: 100%; scrollbar-width: none; }
.admin-nav a { text-decoration: none; color: var(--muted); padding: 10px 14px; border-radius: 10px; white-space: nowrap; }
.admin-nav a.on { background: var(--chip); color: #fff; font-weight: 600; }
.admin .top form { margin-left: auto; }
.admin-main { max-width: 1080px; margin: 0 auto; padding: 20px var(--gutter); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h1, .head-row h2 { margin: 0; }
.panel { background: var(--card); border-radius: 18px; padding: 18px; margin-top: 16px; }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.panel.danger { border: 1px solid #3A1520; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; }
.tile b { font-size: 30px; font-weight: 800; }
.tile small { color: var(--muted); font-size: 12px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-col .bar { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-col small, .bar-val { font-size: 11px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }
tr.on td { background: rgba(255, 79, 135, 0.08); }
.usage { display: grid; gap: 14px; margin-top: 12px; }
.usage-row { display: grid; gap: 6px; }
.usage-label { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.usage-label small, .usage-num { color: var(--muted); font-size: 12px; }
.usage-bar { height: 8px; background: #2A2A33; border-radius: 4px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--accent); }
.usage-row.warn .usage-bar span { background: #FFB020; }
.usage-row.bad .usage-bar span { background: #FF4545; }
.usage-alert { display: block; margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: #3A2A10; color: #FFD27A; font-size: 14px; text-decoration: none; }
.meter { display: inline-block; width: 80px; height: 6px; background: #2A2A33; border-radius: 3px; vertical-align: middle; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-list a { text-decoration: none; }
.admin-list small { display: block; color: var(--muted); font-size: 13px; }
.admin-list p { margin: 4px 0 0; white-space: pre-line; }
.admin-list .faded { opacity: 0.5; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--chip); }
.tag.live { background: rgba(79, 209, 139, 0.15); color: var(--ok); }
.tag.wait { background: rgba(255, 181, 71, 0.15); color: var(--warn); }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.form label.check, .days label { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 15px; min-height: 40px; }
.form input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.form legend { color: var(--muted); font-size: 14px; padding: 0 6px; }
.days { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.upload-img { display: grid; gap: 8px; background: var(--chip); padding: 12px; border-radius: 12px; font-size: 14px; color: var(--muted); }
.upload-img img { width: 140px; border-radius: 8px; }
.upload-img[data-kind="banner"] img { width: 240px; }
.drop { border: 2px dashed #3A3A44; border-radius: 16px; padding: 18px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.drop.over { border-color: var(--accent); background: rgba(255, 79, 135, 0.06); }
.file-list { margin: 0; padding-left: 22px; font-size: 13px; color: var(--muted); max-height: 260px; overflow: auto; columns: 2; }
.file-list li.done { color: var(--ok); }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.page-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; margin-bottom: 14px; }
.page-thumbs img { width: 100%; aspect-ratio: 1 / 2; object-fit: cover; object-position: top; border-radius: 6px; }
details summary { cursor: pointer; padding: 10px 0; color: var(--accent-soft); }
.ok-msg { background: rgba(79, 209, 139, 0.15); color: var(--ok); padding: 10px 14px; border-radius: 12px; }
.err-msg { color: #FF8FA8; margin: 0; }
.login { max-width: 360px; margin: 12vh auto 0; text-align: center; }
.plain { list-style: none; padding: 0; display: grid; gap: 8px; }
@media (min-width: 960px) {
  .admin-nav { order: 0; width: auto; flex: 1; }
  .admin .top form { margin-left: 0; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

.pick-cover { border: 0; padding: 0; margin: 4px 0; }
.pick-cover summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 8px 0; }
.pick-cover[open] summary { margin-bottom: 8px; }
.pick { cursor: pointer; position: relative; }
.pick input { position: absolute; opacity: 0; }
.pick img { border: 3px solid transparent; border-radius: 10px; }
.pick input:checked + img { border-color: var(--accent); }
.pick input:focus-visible + img { outline: 2px solid #fff; }
.pick-none { display: block; margin-bottom: 8px; }

/* ปุ่มแชทช่วยเหลือ */
.help-fab { position: fixed; right: 16px; bottom: calc(84px + var(--safe-b, 0px)); width: 64px; height: 64px; border-radius: 50%; border: 3px solid #fff; padding: 0; overflow: hidden; background: #FFD9E4; cursor: pointer; z-index: 40; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.help-panel { position: fixed; right: 12px; bottom: calc(80px + var(--safe-b, 0px)); width: min(360px, calc(100vw - 24px)); max-height: 70vh; background: var(--card); color: #fff; border-radius: 20px; display: flex; flex-direction: column; z-index: 41; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); overflow: hidden; }
.help-panel[hidden] { display: none; }
.help-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.help-x { border: 0; background: none; color: inherit; font-size: 18px; cursor: pointer; min-width: 36px; min-height: 36px; }
.help-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.help-msg { margin: 0; padding: 9px 13px; border-radius: 16px; max-width: 88%; white-space: pre-line; font-size: 14px; line-height: 1.5; }
.help-msg.bot { background: var(--chip); align-self: flex-start; }
.help-msg.me { background: var(--accent); color: #0E0E12; align-self: flex-end; }
.help-opts { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); }
.help-opt { border: 1px solid var(--line); background: none; color: inherit; border-radius: 12px; padding: 10px 12px; font: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.help-ask { display: flex; gap: 8px; }
.help-ask input { flex: 1; min-width: 0; }
@media (min-width: 900px) { .help-fab { bottom: 24px; } .help-panel { bottom: 24px; } }

/* บัญชี */
.acct-box { margin-bottom: 16px; }
.secret-set { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
.secret-set legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.code-box { text-align: center; padding: 24px 0; }
.code { font-size: 28px; font-weight: 800; letter-spacing: 2px; color: var(--accent-soft); background: var(--chip); border-radius: 14px; padding: 16px; user-select: all; }

[hidden] { display: none !important; }

/* ช่องรหัสผ่าน + ปุ่มแสดง/ซ่อน */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 10px; cursor: pointer; display: grid; place-items: center; font: inherit; font-size: 13px; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: #fff; }
.help-ask .pw-wrap { flex: 1; min-width: 0; }
.help-ask .pw-eye { width: auto; padding: 0 10px; }

/* หน้าบัญชี: ฟอร์มสะอาด โล่ง อ่านง่ายบนมือถือ */
.acct-form, [data-acct-form] { padding: 22px 20px; border-radius: 22px; gap: 16px; }
[data-acct-form] input:not([type="checkbox"]), [data-acct-form] select { min-height: 48px; border-radius: 14px; padding: 0 14px; font-size: 16px; }
[data-acct-form] label { font-size: 13px; }
[data-acct-form] .btn { min-height: 50px; border-radius: 14px; font-size: 16px; }
[data-acct-form] .link { background: none; border: 0; color: var(--accent-soft); cursor: pointer; justify-self: center; padding: 8px; font: inherit; font-size: 14px; }
.acct-box { padding: 22px 20px; border-radius: 22px; }
.acct-box h2 { font-size: 17px; margin-bottom: 14px; }
.acct-box .row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.acct-box .row form { margin: 0; }
.acct-box .switch { border-bottom: 0; padding: 14px 0 4px; }
.secret-set { background: rgba(255, 255, 255, 0.02); }
.code-box .row { justify-content: center; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.code-box h2 { margin-bottom: 8px; }

/* แจ้งคำผิด / เรื่องคล้ายกัน / streak / ออฟไลน์ / ขอเรื่อง */
.r-end-actions { flex-wrap: wrap; }
.r-report .kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.r-report .kinds label { display: block; cursor: pointer; }
.r-report .kinds input { position: absolute; opacity: 0; }
.r-report .kinds span { display: block; text-align: center; padding: 10px 8px; border-radius: 12px; background: var(--chip); font-size: 14px; min-height: 44px; }
.r-report .kinds input:checked + span { background: var(--accent); color: #0E0E12; font-weight: 600; }
.r-report .kinds input:focus-visible + span { outline: 2px solid #fff; }
.r-report textarea, .request-form textarea { width: 100%; background: var(--chip); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; margin-bottom: 8px; }
.r-report .range input[type="number"] { width: 80px; background: var(--chip); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.r-report .btn + .btn { margin-top: 8px; }
.similar h2 { font-size: 18px; margin-bottom: 12px; }
.similar-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.similar-item { display: block; text-decoration: none; min-width: 0; }
.similar-item .cover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; }
.similar-item b { display: block; margin-top: 6px; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.similar-item small { display: block; color: var(--muted); font-size: 12px; }
.streak { display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 0; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-soft); font-size: 14px; font-weight: 600; }
.streak[hidden] { display: none; }
.request-form { margin-top: 14px; }
.bar-col .bar.hot { background: var(--warn); }
a.tile { text-decoration: none; }

.offline-btn.loading { background: linear-gradient(90deg, rgba(255, 79, 135, 0.5) var(--p, 0%), rgba(255, 255, 255, 0.1) var(--p, 0%)); color: #fff; }
.offline-list { margin-top: 28px; text-align: left; display: flex; flex-direction: column; gap: 10px; }

.help-avatar { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; transform: scale(1.14); }
.help-title { display: flex; align-items: center; gap: 10px; }
.help-title .help-avatar { width: 34px; height: 34px; flex: none; transform: scale(1.14); overflow: hidden; }
.help-tease { position: fixed; right: 88px; bottom: calc(96px + var(--safe-b, 0px)); z-index: 40; border: 0; background: #fff; color: #0E0E12; font: inherit; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 16px 16px 4px 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); cursor: pointer; animation: tease-in 0.35s ease; }
.help-tease[hidden] { display: none; }
@keyframes tease-in { from { opacity: 0; transform: translateY(6px); } }
@media (min-width: 900px) { .help-tease { bottom: 36px; } }

.help-fab.mini { width: auto; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(23, 23, 29, 0.85); color: var(--muted); font: inherit; font-size: 13px; bottom: calc(72px + var(--safe-b, 0px)); box-shadow: none; transition: opacity 0.25s ease; }
.help-fab.mini:hover { color: #fff; }
body:has(.reader.hide-ui) .help-fab.mini { opacity: 0; pointer-events: none; }
body.bare .help-panel { bottom: calc(76px + var(--safe-b, 0px)); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
