/* ===== Chuỗi hằng ngày (public/streaks.js) ===== */
.streak-flame { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.streak-flame .streak-flame-outer { fill: #C5CFCA; }
.streak-flame .streak-flame-inner { fill: #E3E9E6; }
.streak-flame.is-lit .streak-flame-outer { fill: #FF7417; }
.streak-flame.is-lit .streak-flame-inner { fill: #FFCE3D; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .streak-flame .streak-flame-outer { fill: #4B5A54; }
  :root:not([data-theme="light"]) .streak-flame .streak-flame-inner { fill: #66766F; }
  :root:not([data-theme="light"]) .streak-flame.is-lit .streak-flame-outer { fill: #FF8226; }
  :root:not([data-theme="light"]) .streak-flame.is-lit .streak-flame-inner { fill: #FFD25A; }
}
:root[data-theme="dark"] .streak-flame .streak-flame-outer { fill: #4B5A54; }
:root[data-theme="dark"] .streak-flame .streak-flame-inner { fill: #66766F; }
:root[data-theme="dark"] .streak-flame.is-lit .streak-flame-outer { fill: #FF8226; }
:root[data-theme="dark"] .streak-flame.is-lit .streak-flame-inner { fill: #FFD25A; }

/* Nhãn trên thẻ game */
.game-chip.is-streak { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .9); color: #8A3A00; }
.game-chip.is-streak.is-risk { background: #FFD54A; color: #3A2A00; }

/* Khung chuỗi chung ở trang Trò chơi */
.streak-hero {
  display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: 20px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.streak-hero:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }
.streak-hero.is-risk { border-color: #F5B300; box-shadow: inset 0 0 0 1px #F5B300; }
.streak-hero-flame { position: relative; display: grid; place-items: center; width: 64px; height: 64px; flex: none; }
.streak-hero-flame .streak-flame { width: 64px; height: 64px; }
.streak-hero-flame strong {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 900; color: #fff;
  text-shadow: 0 1px 2px rgba(120, 40, 0, .55); font-variant-numeric: tabular-nums;
}
.streak-hero:not(.is-lit) .streak-hero-flame strong { color: var(--ink); text-shadow: none; }
.streak-hero.is-lit .streak-hero-flame .streak-flame { animation: streak-flicker 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes streak-flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.04, .97) rotate(-2deg); } 60% { transform: scale(.98, 1.03) rotate(1.5deg); } }
.streak-hero-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.streak-hero-main h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.streak-hero-main p { font-size: 13.5px; color: var(--muted); }
.streak-hero.is-risk .streak-hero-main p { color: var(--turmeric-ink); font-weight: 700; }
.streak-hero-more { font-size: 26px; color: var(--muted); line-height: 1; }

/* 7 ngày gần nhất */
.streak-week { display: flex; gap: 6px; padding: 0; margin: 4px 0 0; list-style: none; }
.streak-week li { display: grid; justify-items: center; gap: 2px; }
.streak-week small { font-size: 11px; color: var(--muted); font-weight: 700; }
.streak-week li.is-today small { color: var(--ink); }
.streak-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--field); display: grid; place-items: center; }
.streak-week li.is-on .streak-dot { background: #FFE7CC; }
.streak-week li.is-today .streak-dot { box-shadow: inset 0 0 0 2px var(--line); }
.streak-week li.is-today.is-on .streak-dot { box-shadow: inset 0 0 0 2px #FF9A3D; }
.streak-dot .streak-flame { width: 16px; height: 16px; }
.streak-week.is-small { gap: 4px; }
.streak-week.is-small .streak-dot { width: 18px; height: 18px; }
.streak-week.is-small .streak-dot .streak-flame { width: 12px; height: 12px; }
.streak-week.is-small small { font-size: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .streak-week li.is-on .streak-dot { background: #4A2E14; } }
:root[data-theme="dark"] .streak-week li.is-on .streak-dot { background: #4A2E14; }
/* Điện thoại hẹp (360 px): bảy chấm của tuần vẫn vừa khung, trang Trò chơi không bị tràn ngang */
@media (max-width: 379.98px) {
  .streak-hero { gap: 10px; }
  .streak-hero .streak-week { gap: 3px; }
}

/* Huy hiệu trong từng game */
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 8px; border-radius: 999px; border: 0;
  background: var(--field); color: var(--muted); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; flex: none;
  font-variant-numeric: tabular-nums;
}
.streak-badge .streak-flame { width: 20px; height: 20px; }
.streak-badge.is-lit { background: #FFEBD6; color: #A14400; }
.streak-badge.is-risk { background: #FFF3C4; color: #7A5600; box-shadow: inset 0 0 0 1.5px #F5B300; }
.streak-badge:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .streak-badge.is-lit { background: #4A2E14; color: #FFC58F; }
  :root:not([data-theme="light"]) .streak-badge.is-risk { background: #3A2F12; color: #F2C04E; }
}
:root[data-theme="dark"] .streak-badge.is-lit { background: #4A2E14; color: #FFC58F; }
:root[data-theme="dark"] .streak-badge.is-risk { background: #3A2F12; color: #F2C04E; }
/* Trên nền đậm (thẻ ELO cờ vua / caro) */
.chess-hero .streak-badge, .caro-hero .streak-badge { background: rgba(255, 255, 255, .16); color: #fff; }
.chess-hero .streak-badge.is-lit, .caro-hero .streak-badge.is-lit { background: #fff; color: #A14400; }
.chess-hero .streak-badge.is-risk, .caro-hero .streak-badge.is-risk { background: #FFD54A; color: #3A2A00; box-shadow: none; }

/* Bảng chi tiết */
.streak-top { display: flex; gap: 16px; align-items: center; }
.streak-top h3 { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; }
.streak-big { position: relative; width: 84px; height: 84px; flex: none; display: grid; place-items: center; }
.streak-big .streak-flame { width: 84px; height: 84px; }
.streak-big strong { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 22px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.streak-big.is-lit strong { color: #fff; text-shadow: 0 1px 2px rgba(120, 40, 0, .55); }
.streak-note { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.streak-rows { display: grid; gap: 0; padding: 0; margin: 0; list-style: none; border: 1px solid var(--line); border-radius: 16px; }
.streak-row:first-child { border-radius: 15px 15px 0 0; }
.streak-row:last-child { border-radius: 0 0 15px 15px; }
.streak-row:only-child { border-radius: 15px; }
.streak-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.streak-row + .streak-row { border-top: 1px solid var(--line); }
.streak-row.is-focus { background: var(--jade-wash); }
.streak-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.streak-row-main strong { font-size: 15px; }
.streak-row-main small { color: var(--muted); font-size: 12.5px; }
.streak-row.is-risk .streak-row-main small { color: var(--turmeric-ink); font-weight: 700; }
.streak-row-count { display: inline-flex; align-items: center; gap: 4px; font-size: 20px; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.streak-row-count .streak-flame { width: 26px; height: 26px; }
.streak-row-count.is-lit { color: #D35400; }
.streak-miles { display: flex; flex-wrap: wrap; gap: 6px; }
.streak-miles span { padding: 3px 10px; border-radius: 999px; background: var(--field); color: var(--muted); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.streak-miles span::after { content: ' ngày'; font-weight: 600; }
.streak-miles span.is-done { background: #FFEBD6; color: #A14400; }
.streak-remind { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.streak-remind input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--jade); flex: none; }

/* Chúc mừng mốc */
.streak-cheer { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 0; }
.streak-cheer h3 { font-size: 19px; font-weight: 800; }
.streak-cheer-flame { position: relative; width: 120px; height: 120px; display: grid; place-items: center; animation: streak-pop .7s cubic-bezier(.2, 1.6, .5, 1); }
.streak-cheer-flame .streak-flame { width: 120px; height: 120px; filter: drop-shadow(0 8px 18px rgba(255, 116, 23, .45)); animation: streak-flicker 2.2s ease-in-out .7s infinite; transform-origin: 50% 90%; }
.streak-cheer-flame strong { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 3px rgba(120, 40, 0, .55); }
@keyframes streak-pop { from { transform: scale(.2) rotate(-12deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .streak-hero.is-lit .streak-hero-flame .streak-flame, .streak-cheer-flame, .streak-cheer-flame .streak-flame { animation: none; }
}

/* Đóng băng chuỗi */
.streak-ice { width: 1em; height: 1em; flex: none; fill: none; stroke: #3A9BDC; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.streak-week li.is-frozen .streak-dot { background: #DDF1FF; }
.streak-dot .streak-ice { width: 14px; height: 14px; }
.streak-week.is-small .streak-dot .streak-ice { width: 11px; height: 11px; }
.streak-hero-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.streak-hero-head h3 { flex: 1; min-width: 0; }
.streak-freeze-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px 2px 6px; border-radius: 999px; flex: none;
  background: #DDF1FF; color: #1D5F8C; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.streak-freeze-pill .streak-ice { width: 14px; height: 14px; }
.streak-freeze-pill.is-empty { background: var(--field); color: var(--muted); }
.streak-freeze-pill.is-empty .streak-ice { stroke: var(--muted); }
.streak-freeze { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: #EEF8FF; }
.streak-freeze b { font-size: 15px; color: #164C70; }
.streak-freeze .streak-note { margin-top: 2px; }
.streak-freeze-icons { display: flex; gap: 4px; flex: none; padding-top: 2px; }
.streak-freeze-icons span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(58, 155, 220, .12); }
.streak-freeze-icons span .streak-ice { width: 20px; height: 20px; stroke: #9DB5C6; }
.streak-freeze-icons span.is-have { background: #CDEBFF; }
.streak-freeze-icons span.is-have .streak-ice { stroke: #2286CC; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .streak-week li.is-frozen .streak-dot { background: #16344A; }
  :root:not([data-theme="light"]) .streak-freeze-pill:not(.is-empty) { background: #16344A; color: #9FD6FF; }
  :root:not([data-theme="light"]) .streak-freeze { background: #10273A; }
  :root:not([data-theme="light"]) .streak-freeze b { color: #BFE3FF; }
  :root:not([data-theme="light"]) .streak-freeze-icons span.is-have { background: #1C4766; }
  :root:not([data-theme="light"]) .streak-dot .streak-ice, :root:not([data-theme="light"]) .streak-freeze-pill:not(.is-empty) .streak-ice, :root:not([data-theme="light"]) .streak-freeze-icons .is-have .streak-ice { stroke: #6CC0FF; }
  :root:not([data-theme="light"]) .streak-freeze-icons span:not(.is-have) .streak-ice { stroke: #4E6576; }
}
:root[data-theme="dark"] .streak-week li.is-frozen .streak-dot { background: #16344A; }
:root[data-theme="dark"] .streak-freeze-pill:not(.is-empty) { background: #16344A; color: #9FD6FF; }
:root[data-theme="dark"] .streak-freeze { background: #10273A; }
:root[data-theme="dark"] .streak-freeze b { color: #BFE3FF; }
:root[data-theme="dark"] .streak-freeze-icons span.is-have { background: #1C4766; }
:root[data-theme="dark"] .streak-dot .streak-ice, :root[data-theme="dark"] .streak-freeze-pill:not(.is-empty) .streak-ice, :root[data-theme="dark"] .streak-freeze-icons .is-have .streak-ice { stroke: #6CC0FF; }
:root[data-theme="dark"] .streak-freeze-icons span:not(.is-have) .streak-ice { stroke: #4E6576; }
