:root {
  --bg-page: #eef6fc;
  --card-bg: #ffffff;
  --card-border: #dbeafe;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-soft: #bfdbfe;
  --pink: #ec4899;
  --pink-soft: #fce7f3;
  --shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
  --row-back: #f472b6;
  --row-front: #3b82f6;
}

html.dark {
  --bg-page: #0b1430;
  --card-bg: #131c3d;
  --card-border: #2b3a66;
  --text: #e7edf9;
  --muted: #93a3c4;
  --accent: #60a5fa;
  --accent-soft: #1e3a6e;
  --pink: #f472b6;
  --pink-soft: #3a1f3a;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Anuphan", "Segoe UI", "Noto Sans Thai", "Tahoma", sans-serif;
  background-color: var(--bg-page);
  /* Layers, front to back: readability wash, ฮายอนคอส on the right (same
     zoomed/top-anchored framing slot เบลลิกา used before), ไอลีน on the
     left at full opacity (same slot ฮายอน used before), bg_mix at the back
     (bg_sky with only newbg's fine detail -- high-pass, added on top -- so
     it keeps bg_sky's darkness plus newbg's magic circle/stars).
     See git history on this rule (previously Pic BG1/BG2, then wider
     multi-character versions with นาจา/เซอิน/น็อกซ์, then โอยอง-scene, then
     a faded โอยอง, then โอยอง + โดยอง-Summer-flip, then โอม๊ก + ยุนกอน, then
     เบลลิกา + ฮายอน over bg_sky) if this ever needs revisiting. */
  background-image: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.72),
      rgba(238, 246, 252, 0.8)
    ),
    url("../public/bg/ฮายอนคอส.webp"),
    url("../public/bg/ไอลีน.webp"),
    url("../public/bg/bg_mix.webp");
  background-size: cover, auto 155vh, auto 160vh, cover;
  background-position:
    top center,
    right -28vw top -27vh,
    left -35vw top -28vh,
    top center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-attachment: fixed, fixed, fixed, fixed;
  color: var(--text);
  min-height: 100vh;
  transition: background-color 0.2s, color 0.2s;
}

html.dark body {
  background-image: linear-gradient(
      to bottom,
      rgba(11, 20, 48, 0.55),
      rgba(11, 20, 48, 0.85)
    ),
    url("../public/bg/ฮายอนคอส.webp"),
    url("../public/bg/ไอลีน.webp"),
    url("../public/bg/bg_mix.webp");
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* ── Site-wide scrollbar + <select> polish ────────────────────────────────
   Lives up here (before any page-specific stylesheet) on purpose: every rule
   below is either low-specificity or scoped so a page's own .field select /
   .hero-filter-select / etc. can still override colors, padding and size —
   these only supply what nobody had styled before (scrollbar look, the
   dropdown arrow, dark-mode native popups). */
html { color-scheme: light; }
html.dark { color-scheme: dark; } /* dark native <option> popup, date pickers, etc. */

:root {
  --scroll-thumb: rgba(100, 116, 139, 0.45);
  --scroll-thumb-hover: rgba(59, 130, 246, 0.7);
}
html.dark {
  --scroll-thumb: rgba(147, 163, 196, 0.35);
  --scroll-thumb-hover: rgba(96, 165, 250, 0.7);
}

/* Chrome/Edge/Safari: slim rounded thumb floating in a transparent track
   (the transparent border + background-clip inset is what gives the thumb its
   breathing room). Applies to the page's own scrollbar too. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--scroll-thumb-hover);
  border-width: 2px;
}
::-webkit-scrollbar-corner { background: transparent; }
/* Firefox has no ::-webkit-scrollbar — the standard properties are its only
   hook. Gated so Chrome (which would prefer these over the rules above and
   drop the rounded look) never sees them. */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) transparent;
  }
}

/* Base look for a bare <select> (e.g. counter.html's copy-guild picker) —
   page-specific rules like .field select come later/higher and win. */
select {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  background-color: var(--card-bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* Custom chevron for every single-choice dropdown. :not([multiple]):not([size])
   deliberately out-specifies the page-specific `background:` shorthands, which
   would otherwise reset the image and bring the native arrow back. Only the
   arrow-related longhands are set here — the colors stay each page's own. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
}
html.dark select:not([multiple]):not([size]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2393a3c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
}
select:hover { border-color: var(--accent); }
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select option {
  background: var(--card-bg);
  color: var(--text);
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 20px 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* "กำลังโหลด.../กำลังตรวจสอบสิทธิ์..." status text shown while a page's
   initial fetch is in flight — every page that has one (castle.html,
   teams.html, hero-tier-list.html, draft-teams.html, counter.html,
   ranking.html, tools.html, ...) marks it with this same class. A handful
   of those pages' own CSS also touches .home-status for a page-specific
   padding/color tweak (e.g. css/castle.css) — those load after this file
   so they still win on the properties they set, they just no longer need
   to (and don't have to) redeclare the spinner. Pure-CSS ring via ::before
   so no page's markup has to change to get it. */
.home-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 70px 0;
}

.home-status::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; /* @keyframes spin — shared with .spin-icon further down */
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 16px;
}

@media (max-width: 700px) {
  .site-header {
    flex-wrap: wrap;
    row-gap: 8px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  height: 44px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

@media (max-width: 480px) {
  .brand img { height: 34px; }
  .brand-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46vw;
  }
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-display-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  margin-right: 2px;
}

.user-rank-badge {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.user-points-text {
  color: var(--accent);
  font-weight: 800;
}

/* T-coin balance — same weight as points, distinct gold tone so the two
   currencies never get mistaken for each other at a glance. */
.user-tcoin-text {
  color: #eab308;
  font-weight: 800;
}

.icon-btn {
  position: relative; /* positioning context for .icon-btn-dot below */
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  box-shadow: var(--shadow);
}

/* Hamburger "switch page" menu, top-left next to the logo, on the 4
   per-guild pages (hero-tier-list, castle, draft-teams, teams) — see
   js/guild-nav.js's GuildNav.render(). */
.guild-nav {
  position: relative;
}

.guild-nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; /* opens rightward from the button, which sits at the header's left edge */
  min-width: 190px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 200;
}

.guild-nav-menu.open {
  display: block;
}

.guild-nav-item {
  display: block;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.guild-nav-item:hover {
  background: var(--bg-page);
}

/* Separates the guild-switch links (PAGES) from the account-level ones
   (UTILITY_PAGES: ranking, T-coin shop). */
.guild-nav-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--card-border);
}

.guild-nav-item.active {
  color: var(--accent);
  background: var(--bg-page);
}

/* Unread-achievement signal on #rankingBtn (js/mascot.js's
   updateRankingBtnDot) — "you unlocked something, go take a look" nudge
   that outlives the celebratory center-screen popup (css/mascot.css's
   .achv-unlock-overlay), which only shows once and is easy to miss/close
   without really registering. Clears once ranking.html's own trophy
   section is actually opened (Auth.markAchievementsViewed), same "viewed"
   cursor that also drives ranking.css's .my-achv-dot. */
.icon-btn-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg-page);
}

.icon-btn-dot.show {
  display: block;
}

.icon-btn:hover {
  border-color: var(--accent);
}

.icon-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Owner-tools dropdown (index.html's 🗂️, js/home.js's
   initOwnerToolsDropdown) — same open/close mechanics as .guild-nav above,
   just anchored right (right: 0, not left: 0) since this button sits at the
   header's right edge, and opening leftward like .guild-nav-menu would push
   the panel off-screen. */
.icon-dropdown {
  position: relative;
  display: flex;
}

.icon-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 200;
}

.icon-dropdown.open .icon-dropdown-menu {
  display: block;
}

.icon-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.icon-dropdown-menu a:hover {
  background: var(--bg-page);
}

/* Update notification banner (new data from admin) */
.update-notif-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #065f46;
  border-bottom: 2px solid #059669;
  padding: 10px 16px;
  font-size: 14px;
  color: #ecfdf5;
  position: sticky;
  top: 0;
  z-index: 200;
  animation: notif-fadein 0.4s ease;
}
@keyframes notif-fadein {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.update-notif-btn {
  margin-left: 4px;
  padding: 4px 14px;
  border-radius: 6px;
  border: 1.5px solid #34d399;
  background: #059669;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.update-notif-btn:hover {
  background: #047857;
}
.update-notif-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #6ee7b7;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

/* Update banner */
.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #eff6ff;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #1e3a5f;
  font-weight: 500;
}

[data-theme="dark"] .update-banner {
  background: #0f1f3d;
  border-color: #60a5fa;
  color: #bfdbfe;
}

.update-banner .banner-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.update-banner b {
  margin-right: 2px;
}

.update-banner a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.update-banner .close-banner {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}

.search-bar .search-icon {
  color: var(--muted);
}

/* Main tabs — ทีมบุก / ทีมป้องกัน */
.main-tabs {
  display: flex;
  border-bottom: 2px solid var(--card-border);
  margin-bottom: 20px;
  gap: 0;
}

.main-tab-btn {
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}

@media (max-width: 480px) {
  .main-tab-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
}

.main-tab-btn:hover:not(.active) {
  color: var(--text);
}

.main-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Filters */
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.filter-row .filter-label {
  font-weight: 700;
  font-size: 14px;
}

.filter-row .filter-count {
  font-size: 13px;
  color: var(--muted);
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pill {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

.pill.active {
  background: var(--text);
  color: var(--bg-page);
  border-color: var(--text);
}

.pill[data-cat="tank"].active { background: #94a3b8; border-color: #94a3b8; color: #fff; }
.pill[data-cat="magic"].active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.pill[data-cat="physical"].active { background: #ef4444; border-color: #ef4444; color: #fff; }
.pill[data-cat="other"].active { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }

.pill-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--card-border);
  margin: 0 4px;
  vertical-align: middle;
}

.guild-filter-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.pill-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.pill-guild-legends { color: #9333ea; border-color: rgba(147, 51, 234, 0.35); }
.pill-guild-legends.active {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: transparent;
  color: #fff;
}

.pill-guild-iconyx { color: #0891b2; border-color: rgba(8, 145, 178, 0.35); }
.pill-guild-iconyx.active {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  border-color: transparent;
  color: #fff;
}

/* Card grid. 2 columns by default - the formation slots are now big enough
   that 3 columns would force them to wrap awkwardly inside each card. */
.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 700px) {
  .team-grid { grid-template-columns: 1fr; }
}

.team-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.team-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.22);
}

.team-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 0;
}

