/* ==========================================================================
   TOOLS — công cụ theo dõi thời tiết (/cong-cu/{slug}/, tool-pages/*.php)
   Dùng token của base.css; tiền tố .tw- để không đụng các thành phần khác.
   ========================================================================== */

.tw-page { padding-top: 20px; padding-bottom: 48px; }
.tw-section { margin: 36px 0; }
.tw-h1 { margin: 4px 0 10px; font-size: clamp(28px, 5vw, 40px); line-height: 1.15; font-weight: 700; color: var(--color-dark); letter-spacing: -0.02em; }
.tw-h2 { margin: 0 0 14px; font-size: clamp(19px, 3vw, 23px); line-height: 1.3; font-weight: 700; color: var(--color-dark); }
.tw-h3 { margin: 22px 0 10px; font-size: 16px; font-weight: 700; color: var(--color-dark); }
.tw-kicker { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-primary); }
.tw-lead { margin: 0; max-width: 680px; font-size: 16px; color: var(--color-text-muted); }
.tw-text { margin: 0 0 10px; color: var(--color-text-muted); }
.tw-text strong { color: var(--color-dark); }
.tw-empty { padding: 24px; border-radius: var(--radius-md); background: var(--color-tint); text-align: center; }
.tw-source { margin: 12px 0 0; font-size: 13px; color: var(--color-subtext); }
.tw-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; font-size: 13px; color: var(--color-subtext); }
.tw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tw-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.tw-nowrap { white-space: nowrap; }
.tw-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.tw-cols { display: grid; gap: 28px; }
@media (min-width: 860px) { .tw-cols { grid-template-columns: 1fr 1fr; } }
.tw-note { padding: 22px; border-radius: var(--radius-lg); background: var(--color-surface-alt); border: 1px solid var(--color-border-soft); }
.tw-steps { margin: 8px 0 12px; padding-left: 20px; color: var(--color-text-muted); }
.tw-steps li { margin-bottom: 6px; }

