/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; font-family: inherit; }
input  { font-family: inherit; }


::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #444; }
::-webkit-scrollbar-thumb:hover { background: #666; }

/* ===== SCREENS ===== */
.screen { display: none; flex-direction: column; height: 100vh; overflow: hidden; }
.screen.active { display: flex; }

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex;
  align-items: stretch;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  background: #000;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #f0e68c;
  background: rgba(17,17,17,0.9);
  color: #f0e68c;
  font-size: 18px;
  cursor: pointer;
  z-index: 9000;
  transition: opacity 0.25s ease, transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.back-to-top:hover {
  background: rgba(240,230,140,0.15);
  transform: translateY(-2px);
}
.back-to-top.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.nav-logo {
  width: 160px;
  height: 92px;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.header-right {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  max-width: 420px;
}
.auth-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
  order: 10;
}
.auth-row .auth-btn {
  flex: 1;
}
/* Auth button border + text color follows sync-dot state (desktop + mobile) */
.auth-row .auth-btn {
  transition: border-color 0.3s ease, color 0.3s ease;
}
.auth-row .sync-dot.syncing ~ .auth-btn { border-color: #f0e68c; color: #f0e68c; }
.auth-row .sync-dot.saved ~ .auth-btn { border-color: #6fcf7a; color: #6fcf7a; }
.auth-row .sync-dot.sync-error ~ .auth-btn { border-color: #e06c6c; color: #e06c6c; }

.btn-back {
  background: transparent;
  border: none;
  color: #bbb;
  font-size: 0.8rem;
  letter-spacing: 1px;
  padding: 6px 0;
  white-space: nowrap;
  transition: color 0.15s;
}
.btn-back:hover { color: #fff; }

/* ===== SEARCH BAR ===== */
.search-wrap {
  padding: 14px 20px 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-wrap input {
  flex: 1;
  max-width: 480px;
  background: #0d0d0d;
  border: 1px solid #333;
  color: #fff;
  padding: 14px 18px;
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-wrap input:focus    { border-color: #666; }
.search-wrap input::placeholder { color: #555; }

.btn-clear-search {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #1a1a1a;
  border: 1px solid #444;
  color: #aaa;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.btn-clear-search:hover { color: #fff; border-color: #888; }

/* ===== TAGLINE ===== */
.tagline-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 20px;
  padding: 28px 0;
  border-bottom: 1px solid #2a2a2a;
  user-select: none;
}
.tagline-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(240, 230, 140, 0.7) 12%,
    rgba(240, 230, 140, 0.85) 50%,
    rgba(240, 230, 140, 0.7) 88%,
    transparent 100%
  );
  transition: height 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.tagline-text {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.35),
               0 0 14px rgba(255, 255, 255, 0.15),
               0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  cursor: default;
  transition: color 0.3s ease, text-shadow 0.3s ease, transform 0.3s ease;
}
/* Hover the entire tagline row — text + lines glow together */
.tagline-wrap:hover .tagline-text {
  color: #f0e68c;
  text-shadow: 0 0 8px rgba(240, 230, 140, 0.8),
               0 0 18px rgba(240, 230, 140, 0.5),
               0 0 30px rgba(240, 230, 140, 0.3),
               0 1px 2px rgba(0, 0, 0, 0.8);
  transform: scale(1.03);
}
.tagline-wrap:hover .tagline-line {
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(240, 230, 140, 1) 12%,
    rgba(255, 248, 176, 1) 50%,
    rgba(240, 230, 140, 1) 88%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(240, 230, 140, 0.6),
              0 0 16px rgba(240, 230, 140, 0.3);
}
.lang-cn .tagline-text {
  letter-spacing: 1.5px;
  font-size: 1.05rem;
}

/* ===== CHAMPION GRID ===== */
.champ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 16px;
  padding: 14px 36px 650px;
  overflow-y: auto;
  flex: 1;
}

/* ===== CHAMPION CARD ===== */
.champ-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  scroll-margin-top: 10px;
}

.champ-img-wrap {
  width: 78px;
  height: 78px;
  overflow: hidden;
  display: block;
  border: 1px solid #333;
  box-sizing: border-box;
  transition: border-color 0.15s;
  position: relative;
}

/* Champions with custom Wild Rift splash art: soft 3px dark vignette around
   the edges that fades out toward the center. Sits above the image but below
   the corner badges (star / check), since they live at z-index: 3. */
.champ-img-wrap.has-custom-art::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 4px 4.24px rgba(0, 0, 0, 1);
  pointer-events: none;
  z-index: 2;
}
.champ-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center;
  transition: transform 0.2s ease;
}
.champ-img-wrap.zoom-2x img {
  transform: scale(2);
}

.champ-card .champ-name {
  margin-top: 5px;
  text-align: center;
  max-width: 78px;
  transition: color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.champ-card .champ-name .zh {
  font-size: 0.72rem;
  color: #eee;
  line-height: 1.2;
}

.champ-card .champ-name .en {
  font-size: 0.55rem;
  color: #888;
  line-height: 1.2;
  word-break: break-word;
}

.champ-card:hover .champ-name .zh { color: #fff; }
.champ-card:hover .champ-name .en { color: #aaa; }

.champ-card:hover .champ-img-wrap      { border-color: #fff; }
.champ-card:hover .champ-name { color: #ddd; }

/* Pool states */
.champ-card.is-in-pool .champ-img-wrap   { border-color: #444; }
.champ-card.is-in-pool .champ-name { color: #888; }
.champ-card.is-in-pool:hover .champ-img-wrap   { border-color: #fff; }

.champ-card.not-in-pool {
  opacity: 0.55;
}
.champ-card.not-in-pool:hover { opacity: 0.85; }

/* Jungle mark */
.champ-card.is-jungle .champ-img-wrap {
  box-shadow: inset 0 0 0 2px #555;
}

/* Hover trigger zone — bottom portion of the image. Top strip reserved for ★/✓. */
.card-hover-zone {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(100% - 24px);
  z-index: 1;
  cursor: pointer;
}

/* Checkmark badge — 28×24 transparent hit area, 16×16 visual icon inside */
.card-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  pointer-events: auto;
  cursor: pointer;
  box-sizing: border-box;
  z-index: 3;
}
.card-badge-icon {
  width: 16px;
  height: 16px;
  background: #fff;
  color: #000;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  pointer-events: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.card-badge:hover .card-badge-icon {
  transform: scale(1.15);
  background: #e8e8e8;
}

/* Hollow checkbox — shown on hover for unselected champions */
.card-badge-hollow {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 24px;
  box-sizing: border-box;
  background: transparent;
  border: none;
  opacity: 0.5;
  transition: opacity 0.15s ease;
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}
.card-badge-hollow::after {
  content: '✓';
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 1px solid #f0e68c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.champ-card:hover .card-badge-hollow {
  opacity: 1;
}
.champ-card:hover .card-badge-hollow::after {
  border-color: #fff;
}
.card-badge-hollow:hover::after {
  background: #fff;
  color: #000;
  border-color: #fff;
  transform: scale(1.1);
}

/* Star (pin to front) — 28×24 transparent hit area, 16×16 visual icon inside */
.card-star {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 24px;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  z-index: 3;
  transition: opacity 0.15s ease;
}
.card-star-icon {
  width: 16px;
  height: 16px;
  background: #000;
  border: 1px solid #f0e68c;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  pointer-events: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

/* In-pool stars — always visible */
.card-star.is-pool { opacity: 1; }
.card-star.is-pool:not(.is-starred):hover .card-star-icon {
  background: rgba(240, 230, 140, 0.3);
  border-color: #f0e68c;
  transform: scale(1.15);
}

/* Starred state */
.card-star.is-starred .card-star-icon {
  background: #f0e68c;
  border-color: #f0e68c;
  color: #1a1a1a;
}
.card-star.is-starred:hover .card-star-icon {
  background: #fff3a0;
  border-color: #fff3a0;
}

.card-star:active .card-star-icon {
  transform: scale(0.88);
  transition: transform 0.08s ease;
}

/* ===== INTERACTIVE HOVER PANEL ===== */
#tooltip {
  position: fixed;
  z-index: 9999;
  background: #111;
  border: 2px solid #f0e68c;
  box-shadow: 0 0 0 1px rgba(240,230,140,0.2), 0 6px 24px rgba(0,0,0,0.7);
  width: 230px;
  /* max-height and overflow-y set dynamically by positionHoverPanel() */
  overscroll-behavior: auto;
  pointer-events: auto;
}
#tooltip::-webkit-scrollbar { width: 6px; }
#tooltip::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
#tooltip::-webkit-scrollbar-thumb:hover { background: #666; }
#tooltip::-webkit-scrollbar-track { background: transparent; }
#tooltip.hidden { display: none; }

/* Gold ring on the active card */
.champ-card.hp-active {
  opacity: 1 !important;
}
.champ-card.hp-active .champ-img-wrap {
  border: 2px solid #f0e68c !important;
  box-shadow: none !important;
  filter: brightness(1) !important;
}
.champ-card.hp-active .champ-name .zh { color: #f5f0a0; }
.champ-card.hp-active .champ-name .en { color: #b8a840; }

.hp-champ-header {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
  padding: 9px 12px 8px;
  border-bottom: 1px solid #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-name {
  font-size: 0.72rem;
  color: #888;
  letter-spacing: 1px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #222;
  text-transform: uppercase;
}

.hp-section {
  padding: 8px 12px 10px;
}

.hp-divider {
  height: 1px;
  background: #222;
}

.hp-hint {
  font-size: 0.82rem;
  color: #888;
  line-height: 1.8;
  padding: 6px 12px;
}
.hp-hint-label {
  color: #bbb;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.hp-chain-list {
  list-style: disc;
  padding-left: 18px;
  margin: 4px 0;
}
.hp-chain-list li {
  padding: 2px 0;
}

.hp-kw {
  color: #ccc;
  display: inline;
  position: relative;
  padding: 1px 4px;
  font-weight: 600;
  transition: color 0.15s ease, transform 0.15s ease, text-shadow 0.15s ease;
  cursor: default;
}
.hp-kw:hover {
  color: #f0e68c;
  transform: scale(1.2);
  text-shadow: 0 0 8px rgba(240,230,140,0.6);
  z-index: 10;
}

.hp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.hp-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hp-plus-btn {
  background: transparent;
  border: 1px solid #555;
  color: #bbb;
  width: 18px;
  height: 18px;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.12s, border-color 0.12s;
}
.hp-plus-btn:hover { border-color: #fff; color: #fff; }

.hp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.hp-tag {
  background: rgba(240,230,140,0.08);
  border: 1px solid #f0e68c;
  color: #f0e68c;
  font-size: 0.82rem;
  padding: 3px 8px 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hp-tag-link {
  cursor: pointer;
  transition: color 0.12s;
}
.hp-tag-link:hover { color: #fff; }

.hp-tag-x {
  background: transparent;
  border: none;
  color: #666;
  font-size: 0.88rem;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
}
.hp-tag-x:hover { color: #cc6666; }

.hp-picker-label {
  font-size: 0.58rem;
  color: #aaa;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.hp-picker-label-selected { color: #b8a840; }

.hp-tag-picker-divider {
  height: 1px;
  background: #333;
  margin: 6px 0;
}

.hp-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.hp-tag-option {
  background: transparent;
  border: 1px solid #444;
  color: #bbb;
  font-size: 0.68rem;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.hp-tag-option:hover { border-color: #aaa; color: #eee; background: #1a1a1a; }

.hp-tag-option-selected {
  border-color: #f0e68c;
  color: #f0e68c;
  background: rgba(240,230,140,0.08);
}
.hp-tag-option-selected:hover { border-color: #f5f0a0; color: #f5f0a0; background: rgba(240,230,140,0.15); }

.hp-counters {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}

.hp-counter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
}
.hp-counter-item img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border: 1px solid #333;
  flex-shrink: 0;
}
.hp-nav-img {
  cursor: pointer;
  transition: border-color 0.12s, opacity 0.12s;
}
.hp-nav-img:hover { border-color: #f0e68c !important; opacity: 1; }

.hp-nav-name {
  cursor: pointer;
  transition: color 0.12s;
}
.hp-nav-name:hover { color: #fff !important; }

.hp-counter-item span {
  flex: 1;
  font-size: 0.88rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-counter-search,
.hp-tag-search {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #333;
  color: #ddd;
  font-size: 0.78rem;
  padding: 5px 0 4px;
  outline: none;
  margin-top: 4px;
  font-family: inherit;
}
.hp-counter-search::placeholder,
.hp-tag-search::placeholder { color: #555; }
.hp-tag-search { margin-bottom: 6px; }

.hp-counter-results {
  max-height: 130px;
  overflow-y: auto;
  margin-top: 3px;
}

.hp-result-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  cursor: pointer;
  transition: background 0.1s;
}
.hp-result-row:hover { background: #1a1a1a; }
.hp-result-row img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border: 1px solid #333;
  flex-shrink: 0;
}
.hp-result-row span {
  font-size: 0.75rem;
  color: #ccc;
}

.hp-empty {
  color: #888;
  font-size: 0.82rem;
  padding: 4px 0;
  font-style: italic;
}

/* ===== EDIT MODAL ===== */
#edit-modal {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
}
#edit-modal.hidden { display: none; }

.modal-box {
  background: #111;
  border: 1px solid #333;
  width: 90%;
  max-width: 460px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}

.modal-champ {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-champ img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid #444;
}

.modal-champ-name {
  font-size: 1rem;
  letter-spacing: 1px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #777;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: #fff; }

.modal-body {
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Modal section */
.modal-section-label {
  font-size: 0.68rem;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* Tags */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  margin-bottom: 10px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  color: #ccc;
  font-size: 0.75rem;
  padding: 3px 10px;
}

.tag-pill button {
  background: transparent;
  border: none;
  color: #666;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}
.tag-pill button:hover { color: #fff; }

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid #333;
  color: #fff;
  padding: 8px 12px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}
.input-row input:focus { border-color: #666; }
.input-row input::placeholder { color: #555; }

.btn-add {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  padding: 8px 14px;
  font-size: 0.78rem;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-add:hover { border-color: #fff; color: #fff; }

/* Counters in modal */
.counters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
  margin-bottom: 10px;
}

.counter-pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}

.counter-pill img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border: 1px solid #333;
}

.counter-pill .cpill-name {
  font-size: 0.58rem;
  color: #888;
  text-align: center;
  width: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.counter-pill .cpill-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  background: #1a1a1a;
  border: 1px solid #444;
  color: #888;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, border-color 0.15s;
}
.counter-pill .cpill-remove:hover { color: #fff; border-color: #888; }

/* Counter search dropdown */
.counter-search-wrap {
  position: relative;
}

.counter-dropdown {
  border: 1px solid #333;
  border-top: none;
  max-height: 150px;
  overflow-y: auto;
  background: #0d0d0d;
}

.counter-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.counter-drop-item:hover { background: #1a1a1a; }
.counter-drop-item img {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 1px solid #333;
}
.counter-drop-item span {
  font-size: 0.82rem;
  color: #ddd;
}

/* Jungle toggle */
.jungle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.jungle-label {
  font-size: 0.82rem;
  color: #ddd;
  letter-spacing: 1px;
}

.toggle-track {
  width: 38px;
  height: 20px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 0;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s;
  flex-shrink: 0;
}
.toggle-track.on { border-color: #fff; }

.toggle-knob {
  width: 12px;
  height: 12px;
  background: #555;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.2s, background 0.2s;
}
.toggle-track.on .toggle-knob {
  transform: translateX(18px);
  background: #fff;
}

/* Remove from pool */
.btn-danger {
  background: transparent;
  border: 1px solid #4a2020;
  color: #aa6666;
  padding: 8px 18px;
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
  align-self: flex-start;
}
.btn-danger:hover { border-color: #aa4444; color: #ee8888; }

/* ===== ADD SCREEN ===== */
#add-screen {
  overflow-y: auto;
  height: 100vh;
  margin: 0 auto;
}

.title-box {
  position: relative;
  border: 1px solid #f0e68c;
  padding: 4px 12px 3px;
  box-shadow: 0 0 0 1px rgba(240,230,140,0.08), inset 0 0 12px rgba(240,230,140,0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.title-box:hover {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px rgba(240,230,140,0.4), inset 0 0 16px rgba(240,230,140,0.06);
}
/* Logo hover independently */
.nav-logo:hover {
  transform: scale(1.04);
}
/* corner accents — all four corners */
.title-corner {
  position: absolute;
  width: 6px;
  height: 6px;
  border-color: #f0e68c;
  border-style: solid;
}
.title-corner-tl { top: -3px; left: -3px; border-width: 1px 0 0 1px; }
.title-corner-tr { top: -3px; right: -3px; border-width: 1px 1px 0 0; }
.title-corner-bl { bottom: -3px; left: -3px; border-width: 0 0 1px 1px; }
.title-corner-br { bottom: -3px; right: -3px; border-width: 0 1px 1px 0; }

#add-screen .screen-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: #ffe680;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 230, 128, 0.6),
               0 0 16px rgba(255, 230, 128, 0.3);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.title-box:hover h2 {
  color: #fff8b0;
  text-shadow: 0 0 12px rgba(255, 230, 128, 0.9),
               0 0 24px rgba(255, 230, 128, 0.5);
}
.title-box:hover .title-desc {
  color: #fff;
}

.title-desc {
  font-size: 0.92rem;
  color: #fff;
  letter-spacing: 0.5px;
  margin-top: 5px;
  line-height: 1.3;
  font-weight: 300;
  max-width: 520px;
  transition: text-shadow 0.2s ease;
}
.title-box:hover .title-desc {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5),
               0 0 16px rgba(255, 255, 255, 0.2);
}

/* Footer at the very bottom of #add-screen, separated by a hairline divider */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #000;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 24px 18px;
  user-select: none;
}
.footer-copyright,
.footer-visits,
.title-version {
  font-size: 0.82rem;
  color: #888;
  letter-spacing: 1.2px;
  font-weight: 400;
}
.footer-copyright { flex: 1; text-align: left; }
.footer-visits {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  text-align: center;
}
.title-version { flex: 1; text-align: right; }
.footer-visits #visit-count {
  color: #f0e68c;
  font-weight: 600;
  margin-left: 2px;
  transition: transform 0.25s ease;
}
.footer-real-visits {
  font-size: 0.78rem;
  color: #666;
  letter-spacing: 1px;
  font-weight: 400;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.footer-real-visits #real-visit-count {
  color: #aaa;
  font-weight: 500;
  margin-left: 2px;
}
.visit-bubble {
  position: absolute;
  top: 50%;
  right: -14.5px;
  transform: translateY(-50%);
  color: #f0e68c;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  pointer-events: none;
  filter: blur(0.3px);
  opacity: 0;
  z-index: 100;
  white-space: nowrap;
  animation: visit-bubble-fly 1.2s ease-out forwards;
}
@keyframes visit-bubble-fly {
  0%   { opacity: 0; transform: translateY(-50%) translateX(0); }
  15%  { opacity: 0.8; transform: translateY(-80%) translateX(0); }
  20%  { opacity: 1; transform: translateY(-80%) translateX(0); }
  25%  { opacity: 0.5.; transform: translateY(-80%) translateX(0); }
  40%  { opacity: 0.2; transform: translateY(-140%) translateX(0); }
  100% { opacity: 0; transform: translateY(-220%) translateX(0); }
}

#add-screen .screen-header h2 .title-sep {
  color: #888;
  font-weight: 300;
  margin: 0 4px;
  letter-spacing: 0;
}

#add-grid {
  flex: unset;
  overflow-y: visible;
  align-content: start;
}

.add-selected-label {
  padding: 22px 28px 10px;
  font-size: 1.7rem;
  font-weight: 800;
  color: #f5eac8;
  font-family: 'Cormorant Garamond', 'Noto Serif SC', Georgia, 'Songti SC', serif;
  letter-spacing: 3.5px;
  text-shadow: 0 0 8px rgba(245, 234, 200, 0.5),
               0 0 18px rgba(245, 234, 200, 0.25),
               0 1px 3px rgba(0, 0, 0, 0.55);
}

/* Pool / starred filter checkboxes shown under "My Champion Pool" label */
.pool-filters {
  display: flex;
  gap: 18px;
  padding: 4px 28px 0;
}
.pool-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  color: #bbb;
  letter-spacing: 1px;
  transition: color 0.15s ease;
}
.pool-filter-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pool-filter-box {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 1.5px solid #555;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pool-filter-box::after {
  content: '';
  width: 7px;
  height: 7px;
  background: #f0e68c;
  transform: scale(0);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pool-filter-check:hover .pool-filter-box {
  border-color: #f0e68c;
}
.pool-filter-check input:checked + .pool-filter-box {
  border-color: #f0e68c;
  background: rgba(240, 230, 140, 0.08);
}
.pool-filter-check input:checked + .pool-filter-box::after {
  transform: scale(1);
}
.pool-filter-check input:checked ~ .pool-filter-label {
  color: #f0e68c;
  font-weight: 600;
}

.filter-clear-btn {
  background: transparent;
  border: 1px solid #555;
  color: #888;
  width: 14px;
  height: 14px;
  font-size: 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.filter-clear-btn:hover {
  border-color: #e06c6c;
  color: #fff;
  background: #e06c6c;
}

/* ===== KEYWORD CHIPS ===== */
.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 20px 10px;
}

.kw-chip {
  position: relative;
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #ccc;
  padding: 8px 20px;
  font-size: 1rem;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: all 0.15s;
}
.kw-chip-label { display: inline-block; }
.kw-chip-star,
.kw-chip-x {
  position: absolute;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 2;
  font-weight: 700;
}
.kw-chip-star {
  top: -6px;
  left: -6px;
  border: 1.5px solid #f0e68c;
  color: #f0e68c;
  background: #111;
}
.kw-chip-x {
  top: -6px;
  right: -6px;
  border: 1.5px solid #c55;
  color: #e88;
  background: #111;
  font-size: 11px;
  text-align: center;
}
/* Hover zones (kept in DOM but no longer used for split detection) */
.kw-zone { display: none; }

/* Show both star + x when hovering the chip */
.kw-chip:hover .kw-chip-star,
.kw-chip:hover .kw-chip-x,
.kw-chip-star:hover,
.kw-chip-x:hover {
  opacity: 1;
  pointer-events: auto;
}
.kw-chip-star:hover {
  background: #f0e68c;
  color: #1a1a1a;
  transform: scale(1.15);
}
.kw-chip-x:hover {
  background: #c55;
  color: #fff;
  transform: scale(1.15);
}
/* Already-starred chip: star icon filled */
.kw-chip-priority .kw-chip-star {
  background: #f0e68c;
  color: #1a1a1a;
}
.kw-chip-priority .kw-chip-star:hover {
  background: #fff3a0;
}
.kw-chip:hover  { border-color: #aaa; color: #fff; }
.kw-chip.active {
  border-color: #f0e68c;
  color: #1a1a1a;
  background: #f0e68c;
  box-shadow: 0 0 12px rgba(240, 230, 140, 0.5);
  font-weight: 600;
}

.kw-chip-all { border-color: #2a2a2a; }
.kw-chip-all.active {
  border-color: #f0e68c;
  color: #1a1a1a;
  background: #f0e68c;
  box-shadow: 0 0 12px rgba(240, 230, 140, 0.5);
  font-weight: 600;
}

/* Priority / pinned keywords — subtle gold highlight to stand out even when not selected */
.kw-chip-priority {
  border-color: rgba(240, 230, 140, 0.55);
  color: #e8d88a;
  background: rgba(240, 230, 140, 0.05);
  font-weight: 600;
  box-shadow: 0 0 6px rgba(240, 230, 140, 0.1);
}
.kw-chip-priority:hover {
  border-color: #f0e68c;
  color: #fff8b0;
  background: rgba(240, 230, 140, 0.12);
  box-shadow: 0 0 10px rgba(240, 230, 140, 0.25);
}
.kw-chip-priority.active {
  border-color: #f0e68c;
  color: #1a1a1a;
  background: #f0e68c;
  box-shadow: 0 0 12px rgba(240, 230, 140, 0.5);
}

.kw-chip-plus {
  border-style: solid;
  color: #aaa;
  padding: 0;
  width: 36px;
  height: 36px;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
}
.kw-chip-plus:hover { border-color: #bbb; color: #fff; }
.kw-chip-plus.active { border-color: #f0e68c; color: #f0e68c; background: rgba(240,230,140,0.08); }

/* Keyword add panel (create new keyword) */
.kw-add-panel {
  margin: 8px 20px 0;
  background: #111;
  border: 1px solid #333;
  padding: 8px 12px;
  flex-shrink: 0;
}
.kw-add-panel.hidden { display: none; }

.kw-create-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kw-create-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid #333;
  color: #ddd;
  font-size: 1rem;
  padding: 6px 0;
  outline: none;
  font-family: inherit;
}
.kw-create-input::placeholder { color: #555; }

/* "Mark as starred" checkbox in the create keyword panel */
.kw-star-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 1rem;
  color: #bbb;
  letter-spacing: 0.5px;
}
.kw-star-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.kw-star-check-box {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 1.5px solid #555;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.kw-star-check:hover .kw-star-check-box {
  border-color: #f0e68c;
}
.kw-star-check input:checked + .kw-star-check-box {
  border-color: #f0e68c;
  background: #f0e68c;
  color: #1a1a1a;
}
.kw-star-check input:checked ~ span:not(.kw-star-check-box) {
  color: #f0e68c;
  font-weight: 600;
}

.kw-create-btn {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: #888;
  font-size: 1rem;
  padding: 6px 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.kw-create-btn:hover { border-color: #aaa; color: #eee; }

/* ===== LANE TABS (ADD SCREEN) ===== */
.lane-tabs {
  display: flex;
  gap: 0;
  padding: 10px 20px 0;
  border-bottom: 1px dashed #2a2a2a;
}

.lane-tab {
  background: transparent;
  color: #bbb;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.lane-tab:hover  { color: #fff; }
.lane-tab.active {
  color: #f0e68c;
  border-bottom-color: #f0e68c;
  text-shadow: 0 0 6px rgba(240, 230, 140, 0.3);
}

/* ===== VIEW TOGGLE ===== */
.hidden { display: none !important; }

/* ===== EXPORT BUTTON ===== */
.export-btn {
  background: #000;
  border: 1px solid #fff;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1px;
  padding: 7px 14px;
  margin-right: 0;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}
.export-btn:hover {
  background: #1a1a1a;
  border-color: #fff;
  color: #fff;
  transform: scale(1.03);
}

/* ===== LANGUAGE TOGGLE ===== */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  font-size: 0.92rem;
  letter-spacing: 1.2px;
  font-weight: 600;
  color: #666;
  transition: color 0.2s;
  flex-shrink: 0;
}
.lang-toggle:hover { color: #aaa; transform: scale(1.03); }
.lang-label { transition: color 0.2s; }
body.lang-en .lang-toggle .lang-label-en,
body.lang-cn .lang-toggle .lang-label-cn {
  color: #f0e68c;
}
.lang-track {
  position: relative;
  width: 58px;
  height: 28px;
  background: #111;
  border: 1px solid #333;
  border-radius: 999px;
  transition: border-color 0.2s, background 0.2s;
  display: inline-block;
}
.lang-toggle:hover .lang-track {
  border-color: #f0e68c;
  background: #1a1a1a;
}
.lang-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
body.lang-cn .lang-knob { transform: translateX(30px); }
.lang-flag { display: none; }
body.lang-en .lang-flag-en { display: inline; }
body.lang-cn .lang-flag-cn { display: inline; }

/* ===== EN MODE: swap champion name sizes (English primary) ===== */
body.lang-en .champ-card .champ-name { flex-direction: column-reverse; }
body.lang-en .champ-card .champ-name .zh {
  font-size: 0.55rem;
  color: #888;
}
body.lang-en .champ-card .champ-name .en {
  font-size: 0.72rem;
  color: #eee;
}
body.lang-en .champ-card:hover .champ-name .zh { color: #aaa; }
body.lang-en .champ-card:hover .champ-name .en { color: #fff; }
body.lang-en .champ-card.hp-active .champ-name .zh { color: #b8a840; }
body.lang-en .champ-card.hp-active .champ-name .en { color: #f5f0a0; }

/* ===== RESPONSIVE / MOBILE LAYOUT ===== */

/* Tablet / narrow laptop: soften sizes */
@media (max-width: 900px) {
  .screen-header {
    gap: 12px;
    padding: 14px 14px;
  }
  .nav-logo {
    width: 110px;
    height: 72px;
  }
  #add-screen .screen-header h2 {
    font-size: 1.1rem;
    letter-spacing: 3px;
  }
  .title-desc {
    font-size: 0.72rem;
  }
  .export-btn {
    font-size: 0.78rem;
    padding: 7px 14px;
    margin-right: 10px;
  }
  .lang-toggle {
    font-size: 0.82rem;
    gap: 8px;
  }
}

/* Mobile: stack header into two rows, shrink aggressively */
@media (max-width: 640px) {
  .screen-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    row-gap: 8px;
    position: static;
    z-index: auto;
  }
  .nav-logo {
    width: 96px;
    height: 64px;
  }
  .title-box {
    flex: 1 1 0;
    min-width: 0;
    padding: 4px 10px;
  }
  #add-screen .screen-header h2 {
    font-size: 0.82rem;
    letter-spacing: 1.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .title-desc {
    font-size: 0.66rem;
    letter-spacing: 0.3px;
    line-height: 1.4;
    margin-top: 3px;
  }
  .header-right {
    margin-left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }
  .export-btn {
    font-size: 0.72rem;
    padding: 6px 10px;
    margin-right: 0;
    letter-spacing: 0.8px;
  }
  .lang-toggle {
    font-size: 0.78rem;
    gap: 6px;
    padding: 4px 2px;
  }
  .lang-track {
    width: 48px;
    height: 24px;
  }
  .lang-knob {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }
  body.lang-cn .lang-knob { transform: translateX(24px); }

  .lane-tabs {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #111;
    padding: 8px 12px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 2px dashed #f0e68c;
    display: flex;
    min-height: 44px;
  }
  .lane-tabs::-webkit-scrollbar { display: none; }
  .lane-tab {
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    flex-shrink: 0;
  }

  .keyword-chips {
    padding: 8px 12px 6px;
  }
  .keyword-chips .kw-chip {
    font-size: 0.78rem;
    padding: 5px 12px;
  }
  .keyword-chips .kw-chip-plus {
    width: 24.5px;
    height: 24.5px;
    padding: 0;
    font-size: 1rem;
    align-self: center;
  }
  /* Mobile: show both star + x on chip hover (no zone-based split) */
  .kw-chip:hover .kw-chip-star,
  .kw-chip:hover .kw-chip-x {
    opacity: 1;
    pointer-events: auto;
  }
  .search-wrap {
    padding: 8px 12px 0;
  }
  .search-wrap input {
    border-radius: 4px;
  }
  .tagline-wrap {
    margin: 6px 12px 0;
    padding: 12px 0;
    border-bottom: 1px solid #2a2a2a;
  }
  .tagline-text {
    font-size: 0.88rem;
    letter-spacing: 0.4px;
    white-space: normal;
    text-align: center;
    color: #fff;
  }
  .tagline-line {
    flex: 1;
    max-width: 40px;
  }
  .champ-grid {
    padding: 10px 28px 500px;
    gap: 9px;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }
  .champ-img-wrap {
    width: 100%;
    max-width: 78px;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 14px;
  }
  .site-footer .title-version,
  .site-footer .footer-copyright {
    font-size: 0.7rem;
    letter-spacing: 0.8px;
  }
  .title-box::before,
  .title-box::after { display: none; }
}

/* Very narrow phones: tighten further */
@media (max-width: 400px) {
  .nav-logo {
    width: 56px;
    height: 38px;
  }
  #add-screen .screen-header h2 {
    font-size: 0.72rem;
    letter-spacing: 1px;
  }
  .export-btn {
    font-size: 0.66rem;
    padding: 5px 8px;
  }
  .lane-tab {
    padding: 6px 9px;
    font-size: 0.72rem;
  }
  .champ-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  }
}

/* ===== AUTH BUTTON + SYNC DOT ===== */
.auth-btn {
  background: #000;
  border: 1px solid #fff;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1.2px;
  padding: 7px 14px;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-btn:hover {
  background: #1a1a1a;
  transform: scale(1.03);
}
.auth-btn.signed-in {
  border-color: #f0e68c;
  color: #f0e68c;
  font-weight: 500;
  letter-spacing: 0.6px;
  text-transform: none;
}
.auth-btn.signed-in:hover {
  background: rgba(240, 230, 140, 0.08);
}

.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  margin: 0 4px 0 -6px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}
.sync-dot.syncing {
  background: #f0e68c;
  box-shadow: 0 0 6px rgba(240, 230, 140, 0.6);
  animation: sync-pulse 1s ease-in-out infinite;
}
.sync-dot.saved {
  background: #6fcf7a;
  box-shadow: 0 0 4px rgba(111, 207, 122, 0.4);
}
.sync-dot.sync-error {
  background: #e06c6c;
  box-shadow: 0 0 6px rgba(224, 108, 108, 0.5);
}
@keyframes sync-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ===== AUTH / MERGE MODAL ===== */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal-panel {
  position: relative;
  background: #141414;
  border: 1px solid #333;
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.auth-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.auth-modal-close:hover { color: #fff; }

.auth-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0e68c;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.auth-modal-sub {
  font-size: 0.82rem;
  color: #bbb;
  margin-bottom: 14px;
  line-height: 1.5;
}
.auth-modal-email {
  font-size: 0.92rem;
  color: #f0e68c;
  margin-bottom: 16px;
  word-break: break-all;
}
.auth-email-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #333;
  color: #fff;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 12px;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.auth-email-input:focus {
  outline: none;
  border-color: #f0e68c;
}
.auth-modal-btn {
  width: 100%;
  background: transparent;
  border: 1px solid #555;
  color: #fff;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.auth-modal-btn:hover:not(:disabled) {
  background: rgba(240, 230, 140, 0.08);
  border-color: #f0e68c;
  color: #f0e68c;
}
.auth-modal-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.auth-modal-msg {
  font-size: 0.78rem;
  color: #888;
  margin-top: 8px;
  min-height: 1.2em;
}
.auth-modal-msg.ok  { color: #6fcf7a; }
.auth-modal-msg.err { color: #e06c6c; }
.auth-modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #bbb;
  margin: 10px 0 14px;
  cursor: pointer;
  user-select: none;
}
.auth-modal-check input { cursor: pointer; }
.auth-modal-danger {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #2a2a2a;
}
.auth-modal-danger .btn-danger {
  width: 100%;
  background: transparent;
  border: 1px solid #552222;
  color: #cc6666;
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.auth-modal-danger .btn-danger:hover {
  border-color: #aa4444;
  color: #ee8888;
  background: rgba(170, 68, 68, 0.08);
}

.merge-stats {
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  padding: 10px 12px;
  margin: 8px 0 14px;
  font-size: 0.78rem;
  color: #aaa;
  line-height: 1.8;
}
.merge-stats b { color: #fff; font-weight: 600; }

@media (max-width: 640px) {
  .auth-row {
    width: 100%;
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    align-items: center;
    gap: 8px;
    order: 10;
  }
  .auth-row .auth-btn {
    font-size: 0.72rem;
    padding: 6px 10px;
    letter-spacing: 0.8px;
    flex: 1;
    max-width: none;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    border-color: #555;
    transition: border-color 0.3s ease, color 0.15s ease;
  }
  .auth-row .sync-dot {
    margin: 0;
  }
  .auth-row .sync-dot.syncing ~ .auth-btn { border-color: #f0e68c; color: #f0e68c; }
  .auth-row .sync-dot.saved ~ .auth-btn { border-color: #6fcf7a; color: #6fcf7a; }
  .auth-row .sync-dot.sync-error ~ .auth-btn { border-color: #e06c6c; color: #e06c6c; }
  .header-right .export-btn,
  .header-right #import-btn {
    flex: 1;
  }
  .header-right .lang-toggle {
    flex: 0 0 auto;
  }
  .auth-modal-panel {
    padding: 22px 18px 18px;
  }
}