.badge-need {
  background: var(--pink-soft);
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.counter-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-guild {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #fff;
}

.badge-guild-legends {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 1px 6px rgba(124, 58, 237, 0.45);
}

.badge-guild-iconyx {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  box-shadow: 0 1px 6px rgba(8, 145, 178, 0.45);
}

/* Enemy's guild name on a report-tab card — arbitrary free text, so it can't
   map to the fixed badge-guild-legends/iconyx palette. Styled distinctly to
   read as "their guild" rather than one of ours. */
.badge-enemy-guild {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
  background: linear-gradient(135deg, #ec4899, #db2777);
  box-shadow: 0 1px 6px rgba(219, 39, 119, 0.45);
}

.badge-developer {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #1a1200;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 1px 6px rgba(245, 158, 11, 0.45);
}

.team-card-body {
  display: flex;
  padding: 12px 14px;
  gap: 10px;
}

.badge-cat {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}
.badge-cat-physical { color: #f87171; border-color: rgba(248,113,113,0.5); background: rgba(248,113,113,0.1); }
.badge-cat-tank     { color: #94a3b8; border-color: rgba(148,163,184,0.5); background: rgba(148,163,184,0.1); }
.badge-cat-magic    { color: #60a5fa; border-color: rgba(96,165,250,0.5);  background: rgba(96,165,250,0.1);  }
.badge-cat-other    { color: #a78bfa; border-color: rgba(167,139,250,0.5); background: rgba(167,139,250,0.1); }

.cat-bg {
  border-radius: 10px;
  border: 2px solid transparent;
  margin: 0 10px 10px;
  padding: 10px;
}
.cat-bg-physical {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.07);
}
.cat-bg-tank {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(148, 163, 184, 0.07);
}
.cat-bg-magic {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.07);
}
.cat-bg-other {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.07);
}

.enemy-name {
  font-size: 13px;
  font-weight: 700;
  padding: 0 14px 8px;
  color: var(--text);
  overflow-wrap: break-word;
}

/* Report-tab card: the enemy character's name is the whole point of the
   card, so give it more weight/size than the attack/defense cards where
   the name is secondary to the formation preview. */
.enemy-name-report {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 16px;
  font-weight: 800;
  color: var(--pink);
  overflow-wrap: break-word;
}

.enemy-name-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.enemy-preview {
  flex: 1;
}

.enemy-preview .formation-fill-count {
  display: none;
}

.card-footer {
  border-top: 1px solid var(--card-border);
  padding: 8px 14px;
  text-align: right;
}

.view-more-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.counters-panel {
  border-top: 1px solid var(--card-border);
  padding: 12px 14px;
  background: var(--bg-page);
  display: none;
}

.counters-panel.open {
  display: block;
}

.counter-item {
  margin-bottom: 14px;
}

.counter-item:last-child {
  margin-bottom: 0;
}

.counter-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* Formation grid (shared by card preview detail + editor): back row on top,
   front row below, both using equal-size slots and centered on each other -
   matches the small pattern-icon artwork exactly. */
.formation-grid {
  --slot-size: 92px;
  --slot-gap: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

@media (max-width: 480px) {
  /* Homepage list cards use the base 92px slot size unscaled (unlike the
     detail/popup contexts, which already shrink it) — too wide for a
     single-column phone card, so scale it down here only. */
  .team-card .formation-grid {
    --slot-size: 64px;
    --slot-gap: 6px;
  }
  /* Same problem in the admin editor's own formation grid (enemy + counter
     cards) — the editable 92px slot doesn't fit a phone-width panel. */
  #adminView .formation-grid {
    --slot-size: 60px;
    --slot-gap: 6px;
  }
}

.formation-row {
  display: flex;
  justify-content: center;
  gap: var(--slot-gap);
  flex-wrap: wrap;
}

/* Each slot + its dots column sit side-by-side */
.formation-slot-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 3 dots stacked vertically beside the hero card (A top, U mid, L bottom) */
.slot-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.slot-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #4b5563;
  background: transparent;
  color: #6b7280;
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
  user-select: none;
}
.slot-dot.dot-inactive:hover {
  border-color: #93c5fd;
  color: #93c5fd;
}
.slot-dot.dot-selected { color: #fff; }
.slot-dot.dot-order-1 { background: #ef4444; border-color: #ef4444; }
.slot-dot.dot-order-2 { background: #f97316; border-color: #f97316; }
.slot-dot.dot-order-3 { background: #eab308; border-color: #eab308; color: #000; }
.slot-dot.dot-greyed {
  border-color: #374151;
  color: #374151;
  cursor: pointer;
}
.slot-dot.dot-greyed:hover {
  border-color: #6b7280;
  color: #6b7280;
}
/* Read-only dots (span, not button) */
span.slot-dot { cursor: default; pointer-events: none; }
span.slot-dot.dot-greyed { cursor: default; }
span.slot-dot.dot-greyed:hover { border-color: #374151; color: #374151; }

.formation-fill-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.formation-slot {
  position: relative;
  width: var(--slot-size);
  height: var(--slot-size);
  border-radius: 15px;
  border: 2px dashed var(--card-border);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.formation-slot.filled {
  border-style: solid;
  border-color: var(--accent);
}

.formation-slot .slot-row-dot {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.formation-slot .slot-row-dot.back { background: var(--row-back); }
.formation-slot .slot-row-dot.front { background: var(--row-front); }

.formation-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.formation-slot .slot-num {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 5px;
  padding: 0 4px;
  z-index: 2;
}

.formation-slot .slot-plus {
  color: var(--muted);
  font-size: 24px;
}

.formation-slot .slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
}

@media (max-width: 700px) {
  /* These small remove/reorder/order-dot buttons (16-24px) are too small to
     tap reliably on a phone. Expand the tappable area via an invisible
     ::after overlay instead of the visible size, so the icons themselves
     (and desktop, outside this media query) don't change. .slot-remove/
     .pet-slot-remove/.gear-slot-remove are already position:absolute
     (needed for their top/right placement) so only the ::after is added
     for those; .slot-dot/.btn-reorder aren't positioned yet and need
     position:relative first to anchor the overlay. */
  .slot-dot,
  .btn-reorder {
    position: relative;
  }
  .formation-slot .slot-remove::after,
  .pet-slot-remove::after,
  .gear-slot-remove::after,
  .slot-dot::after,
  .btn-reorder::after {
    content: "";
    position: absolute;
    inset: -8px;
  }
}

.formation-grid.editable .formation-slot {
  cursor: pointer;
}

.formation-grid.editable .formation-slot.filled {
  cursor: grab;
}

.formation-grid.editable .formation-slot.dragover {
  border-color: var(--pink);
  background: var(--pink-soft);
}

.formation-grid.editable .formation-slot.picked {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}

/* Read-only grids (homepage): thin dashed border on all slots; hide the "+"
   placeholder since these are just display-only formation diagrams. */
.formation-grid:not(.editable) .formation-slot {
  border-width: 1px;
  border-style: dashed;
  border-color: var(--card-border);
}

.formation-grid:not(.editable) .formation-slot.filled {
  border-color: var(--accent);
}

.formation-grid:not(.editable) .slot-plus {
  display: none;
}

.formation-grid:not(.editable) .formation-slot.empty .slot-row-dot {
  background: var(--muted);
}

/* Pattern picker */
.pattern-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 700px) {
  .pattern-choices { grid-template-columns: repeat(2, 1fr); }
}

.pattern-choice {
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
}

.pattern-choice.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pattern-choice .pattern-label {
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
}

.pattern-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.pattern-row {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.pattern-pip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
}

.pattern-back .pattern-pip { background: var(--row-back); opacity: 0.85; }
.pattern-front .pattern-pip { background: var(--row-front); }

/* Admin / editor */
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .admin-bar .btn {
    padding: 7px 10px;
    font-size: 12px;
  }
}

.admin-title {
  font-size: 20px;
  font-weight: 800;
}

.btn {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--card-border);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.btn-publish {
  background: #059669;
  border-color: #059669;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.btn-publish:hover:not(:disabled) {
  background: #047857;
  border-color: #047857;
}
.btn-publish.btn-publishing {
  background: #6b7280;
  border-color: #6b7280;
  cursor: wait;
}
.btn-publish.btn-published {
  background: #0ea5e9;
  border-color: #0ea5e9;
}
.spin-icon {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon-danger {
  color: #ef4444;
  border-color: #ef4444;
}

.btn-icon-danger:hover {
  background: #ef4444;
  color: #fff;
}

/* js/counter.js's "ยืนยันว่าทีมนี้ใช้งานได้จริง" button (only shown on a
   .badge-fromdraft counter) — same treatment as .btn-icon-danger, just
   matching .badge-fromdraft's blue instead of red. */
.btn-icon-confirm-draft {
  color: #2563eb;
  border-color: #2563eb;
}

.btn-icon-confirm-draft:hover {
  background: #2563eb;
  color: #fff;
}

.btn-first-pick-active {
  color: #f5a623;
  border-color: #f5a623;
  background: rgba(245, 166, 35, 0.14);
}

.btn-first-pick-active:hover {
  background: rgba(245, 166, 35, 0.24);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-team-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
}

@media (max-width: 700px) {
  .admin-team-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .admin-team-row .name {
    flex-basis: 100%;
  }
}

.admin-team-row .name {
  font-weight: 700;
  flex: 1;
}

.admin-team-row.row-hidden {
  opacity: 0.45;
}

.btn-eye { color: var(--muted); }
.btn-eye-off { color: var(--accent); opacity: 1 !important; }

.admin-team-row.row-locked .btn-icon:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.drag-handle {
  color: var(--muted);
  cursor: grab;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 4px;
  opacity: 0.35;
  transition: opacity 0.15s;
}
.drag-handle:hover { opacity: 1; }

.admin-team-row.dragging {
  opacity: 0.35;
  border-style: dashed;
}

.admin-team-row.drag-over-top {
  border-top: 2px solid var(--accent);
  box-shadow: 0 -2px 0 var(--accent);
}

.admin-team-row.drag-over-bottom {
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 0 var(--accent);
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.btn-reorder {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

.btn-reorder:not(:disabled):hover {
  opacity: 1;
}

.btn-reorder:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.editor-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  margin-top: 16px;
}

.palette-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--card-bg);
  border-top: 2px solid var(--card-border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.30);
  padding: 0 24px 18px;
  max-height: 350px;
  overflow-y: auto;
}

/* #adminView's bottom padding reserves room above the fixed-position dock
   so its content isn't hidden behind it — set via class (toggled in
   js/editor.js) rather than inline style, so the mobile breakpoint below
   can retarget the value to match the smaller mobile dock max-height. */
#adminView.dock-open { padding-bottom: 370px; }
#adminView.dock-collapsed { padding-bottom: 56px; }

@media (max-width: 700px) {
  .palette-dock { max-height: 260px; padding: 0 12px 14px; }
  #adminView.dock-open { padding-bottom: 280px; }
}

.palette-dock::before { display: none; }

.palette-dock-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 8px;
  position: sticky;
  top: 0;
  background: var(--card-bg);
  z-index: 1;
}

.palette-dock-title { display: none; }

.palette-dock-toggle {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 0;
  width: min(240px, 50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: background 0.15s, border-color 0.15s;
}
.palette-dock-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }
.palette-dock-toggle svg {
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}
.palette-dock.collapsed .palette-dock-toggle svg { transform: rotate(0deg); }
.palette-dock.collapsed .palette-dock-body { display: none; }
.palette-dock.collapsed { max-height: none; overflow: visible; }

/* Inside dock: hide the section title and verbose hint */
.palette-dock .editor-section-title { display: none; }
.palette-dock .hint { display: none; }

/* Inside dock: grid is borderless and transparent — dock bg is the container */
.palette-dock .hero-grid {
  border: none;
  background: transparent;
  padding: 2px 0;
  max-height: none;
  gap: 8px;
}

/* Tighten up search and tabs spacing inside dock */
.palette-dock .hero-search {
  margin-bottom: 8px;
}

.palette-dock .palette-tabs {
  margin-bottom: 8px;
}

/* Pin the sub-tab bar + search box + filter pills as one block under the
   dock header while scrolling the item grid, so switching item / typing a
   search / picking a filter doesn't require scrolling back up first. A
   single sticky wrapper (rather than stacking sticky offsets on each row)
   keeps this correct regardless of how many filter rows a given sub-tab
   renders. top: 45px matches the dock header's rendered height.  */
.palette-dock .palette-sticky-controls {
  position: sticky;
  top: 45px;
  z-index: 2;
  background: var(--card-bg);
  padding-bottom: 6px;
}

.editor-section-title {
  font-weight: 800;
  font-size: 15px;
  margin: 18px 0 10px;
}

.editor-section-title:first-child {
  margin-top: 0;
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.field {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field select {
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: var(--bg-page);
  color: var(--text);
}

.hero-palette {
  margin-top: 10px;
}

.hero-search {
  width: 100%;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: var(--bg-page);
  color: var(--text);
  font-size: 13px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: var(--bg-page);
}

.hero-chip {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: grab;
  border-radius: 8px;
  padding: 4px;
}

.hero-chip.selected {
  background: var(--accent-soft);
}

.hero-chip img {
  width: 60px;
  height: 60px;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid var(--card-border);
}

/* Collab heroes (Demon Slayer: ทันจิโร่ / เซนอิทซึ / ชิโนบุ / กิยู Awake) carry a small red 滅
   seal top-left on their portrait in every คลัง chip. Keyed off the portrait
   file so no renderer needs touching; stays after the collab ends since it
   marks the hero, not the event. Top-left because the game art already has
   the Awake star top-right and the element badge bottom-left. */
.hero-chip:has(> img[src$="/ทันจิโร่ Awake.webp"], > img[src$="/เซนอิทซึ Awake.webp"], > img[src$="/ชิโนบุ Awake.webp"], > img[src$="/กิยู Awake.webp"]) { position: relative; }
.hero-chip:has(> img[src$="/ทันจิโร่ Awake.webp"], > img[src$="/เซนอิทซึ Awake.webp"], > img[src$="/ชิโนบุ Awake.webp"], > img[src$="/กิยู Awake.webp"])::before {
  content: '滅'; position: absolute; z-index: 2; top: 7px; left: calc(50% - 27px);
  display: grid; place-items: center; width: 16px; height: 16px;
  border-radius: 4px; background: #c41e3a; color: #fff; pointer-events: none;
  font: 700 11px/1 'Yu Mincho', 'Hiragino Mincho ProN', 'Noto Serif JP', serif;
  box-shadow: 0 0 0 1px rgba(255, 220, 200, .35), 0 2px 5px rgba(0, 0, 0, .45);
  transform: rotate(-8deg);
}

.hero-chip span {
  font-size: 10px;
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Tier filter pills inside palette */
.hero-search-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.hero-search-row .hero-search {
  flex: 0 0 auto;
  width: min(500px, 45%);
  min-width: 140px;
  margin-bottom: 0;
}
.hero-filter-select {
  flex: 0 0 auto;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-page);
  color: var(--text);
  cursor: pointer;
}

/* Element filter — tap-to-toggle icon buttons (castle.html + counter.html's
   คลัง), replacing the old tier + element <select> dropdowns. Tapping the
   already-active icon clears back to "all elements". */
.hero-element-filter-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.hero-element-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 4px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-page);
  cursor: pointer;
}
.hero-element-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.hero-element-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Palette tier headers */
.palette-tier-header {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 8px 4px;
  margin-top: 6px;
  border-radius: 6px;
}
/* Per-guild overlay from hero-tier-list.html, not a static roster tier —
   see js/heroes-data.js's heroEffectiveTier(). Deliberately louder than the
   others (solid fill, not a translucent tint) so it reads as "promoted". */
.palette-tier-0 { color: #fff; background: linear-gradient(135deg, #fb923c, #dc2626); }
.palette-tier-1 { color: #f5a623; background: rgba(245,166,35,0.12); }
.palette-tier-2 { color: #e879f9; background: rgba(232,121,249,0.12); }
.palette-tier-3 { color: #a78bfa; background: rgba(167,139,250,0.12); }
.palette-tier-4 { color: #818cf8; background: rgba(129,140,248,0.12); }
.palette-tier-5 { color: #f87171; background: rgba(248,113,113,0.12); }
.palette-tier-6 { color: #60a5fa; background: rgba(96,165,250,0.12); }

.counters-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.counter-editor-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-page);
}

.counter-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 700px) {
  .counter-editor-head { flex-wrap: wrap; row-gap: 6px; }
}

.counter-card-body {
  margin-top: 10px;
}

.counter-editor-head b {
  font-size: 13px;
}

/* Formation area: formation grid + pet slots — centered horizontally */
.counter-formation-area {
  display: flex;
  gap: 80px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .counter-formation-area { gap: 20px; }
}

/* Pet slots panel (right of formation grid) */
.pet-slots-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pet-slots-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

/* Slot 1 (large) stacked above 4 small slots (2×2) */
.pet-slots-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.pet-slots-sub {
  display: grid;
  grid-template-columns: repeat(2, 52px);
  gap: 8px;
}

/* Base pet slot — size set by .main / .sub modifier */
.pet-slot {
  position: relative;
  border-radius: 10px;
  border: 2px dashed var(--card-border);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
}

/* Large slot reduced slightly; sub slots enlarged for easier drag targets */
.pet-slot.main {
  width: 76px;
  height: 76px;
}

.pet-slot.sub {
  width: 52px;
  height: 52px;
  border-radius: 9px;
}

.pet-slot.filled {
  border-style: solid;
  border-color: var(--accent);
}

.pet-slot.dragover {
  border-color: var(--pink);
  background: var(--pink-soft);
}

.pet-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-slot .slot-plus {
  color: var(--muted);
  font-size: 20px;
}

.pet-slot.sub .slot-plus {
  font-size: 13px;
}

.pet-slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-slot.sub .pet-slot-remove {
  width: 16px;
  height: 16px;
  font-size: 11px;
  top: 2px;
  right: 2px;
}

/* Read-only pet slots (homepage) — identical styling to edit mode, no pointer */
.pet-slot.readonly {
  cursor: default;
}

/* Hero gear section — appears below formation when heroes are placed */
.hero-gear-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hero-gear-block {
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}

.hero-gear-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.hero-gear-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 700px) {
  .hero-gear-row { flex-wrap: wrap; }
  .hero-gear-row .hero-gear-note { flex: unset; width: 100%; }
}

.hero-gear-left {
  flex: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.hero-gear-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 72px;
  align-self: center;
}

.hero-gear-portrait img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.hero-gear-portrait span {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Speed-order row — heading (reuses .detail-note-tag, same blue as
   สรุปรายละเอียดทีม/แบบย่อ) with the 3 hero portraits in fastest-to-slowest
   order on the line below, joined by arrows. Only rendered once all 3
   heroes have a parseable ความเร็ว value (see computeSpeedBadges/
   renderSpeedOrderRow in counter.js); an empty string from that function
   collapses this row to nothing, so no extra spacing shows up when it's
   not applicable. */
.speed-order-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}

.speed-order-items {
  display: flex;
  align-items: center;
  gap: 4px;
}

.speed-order-item img {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.speed-order-arrow {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.hero-gear-slots {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gear-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gear-type-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 58px;
  flex-shrink: 0;
}

.gear-slots-grid {
  display: flex;
  gap: 6px;
}

.gear-slot {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 2px dashed var(--card-border);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  flex: 0 0 auto;
}

.gear-slot.filled {
  border-style: solid;
  border-color: var(--accent);
}

.gear-slot.dragover {
  border-color: var(--pink);
  background: var(--pink-soft);
}

.gear-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gear-slot .slot-plus {
  color: var(--muted);
  font-size: 18px;
}

.gear-slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Stacked ring pair: main (back-left) + overlay (front-right) */
.ring-slot-pair {
  position: relative;
  width: 68px;
  height: 60px;
  flex-shrink: 0;
}

.ring-slot-pair .gear-slot {
  position: absolute;
  width: 46px;
  height: 46px;
}

.ring-slot-pair .gear-slot:not(.ring-overlay-slot) {
  bottom: 0;
  left: 0;
  z-index: 1;
}

.ring-slot-pair .gear-slot:not(.ring-overlay-slot) .gear-slot-remove {
  top: auto;
  bottom: 2px;
  right: auto;
  left: 2px;
}

.ring-slot-pair .ring-overlay-slot {
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  z-index: 2;
  border-radius: 8px;
}

.ring-overlay-plus {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

/* dp-box ring pair sizing */
.dp-box .ring-slot-pair {
  width: 62px;
  height: 54px;
}
.dp-box .ring-slot-pair .gear-slot:not(.ring-overlay-slot) {
  width: 42px;
  height: 42px;
}
.dp-box .ring-slot-pair .ring-overlay-slot {
  width: 32px;
  height: 32px;
}

.hero-gear-note {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-gear-note label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.hero-gear-note textarea {
  flex: 1;
  min-height: 80px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--bg-page);
  color: var(--text);
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.hero-gear-note textarea[readonly] {
  cursor: default;
  opacity: 0.75;
}

.gear-confirm-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1px dashed var(--card-border);
}

/* Hero stats two-column grid below the gear row */
.hero-stats-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

@media (max-width: 700px) {
  .hero-stats-area { grid-template-columns: 1fr; }
}

.hero-stats-area .hero-stats-table:last-child {
  align-self: center;
}

.hero-stats-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-self: center;
}

.hero-stats-col .hero-stats-table {
  width: 100%;
  margin-top: 0;
}

.hero-stats-table {
  margin-top: 8px;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  overflow: hidden;
}

.hero-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--card-border);
}

.hero-stat-row:last-child {
  border-bottom: none;
}

.hero-stat-row:nth-child(odd) {
  background: var(--bg-page);
}

.hero-stat-row:nth-child(even) {
  background: var(--card-bg);
}

.hero-stat-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-stat-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* Popup: label shrinks to content so dp-stat-value can fill remaining space */
.dp-box .hero-stats-area .hero-stat-label {
  flex: 0 0 auto;
}

.hero-stat-input {
  flex: 0 0 130px;
  width: 130px;
  text-align: right;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-page);
  color: var(--text);
  font-family: inherit;
}

.hero-stat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.hero-stat-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

/* Palette hero/pet tab bar */
.palette-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 10px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}

.palette-tab {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: var(--bg-page);
  color: var(--muted);
  cursor: pointer;
}

.palette-tab.active {
  background: var(--accent);
  color: #fff;
}

.palette-tab:not(.active):hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* Active team row in admin list — highlights whichever team is open in the editor */
.admin-team-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Collapsible section header (enemy section title + chevron) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin: 18px 0 10px;
  padding: 4px 0;
  user-select: none;
}

.section-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.section-header:hover .section-chevron,
.counter-head-toggle:hover .section-chevron {
  background: var(--accent);
  color: #fff;
}

/* Counter card head: left side is clickable toggle, right side has the delete button */
.counter-head-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  padding: 2px 0;
  user-select: none;
}

.counter-head-toggle:hover b {
  color: var(--accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  width: 90%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--card-border);
  padding: 24px 0 32px;
}

/* ── Contact FAB ── */
.contact-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.30);
  z-index: 150;
  transition: transform 0.15s, box-shadow 0.15s;
}
.contact-fab:hover {
  transform: scale(1.10);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.40);
}

/* ── Contact modal ── */
.contact-modal-box {
  max-width: 420px;
  width: calc(100% - 32px);
}
.contact-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.contact-modal-title {
  font-size: 16px;
  font-weight: 800;
}
.contact-modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.contact-modal-box .field {
  margin-bottom: 12px;
}
.contact-modal-box textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
}