/* Hero */
.tw-hero { padding: 22px 0 18px; border-bottom: 1px solid var(--color-border); margin-bottom: 22px; }
.tw-hero--split { display: grid; gap: 18px; align-items: end; }
@media (min-width: 860px) { .tw-hero--split { grid-template-columns: 1fr 300px; } }
.tw-hero--night { border-bottom-color: #c9d3f3; }

/* Bộ chọn */
.tw-picker { display: flex; flex-direction: column; gap: 6px; }
.tw-picker__label { font-size: 13px; font-weight: 600; color: var(--color-subtext); }
.tw-picker__select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--color-border-hover); border-radius: var(--radius-sm); background: var(--color-surface); font: inherit; font-size: 16px; font-weight: 600; color: var(--color-dark); cursor: pointer; }
.tw-picker__select:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Ô số liệu */
.tw-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.tw-facts > div { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--color-surface-alt); border: 1px solid var(--color-border-soft); }
.tw-facts dt { font-size: 12px; color: var(--color-subtext); }
.tw-facts dd { margin: 2px 0 0; font-size: 17px; font-weight: 700; color: var(--color-dark); }
.tw-facts dd small { display: block; font-size: 12px; font-weight: 500; color: var(--color-subtext); }
.tw-facts--tight { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.tw-status { display: flex; gap: 14px; align-items: center; padding: 16px 18px; margin: 0 0 8px; border-radius: var(--radius-md); background: #ecfdf5; border: 1px solid #a7f3d0; }
.tw-status p { margin: 0; color: var(--color-dark); }
.tw-status__icon { font-size: 30px; line-height: 1; }
.tw-status--alert { background: #fff7ed; border-color: #fdba74; }

.tw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); font: inherit; font-size: 14px; color: var(--color-dark); text-decoration: none; cursor: pointer; }
.tw-chip small { color: var(--color-subtext); font-size: 12px; }
.tw-chip:hover, .tw-chip.is-on { border-color: var(--color-primary); background: var(--color-tint); color: var(--color-primary); }

.tw-badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--color-tint); color: var(--color-text-muted); }
.tw-badge--now { background: #1d4ed8; color: #fff; }
.tw-badge--soon { background: #dbeafe; color: #1e40af; }
.tw-badge--later { background: #e0f2fe; color: #075985; }
.tw-badge--maybe { background: #f1f5f9; color: #475569; }
.tw-badge--dry { background: #fef3c7; color: #92400e; }

/* Bảng */
.tw-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tw-table th, .tw-table td { padding: 10px 12px; border-bottom: 1px solid var(--color-border-soft); text-align: left; vertical-align: top; }
.tw-table thead th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-subtext); background: var(--color-surface-alt); }
.tw-table tbody th { font-weight: 600; color: var(--color-dark); white-space: nowrap; }
.tw-table tbody th a { color: var(--color-dark); text-decoration: none; }
.tw-table tbody th a:hover { color: var(--color-primary); }
.tw-table tr:last-child td, .tw-table tr:last-child th { border-bottom: 0; }
.tw-table tr.is-today { background: var(--color-tint); }
[data-city-row].is-picked { background: #fffbe6; }
.tw-emojis { font-size: 18px; letter-spacing: 2px; white-space: nowrap; }

/* Liên kết cuối trang */
.tw-more { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.tw-more__title { margin: 0 0 12px; font-size: 17px; font-weight: 700; }
.tw-more__list { display: flex; flex-wrap: wrap; gap: 8px; }
.tw-more__item { padding: 8px 14px; border-radius: var(--radius-xs); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 14px; color: var(--color-dark); text-decoration: none; }
.tw-more__item:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* Bản đồ nhúng */
.tw-embed { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface); }
.tw-embed__tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--color-border-soft); }
.tw-embed__frame { position: relative; height: clamp(340px, 62vh, 560px); background: linear-gradient(135deg, #0f2a4a, #1e5a8c 55%, #2c8fc4); }
.tw-embed__frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.tw-embed__start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; width: 100%; border: 0; background: transparent; color: #fff; font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; }
.tw-embed__start small { font-size: 13px; font-weight: 400; opacity: 0.8; }
.tw-embed__play { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); font-size: 24px; transition: transform 0.2s; }
.tw-embed__start:hover .tw-embed__play { transform: scale(1.08); background: rgba(255, 255, 255, 0.28); }

/* ---------- Có mưa không ---------- */
.tw-answer { padding: clamp(18px, 3vw, 28px); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.tw-answer--now, .tw-answer--soon { background: linear-gradient(160deg, #eff6ff, #fff 60%); border-color: #bfdbfe; }
.tw-answer--dry { background: linear-gradient(160deg, #fffbeb, #fff 60%); border-color: #fde68a; }
.tw-answer__main { display: flex; gap: 18px; align-items: center; }
.tw-answer__icon { font-size: clamp(48px, 9vw, 72px); line-height: 1; }
.tw-answer__place { margin: 0; font-size: 14px; color: var(--color-subtext); }
.tw-answer__head { margin: 2px 0 4px; font-size: clamp(26px, 5vw, 36px); font-weight: 700; color: var(--color-dark); }
.tw-answer__detail { margin: 0; color: var(--color-text-muted); }
.tw-answer__links { margin: 14px 0 0; font-weight: 600; }

.tw-ribbon { display: grid; grid-template-columns: repeat(24, minmax(22px, 1fr)); gap: 3px; margin: 8px 0 0; padding: 0; list-style: none; overflow-x: auto; }
.tw-ribbon li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 130px; font-size: 11px; color: var(--color-subtext); font-variant-numeric: tabular-nums; }
.tw-ribbon b { font-size: 10px; font-weight: 600; color: var(--color-text-muted); }
.tw-ribbon i { display: block; width: 100%; height: calc(var(--p) * 0.7); border-radius: 5px 5px 2px 2px; background: var(--c); }
.tw-rb0 { --c: #dde4ee; } .tw-rb1 { --c: #93c5fd; } .tw-rb2 { --c: #3b82f6; } .tw-rb3 { --c: #1d4ed8; } .tw-rb4 { --c: #4c1d95; }
.tw-dot { background: var(--c, #cbd5e1); }

.tw-tally { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.tw-tally__item { padding: 8px 14px; border-radius: var(--radius-xs); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 14px; }
.tw-regions { display: grid; gap: 18px; }
@media (min-width: 760px) { .tw-regions { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1140px) { .tw-regions { grid-template-columns: repeat(3, 1fr); } }
.tw-region { padding: 16px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-region__name { margin: 0 0 10px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary); }
.tw-list { margin: 0; padding: 0; list-style: none; }
.tw-list__row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'n b' 'm v'; gap: 6px 10px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--color-border-soft); border-radius: 6px; }
.tw-list__row:last-child { border-bottom: 0; }
.tw-list__name { grid-area: n; font-weight: 600; color: var(--color-dark); text-decoration: none; }
.tw-list__name:hover { color: var(--color-primary); }
.tw-list__row .tw-badge { grid-area: b; justify-self: end; }
.tw-list__row .tw-mini { grid-area: m; }
.tw-list__val { grid-area: v; font-size: 13px; color: var(--color-subtext); text-align: right; white-space: nowrap; }
.tw-mini { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; height: 8px; }
.tw-mini i { border-radius: 1px; background: var(--c); }

/* ---------- Bản đồ mưa: lưới ngày ---------- */
.tw-grid { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.tw-grid th { padding: 6px 8px; font-weight: 600; text-align: left; white-space: nowrap; color: var(--color-dark); }
.tw-grid thead th { text-align: center; font-size: 12px; color: var(--color-subtext); }
.tw-grid thead th small { display: block; font-weight: 400; }
.tw-grid tbody th a { color: var(--color-dark); text-decoration: none; }
.tw-grid__group th { padding-top: 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary); }
.tw-grid td { min-width: 46px; height: 34px; border-radius: 6px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.tw-grid__sum { background: var(--color-surface-alt); color: var(--color-dark); }
.tw-heat--0 { background: #f4f7fb; }
.tw-heat--1 { background: #dbeafe; color: #1e3a8a; }
.tw-heat--2 { background: #93c5fd; color: #1e3a8a; }
.tw-heat--3 { background: #3b82f6; color: #fff; }
.tw-heat--4 { background: #1e40af; color: #fff; }
.tw-heat--5 { background: #5b21b6; color: #fff; }

.tw-bars { margin: 0; padding: 0; list-style: none; }
.tw-bars li { display: grid; grid-template-columns: minmax(96px, 30%) 1fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }
.tw-bars__name { font-weight: 600; color: var(--color-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-bars__track { height: 10px; border-radius: 99px; background: var(--color-border-soft); overflow: hidden; }
.tw-bars__fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #60a5fa, #2563eb); }
.tw-bars--wind .tw-bars__fill { background: linear-gradient(90deg, #a7f3d0, #10b981); }
.tw-bars__fill.is-warm { background: linear-gradient(90deg, #fde68a, #f59e0b); }
.tw-bars__fill.is-hot { background: linear-gradient(90deg, #fca5a5, #dc2626); }
.tw-bars__val { font-weight: 600; text-align: right; white-space: nowrap; color: var(--color-dark); }
.tw-bars__val small { display: block; font-weight: 400; font-size: 12px; color: var(--color-subtext); }
.tw-stack { margin: 0; padding: 0; list-style: none; }
.tw-stack li { display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; margin-bottom: 8px; border-radius: var(--radius-sm); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-stack li span { font-size: 14px; color: var(--color-text-muted); }

/* ---------- Bão ---------- */
.tw-storms { display: grid; gap: 16px; }
@media (min-width: 860px) { .tw-storms { grid-template-columns: repeat(2, 1fr); } }
.tw-storm { padding: 20px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-storm--east { border: 2px solid #f97316; background: #fffaf5; }
.tw-storm__head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tw-storm__name { margin: 0; font-size: 22px; font-weight: 700; }
.tw-storm__name::before { content: '🌀 '; }
.tw-storm__lvl { padding: 4px 12px; border-radius: 999px; background: var(--color-dark); color: #fff; font-size: 13px; font-weight: 600; }
.tw-storm__foot { margin: 0; font-size: 13px; color: var(--color-subtext); }
.tw-alert { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; }
.tw-alert--green { background: #d1fae5; color: #065f46; }
.tw-alert--orange { background: #ffedd5; color: #9a3412; }
.tw-alert--red { background: #fee2e2; color: #991b1b; }

/* ---------- Mặc gì ---------- */
.tw-wardrobe__sum { margin: 0 0 16px; padding: 14px 18px; border-left: 4px solid var(--color-primary); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--color-tint); color: var(--color-dark); }
.tw-periods { display: grid; gap: 14px; }
@media (min-width: 640px) { .tw-periods { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .tw-periods { grid-template-columns: repeat(4, 1fr); } }
.tw-period { display: flex; flex-direction: column; padding: 18px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-period__head { display: flex; gap: 12px; align-items: center; }
.tw-period__emo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--color-tint); font-size: 26px; }
.tw-period__name { margin: 0; font-size: 16px; font-weight: 700; }
.tw-period__head small { color: var(--color-subtext); font-size: 12px; }
.tw-period__feel { margin-left: auto; font-size: 28px; font-weight: 700; color: var(--color-dark); }
.tw-period__lvl { margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: var(--color-primary); }
.tw-period__wear { margin: 0 0 10px; padding-left: 18px; color: var(--color-dark); }
.tw-period__wear li { margin-bottom: 4px; }
.tw-period__meta { margin: auto 0 0; padding-top: 10px; border-top: 1px dashed var(--color-border); font-size: 12px; color: var(--color-subtext); }
.tw-bag { margin-top: 16px; padding: 16px 18px; border-radius: var(--radius-md); background: #fefce8; border: 1px solid #fde68a; }
.tw-bag__title { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.tw-bag__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tw-bag__list span { font-size: 18px; }
.tw-ladder { display: grid; gap: 6px; margin-bottom: 14px; }
.tw-ladder__step { display: grid; grid-template-columns: 88px 130px 1fr; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--radius-xs); background: var(--color-surface); border-left: 6px solid var(--lc, #94a3b8); font-size: 14px; }
@media (max-width: 640px) { .tw-ladder__step { grid-template-columns: 80px 1fr; } .tw-ladder__txt { grid-column: 1 / -1; } }
.tw-ladder__t { font-weight: 700; font-variant-numeric: tabular-nums; }
.tw-ladder__lv { font-weight: 600; }
.tw-ladder__txt { color: var(--color-text-muted); }
.tw-ladder__step--36 { --lc: #dc2626; } .tw-ladder__step--32 { --lc: #f97316; } .tw-ladder__step--28 { --lc: #f59e0b; } .tw-ladder__step--24 { --lc: #84cc16; }
.tw-ladder__step--20 { --lc: #14b8a6; } .tw-ladder__step--16 { --lc: #0ea5e9; } .tw-ladder__step--12 { --lc: #3b82f6; } .tw-ladder__step--6 { --lc: #6366f1; }

/* ---------- Trời nồm ---------- */
.tw-nomgrid { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); overflow-x: auto; }
.tw-nomgrid__row { display: grid; grid-template-columns: minmax(86px, 1.5fr) repeat(5, minmax(38px, 1fr)); gap: 4px; align-items: center; padding: 8px 10px; list-style: none; }
.tw-nomgrid__row::-webkit-details-marker { display: none; }
.tw-nomgrid__row--head { font-size: 12px; font-weight: 600; color: var(--color-subtext); background: var(--color-surface-alt); text-align: center; }
.tw-nomgrid__row--head span:first-child { text-align: left; }
.tw-nomgrid__group { padding: 10px 12px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary); }
.tw-nomgrid__item { border-top: 1px solid var(--color-border-soft); }
.tw-nomgrid__item summary { cursor: pointer; }
.tw-nomgrid__item summary:hover { background: var(--color-surface-alt); }
.tw-nomgrid__name { font-weight: 600; color: var(--color-dark); }
.tw-nomgrid__name::after { content: ' ▸'; color: var(--color-subtext); font-size: 12px; }
.tw-nomgrid__item[open] .tw-nomgrid__name::after { content: ' ▾'; }
.tw-nomcell { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 8px; font-size: 18px; line-height: 1.1; }
.tw-nomcell small { font-size: 11px; color: var(--color-subtext); }
.tw-nomcell--damp { background: #f1f5f9; }
.tw-nomcell--nom { background: #dbeafe; }
.tw-nomcell--heavy { background: #93c5fd; }
.tw-nomcell--heavy small { color: #1e3a8a; }
.tw-nomgrid__detail { display: grid; gap: 8px; padding: 6px 12px 14px; }
.tw-nomday { display: flex; flex-direction: column; padding: 8px 12px; border-radius: var(--radius-xs); background: var(--color-surface-alt); font-size: 14px; }
.tw-nomday span { color: var(--color-text-muted); }
.tw-tips { display: grid; gap: 12px; }
@media (min-width: 720px) { .tw-tips { grid-template-columns: repeat(3, 1fr); } }
.tw-tip { display: flex; gap: 12px; padding: 16px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-tip > span { font-size: 26px; line-height: 1; }
.tw-tip p { margin: 0; font-size: 14px; color: var(--color-text-muted); }
.tw-tip strong { display: block; color: var(--color-dark); }

/* ---------- AQI ---------- */
.tw-scale { margin: 6px 0 18px; }
.tw-scale__bar { position: relative; height: 28px; border-radius: 8px; overflow: hidden; }
.tw-scale__band { position: absolute; top: 0; bottom: 0; padding: 5px 6px; font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, 0.95); }
.tw-scale__band--1, .tw-dot.tw-scale__band--1 { background: #10b981; }
.tw-scale__band--2, .tw-dot.tw-scale__band--2 { background: #f59e0b; }
.tw-scale__band--3, .tw-dot.tw-scale__band--3 { background: #f97316; }
.tw-scale__band--4, .tw-dot.tw-scale__band--4 { background: #ef4444; }
.tw-scale__band--5, .tw-dot.tw-scale__band--5 { background: #7f1d1d; }
.tw-dot.tw-scale__band--1, .tw-dot.tw-scale__band--2, .tw-dot.tw-scale__band--3, .tw-dot.tw-scale__band--4, .tw-dot.tw-scale__band--5 { position: static; padding: 0; }
.tw-scale__pins { position: relative; height: 18px; }
.tw-scale__pin { position: absolute; top: 2px; width: 3px; height: 14px; margin-left: -1px; border-radius: 2px; background: var(--color-dark); opacity: 0.7; }
.tw-aqcards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tw-aqcard { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-ring { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--lv) calc(var(--pct) * 1%), var(--color-border-soft) 0); }
.tw-ring span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--color-surface); font-size: 18px; font-weight: 700; color: var(--color-dark); }
.tw-aqcard__name { margin: 0; font-size: 16px; }
.tw-aqcard__name a { color: var(--color-dark); text-decoration: none; }
.tw-aqcard__lv { margin: 0; font-size: 13px; font-weight: 600; color: var(--lv); }
.tw-aqcard__pm { margin: 4px 0 0; font-size: 13px; color: var(--color-text-muted); }
.tw-aqcard__pm em { display: block; font-style: normal; font-size: 12px; }
.tw-aqcard__pm em.is-over { color: #b91c1c; }
.tw-aqcard__pm em.is-ok { color: #047857; }
.tw-rank { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.tw-rank li { counter-increment: r; display: grid; grid-template-columns: 26px 1fr auto; grid-template-areas: 'i a b' 'i s b'; column-gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--color-border-soft); }
.tw-rank li::before { content: counter(r); grid-area: i; align-self: center; font-weight: 700; color: var(--color-subtext); }
.tw-rank a { grid-area: a; font-weight: 600; color: var(--color-dark); text-decoration: none; }
.tw-rank span { grid-area: s; font-size: 12px; color: var(--color-subtext); }
.tw-rank b { grid-area: b; align-self: center; font-size: 18px; }

/* ---------- UV ---------- */
.tw-uv { padding: clamp(18px, 3vw, 26px); border-radius: var(--radius-lg); background: linear-gradient(170deg, #fff7ed, #fff 55%); border: 1px solid #fed7aa; }
.tw-uv__top { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; }
.tw-uv__top > div:last-child { flex: 1 1 280px; }
.tw-uvdial { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 132px; height: 132px; border-radius: 50%; border: 12px solid var(--lv); background: var(--color-surface); }
.tw-uvdial__num { font-size: 44px; font-weight: 700; line-height: 1; color: var(--color-dark); }
.tw-uvdial__lv { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--lv); text-align: center; }
.tw-windows { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.tw-windows__w { padding: 8px 12px; border-radius: var(--radius-xs); background: var(--color-surface); border-left: 4px solid #cbd5e1; font-size: 14px; }
.tw-windows__w--3 { border-color: #f59e0b; } .tw-windows__w--6 { border-color: #f97316; } .tw-windows__w--8 { border-color: #ef4444; }
.tw-uvbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(26px, 1fr); gap: 4px; align-items: end; height: 170px; margin: 22px 0 6px; overflow-x: auto; }
.tw-uvbars__c { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--color-subtext); }
.tw-uvbars__c b { font-size: 12px; color: var(--color-dark); }
.tw-uvbars__c i { display: block; width: 100%; height: var(--h); border-radius: 6px 6px 2px 2px; background: var(--lv); }
.tw-uvbars__c small { margin-top: 4px; }
.tw-week { display: grid; grid-template-columns: repeat(7, minmax(68px, 1fr)); gap: 6px; overflow-x: auto; }
.tw-week__d { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--color-surface); border-top: 4px solid var(--lv); text-align: center; }
.tw-week__d small { font-size: 12px; color: var(--color-subtext); }
.tw-week__d strong { font-size: 22px; }
.tw-week__d span { font-size: 11px; color: var(--color-text-muted); }
.tw-pill { display: inline-grid; place-items: center; min-width: 30px; padding: 2px 8px; border-radius: 99px; background: var(--lv); color: #fff; font-weight: 700; }
.tw-burn { padding: 20px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-burn__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tw-burn__row label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--color-text-muted); }
.tw-burn input[type=number], .tw-burn select { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font: inherit; font-size: 16px; background: var(--color-surface-alt); }
.tw-burn__skin { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.tw-burn__skin legend { margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--color-text-muted); }
.tw-skin { position: relative; cursor: pointer; }
.tw-skin input { position: absolute; opacity: 0; }
.tw-skin span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 40px; border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); font-size: 14px; }
.tw-skin span::before { content: ''; position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--sk); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.tw-skin small { font-size: 12px; color: var(--color-subtext); }
.tw-skin input:checked + span { border-color: var(--color-primary); background: var(--color-tint); }
.tw-skin input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tw-skin--1 { --sk: #f6e0d3; } .tw-skin--2 { --sk: #eccbb4; } .tw-skin--3 { --sk: #d9ad87; } .tw-skin--4 { --sk: #b98154; } .tw-skin--5 { --sk: #8a5734; } .tw-skin--6 { --sk: #4b2e1d; }
.tw-burn__out { margin: 16px 0 0; padding: 14px 16px; border-radius: var(--radius-sm); background: #fff7ed; font-size: 17px; font-weight: 700; color: #9a3412; }
.tw-uvscale { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 860px) { .tw-uvscale { grid-template-columns: repeat(5, 1fr); } }
.tw-uvscale__s { padding: 12px; border-radius: var(--radius-sm); background: var(--color-surface); border-top: 5px solid var(--lv); }
.tw-uvscale__s strong { font-size: 18px; }
.tw-uvscale__s span { display: block; font-weight: 600; color: var(--lv); }
.tw-uvscale__s p { margin: 4px 0 0; font-size: 13px; color: var(--color-text-muted); }

/* ---------- Thủy triều ---------- */
.tw-tide { padding: clamp(16px, 3vw, 24px); border-radius: var(--radius-lg); background: linear-gradient(175deg, #ecfeff, #fff 50%); border: 1px solid #a5f3fc; }
.tw-tide__now { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin-bottom: 12px; }
.tw-tide__now .tw-text { flex: 1 1 260px; margin: 0; }
.tw-tide__gauge { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-tide__gauge small, .tw-tide__gauge span { display: block; font-size: 12px; color: var(--color-subtext); }
.tw-tide__gauge strong { display: block; font-size: 28px; line-height: 1.1; }
.tw-tide__arrow { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-size: 18px; color: #fff; background: #0891b2; }
.tw-tide__gauge.is-down .tw-tide__arrow { background: #64748b; }
.tw-chart { margin: 0 0 16px; overflow-x: auto; }
.tw-chart svg { display: block; width: 100%; min-width: 560px; height: auto; }
.tw-chart figcaption { font-size: 12px; color: var(--color-subtext); }
.tw-chart__grid { stroke: #e2e8f0; stroke-dasharray: 3 4; }
.tw-chart__lbl { font-size: 11px; fill: #64748b; }
.tw-chart__area { fill: rgba(8, 145, 178, 0.14); }
.tw-chart__line { fill: none; stroke: #0891b2; stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.tw-chart__pt--high { fill: #0e7490; } .tw-chart__pt--low { fill: #94a3b8; }
.tw-chart__val { font-size: 11px; font-weight: 600; fill: #0f172a; }
.tw-chart__now { stroke: #f97316; stroke-width: 2; }
.tw-up b { color: #0e7490; } .tw-down b { color: #475569; }
.tw-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tw-tag--rong { background: #cffafe; color: #155e75; } .tw-tag--kem { background: #f1f5f9; color: #475569; } .tw-tag--trung { background: #ecfeff; color: #0e7490; }
.tw-coast { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tw-coast__item { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--color-surface); border: 1px solid var(--color-border); font-size: 13px; color: var(--color-text-muted); text-decoration: none; }
.tw-coast__item strong { color: var(--color-dark); font-size: 14px; }
.tw-coast__item:hover { border-color: #0891b2; }
.tw-coast__range { display: flex; gap: 8px; align-items: center; font-weight: 600; color: #0e7490; }
.tw-coast__range i { flex: none; width: 90px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, #06b6d4 var(--r), #e2e8f0 0); }

/* ---------- Câu cá ---------- */
.tw-fishdays { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tw-fishday { display: flex; flex-direction: column; padding: 16px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); border-top: 5px solid #94a3b8; }
.tw-fishday--4 { border-top-color: #059669; } .tw-fishday--3 { border-top-color: #10b981; } .tw-fishday--2 { border-top-color: #f59e0b; } .tw-fishday--1 { border-top-color: #94a3b8; }
.tw-fishday--unsafe { border-top-color: #dc2626; background: #fef2f2; }
.tw-fishday__head { display: flex; justify-content: space-between; gap: 8px; }
.tw-fishday__head strong { display: block; font-size: 16px; }
.tw-fishday__head small { font-size: 12px; color: var(--color-subtext); }
.tw-fishday__score { margin: 8px 0; font-weight: 700; }
.tw-fishday__score small { font-weight: 500; color: var(--color-subtext); }
.tw-stars { color: #f59e0b; letter-spacing: 1px; }
.tw-fishday__win { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.tw-win { padding: 3px 9px; border-radius: 99px; font-size: 12px; }
.tw-win--major { background: #d1fae5; color: #065f46; } .tw-win--minor { background: #f1f5f9; color: #475569; }
.tw-fishday__facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.tw-fishday__facts div { display: contents; }
.tw-fishday__facts dt { color: var(--color-subtext); }
.tw-fishday__facts dd { margin: 0; color: var(--color-dark); }
.tw-fishday__why { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--color-border); font-size: 12px; color: var(--color-text-muted); }

/* ---------- Bầu trời đêm ---------- */
.moon-svg { display: inline-block; vertical-align: middle; }
.moon-svg__dark { fill: #263252; }
.moon-svg__lit { fill: #fdf6d8; }
.tw-moon { display: flex; flex-wrap: wrap; gap: 26px; align-items: center; padding: clamp(18px, 3vw, 28px); margin-bottom: 18px; border-radius: var(--radius-lg); background: radial-gradient(circle at 15% 30%, #24345e, #0e1730 70%); color: #e2e8f0; }
.tw-moon .tw-h2 { color: #fff; }
.tw-moon .tw-text { color: #cbd5e1; }
.tw-moon .tw-text strong { color: #fff; }
.tw-moon__art .moon-svg { filter: drop-shadow(0 0 28px rgba(253, 246, 216, 0.35)); }
.tw-moon > div:last-child { flex: 1 1 280px; }
.tw-phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.tw-phases li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.07); }
.tw-phases strong { display: block; font-size: 13px; color: #fff; }
.tw-phases small { font-size: 12px; color: #94a3b8; }
.tw-tonight { padding: clamp(16px, 3vw, 24px); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-tonight__head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tw-tonight__head .tw-h2 { margin: 0; }
.tw-rate { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #f1f5f9; color: #475569; }
.tw-rate--great { background: #312e81; color: #fff; } .tw-rate--good { background: #e0e7ff; color: #3730a3; }
.tw-rate--fair { background: #f1f5f9; color: #475569; } .tw-rate--poor { background: #fee2e2; color: #991b1b; }
.tw-timeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: none; }
.tw-timeline li { position: relative; padding: 14px 10px 0; border-top: 3px solid #c7d2fe; }
.tw-timeline li::before { content: ''; position: absolute; top: -8px; left: 10px; width: 13px; height: 13px; border-radius: 50%; background: #4f46e5; box-shadow: 0 0 0 3px var(--color-surface); }
.tw-timeline small { display: block; font-size: 12px; color: var(--color-subtext); }
.tw-timeline strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.tw-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.tw-cal__wd { padding: 4px 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--color-subtext); }
.tw-cal__d { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: var(--radius-xs); background: #10193a; color: #cbd5e1; }
.tw-cal__d.is-key { background: #1e2b5c; }
.tw-cal__d.is-today { outline: 2px solid #f59e0b; }
.tw-cal__n { font-size: 11px; color: #94a3b8; }
.tw-cal__l { font-size: 13px; font-weight: 700; color: #fde68a; }
.tw-meteors { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tw-meteor { padding: 16px; border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); }
.tw-meteor__date { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #4f46e5; }
.tw-meteor__name { margin: 2px 0 4px; font-size: 17px; }
.tw-meteor__meta { margin: 0 0 6px; font-size: 13px; color: var(--color-text-muted); }
.tw-meteor__moon { display: flex; gap: 6px; align-items: center; margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.tw-meteor__moon.is-ok { color: #047857; } .tw-meteor__moon.is-bad { color: #b45309; }

@media (max-width: 640px) {
  .tw-ribbon { grid-template-columns: repeat(24, 26px); }
  .tw-ribbon li { height: 110px; }
  .tw-answer__main { align-items: flex-start; }
  .tw-cal__d { padding: 6px 0; }
  .tw-cal .moon-svg { width: 22px; height: 22px; }
}