.site-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.site-footer-brand {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.site-footer-divider {
  width: 32px;
  height: 2px;
  background: linear-gradient(90deg, #0891b2, #a855f7);
  border-radius: 2px;
}

.site-footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.site-footer-dot {
  color: var(--card-border);
}

.site-footer-guild {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Same gradient-text treatment as .site-footer-guild (kept separate rather
   than repurposed, since index.html still uses that one for "ICONYX"), just
   เสือหนิก's orange from css/ranking.css's .badge-guild-suea-nik instead. */
.site-footer-guild-suea-nik {
  background: linear-gradient(135deg, #ea580c, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-footer-copy {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.6;
}

.site-build-time {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.45;
  margin-top: 2px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-page);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Daily-login "consistency challenge" card — pops up once per day when the
   T-coin daily claim actually fires (js/auth.js's showStreakCard), showing
   the reward just earned plus a 7-dot progress track for the login-streak
   milestone bonus (functions/ranking/claim-daily.js's STREAK_MILESTONE).
   Also the guild-war freeze notice (showTcoinFreezeNotice). Same black
   glass look on every page (new theme), with fixed colours rather than
   page tokens so old- and new-theme pages render it identically; icons are
   Lucide SVGs from js/auth.js's STREAK_ICONS. ?streakPreview shows a sample. */
/* Event popups (ทายฮีโร่ประจำวัน + the ค่ายตัดไม้ market) — js/auth.js
   showEventPopups. One <dialog> in the top layer holding a card per event:
   side by side on a wide screen, swiped one at a time on a phone. Self-
   contained colours like the streak card below so it looks the same on
   every page. */
.hq-pop {
  width: min(400px, calc(100vw - 32px)); max-width: none; max-height: none; padding: 0; overflow: visible;
  border: 0; background: none; color: #fafafa;
  font-family: 'Anuphan', 'Inter', system-ui, sans-serif;
  opacity: 0; scale: .9; translate: 0 18px;
  transition: opacity .28s ease-out, scale .45s cubic-bezier(.34, 1.4, .64, 1), translate .45s cubic-bezier(.23, 1, .32, 1), display .35s, overlay .35s;
  transition-behavior: allow-discrete;
}
.hq-pop[open] { opacity: 1; scale: 1; translate: 0 0; }
@starting-style { .hq-pop[open] { opacity: 0; scale: .9; translate: 0 18px; } }
/* No backdrop blur (2026-11-30): re-blurring the page every frame made the popup stutter; a darker dim instead */
.hq-pop::backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background .3s, display .3s, overlay .3s; transition-behavior: allow-discrete;
}
.hq-pop[open]::backdrop { background: rgba(0, 0, 0, .84); }
@starting-style { .hq-pop[open]::backdrop { background: rgba(0, 0, 0, 0); } }
.hq-pop:focus-visible { outline: none; }
/* The cards share one grid cell, so they stack into a deck. The position
   (data-pos, 0 = front) drives translate/rotate/scale; `transform` is kept
   free for the drag, the tuck to the back and the toss away. */
.hq-pop-track { display: grid; }
.hq-pop-card {
  grid-area: 1 / 1; position: relative; z-index: 1; box-sizing: border-box; padding: 26px 26px 24px; text-align: center;
  border: 1px solid rgba(250, 250, 250, .12); border-radius: 28px;
  background: radial-gradient(90% 60% at 50% 0%, #1d1a10, #070707);
  box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(234, 179, 8, .08);
  transform: translateX(calc(var(--drag, 0) * 1px)) rotate(calc(var(--drag, 0) * .06deg));
  transition: translate .55s cubic-bezier(.34, 1.45, .64, 1), rotate .55s cubic-bezier(.34, 1.45, .64, 1), scale .45s ease-out,
    filter .35s, transform .35s cubic-bezier(.34, 1.3, .64, 1), opacity .3s;
  /* dealt in one after another, dropping from above with a twist */
  animation: hq-pop-deal .65s calc(.12s + var(--deal, 0) * .16s) cubic-bezier(.34, 1.4, .64, 1) backwards;
}
@keyframes hq-pop-deal { from { opacity: 0; transform: translateY(-90px) rotate(-16deg) scale(.85); } }
.hq-pop-card[data-pos="0"] { z-index: 3; }
/* The deck's cards share one grid cell, so all grow to the tallest; the buttons
   stay at the bottom of each card instead of leaving a gap under them. */
.hq-pop-card { display: flex; flex-direction: column; }
.hq-pop-card > .hq-pop-kicker, .hq-pop-card > .lk-pop-todo { align-self: center; }
.hq-pop-card > .hq-pop-actions { margin-top: auto; }
.hq-pop.is-deck { width: min(400px, calc(100vw - 80px)); }
/* เรด + ลอยกระทง side by side in one deck slot (wide screens only, js/auth.js
   showEventPopups); the single cards keep their own width in the middle. */
.hq-pop.has-pair { width: min(1040px, calc(100vw - 80px)); }
.hq-pop.has-pair .hq-pop-track > .hq-pop-card:not(.hq-pop-pair) { justify-self: center; width: min(400px, 100%); }
.hq-pop.has-pair.is-deck .hq-pop-track > .hq-pop-card[data-pos="0"] { rotate: -1deg; }
.hq-pop.has-pair.is-deck .hq-pop-track > .hq-pop-card[data-pos="1"]:not(.hq-pop-pair) { translate: 0 -34px; }
.hq-pop.has-pair.is-deck .hq-pop-track > .hq-pop-card[data-pos="1"]:not(.hq-pop-pair):hover { translate: 0 -42px; }
/* the next pair waits behind, just its top edge showing */
.hq-pop.has-pair.is-deck .hq-pop-track > .hq-pop-pair[data-pos="1"] { translate: 0 -30px; rotate: 0deg; scale: .96; }
.hq-pop.has-pair.is-deck .hq-pop-track > .hq-pop-pair[data-pos="1"]:hover { translate: 0 -40px; }
/* A hand of 2-5 cards (js/auth.js layHand): all share one grid cell and lean
   apart from a point below the hand, like cards held in a fist. --off is the
   card's place from the middle (-2..2), --arc = off² drops the outer ones a
   little; the gap between cards (--spread) shrinks to fit the screen. The one
   in front (.is-front) stands up and bright, the rest tuck behind it, dimmed,
   stacked by distance (inline z-index). Tap one to bring it up. Dealt in, they
   fan out from the middle one after another. */
.hq-pop-card.hq-pop-pair {
  --cw: 380px; --spread: min(170px, calc((min(1040px, 100vw - 80px) - var(--cw)) / (var(--n, 2) - 1)));
  display: grid; justify-self: center; width: calc(var(--cw) + (var(--n, 2) - 1) * var(--spread)); max-width: 100%;
  gap: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible;
}
.hq-pop-pair > .hq-pop-card { grid-area: 1 / 1; justify-self: center; width: var(--cw); }
.hq-pop-pair > .hq-pop-card:not(.is-leaving) { transform: none; }
.hq-pop-pair > .hq-pop-card {
  --side: 0; transform-origin: 50% 160%;
  translate: calc(var(--off, 0) * var(--spread)) calc(14px + var(--arc, 0) * 6px);
  rotate: calc(var(--off, 0) * 5deg); scale: .93;
  animation: hq-pop-fan .7s calc(.16s + var(--deal, 0) * .16s + var(--i, 0) * .09s) cubic-bezier(.34, 1.35, .64, 1) backwards;
  transition: translate .5s cubic-bezier(.34, 1.4, .64, 1), rotate .5s cubic-bezier(.34, 1.4, .64, 1), scale .4s cubic-bezier(.34, 1.3, .64, 1), filter .3s, box-shadow .3s, opacity .3s;
}
.hq-pop-pair > .hq-pop-card:not(.is-front) { filter: brightness(.6) saturate(.85); cursor: pointer; }
.hq-pop-pair > .hq-pop-card:not(.is-front) > * { pointer-events: none; }
.hq-pop-pair > .hq-pop-card:not(.is-front):hover { filter: brightness(.8) saturate(.95); translate: calc(var(--off, 0) * var(--spread)) calc(var(--arc, 0) * 6px - 6px); }
.hq-pop-pair > .hq-pop-card.is-front { scale: 1; translate: calc(var(--off, 0) * var(--spread)) calc(var(--arc, 0) * 4px - 8px); rotate: calc(var(--off, 0) * 2.5deg);
  box-shadow: 0 50px 110px rgba(0, 0, 0, .8), 0 0 0 1px rgba(250, 250, 250, .06); }
@keyframes hq-pop-fan { from { opacity: 0; translate: 0 -40px; rotate: 0deg; scale: .85; } }
/* the one card left after the rest of its hand is tossed: back to straight */
.hq-pop-track > .hq-pop-card:not(.hq-pop-pair) { --side: 0; --off: 0; --arc: 0; }
@media (prefers-reduced-motion: reduce) { .hq-pop-pair > .hq-pop-card { animation: none; transition: none; } }
.hq-pop.is-deck .hq-pop-card[data-pos="0"] { rotate: -2.5deg; }
/* the card behind peeks out at the top right, dimmed; tapping it swaps */
.hq-pop.is-deck .hq-pop-card[data-pos="1"] { z-index: 2; translate: 34px -18px; rotate: 7deg; scale: .94; filter: brightness(.62) saturate(.85); cursor: pointer; }
.hq-pop.is-deck .hq-pop-card[data-pos="1"] > * { pointer-events: none; }
.hq-pop.is-deck .hq-pop-card[data-pos="1"]:hover { filter: brightness(.8) saturate(.95); translate: 40px -24px; }
.hq-pop.is-deck .hq-pop-card[data-pos="0"] { touch-action: pan-y; cursor: grab; }
.hq-pop-card.is-dragging { transition: none; cursor: grabbing; user-select: none; }
.hq-pop-card.is-tucking { transform: translateX(calc(var(--fly, -1) * 78%)) translateY(-10px) rotate(calc(var(--fly, -1) * 16deg)); transition: transform .24s ease-out; }
/* one card's ×/ไว้ทีหลัง tosses it off while the other comes forward */
.hq-pop-card.is-leaving {
  z-index: 4; pointer-events: none; opacity: 0; transform: translate(-120%, 60px) rotate(-32deg);
  transition: transform .5s cubic-bezier(.55, 0, .8, .4), opacity .45s .05s;
}
.hq-pop-next {
  display: flex; align-items: center; gap: 7px; margin: 20px auto 0; padding: 8px 15px; position: relative; z-index: 5;
  border-radius: 999px; border: 1px solid rgba(250, 250, 250, .18); background: rgba(24, 24, 24, .85); color: #d4d4d4;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s;
}
.hq-pop-next span { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #737373; }
.hq-pop-next b { color: #fafafa; }
.hq-pop-next svg { transition: rotate .45s cubic-bezier(.34, 1.56, .64, 1); }
.hq-pop-next:hover { background: #262626; color: #fafafa; }
.hq-pop-next:hover svg { rotate: -180deg; }
.hq-pop-next:focus-visible { outline: 2px solid #bef264; outline-offset: 3px; }
.hq-pop-close {
  position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border-radius: 50%; border: 1px solid rgba(250, 250, 250, .22); background: #1f1f1f; color: #fafafa; cursor: pointer;
  transition: background .2s, rotate .35s cubic-bezier(.34, 1.56, .64, 1);
}
.hq-pop-close svg { width: 15px; height: 15px; }
.hq-pop-close:hover { background: #333; rotate: 90deg; }
.hq-pop-close:focus-visible, .hq-pop-go:focus-visible, .hq-pop-later:focus-visible { outline: 2px solid #bef264; outline-offset: 3px; }
.hq-pop-kicker {
  display: inline-block; padding: 5px 13px; border-radius: 999px; border: 1px solid rgba(234, 179, 8, .45);
  background: rgba(234, 179, 8, .1); color: #eab308; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.hq-pop-art { position: relative; width: 168px; margin: 22px auto 18px; }
.hq-pop-halo { position: absolute; inset: -34px; border-radius: 50%; background: radial-gradient(circle, rgba(234, 179, 8, .26), transparent 68%); animation: hq-pop-pulse 2.6s ease-in-out infinite; }
@keyframes hq-pop-pulse { 50% { scale: 1.12; opacity: .6; } }
.hq-pop-frame {
  position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 24px; rotate: -4deg;
  border: 2px solid rgba(250, 250, 250, .9); background: #141414; box-shadow: 0 18px 40px rgba(0, 0, 0, .6);
}
.hq-pop[open] .hq-pop-frame { animation: hq-pop-drop .7s .12s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes hq-pop-drop { from { rotate: 9deg; scale: .7; opacity: 0; } }
.hq-pop-frame img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.hq-pop-frame b {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0, 0, 0, .65); border: 1px solid rgba(250, 250, 250, .3); color: #fafafa; font: 800 16px 'JetBrains Mono', monospace;
}
.hq-pop-coin {
  position: absolute; right: -26px; bottom: -10px; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; rotate: 10deg;
  background: #eab308; color: #0a0a0a; font: 900 17px 'Inter', sans-serif; letter-spacing: -.03em;
  border: 3px solid #070707; box-shadow: 0 8px 20px rgba(234, 179, 8, .35);
}
.hq-pop[open] .hq-pop-coin { animation: hq-pop-coin .6s .45s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes hq-pop-coin { from { scale: 0; rotate: -40deg; } }
.hq-pop-title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; color: #fafafa; }
.hq-pop-text { margin: 8px 0 22px; font-size: 14px; font-weight: 500; line-height: 1.7; color: #a3a3a3; }
.hq-pop-text b { color: #fafafa; font-weight: 700; }
.hq-pop-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hq-pop-go {
  position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 24px; border-radius: 999px; background: #fafafa; color: #0a0a0a; text-decoration: none;
  font-size: 15px; font-weight: 800; box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
  transition: transform .3s cubic-bezier(.23, 1, .32, 1);
}
.hq-pop-go::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .12), transparent); transform: translateX(-100%); animation: hq-pop-sweep 2.2s 1s infinite; }
@keyframes hq-pop-sweep { 60%, 100% { transform: translateX(100%); } }
/* shared-member-code visitors: the button logs in with Discord instead */
.hq-pop-go.discord { background: #5865f2; color: #fff; }
.hq-pop-go:hover { transform: scale(1.03); }
.hq-pop-go:active { transform: scale(.97); }
.hq-pop-go svg { transition: translate .3s cubic-bezier(.23, 1, .32, 1); }
.hq-pop-go:hover svg { translate: 4px 0; }
.hq-pop-later { padding: 10px 18px; border: 0; background: none; color: #a3a3a3; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 999px; transition: color .2s; }
.hq-pop-later:hover { color: #fafafa; }
/* a card's quieter "don't show again today", under ไว้ทีหลัง */
/* a checkbox: ticked = this card stays away until tomorrow, whichever button closes it */
.hq-pop-mute { display: flex; align-items: center; justify-content: center; gap: 7px; width: fit-content; margin: -6px auto 0; padding: 4px 10px; color: #737373; font-size: 12px; font-weight: 500; cursor: pointer; user-select: none; transition: color .2s; }
.hq-pop-mute:hover, .hq-pop-mute:has(input:checked) { color: #d4d4d4; }
.hq-pop-mute input { appearance: none; -webkit-appearance: none; display: grid; place-content: center; flex: none; width: 15px; height: 15px; margin: 0; border: 1px solid #525252; border-radius: 4px; background: transparent; cursor: pointer; transition: border-color .2s, background-color .2s; }
.hq-pop-mute input::before { content: ""; width: 8px; height: 8px; background: #0a0a0a; clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%); transform: scale(0); transition: transform .15s ease-out; }
.hq-pop-mute:hover input { border-color: #a3a3a3; }
.hq-pop-mute input:checked { border-color: #e5e5e5; background: #e5e5e5; }
.hq-pop-mute input:checked::before { transform: scale(1); }
.hq-pop-mute input:focus-visible { outline: 2px solid #bef264; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hq-pop-mute input, .hq-pop-mute input::before { transition: none; } }
/* The ค่ายตัดไม้ war-day market card (js/auth.js lumberCard): the same
   card in the yard's wood colour, with the merchant Droppy who is buying. */
.hq-pop-card.lm-pop { background: radial-gradient(90% 60% at 50% 0%, #21170d, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(211, 154, 91, .1); }
.lm-pop .hq-pop-kicker { border-color: rgba(211, 154, 91, .5); background: rgba(211, 154, 91, .12); color: #d39a5b; }
.lm-pop .hq-pop-halo { background: radial-gradient(circle, rgba(211, 154, 91, .3), transparent 68%); }
.lm-pop-frame { background: linear-gradient(to top, #2a1d12 0 20%, #15110d 20%) !important; }
/* กิลด์เรด card (js/auth.js raidCard): crimson, the member's own hero Droppy, a sword badge. */
.hq-pop-card.rd-pop { background: radial-gradient(90% 60% at 50% 0%, #2a0d14, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(244, 63, 94, .12); }
.rd-pop .hq-pop-kicker { border-color: rgba(244, 63, 94, .5); background: rgba(244, 63, 94, .12); color: #fb7185; }
.rd-pop .hq-pop-halo { background: radial-gradient(circle, rgba(244, 63, 94, .3), transparent 68%); }
/* no frame: the enraged boss stands on the card, shaking, steam drifting up */
.rd-pop-boss { position: relative; display: block; width: 210px; aspect-ratio: 1; margin: -18px -21px -20px; }
.rd-pop-boss svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, .55)); }
.hq-pop[open] .rd-pop-boss { animation: hq-pop-drop .7s .12s cubic-bezier(.34, 1.56, .64, 1) both; }
.rd-pop-boss .bob { transform-box: fill-box; transform-origin: 50% 100%; animation: rd-pop-rage .9s ease-in-out infinite; }
@keyframes rd-pop-rage { 0%, 100% { transform: translateX(0) scale(1, 1); } 20% { transform: translateX(-2px) scale(1.03, .97); } 40% { transform: translateX(2px) scale(.98, 1.02); } 60% { transform: translateX(-1.5px) scale(1.02, .98); } 80% { transform: translateX(1.5px); } }
.rd-pop-boss .aura, .rd-pop-boss .pulse { animation: hq-pop-pulse 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.rd-pop-boss .float { animation: rd-pop-steam 1.6s ease-out infinite; }
@keyframes rd-pop-steam { 0% { opacity: 0; transform: translateY(4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .rd-pop-boss .bob, .rd-pop-boss .aura, .rd-pop-boss .pulse, .rd-pop-boss .float { animation: none; } }
/* per crown tier (raidCard rd-t0..3): pull the smaller low-level boss up, badge level with its crown */
/* guild HP bar + today's hitters (js/auth.js raidCard) */
.rd-pop-hp { width: 100%; max-width: 280px; margin: 12px auto 0; text-align: left; }
.rd-pop-hp-row span { margin-right: 12px; }
.rd-pop-hp-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; color: #a3a3a3; margin-bottom: 6px; }
.rd-pop-hp-row b { font-size: 14px; color: #fafafa; font-variant-numeric: tabular-nums; }
.rd-pop-hp-bar { display: block; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); overflow: hidden; }
.rd-pop-hp-bar i { display: block; height: 100%; border-radius: inherit; background: #f43f5e; transform-origin: left; }
.hq-pop[open] .rd-pop-hp-bar i { animation: rd-pop-hp-in .9s .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rd-pop-hp-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.rd-pop-how { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: #a3a3a3; }
.rd-pop-how span { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); color: #e5e5e5; font-size: 12px; white-space: nowrap; }
.rd-pop.is-near .rd-pop-hp-row span { color: #fb7185; }
.rd-pop.is-near .rd-pop-hp-bar i { background: #fb7185; animation: hq-pop-pulse 1.4s ease-in-out infinite; }
/* raid "go" button: rose fill + the member's hero Droppy peeking in from the left */
.hq-pop-go.rd-pop-go { justify-content: center; gap: 12px; padding: 10px 22px 10px 12px; min-height: 58px; background: #f43f5e; color: #fff; box-shadow: 0 14px 32px rgba(244, 63, 94, .28), inset 0 -3px 0 rgba(0, 0, 0, .18); }
.rd-pop-go::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent); }
.rd-pop-go:active { box-shadow: 0 8px 18px rgba(244, 63, 94, .25), inset 0 -1px 0 rgba(0, 0, 0, .18); }
.rd-pop-go-pet { flex: none; position: relative; display: grid; place-items: center; width: 50px; height: 50px; margin: -6px 0; border-radius: 50%; background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); }
/* the hero Droppy, whole, a little bigger than its circle so it pops out of it */
.rd-pop-go-pet svg { width: 60px; height: 60px; margin-top: -10px; overflow: visible; }
/* a hero Droppy stands on its own: no circle (it looked off-centre), a box as wide as the
   art so props like a staff stay clear of the label */
.rd-pop-go-pet:not(.is-egg):not(.is-flag) { width: 64px; height: 46px; margin: -8px 2px -8px 0; background: none; box-shadow: none; border-radius: 0; }
/* wide wings or a twin beside it: more room before the label */
.rd-pop-go-pet:not(.is-egg):not(.is-flag):is([data-pet="judas"], [data-pet="rudy"], [data-pet="eve"], [data-pet="bael"], [data-pet="kris"]) { margin-right: 16px; }
.rd-pop-go-pet:not(.is-egg):not(.is-flag) svg { width: 64px; height: 64px; margin-top: -14px; overflow: visible; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.rd-pop-go-pet.is-egg svg { width: 30px; height: 35px; margin-top: 0; }
.rd-pop-go-pet.is-flag svg { width: 24px; height: 24px; margin: 0; }
.hq-pop[open] .rd-pop-go-pet svg { animation: rd-pop-go-hop 1.6s 1s ease-in-out infinite; transform-origin: 50% 100%; }
.hq-pop[open] .rd-pop-go-pet.is-flag svg { animation: rd-pop-go-wave 1.4s 1s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes rd-pop-go-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-4px) scale(.97, 1.03); } 90% { transform: translateY(0) scale(1.03, .97); } }
@keyframes rd-pop-go-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
/* boss down: the plant-a-flag button in the card's gold */
.rd-pop.is-dead .rd-pop-go { background: #eab308; color: #0a0a0a; box-shadow: 0 14px 32px rgba(234, 179, 8, .25), inset 0 -3px 0 rgba(0, 0, 0, .18); }
.rd-pop.is-dead .rd-pop-go-txt small { color: rgba(10, 10, 10, .7); }
.rd-pop.is-dead .rd-pop-go-pet { background: rgba(0, 0, 0, .12); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .25); }
.rd-pop-go-txt { display: grid; text-align: left; line-height: 1.25; font-size: 16px; }
.rd-pop-go-txt small { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .78); }
.rd-pop-go:hover .rd-pop-go-pet svg { translate: none; }
@media (prefers-reduced-motion: reduce) { .rd-pop-go-pet svg { animation: none !important; } }
.rd-pop-social { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: #d4d4d4; text-wrap: balance; }
.rd-pop-social b { color: #fafafa; }
.rd-pop-social + .hq-pop-text { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .rd-pop-hp-bar i { animation: none !important; } }
.rd-t0 .rd-pop-boss { margin-top: -62px; } .rd-t0 .rd-pop-coin { top: 44px; }
.rd-t1 .rd-pop-boss { margin-top: -50px; } .rd-t1 .rd-pop-coin { top: 38px; }
.rd-t2 .rd-pop-boss { margin-top: -34px; } .rd-t2 .rd-pop-coin { top: 30px; }
.rd-pop-coin { top: 22px; bottom: auto; right: -22px; background: #f43f5e; color: #fff; font-size: 15px; box-shadow: 0 8px 20px rgba(244, 63, 94, .4); }
/* forms 2-4 hold a sword / sceptre on the right (js/raid-boss.js), so the Lv coin sits up above its hilt,
   the same spot for every form 2-4 (plume / shield / horns take the left).
   The knocked-out art drops them around the puddle and keeps the top right free, so .is-dead keeps the usual spot. */
.rd-pop:not(.is-dead) :is(.rd-t1, .rd-t2, .rd-t3) .rd-pop-coin { top: 2px; right: -34px; }
/* the laughing boss (reward card, boss survived) has HA bubbles on the left: its coin sits up over the right instead */
.rw-pop:not(.is-dead) .rd-t2 .rd-pop-coin, .rw-pop:not(.is-dead) .rd-t3 .rd-pop-coin { left: auto; right: -40px; top: -4px; }
/* boss down (js/auth.js raidCard r.dead): the boss melted into a puddle (js/raid-boss.js bossA 'dead'), gold "go plant a flag" card */
.hq-pop-card.rd-pop.is-dead { background: radial-gradient(90% 60% at 50% 0%, #1a1714, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(250, 204, 21, .1); }
.rd-pop.is-dead .hq-pop-kicker { border-color: rgba(250, 204, 21, .45); background: rgba(250, 204, 21, .1); color: #facc15; }
.rd-pop.is-dead .hq-pop-halo { background: radial-gradient(circle, rgba(226, 232, 240, .16), transparent 68%); }
.rd-pop.is-dead .rd-pop-coin { background: #3f3f46; color: #fde047; letter-spacing: .04em; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); }
.rd-pop.is-dead .rd-pop-boss .bob { animation: none; }
/* last week's reward (js/auth.js raidRewardCard): the boss still standing, calm (phase 0) on a plain
   dark card, or melted (.is-dead, gold as above); the badge is the T-coin waiting, so it is coin-yellow */
.hq-pop-card.rw-pop:not(.is-dead) { background: radial-gradient(90% 60% at 50% 0%, #17171a, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06); }
.rw-pop:not(.is-dead) .hq-pop-kicker { border-color: rgba(250, 204, 21, .45); background: rgba(250, 204, 21, .1); color: #facc15; }
.rw-pop:not(.is-dead) .hq-pop-halo { background: radial-gradient(circle, rgba(226, 232, 240, .12), transparent 68%); }
.rd-pop .rw-pop-coin, .rd-pop.is-dead .rw-pop-coin { background: #eab308; color: #0a0a0a; letter-spacing: -.03em; box-shadow: 0 8px 20px rgba(234, 179, 8, .3); }
.rw-pop:not(.is-dead) .rw-pop-boss .bob { animation: rw-pop-laugh .5s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes rw-pop-laugh { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-3px) scale(.97, 1.03); } }
.rw-pop .hq-pop-text { text-wrap: balance; }
.hq-pop-card.rw-pop.is-mvp { border-color: rgba(245, 158, 11, .7); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 60px rgba(245, 158, 11, .22); }
.rw-pop-ribbon { position: absolute; z-index: 2; left: 50%; top: -15px; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px 7px 12px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(180deg, #fde68a, #f59e0b 60%, #d97706); color: #451a03; font: 900 13px/1 'Inter', 'Anuphan', sans-serif; letter-spacing: .06em; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(245, 158, 11, .45), inset 0 1px 0 rgba(255, 255, 255, .6); }
.rw-pop-ribbon svg { width: 16px; height: 16px; fill: #451a03; }
.rw-pop-ribbon::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .65) 50%, transparent 70%); translate: -120% 0; animation: rw-pop-shine 2.8s 1s ease-in-out infinite; }
@keyframes rw-pop-shine { 0% { translate: -120% 0; } 45%, 100% { translate: 120% 0; } }
@media (prefers-reduced-motion: reduce) { .rw-pop:not(.is-dead) .rw-pop-boss .bob, .rw-pop-ribbon::after { animation: none; } }
.rd-pop-boss .melt { animation: rd-pop-melt 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes rd-pop-melt { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .96); } }
.rd-pop-boss .drip { animation: rd-pop-drip 2.2s ease-in infinite; transform-box: fill-box; }
@keyframes rd-pop-drip { 0% { opacity: 0; transform: translateY(-4px) scaleY(.6); } 20% { opacity: 1; } 80% { opacity: 1; transform: translateY(7px) scaleY(1.15); } 100% { opacity: 0; transform: translateY(9px) scale(1.4, .4); } }
.rd-pop-boss .soul { animation: rd-pop-soul 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes rd-pop-soul { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 25% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px) scale(1); } }
.rd-pop-boss .cloth { animation: rd-pop-wave 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 0 50%; }
@keyframes rd-pop-wave { 0%, 100% { transform: skewY(0) scaleX(1); } 50% { transform: skewY(-5deg) scaleX(.94); } }
.rd-pop-boss .dust { animation: rd-pop-dust 2.4s ease-out infinite; }
@keyframes rd-pop-dust { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: .6; } 100% { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .rd-pop-boss .melt, .rd-pop-boss .drip, .rd-pop-boss .soul, .rd-pop-boss .cloth, .rd-pop-boss .dust { animation: none; } }
/* บิงโกวอร์ card (js/auth.js bingoCard): the art is the 3×3 card itself. */
.bg-pop .hq-pop-kicker { border-color: rgba(190, 242, 100, .5); background: rgba(190, 242, 100, .1); color: #bef264; }
.bg-pop .hq-pop-halo { background: radial-gradient(circle, rgba(190, 242, 100, .26), transparent 68%); }
.bg-pop-frame { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 12px; }
.bg-pop-frame i { border-radius: 9px; background: #232323; border: 1px solid rgba(250, 250, 250, .08); }
.bg-pop-frame i.mid { border-color: rgba(234, 179, 8, .5); }
.bg-pop-frame i.on { background: #bef264; border-color: #bef264; box-shadow: 0 0 10px rgba(190, 242, 100, .45); }
/* ลอยกระทงดรอปปี้ card (js/auth.js loyCard): the viewer's Droppy rides a krathong down a night river. */
/* บาเอลสั่ง (js/auth.js baelCard): Bael in her web, three strands lit in the game's colours */
.hq-pop-card.bs-pop { background: radial-gradient(90% 60% at 50% 0%, #1a1430, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(196, 181, 253, .12); }
.bs-pop .hq-pop-kicker { border-color: rgba(196, 181, 253, .45); background: rgba(196, 181, 253, .1); color: #c4b5fd; }
.bs-pop .hq-pop-halo { background: radial-gradient(circle, rgba(196, 181, 253, .24), transparent 68%); }
.bs-pop-frame { background: radial-gradient(circle at 50% 45%, #1d1838, #0b0916 75%) !important; }
.bs-pop-web { position: absolute; inset: 4%; width: 92%; height: 92%; overflow: visible; }
.bs-pop-web .ring { fill: none; stroke: rgba(196, 181, 253, .16); stroke-width: .6; }
.bs-pop-web path { fill: none; stroke: rgba(237, 233, 254, .22); stroke-width: .8; stroke-linecap: round; }
.bs-pop-web path.on { stroke: var(--c); stroke-width: 1.6; animation: bs-pop-pluck 2.4s var(--d) ease-in-out infinite; }
.bs-pop-web circle:not(.ring) { fill: #0b0916; stroke: var(--c); stroke-width: .9; opacity: .55; }
.bs-pop-web circle.on { fill: var(--c); opacity: 1; animation: bs-pop-node 2.4s var(--d) ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bs-pop-pluck { 0%, 100% { opacity: .35; } 20% { opacity: 1; } }
@keyframes bs-pop-node { 0%, 100% { scale: 1; } 20% { scale: 1.5; } }
.bs-pop-pet { position: absolute; left: 50%; top: 52%; width: 62%; translate: -50% -50%; animation: lk-pop-bob 3s ease-in-out infinite; }
.bs-pop-pet .pet-svg { display: block; width: 100%; height: auto; overflow: visible; }
.bs-pop .hq-pop-coin.bs-pop-coin { background: #c4b5fd; color: #1c0c38; align-content: center; gap: 1px; font-size: 15px; line-height: 1; letter-spacing: .02em; }
.bs-pop .bs-pop-coin small { display: block; font: 800 8.5px/1 "Inter", sans-serif; letter-spacing: .14em; opacity: .75; }
.bs-pop .hq-pop-go.bs-pop-go { background: #c4b5fd; color: #1c0c38; }
.bs-pop .hq-pop-go.bs-pop-go:hover { background: #d8ccfe; }
@media (prefers-reduced-motion: reduce) { .bs-pop-web path.on, .bs-pop-web circle.on, .bs-pop-pet { animation: none; } }
.hq-pop-card.lk-pop { background: radial-gradient(90% 60% at 50% 0%, #0f1a33, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(250, 204, 21, .1); }
.lk-pop .hq-pop-kicker { border-color: rgba(250, 204, 21, .45); background: rgba(250, 204, 21, .1); color: #facc15; }
.lk-pop .hq-pop-halo { background: radial-gradient(circle, rgba(96, 165, 250, .22), transparent 68%); }
.lk-pop-frame { background: linear-gradient(#0a1128, #16244a 70%) !important; }
.lk-pop-sky i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fef9c3; opacity: .8; animation: lk-pop-twinkle 2.4s var(--d, 0s) ease-in-out infinite; }
@keyframes lk-pop-twinkle { 50% { opacity: .2; } }
.lk-pop-water { position: absolute; left: 0; right: 0; bottom: 0; height: 30%; z-index: 0; background: linear-gradient(#1e3a6b, #0c1d3d); border-top: 1px solid rgba(147, 197, 253, .35); opacity: .92; }
.lk-pop-kt { position: absolute; left: -8%; right: -8%; bottom: 9%; z-index: 1; animation: lk-pop-bob 3s ease-in-out infinite; }
@keyframes lk-pop-bob { 50% { transform: translateY(-3px) rotate(-1.5deg); } }
.lk-pop-kt .kt-svg { display: block; width: 100%; height: auto; overflow: visible; }
.lk-pop-kt .kt-flame { transform-box: fill-box; transform-origin: 50% 100%; animation: kt-flame 1.4s ease-in-out infinite alternate; }
@keyframes kt-flame { from { transform: scale(1, 1); } to { transform: scale(.85, 1.12); } }
.lk-pop-kt .kt-glow, .lk-pop-kt .kt-ember { animation: kt-glow 2.8s ease-in-out infinite alternate; }
@keyframes kt-glow { from { opacity: .6; } to { opacity: 1; } }
.lk-pop-kt .kt-twinkle { animation: kt-twinkle 2.2s ease-in-out infinite; }
@keyframes kt-twinkle { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.lk-pop-text { margin-bottom: 14px; }
/* Both of today's things done: a rubber stamp slams onto the art (js/auth.js loyCard). */
.lk-pop.is-clear .lk-pop-frame { filter: saturate(.75) brightness(.8); }
.lk-pop-clear {
  position: absolute; z-index: 3; left: 50%; top: 46%; translate: -50% -50%; rotate: -14deg;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 18px 12px;
  border: 3px solid #f43f5e; border-radius: 10px; color: #f43f5e; background: rgba(8, 8, 12, .78);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.4 3.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -3.4 3.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: lk-stamp .42s cubic-bezier(.2, 1.5, .4, 1) .55s both;
}
.lk-pop-clear::before { content: ''; position: absolute; inset: 3px; border: 1.5px solid currentColor; border-radius: 6px; }
.lk-pop-clear b { font: 800 30px/1 'Anuphan', sans-serif; letter-spacing: .14em; margin-right: -.14em; }
.lk-pop-clear small { font: 700 11px/1.2 'Anuphan', sans-serif; letter-spacing: .04em; }
@keyframes lk-stamp { from { opacity: 0; scale: 2.2; } 65% { opacity: 1; scale: .94; } to { opacity: 1; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .lk-pop-clear { animation: none; } }
.lk-pop-todo { display: inline-flex; flex-direction: column; gap: 8px; margin: 0 0 22px; padding: 12px 18px; list-style: none; text-align: left;
  border: 1px solid rgba(250, 250, 250, .1); border-radius: 14px; background: rgba(250, 250, 250, .03); }
.lk-pop-todo li { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: #e5e5e5; }
.lk-pop-todo li::before { content: ''; flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #facc15; }
.lk-pop-todo li.is-done { color: #737373; }
/* Unfinished to-dos are whole-row buttons into loykrathong.html (?go=, js/auth.js loyCard):
   a yellow hairline row with "ไปทำ" and a chevron at the right edge. */
.lk-pop-todo li:has(a) { min-width: min(300px, 70vw); }
.lk-pop-todo li a {
  flex: 1; display: flex; align-items: center; gap: 8px; min-height: 40px; margin: -2px 0; padding: 6px 10px 6px 12px; border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, .35); background: rgba(250, 204, 21, .06); color: inherit; text-decoration: none;
  transition: background-color .2s, border-color .2s;
}
.lk-pop-todo li a .lk-go { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; color: #facc15; font-size: 13px; font-weight: 700; }
.lk-pop-todo li a svg { flex: none; }
.lk-pop-todo li a:hover, .lk-pop-todo li a:focus-visible { border-color: #facc15; background: rgba(250, 204, 21, .14); }
.lk-pop-todo li a:focus-visible { outline: 2px solid #facc15; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .lk-pop-todo li a svg { transition: translate .25s cubic-bezier(.23, 1, .32, 1); }
  .lk-pop-todo li a:hover svg, .lk-pop-todo li a:focus-visible svg { translate: 3px 0; }
}
.lk-pop-todo li.is-done::before { border-color: #525252; background: #525252 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5 8.2 9 4' fill='none' stroke='%23e5e5e5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
.lk-pop-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lk-pop-coin { display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1; background: #facc15; font-size: 16px; box-shadow: 0 8px 20px rgba(250, 204, 21, .35); }
.lk-pop-coin small { margin-top: 2px; font: 800 10px 'Anuphan', sans-serif; letter-spacing: 0; }
@media (prefers-reduced-motion: reduce) { .lk-pop-sky i, .lk-pop-kt, .lk-pop-kt * { animation: none; } }
.hq-pop[open] .bg-pop-frame i.on { animation: bg-pop-dot .4s .4s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes bg-pop-dot { from { scale: .3; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hq-pop[open] .bg-pop-frame i.on { animation: none; } }
/* Gift-egg delivery card (js/auth.js giftEggCard): the viewer's own pet hops
   in from the left and lands hugging the Dev egg (two little paws in its
   colour round it); Dev Droppy, who sent it, waves from the top corner. */
.ge-pop-frame { position: relative; overflow: visible !important; background: linear-gradient(to top, #0b2a14 0 20%, #050a06 20%) !important; }
.ge-pop-stage { position: absolute; inset: 0; overflow: hidden; border-radius: 22px; }
.ge-pop-runner { position: absolute; inset: 0; }
.ge-pop-runner > .pet-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ge-pop-egg { position: absolute; left: 50%; bottom: 5%; width: 34%; aspect-ratio: 24 / 26; translate: -50% 0; transform-origin: 50% 90%; animation: ge-pop-rock 2.4s 1.8s ease-in-out infinite; }
.ge-pop-hands { position: absolute; left: 50%; bottom: 13%; width: 46%; translate: -50% 0; display: flex; justify-content: space-between; pointer-events: none; }
.ge-pop-hands i { width: 22%; aspect-ratio: 1; border-radius: 50%; background: var(--paw, #a855f7); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .35), 0 0 0 1.5px #1a1a1a; }
.ge-pop-dev { position: absolute; z-index: 2; right: -20%; top: -22%; width: 46%; aspect-ratio: 1; transform-origin: 50% 85%; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6)); }
.ge-pop-dev > .pet-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hq-pop[open] .ge-pop-runner { animation: ge-run 1.25s .4s cubic-bezier(.3, .7, .4, 1) both, ge-bob 1.8s 1.7s ease-in-out infinite; }
.hq-pop[open] .ge-pop-dev { animation: ge-dev-in .5s .2s cubic-bezier(.34, 1.56, .64, 1) both, ge-wave 1.6s .8s ease-in-out infinite; }
@keyframes ge-run {
  0% { transform: translateX(-120%); }
  22% { transform: translate(-82%, -12%); }
  38% { transform: translate(-50%, 0) scale(1.06, .94); }
  58% { transform: translate(-22%, -10%); }
  76% { transform: translate(0, 0) scale(1.1, .9); }
  88% { transform: translate(0, -5%) scale(.97, 1.03); }
  100% { transform: none; }
}
@keyframes ge-bob { 50% { transform: translateY(-4%); } }
@keyframes ge-dev-in { from { scale: 0; rotate: -30deg; } }
@keyframes ge-wave { 0%, 100% { rotate: -8deg; } 50% { rotate: 10deg; } }
.ge-pop-egg .egg-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55)); }
.ge-pop-coin { background: #4ade80 !important; color: #052e16 !important; }
/* The Dev egg (js/pets.js egg "dev") glitches now and then: a jolt with its
   red and cyan channels split apart; hard and nonstop while it hatches
   (js/pet-gacha.js .is-glitching). transform/filter only, so it stacks with
   the hatch animation's translate/rotate. */
.egg-svg--dev { animation: egg-glitch 3.8s steps(1) infinite; }
.is-glitching .egg-svg--dev { animation: egg-glitch-hard .42s steps(1) infinite; }
@keyframes egg-glitch {
  86% { transform: translate(-3%, 0) skewX(-8deg); filter: drop-shadow(-2px 0 0 rgba(255, 0, 80, .9)) drop-shadow(2px 0 0 rgba(0, 240, 255, .9)); }
  88% { transform: translate(4%, 0) skewX(6deg); filter: drop-shadow(2px 0 0 rgba(255, 0, 80, .9)) drop-shadow(-2px 0 0 rgba(0, 240, 255, .9)); }
  90% { transform: translate(-1%, 1%); filter: drop-shadow(-1px 0 0 rgba(255, 0, 80, .9)) drop-shadow(1px 0 0 rgba(0, 240, 255, .9)); }
  92% { transform: none; }
}
@keyframes egg-glitch-hard {
  0% { transform: translate(-4%, 0) skewX(-10deg); filter: drop-shadow(-5px 0 0 rgba(255, 0, 80, .95)) drop-shadow(5px 0 0 rgba(0, 240, 255, .95)); }
  20% { transform: translate(5%, -1%) skewX(8deg); filter: drop-shadow(6px 0 0 rgba(255, 0, 80, .95)) drop-shadow(-6px 0 0 rgba(0, 240, 255, .95)) brightness(1.4); }
  40% { transform: translate(-2%, 1%) scaleX(1.04); filter: drop-shadow(-3px 1px 0 rgba(255, 0, 80, .95)) drop-shadow(3px -1px 0 rgba(0, 240, 255, .95)); }
  60% { transform: none; filter: drop-shadow(0 0 14px #4ade80); }
  80% { transform: translate(3%, 0) skewX(-6deg); filter: drop-shadow(4px 0 0 rgba(255, 0, 80, .95)) drop-shadow(-4px 0 0 rgba(0, 240, 255, .95)) hue-rotate(40deg); }
}
.ge-pop-letter { margin: 0 auto 6px; max-width: 30ch; padding: 10px 14px; border-radius: 12px; background: #f5ecd7; color: #3b2a1a; font-size: 14px; line-height: 1.5; transform: rotate(-1deg); box-shadow: 0 6px 16px rgba(0, 0, 0, .35); white-space: pre-line; overflow-wrap: anywhere; }
.ge-pop-letter small { display: block; margin-top: 4px; text-align: right; font-size: 12px; opacity: .7; }
@keyframes ge-pop-rock { 0%, 70%, 100% { rotate: 0deg; } 78% { rotate: -8deg; } 86% { rotate: 6deg; } 94% { rotate: -2deg; } }
@media (prefers-reduced-motion: reduce) { .ge-pop-egg, .egg-svg--dev, .is-glitching .egg-svg--dev, .hq-pop[open] .ge-pop-runner, .hq-pop[open] .ge-pop-dev { animation: none; } }
.lm-pop-frame svg { display: block; width: 100%; height: 100%; padding: 0 2px; box-sizing: border-box; overflow: visible; }
.lm-pop-coin { display: flex !important; flex-direction: column; justify-content: center; align-items: center; line-height: 1; background: #d39a5b !important; box-shadow: 0 8px 20px rgba(211, 154, 91, .35) !important; }
.lm-pop-coin small { margin-top: 2px; font: 800 10px 'Anuphan', sans-serif; letter-spacing: 0; }
/* แบ็บบี้ไม้ day: the streamer's purple/pink LIVE look (css/lumber.css .lm-order.is-babby) */
.hq-pop-card.lm-pop.is-babby { background: radial-gradient(90% 60% at 50% 0%, #2a1236, #0a0710); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(192, 132, 252, .22), 0 0 60px -20px rgba(236, 72, 153, .5); }
.lm-pop.is-babby .hq-pop-kicker { display: inline-flex; align-items: center; gap: 7px; border-color: rgba(236, 72, 153, .55); background: linear-gradient(90deg, rgba(168, 85, 247, .2), rgba(236, 72, 153, .2)); color: #f9a8d4; }
.lm-pop.is-babby .hq-pop-halo { background: radial-gradient(circle, rgba(236, 72, 153, .32), transparent 68%); }
.lm-pop.is-babby .lm-pop-frame { background: linear-gradient(to top, #3b1a3f 0 20%, #1a0f1f 20%) !important; }
.lm-pop.is-babby .lm-pop-coin { background: linear-gradient(135deg, #a855f7, #ec4899) !important; color: #fff; box-shadow: 0 8px 20px rgba(236, 72, 153, .4) !important; }
.lm-pop-live { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 5px; background: #ef4444; color: #fff; font: 900 10.5px/1.4 'Inter', sans-serif; letter-spacing: .06em; }
.lm-pop-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: lm-pop-rec 1.2s steps(1) infinite; }
@keyframes lm-pop-rec { 50% { opacity: .2; } }
.lm-pop-say {
  position: absolute; z-index: 2; left: -58px; top: -6px; padding: 5px 10px; border-radius: 12px 12px 2px 12px; rotate: -6deg;
  background: #fff; color: #3b0764; font: 800 12px/1.2 'Anuphan', sans-serif; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  animation: lm-pop-bob 2.4s ease-in-out infinite;
}
@keyframes lm-pop-bob { 50% { translate: 0 -4px; rotate: -3deg; } }
/* Market result card (js/auth.js lumberResultCard): won = T-coin gold and a
   hopping buyer; lost = the same card gone grey, the buyer drooping. */
.lm-res-pet { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.lm-res.is-win .lm-res-pet { animation: lm-res-hop 1.6s ease-in-out infinite; }
@keyframes lm-res-hop { 0%, 60%, 100% { translate: 0 0; scale: 1 1; } 70% { scale: 1.06 .94; } 80% { translate: 0 -7px; scale: .97 1.03; } 90% { translate: 0 0; scale: 1.03 .97; } }
.lm-res.is-win:not(.is-babby) .lm-pop-coin { background: #fbbf24 !important; color: #1c1206; box-shadow: 0 8px 20px rgba(251, 191, 36, .4) !important; }
.lm-res.is-win:not(.is-babby) .hq-pop-halo { background: radial-gradient(circle, rgba(251, 191, 36, .3), transparent 68%); }
.hq-pop-card.lm-res.is-lose { background: radial-gradient(90% 60% at 50% 0%, #18181b, #070707); box-shadow: 0 40px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(161, 161, 170, .12); }
.lm-res.is-lose .hq-pop-kicker { border-color: rgba(161, 161, 170, .4); background: rgba(161, 161, 170, .08); color: #a1a1aa; }
.lm-res.is-lose .hq-pop-halo { background: none; }
.lm-res.is-lose .lm-pop-frame { background: linear-gradient(to top, #202023 0 20%, #111113 20%) !important; }
.lm-res.is-lose .lm-res-pet { filter: saturate(.55) brightness(.85); rotate: -4deg; translate: 0 4px; }
.lm-res.is-lose .pet-eyes-open, .lm-res.is-lose .pet-mouth-smile { display: none; }
.lm-res.is-lose .pet-eyes-held, .lm-res.is-lose .pet-mouth-wave { display: inline; }
.lm-res-tears path { transform-box: fill-box; transform-origin: 50% 0; animation: lm-res-tear 1.1s ease-in var(--d) infinite; }
@keyframes lm-res-tear { 0% { opacity: 0; translate: 0 -2px; scale: .5; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 9px; scale: 1 1.25; } }
.lm-res.is-lose .lm-pop-coin { background: #3f3f46 !important; color: #e4e4e7; box-shadow: 0 8px 20px rgba(0, 0, 0, .5) !important; }
.lm-res.is-lose.is-babby .lm-pop-live { background: #52525b; }
.lm-res.is-lose.is-babby .lm-pop-live::before { animation: none; }
.lm-res.is-lose .lm-pop-say { opacity: .75; filter: grayscale(.6); }
@media (prefers-reduced-motion: reduce) { .lm-pop-live::before, .lm-pop-say, .lm-res-pet, .lm-res-tears path { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .hq-pop, .hq-pop::backdrop, .hq-pop-card, .hq-pop-close, .hq-pop-go, .hq-pop-go svg, .hq-pop-next svg { transition: none; }
  .hq-pop-card, .hq-pop-halo, .hq-pop-go::after, .hq-pop[open] .hq-pop-frame, .hq-pop[open] .hq-pop-coin { animation: none; }
}

.streak-card {
  position: fixed; top: 16px; left: 50%; z-index: 10000;
  width: min(360px, calc(100vw - 32px)); padding: 18px 18px 22px;
  background: rgba(10, 10, 10, .72); color: #fafafa;
  border: 1px solid rgba(250, 250, 250, .10); border-radius: 22px;
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  font-family: 'Anuphan', 'Inter', system-ui, sans-serif;
  transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  transition: transform .45s cubic-bezier(.23, 1, .32, 1), opacity .3s;
}
.streak-card.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }

.streak-card-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: #262626; color: #fafafa;
  transition: transform .4s cubic-bezier(.23, 1, .32, 1), background .25s;
}
.streak-card-close svg { width: 14px; height: 14px; }
.streak-card-close:hover { background: #333; transform: rotate(90deg); }

.streak-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-right: 30px; }
.streak-card-head:last-child { margin-bottom: 0; } /* freeze notice has no dot track */
.streak-card-icon {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1d1d1d, #0e0e0e); border: 1px solid rgba(234, 179, 8, .35);
  color: #eab308; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 18px rgba(234, 179, 8, .15);
}
.streak-card-icon svg { width: 22px; height: 22px; }
.streak-card-icon.party { color: #bef264; border-color: rgba(190, 242, 100, .45); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 18px rgba(190, 242, 100, .2); }
.streak-card-icon.pause { color: #a3a3a3; border-color: rgba(250, 250, 250, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }

.streak-card-title strong { display: block; font-size: 14px; font-weight: 800; color: #fafafa; }
.streak-card-sub { display: block; margin-top: 3px; font-size: 12px; line-height: 1.5; color: #a3a3a3; }

.streak-card-track { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 0 2px; }
.streak-card-track::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 50%;
  height: 2px; border-radius: 2px; background: rgba(250, 250, 250, .10); transform: translateY(-50%);
}
.streak-card-fill {
  position: absolute; left: 14px; top: 50%; height: 2px; border-radius: 2px;
  max-width: calc(100% - 28px); /* inline width is % of the whole track; stop at the last dot's centre */
  background: #bef264; box-shadow: 0 0 8px #bef264; transform: translateY(-50%);
  transition: width .5s ease;
}
.streak-card-dot {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: #141414; border: 1.5px solid rgba(250, 250, 250, .12); color: #a3a3a3;
}
.streak-card-dot svg { width: 14px; height: 14px; }
.streak-card-dot.done { background: #bef264; border-color: #bef264; color: #0a0a0a; }
.streak-card-dot.today { box-shadow: 0 0 0 4px rgba(190, 242, 100, .18), 0 0 14px rgba(190, 242, 100, .45); }
.streak-card-dot.gift { border-style: dashed; border-color: rgba(234, 179, 8, .6); color: #eab308; }
/* Mummy event row under the track (js/auth.js showStreakCard). */
.streak-card-event {
  display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 10px 12px;
  border-radius: 14px; border: 1px solid rgba(228, 215, 182, .28); background: rgba(228, 215, 182, .07);
  color: inherit; text-decoration: none; transition: border-color .25s, background .25s;
}
.streak-card-season { border-color: rgba(253, 224, 71, .35); background: rgba(253, 224, 71, .07); }
.streak-card-season .sce-go { background: #fde047; color: #2b1d14; }
.streak-card-event:hover { border-color: rgba(228, 215, 182, .6); background: rgba(228, 215, 182, .12); }
.sce-ico { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; }
.sce-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sce-text strong { font-size: 13px; font-weight: 800; color: #fafafa; }
.sce-text > span { font-size: 11.5px; line-height: 1.4; color: #a3a3a3; }
.sce-steps { display: flex; gap: 4px; margin-top: 3px; }
.sce-steps i { width: 22px; height: 5px; border-radius: 5px; background: rgba(250, 250, 250, .12); }
.sce-steps i.on { background: #e4d7b6; }
.sce-go { flex-shrink: 0; padding: 5px 10px; border-radius: 999px; background: #e4d7b6; color: #2b1d14; font-size: 12px; font-weight: 800; }
.streak-card-dot.gift.done { border-style: solid; background: #eab308; border-color: #eab308; color: #0a0a0a; }

/* Waiting slot — glowing border when a slot is active and awaiting an item */
.formation-grid.editable .formation-slot.waiting {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 8px 2px rgba(59,130,246,0.35);
  animation: slot-pulse 1.2s ease-in-out infinite;
}

.pet-slot.waiting {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 8px 2px rgba(59,130,246,0.35);
  animation: slot-pulse 1.2s ease-in-out infinite;
}

.gear-slot.waiting {
  border-style: solid;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 8px 2px rgba(59,130,246,0.35);
  animation: slot-pulse 1.2s ease-in-out infinite;
}

/* Picked slot — pink highlight while in click-to-swap mode */
.pet-slot.picked {
  border-style: solid;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}

.gear-slot.picked {
  border-style: solid;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px var(--pink-soft);
}

@keyframes slot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 8px 2px rgba(59,130,246,0.35); }
  50%       { box-shadow: 0 0 0 5px var(--accent-soft), 0 0 14px 4px rgba(59,130,246,0.55); }
}

/* Admin login modal */
.admin-login-box {
  max-width: 400px;
}

.admin-login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.admin-login-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.admin-login-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-page);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.admin-login-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.admin-login-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}

.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field-wrap input {
  width: 100%;
  padding-right: 42px;
  border: 1.5px solid var(--card-border);
  border-radius: 8px;
  padding-top: 9px;
  padding-bottom: 9px;
  padding-left: 10px;
  font-size: 14px;
  background: var(--bg-page);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.password-field-wrap input[type="password"]::-ms-reveal,
.password-field-wrap input[type="password"]::-ms-clear {
  display: none;
}

.password-field-wrap input:focus {
  border-color: var(--accent);
}

.password-eye {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
}

.password-eye:hover {
  color: var(--accent);
}

.admin-login-error {
  font-size: 12px;
  color: #ef4444;
  margin: 8px 0 0;
  min-height: 18px;
}

/* Disabled palette tab */
.palette-tab:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.palette-tab:disabled:hover {
  background: var(--bg-page);
  color: var(--muted);
}

/* ── Detail view ─────────────────────────────────────────────────────────── */

#detailView {
  padding-bottom: 40px;
}

.detail-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 14px;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.detail-back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.detail-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-enemy-box {
  background: var(--pink-soft);
  border: 2px solid var(--pink);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 28px;
}

.detail-enemy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.detail-enemy-title {
  font-size: 12px;
  font-weight: 800;
  background: var(--pink);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

/* Category badge inside the pink box: use card background so it contrasts */
.detail-enemy-box .badge-need {
  background: var(--card-bg);
  border: 1.5px solid var(--pink);
  color: var(--pink);
}

.detail-enemy-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 14px;
  overflow-wrap: break-word;
}

.detail-enemy-body {
  display: flex;
  justify-content: center;
}

.detail-counters-heading {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--card-border);
}

.detail-counters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 680px) {
  .detail-counters-grid {
    grid-template-columns: 1fr;
  }
}

.detail-counter-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: default;
}

.detail-counter-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.22);
}

.detail-counter-card--first-pick {
  border-color: #f5a623;
  box-shadow: 0 0 0 1px #f5a623, 0 8px 24px rgba(245, 166, 35, 0.18);
}

.badge-first-pick {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #7a4a06;
  background: linear-gradient(135deg, #fbbf24, #f5a623);
}

.detail-counter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  /* Takes the remaining row width and wraps its OWN contents onto a 2nd
     line when badges pile up, instead of pushing .counter-card-actions
     (css/counter.css, now flex-wrap:nowrap on the parent) down with it. */
  flex: 1;
  min-width: 0;
}

/* Formation + pets side by side, scaled down to fit inside 2-col card */
.detail-formation-area {
  gap: 20px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}

@media (max-width: 700px) {
  .detail-formation-area { flex-wrap: wrap; }
}

.detail-formation-area .formation-grid {
  --slot-size: 68px;
}

.detail-formation-area .pet-slot.main {
  width: 58px;
  height: 58px;
}

.detail-formation-area .pet-slot.sub {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

/* Sub-slot flex container for detail view: only filled slots, centered */
.detail-pet-subs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 88px;
}

/* Footer: note section + actions row */
.detail-counter-footer {
  border-top: 1px dashed var(--card-border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-counter-card--hidden {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.counter-hidden-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

.counter-hide-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  float: right;
}

.counter-hide-btn:hover {
  background: var(--card-border);
  color: var(--text);
}

.counter-hide-btn--hidden {
  border-color: var(--accent);
  color: var(--accent);
}


/* "สรุปรายละเอียดแบบย่อ" heading — slightly larger and prominent */
.detail-note-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.detail-team-note-block {
  margin-bottom: 10px;
}
.dp-team-note {
  margin: 10px 0;
}
.detail-team-note-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.6;
  background: var(--bg-page);
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  margin-top: 4px;
}

.detail-counter-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Hero block: name header + note text */
.detail-note-hero-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Hero name — same size as the section label, accented */
.detail-note-hero-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 7px;
}

.detail-note-text {
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.65;
  word-break: break-word;
  padding-left: 10px;
}

.note-keyword {
  font-weight: 800;
  color: var(--accent);
}

.detail-note-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Expanded stats block per hero */
.detail-stats-expand {
  border-top: 1px dashed var(--card-border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-stats-hero {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-stats-hero-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.detail-stats-values {
  font-size: 11px;
  color: var(--text);
  line-height: 1.6;
}

/* Footer action row — .detail-added-by (submitter credit, js/counter.js's
   renderCounterCardReadonly) on the left when present, vote buttons +
   "ดูรายละเอียดเพิ่มเติม" always pushed to the right via
   .detail-footer-actions-right's margin-left:auto (so they stay
   right-aligned whether or not the credit span is there — a plain
   justify-content:flex-end on this row alone couldn't do both at once). */
.detail-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-footer-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.detail-added-by {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.detail-more-btn {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 10px;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.detail-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Counter-detail popup (full read-only view) ──────────────────────────── */

.dp-box {
  background: var(--card-bg);
  border-radius: 16px;
  width: 98%;
  max-width: 1440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
  flex-shrink: 0;
}

.dp-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.dp-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-page);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  font-family: inherit;
}

.dp-close-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.dp-body {
  overflow-y: auto;
  padding: 16px 18px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Formation + pets row inside the popup */
.dp-formation-row {
  background: var(--bg-page);
  border-radius: 12px;
  padding: 14px;
  gap: 40px;
}

.dp-formation-row .formation-grid {
  --slot-size: 76px;
}

/* Stacked counter sections inside the report-tab "ดูเพิ่ม" popup */
.dp-counter-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 10px;
}

.dp-section-divider {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 4px 0;
}

.dp-formation-row .detail-pet-subs {
  max-width: none;
  flex-wrap: nowrap;
}

/* Read-only gear slots: no pointer, no hover effects */
.dp-gear-ro {
  cursor: default !important;
  pointer-events: none;
}

/* Note as a div that looks like the textarea */
.dp-note-text {
  flex: 1;
  min-height: 78px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--bg-page);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-family: inherit;
}

/* Stat value span (replaces the input in read-only mode) */
.dp-stat-value {
  width: 72px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.dp-stat-empty {
  color: var(--muted);
  font-weight: 400;
}

/* ── Horizontal hero cards inside the detail popup ── */
.dp-box .hero-gear-section {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 10px;
  margin-top: 0;
  padding: 0 4px 6px 4px;
  border-top: none;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  justify-content: safe center;
  /* Setting overflow-x alone makes the UA compute overflow-y as auto too
     (CSS Overflow §3: pairing a non-visible axis with visible forces both
     non-visible — an explicit overflow-y:visible here gets silently
     upgraded to auto the same way, so that's not a usable fix). That
     turns this row into a scroll container, and a scroll container's
     flex min-height special-cases to 0 instead of its content's natural
     height — so once .dp-body ran short on room (tall notes/stats on a
     normal-height screen), the flex-shrink algorithm was free to squash
     this row — and the .hero-gear-block cards stretched to match it via
     align-items:stretch — down far below what their stat tables need.
     Card border/background ended up shorter than its own stat rows,
     which kept rendering past the bottom edge, uncontained. A concrete
     min-height (not the keyword "auto") sidesteps the special case
     entirely and keeps this row's own vertical size content-driven,
     while overflow-x's horizontal card-swipe scroll still works. */
  min-height: min-content;
}

.dp-box .hero-gear-block {
  flex: 0 0 min(420px, 85vw);
  min-width: 0;
  background: var(--bg-page);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--card-border);
  scroll-snap-align: start;
}

.dp-box .hero-gear-block:last-child {
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
}

.dp-box .hero-gear-row {
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.dp-box .hero-gear-left {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.dp-box .hero-gear-portrait {
  flex-direction: row;
  flex: unset;
  align-self: unset;
  gap: 8px;
  justify-content: flex-start;
}

.dp-box .hero-gear-portrait img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
}

.dp-box .hero-gear-portrait span {
  max-width: unset;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: normal;
  line-height: 1.3;
}

.dp-box .gear-type-label {
  width: 46px;
  font-size: 12px;
}

.dp-box .gear-slot {
  width: 48px;
  height: 48px;
  border-radius: 9px;
}

.dp-box .hero-gear-note {
  width: 100%;
  flex: unset;
}

.dp-box .dp-note-text {
  min-height: 60px;
  font-size: 13px;
}

.dp-box .hero-stats-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.dp-box .hero-stats-area .hero-stats-table {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  align-self: stretch;
  margin-top: 0;
}

/* .hero-stats-col (ผลเข้าเป้า/ต้านทานผล + เสริมความเสียหาย/บดขยี้/ยืดหยุ่น/
   ฟื้นคืน's wrapper) inherits .hero-stats-col's own generic align-self:
   center — fine in the grid-based .hero-stats-area layout elsewhere (the
   editor's stat-input view) where it just centers within its grid cell,
   but in THIS flex-column popup it also means the column never stretches
   to the row's full width, so it — and the two .hero-stats-table boxes
   inside it, even though THEY already ask for width:100% — end up sized
   to their own narrower content instead of matching the main stats table
   above them. Stretching the column itself here is what actually fixes
   that; the two tables' own width:100% only ever had this to fill. */
.dp-box .hero-stats-area .hero-stats-col {
  align-self: stretch;
  width: 100%;
}

.dp-box .hero-stat-row {
  gap: 5px;
  align-items: flex-start;
}

.dp-box .hero-stat-label {
  font-size: 12px;
  white-space: normal;
}

.dp-box .dp-stat-value {
  font-size: 12px;
  flex: 1;
  width: auto;
  text-align: right;
  white-space: normal;
  word-break: break-word;
}

.detail-no-counters {
  text-align: center;
  color: var(--muted);
  padding: 32px;
  font-size: 14px;
}

/* Site-wide gate screen */
#gateView {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 40px 20px;
}

.gate-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  max-width: 360px;
}

.gate-lock-icon {
  width: 44px;
  height: 44px;
  color: var(--muted);
  opacity: 0.45;
}

.gate-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
}

.gate-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.45;
}

.gate-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

/* Copyright/copycat notice on the pre-login gate — see the HTML comment
   above this element in index.html for why it lives here specifically.
   Amber, not red/alarm-colored: factual notice, not a site-down warning. */
.gate-copyright-notice {
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  background: rgba(217, 119, 6, 0.14);
  border: 1.5px solid rgba(217, 119, 6, 0.55);
  border-left: 4px solid #b45309;
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.7;
  margin: 0;
  text-align: left;
}

.gate-login-btn {
  margin-top: 6px;
  padding: 10px 36px;
  font-size: 15px;
}

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 28px;
  border-radius: 10px;
  background: #5865f2;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}
.btn-discord:hover { background: #4752c4; color: #fff; }

.gate-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0;
  width: 100%;
}
.gate-divider::before,
.gate-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--card-border);
}

.gate-auth-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}

/* Tiled full-viewport watermark (background-image set in JS, see
   App.showWatermark) — fixed so it covers whatever's on screen at any
   scroll position, not just a single corner label or one mark per card. */
.discord-watermark {
  position: fixed;
  inset: 0;
  background-repeat: repeat;
  pointer-events: none;
  z-index: 9999;
}

/* ── Admin Tools page ──────────────────────────────────────────────────────── */
.tools-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.tools-title {
  font-size: 20px;
  font-weight: 800;
  margin: 8px 0 20px;
}

.tools-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.tools-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
}

.tools-today {
  text-align: center;
  padding: 16px 0 20px;
  border-bottom: 1.5px solid var(--card-border);
  margin-bottom: 16px;
}

.tools-today-date {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.tools-today-code {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--accent);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.tools-today-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.tools-code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tools-code-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--card-border);
}

.tools-code-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text);
}

.tools-code-table tr:last-child td {
  border-bottom: none;
}

.tools-row-today td {
  background: var(--accent-soft);
  font-weight: 700;
}

.tools-code-cell {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.code-masked {
  color: var(--muted);
  letter-spacing: 3px;
  opacity: 0.5;
}

.tools-static-codes {
  font-family: monospace;
  background: var(--bg-page);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

/* ── Counter head actions ─────────────────────────────────────────── */
.counter-head-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.counter-team-note-section {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--card-border);
  margin-top: 8px;
}
.counter-team-note-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.counter-team-note-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--bg-page);
  color: var(--text);
  font-family: inherit;
  box-sizing: border-box;
}
.counter-team-note-input:focus {
  outline: none;
  border-color: var(--accent);
}

.counter-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  padding: 1px 2px;
  width: 160px;
  font-family: inherit;
  cursor: text;
}

@media (max-width: 480px) {
  .counter-name-input { width: 100px; }
}
.counter-name-input:hover { border-bottom-color: var(--muted); }
.counter-name-input:focus { outline: none; border-bottom-color: var(--accent); }

/* ── Copy counter modal ───────────────────────────────────────────── */
.copy-counter-team-list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copy-counter-team-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-page);
  border: 1px solid var(--card-border);
  transition: background 0.15s;
}
.copy-counter-team-item:hover {
  background: var(--accent-soft);
}
.copy-counter-team-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
/* Loading / busy states for the copy modal (js/counter.js's openCopyModal):
   the list spinner while castle+summary data loads, a spinning ring on the
   confirm button while the copy POSTs run, and a dimmed, non-clickable list
   so nothing can be re-ticked mid-copy. Spinner is the same ring as
   .home-status::before, scaled down. */
.copy-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.copy-loading::before,
.btn.is-busy::before {
  content: "";
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.btn.is-busy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 1;
  cursor: progress;
}
.btn.is-busy::before {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
}
.copy-counter-team-list.is-locked {
  opacity: 0.55;
  pointer-events: none;
}
/* ── Share-as-image modal (js/counter-share.js) ───────────────────── */
.share-modal-box {
  max-width: 560px;
}
.share-image-body {
  max-height: 68vh;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg-page);
  min-height: 120px;
}
.share-preview-img {
  display: block;
  width: 100%;
  height: auto;
}
.share-image-actions.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.detail-share-btn {
  white-space: nowrap;
}
.dp-header .detail-share-btn {
  margin-left: auto;
  margin-right: 10px;
}
.copy-team-name {
  flex: 1;
  font-weight: 500;
}
/* counter.html's variant shows hero icons instead of a team name — stacked
   above the count line (not inline) so it never overflows .modal-box's
   380px width no matter how long "จำนวน N ทีม · มีทีมตอบโต้แล้ว N" gets. */
.copy-team-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.copy-team-heroes.saved-team-heroes {
  gap: 4px;
}
.copy-team-heroes .saved-team-slot {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}
.copy-team-count {
  font-size: 12px;
  color: var(--muted);
}

/* ── Vote buttons ─────────────────────────────────────────────────── */
.vote-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--card-border);
  background: var(--bg-card);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  font-family: inherit;
}

.vote-btn:hover {
  background: var(--bg-page);
  border-color: var(--muted);
}

.vote-btn:active {
  transform: scale(0.93);
}

.vote-btn.vote-like.active {
  background: #fff0f0;
  border-color: #e00055;
  color: #e00055;
}

.vote-btn.vote-dislike.active {
  background: #f0f4ff;
  border-color: #5571d8;
  color: #5571d8;
}

[data-theme="dark"] .vote-btn.vote-like.active {
  background: #3d0014;
  border-color: #ff4488;
  color: #ff4488;
}

[data-theme="dark"] .vote-btn.vote-dislike.active {
  background: #0d1540;
  border-color: #7a9bff;
  color: #7a9bff;
}

.vote-count {
  min-width: 14px;
  text-align: center;
}

/* LINE message pre */
.line-message-pre {
  white-space: pre-wrap;
  background: var(--bg-page);
  border: 1.5px solid var(--card-border);
  border-radius: 8px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.75;
  font-family: "Anuphan", "Segoe UI", "Noto Sans Thai", sans-serif;
  margin: 0;
}

/* หีบเกียร์ art (js/gear-chest-art.js) on tcoin-shop.html's chest card and forge.html's chest panel */
.gch { display: block; overflow: visible; filter: drop-shadow(0 0 14px rgba(249, 115, 22, .18)); }
.gch-item, .gch-lid, .gch-spark, .gch-glow, .gch-cap { transform-box: fill-box; }
.gch-lid { transform-origin: 50% 100%; transition: scale .5s cubic-bezier(.34, 1.56, .64, 1); }
.gch-spark { transform-origin: center; animation: gch-twinkle 2.4s var(--d, 0ms) ease-in-out infinite; }
.gch-glow { transform-origin: center; animation: gch-glow 3.2s ease-in-out infinite; }
:is(.gear-card, .gch-host):is(:hover, :focus-within) .gch-lid { scale: 1 1.1; }
:is(.gear-card, .gch-host):is(:hover, :focus-within) .gch-item { animation: gch-hop .6s var(--d, 0ms) cubic-bezier(.34, 1.56, .64, 1); }
@keyframes gch-hop { 40% { translate: 0 -6px; } }
@keyframes gch-twinkle { 0%, 100% { opacity: .2; scale: .6; } 50% { opacity: 1; scale: 1; } }
@keyframes gch-glow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gch-spark, .gch-glow, .gch-item { animation: none !important; } .gch-lid { transition: none; } }

/* raid boss element aura (js/raid-element.js art()): back svg + boss + front svg stacked in one box,
   for the home raid popup (raid.html has its own copy) */
.elfx { position: relative; display: block; width: 100%; height: 100%; }
.elfx > svg { position: absolute; inset: 0; width: 100% !important; height: 100% !important; overflow: visible; }
.elfx .pulse { animation: elpulse 2.4s ease-in-out infinite; }
@keyframes elpulse { 50% { opacity: .55; } }
.elfx .twinkle { animation: eltw 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes eltw { 0%,100% { opacity: .2; } 50% { opacity: 1; } }
.elfx .rise { animation: elrise var(--d, 3s) linear infinite; animation-delay: var(--dl, 0s); }
@keyframes elrise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-120px); opacity: 0; } }
.elfx .flick { animation: elflick .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; animation-delay: var(--dl, 0s); }
@keyframes elflick { to { transform: scale(.85, 1.15); } }
.elfx .spin { animation: elspin var(--d, 24s) linear infinite; transform-box: view-box; transform-origin: 120px 214px; }
.elfx .spinc { animation: elspin var(--d, 30s) linear infinite; transform-box: view-box; transform-origin: 120px 120px; }
@keyframes elspin { to { transform: rotate(360deg); } }
.elfx .ripple { animation: elrip 2.6s ease-out infinite; transform-box: fill-box; transform-origin: center; animation-delay: var(--dl, 0s); }
@keyframes elrip { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.3); opacity: 0; } }
.elfx .hover { animation: elhov var(--d, 3s) ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes elhov { 50% { transform: translateY(-8px); } }
.elfx .wisp { animation: elwisp 4s ease-in-out infinite; animation-delay: var(--dl, 0s); }
@keyframes elwisp { 0% { transform: translate(0, 10px); opacity: 0; } 30% { opacity: .8; } 100% { transform: translate(var(--x, 6px), -70px); opacity: 0; } }
.elfx .dash { animation: eldash 3s linear infinite; }
.elfx .dash.rev { animation-duration: 4.5s; animation-direction: reverse; }
@keyframes eldash { to { stroke-dashoffset: -52; } }
.elfx .pop { animation: elpop 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes elpop { 0% { transform: scale(.2); opacity: 0; } 40% { opacity: 1; } 80% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .elfx * { animation: none !important; } }
.rd-pop-boss .elfx > svg { overflow: visible; }
.rd-pop-boss .elfx > svg:first-child, .rd-pop-boss .elfx > svg:last-child { filter: none; }
