.row-highlight {
  outline: 2px solid #60a5fa;
  background: rgba(96,165,250,0.08);
  transition: background 0.3s ease, outline-color 0.3s ease;
}
/* Update indicator */
.update-indicator {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  color: #4CAF50;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 1;
  transform: translateX(0);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.update-indicator.show {
  opacity: 1;
  transform: translateX(0);
}

.update-indicator i {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Style for zero count items in inventory */
.tchip.zero-count {
  opacity: 0.6;
  filter: grayscale(0.3);
  justify-content: center;
  text-align: center;
}

.tchip.zero-count .num {
  color: #6b7280;
}

.hint.key-empty {
  background: rgba(252, 231, 121, 0.1);
  border: 1px dashed rgba(252, 211, 77, 0.6);
  color: #fcd34d;
  padding: 10px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hint.key-empty i {
  color: #f59e0b;
}

/* Prevent white flash on page load */
html, body {
  background: linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%) !important;
  background-attachment: fixed !important;
  transition: background 0.1s ease;
}

/* Enhanced skeleton loading animations */
.tchip.placeholder,
tr.placeholder {
  opacity: 0.6;
  animation: skeletonPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
/* Stable skeleton chips to avoid layout jump */
.list-table .primary,.list-table .pc-name,.num-pill{min-width:120px}

.skeleton-icon,
.skeleton-text,
.skeleton-number,
.skeleton-text-small {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.skeleton-text {
  height: 16px;
  width: 80%;
}

.skeleton-number {
  height: 14px;
  width: 60px;
}

.skeleton-text-small {
  height: 12px;
  width: 120px;
}

/* Enhanced keyframe animations */
@keyframes skeletonPulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes skeletonShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Smooth loading transitions */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hide {
  opacity: 1;
  visibility: visible;
}

.loading-card {
  text-align: center;
  color: #cbd5f5;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(203, 213, 245, 0.2);
  border-top: 3px solid #60a5fa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.loading-msg {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 14px;
  color: #9cb0d8;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Smooth fade transitions */
.soft-fade {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.soft-fade-out {
  opacity: 0;
  transform: translateY(10px);
}

/* Smooth number animations */
.animating {
  animation: numberPulse 0.6s ease-out;
}

@keyframes numberPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Smooth pop-in animations */
.pop-in {
  animation: popIn 0.4s ease-out;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Smooth page transitions */
.page-in {
  animation: pageIn 0.3s ease-out;
}

.page-out {
  animation: pageOut 0.2s ease-in;
}

@keyframes pageIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Enhanced toast animations */
.toast {
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
  transform: translateX(0);
  animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
  0% {
    transform: translateX(100%) scale(0.8);
    opacity: 0;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* Smooth interactive elements */
.clickable {
  transition: all 0.2s ease;
  cursor: pointer;
}

.clickable:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

.clickable:active {
  transform: scale(0.98);
}

/* Smooth form animations */
.ig-input:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.btn-primary:active, .btn-discord:active {
  transform: scale(0.95);
}

/* Smooth table animations */
.list-table tbody tr{transition:opacity .18s ease,transform .18s ease;transform-origin:left center;will-change:opacity,transform}

.list-table tbody tr:hover {
  transform: translateX(4px) scale(1.01);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Lock table layout to prevent column shifting on first paint */
.list-table{table-layout:fixed;width:100%;border-collapse:separate;border-spacing:0}
.list-table thead th,.list-table tbody td{overflow:hidden;text-overflow:ellipsis}
.list-table thead th:nth-child(1),.list-table tbody td:nth-child(1){width:32%}
.list-table thead th:nth-child(2),.list-table tbody td:nth-child(2){width:14%}
.list-table thead th:nth-child(3),.list-table tbody td:nth-child(3){width:14%}
.list-table thead th:nth-child(4),.list-table tbody td:nth-child(4){width:14%}
.list-table thead th:nth-child(5),.list-table tbody td:nth-child(5){width:12%}
.list-table thead th:nth-child(6),.list-table tbody td:nth-child(6){width:14%}

/* Keep numbers stable while values stream in */
.num-pill .num{display:inline-block;min-width:3.0ch;text-align:right}

/* Soft loading state to avoid flicker while fetching */
.list-table.loading tbody tr{opacity:.55;filter:grayscale(.15)}

/* Smooth pill hover effects */
.num-pill {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.num-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.num-pill:hover::before {
  left: 100%;
}

.num-pill:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Smooth status badge animations */
.status-badge {
  transition: all 0.2s ease;
}

.status-badge:hover {
  transform: scale(1.05);
}

/* Smooth divider animations */
.divider {
  transition: all 0.3s ease;
}

.divider:hover {
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.3), transparent);
}

/* Enhanced modal animations */
.modal {
  backdrop-filter: blur(0px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show {
  backdrop-filter: blur(8px);
  animation: modalBackdropIn 0.3s ease-out;
}

.modal.show .panel {
  animation: modalPanelIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalBackdropIn {
  0% {
    backdrop-filter: blur(0px);
    opacity: 0;
  }
  100% {
    backdrop-filter: blur(8px);
    opacity: 1;
  }
}

@keyframes modalPanelIn {
  0% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Smooth form animations */
.form-group {
  transition: all 0.2s ease;
}

.form-group:focus-within {
  transform: translateY(-2px);
}

.ig-input {
  transition: all 0.2s ease;
}

.ig-input:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* Smooth button animations */
.btn-primary, .btn-discord, .btn-danger {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before, .btn-discord::before, .btn-danger::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before, .btn-discord:hover::before, .btn-danger:hover::before {
  left: 100%;
}

.btn-primary:hover, .btn-discord:hover, .btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.btn-primary:active, .btn-discord:active, .btn-danger:active {
  transform: translateY(0) scale(0.98);
}

/* Smooth settings animations */
.settings-row {
  transition: all 0.2s ease;
  border-radius: 8px;
  padding: 8px;
}

.settings-row:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.settings-row.checked {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

/* Script modal styles */
.script-container {
  position: relative;
  margin: 16px 0;
}

.script-textarea {
  width: 100%;
  height: 210px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  tab-size: 2;
  cursor: default;
  user-select: all;
  -webkit-user-select: all;
  -moz-user-select: all;
  -ms-user-select: all;
  overflow: visible;
  pointer-events: auto;
}

.script-textarea:focus {
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.script-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.copy-btn {
  background: #4a9eff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #3a8eef;
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: #22c55e;
}

.copy-btn.copied i {
  animation: checkmark 0.3s ease;
}

@keyframes checkmark {
  0% { transform: scale(0) rotate(0deg); }
  50% { transform: scale(1.2) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

.skel {
  position: relative;
  overflow: hidden;
}

.skeleton-item {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.tchip.placeholder .skeleton-icon {
  width: 20px;
  height: 20px;
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.tchip.placeholder .label,
tr.placeholder .primary {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 16px;
  width: 80px;
  display: inline-block;
}

.tchip.placeholder .num,
tr.placeholder .num {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 16px;
  width: 40px;
  display: inline-block;
}

/* Skeleton text styles */
.skeleton-text {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 18px;
  width: 120px;
  display: inline-block;
}

.skeleton-text-small {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 14px;
  width: 60px;
  display: inline-block;
}

.skeleton-number {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 20px;
  width: 50px;
  display: inline-block;
}

.skeleton-dot {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 50%;
  width: 8px;
  height: 8px;
  display: inline-block;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 0.8;
  }
}
:root{
  --bgA:#0a0f1a;--bgB:#0d1421;--bgC:#0f1624;
  --text:#f1f5f9;--muted:#94a3b8;--line:#334155;
  --chip:#0f172a;--card:#1e293b;--shadow:0 20px 40px rgba(0,0,0,.4);
  --ok:#10b981;--down:#ef4444;
  --font-ui:"Inter","Noto Sans Thai",system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial;
  --card-grad:linear-gradient(145deg,#1e293b,#0f172a);
  --card-grad-2:linear-gradient(145deg,#334155,#1e293b);
  --glass-bg:rgba(255,255,255,.08);--glass-bd:rgba(255,255,255,.15);
  --ring:0 0 0 3px rgba(59,130,246,.4);
  --pad-xs:6px;--pad-sm:8px;--pad-md:12px;
  --fs-100:12px;--fs-200:13px;--fs-300:14px;--fs-400:16px;
  --primary:#3b82f6;--primary-hover:#2563eb;
  --secondary:#64748b;--secondary-hover:#475569;
  --success:#10b981;--warning:#f59e0b;--error:#ef4444;
  --border-radius:12px;--border-radius-lg:16px;
  --transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
*{box-sizing:border-box;scrollbar-width:none;-ms-overflow-style:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
*::-webkit-scrollbar{width:8px;height:8px}
html,body{height:100%;font-family:var(--font-ui);overflow-x:hidden;max-width:100vw;overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgba(59,130,246,0.3) transparent;background:linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%);background-attachment:fixed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px}
html::-webkit-scrollbar-track,body::-webkit-scrollbar-track{background:rgba(15,24,38,0.3);border-radius:4px}
html::-webkit-scrollbar-thumb,body::-webkit-scrollbar-thumb{background:rgba(59,130,246,0.4);border-radius:4px;transition:background 0.2s ease}
html::-webkit-scrollbar-thumb:hover,body::-webkit-scrollbar-thumb:hover{background:rgba(59,130,246,0.6)}
body{
  margin:0;color:var(--text);font-size:15px;line-height:1.6;
  background:linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
  transition:var(--transition);
  position:relative;
  overflow-x:hidden;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
body::before{
  content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
  background:
    radial-gradient(1200px 700px at 15% 0%, #111b3a 0%, transparent 60%),
    radial-gradient(900px 600px at 85% 100%, #0b1b34 0%, transparent 55%),
    linear-gradient(180deg,var(--bgA) 0%,var(--bgB) 50%,var(--bgC) 100%);
  background-repeat:no-repeat;background-color:var(--bgB)
}
.wrap{max-width:min(1280px,100%);margin:0 auto;padding:16px 14px;display:grid;row-gap:18px;overflow-x:hidden}
.title-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.title{font-size:28px;font-weight:900;letter-spacing:.2px;display:inline-flex;align-items:center;gap:.6rem}
.title .logo{
  display:inline-flex;width:36px;height:36px;border-radius:999px;align-items:center;justify-content:center;color:#fff;
  background:linear-gradient(145deg,#1e2b57,#0d1530);box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 10px 26px rgba(0,0,0,.35)
}
.title .logo i,.panel-hd h3 i{line-height:1;display:inline-block;vertical-align:middle}
.discord-avatar-btn{width:36px;height:36px;border-radius:50%;object-fit:cover;box-shadow:0 0 0 2px rgba(255,255,255,.35) inset}
.fab[hidden]{visibility:visible!important;opacity:1!important}
.bar{display:flex!important;flex-wrap:wrap!important;gap:10px;-webkit-overflow-scrolling:touch;padding:4px 0;scrollbar-width:none;-ms-overflow-style:none;justify-content:center!important;max-width:100%;width:100%}
#totals.bar{flex-wrap:wrap!important;row-gap:8px;overflow:visible}
.bar::-webkit-scrollbar{width:8px;height:8px}
#totals{position:sticky;top:8px;z-index:10;backdrop-filter:blur(6px);display:flex;width:100%;max-width:100%;background:transparent;border:0;justify-content:center}
/* ใช้แทนตัวเดิม */
.tchip{
  display:inline-flex;           /* inline-flex ให้วางต่อข้อความได้ และกว้างเท่าที่ต้อง */
  align-items:center;
  justify-content:center;
  gap:8px;

  /* ล็อกความสูงไว้ แล้วคุมระยะด้านข้างด้วย padding */
  height:40px;                   /* <<< ล็อกสูง */
  padding:0 14px;                /* เอา padding บน-ล่างออก ให้สูงคงที่ */

  border-radius:14px;
  background:linear-gradient(145deg,rgba(30,42,68,0.9),rgba(15,24,38,0.8));
  border:1px solid rgba(255,255,255,0.1);
  box-shadow:0 6px 20px rgba(0,0,0,0.4),inset 0 1px 0 rgba(255,255,255,0.1);
  flex-shrink:0;                 /* กันถูกบีบใน flex parent */
  white-space:nowrap;
  backdrop-filter:blur(8px);

  /* เลิกใช้ min-width:fit-content เพราะรีเฟรชแล้วชอบคำนวณใหม่ */
  /* min-width:fit-content;  <-- ลบออก */
}

/* ไอคอน/รูปภายใน ให้มีขนาดตายตัวกันเลย์เอาท์เด้ง */
.tchip__icon{
  width:18px; height:18px;
  flex:0 0 18px;
  display:inline-block;
}

/* ข้อความ: คุม line-height ให้ไม่ดันความสูง */
.tchip__label{
  line-height:1;                 /* ป้องกันบรรทัดดันสูง */
  font-size:14px;
}

.tchip.info{opacity:.85}
.tchip img{width:16px;height:16px;border-radius:4px;object-fit:contain;background:#0f1826}
.tchip .label{opacity:.92;font-weight:600;letter-spacing:.2px}
.tchip .num{font-weight:800;flex-shrink:0}
.tchip:hover,.tchip:focus-visible{transform:translateY(-1px);box-shadow:0 8px 24px rgba(0,0,0,.22),inset 0 0 0 999px rgba(255,255,255,.02);border-color:rgba(138,180,255,.25);outline:none}
.tchip:active{transform:translateY(0) scale(.99)}
.tchip img{width:26px;height:26px;border-radius:8px;object-fit:contain;background:#0b1226;border:1px solid #1e2a44;image-rendering:-webkit-optimize-contrast;image-rendering:crisp-edges;transform:translateZ(0)}
.tchip .label{color:#cbd9ff;font-weight:800;flex-shrink:0}
.tchip .num{font-weight:900;font-variant-numeric:tabular-nums;color:#e6eefc;text-shadow:0 1px 2px rgba(0,0,0,.3)}
.divider{
  height:1px;
  margin:12px 0;
  background:transparent;
  opacity:0.3;
  border-radius:1px
}
.list-divider{
  height:3px;
  background:linear-gradient(90deg,
    transparent 0%,
    rgba(96, 165, 250, 0.1) 15%,
    rgba(96, 165, 250, 0.3) 30%,
    rgba(96, 165, 250, 0.5) 50%,
    rgba(96, 165, 250, 0.3) 70%,
    rgba(96, 165, 250, 0.1) 85%,
    transparent 100%
  );
  margin:20px 0 24px 0;
  border-radius:2px;
  position: relative;
  overflow: hidden;
}

.list-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(96, 165, 250, 0.2),
    transparent
  );
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}
.chip{
  display:flex;align-items:center;gap:10px;background:var(--chip);border:1px solid var(--line);
  border-radius:12px;padding:8px 10px;font-size:13px;color:var(--muted);
  width:100%;min-width:0;max-width:100%;overflow:hidden;white-space:nowrap
}
.chip img{width:18px;height:18px;border-radius:6px;object-fit:contain;background:#0b1226;border:1px solid #1e2a44}
.chip .label{color:#cbd9ff;white-space:nowrap;font-weight:700;margin-right:auto;min-width:0;overflow:hidden;text-overflow:ellipsis;max-width:60%}
.chip .num,.num,.dval,.today-pill .val{font-variant-numeric:tabular-nums}
.chip .ipill{
  --pill-h:32px;height:var(--pill-h);padding:0 12px;border-radius:calc(var(--pill-h)/2);
  display:inline-flex;align-items:center;gap:8px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);font-weight:800;color:#cfe0ff;flex:0 0 auto
}
.chip .ipill i{width:16px;text-align:center;font-size:14px;line-height:1;opacity:.95}
.chip .ipill .val{font-weight:900;line-height:1;color:#e6eefc}

/* mini pills colors */
.chip .ipill.abs{background:rgba(59,130,246,.12);border-color:rgba(59,130,246,.35);color:#bfdbfe}
.chip .ipill.abs i,.chip .ipill.abs .val{color:#bfdbfe}
.chip .ipill.buff.dino{background:rgba(34,197,94,.12);border-color:rgba(34,197,94,.35);color:#86efac}
.chip .ipill.buff.dino i,.chip .ipill.buff.dino .val{color:#86efac}
.chip .ipill.buff.snow{background:rgba(148,163,184,.12);border-color:rgba(148,163,184,.35);color:#dbeafe}
.chip .ipill.buff.snow i,.chip .ipill.buff.snow .val{color:#dbeafe}

.empty-msg{display:flex;align-items:center;justify-content:center;gap:8px;padding:10px 12px;min-height:40px;color:#9cb0d8;background:rgba(255,255,255,.04);border:1px dashed #2a3553;border-radius:12px;font-weight:800}
.today-pill{
  position:absolute;top:12px;right:14px;display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:999px;
  background:var(--glass-bg);border:1px solid var(--glass-bd);font-size:12px;color:#cfe0ff;font-weight:800;box-shadow:0 4px 12px rgba(0,0,0,.25)
}
.today-pill.hidden{visibility:visible!important;opacity:1!important}

.footer{
  margin-top:-2px;
  color:var(--muted);
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  position:relative;
  padding-top:20px;
}

.footer::before{
  content:"";
  position:absolute;
  top:0;
  left:50%;
  transform:translateX(-50%);
  width:80%;
  height:2px;
  background:linear-gradient(90deg,
    transparent 0%,
    rgba(96, 165, 250, 0.2) 20%,
    rgba(96, 165, 250, 0.4) 50%,
    rgba(96, 165, 250, 0.2) 80%,
    transparent 100%
  );
  border-radius:1px;
  box-shadow:0 0 8px rgba(96, 165, 250, 0.1);
  pointer-events:none;
}

.noselect,.noselect *{-webkit-user-select:none;user-select:none}
.noselect img{-webkit-user-drag:none}
.mini-link{cursor:pointer;text-decoration:underline}
.mini-link:focus-visible{outline:none;box-shadow:var(--ring)}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* modal */
.modal{position:fixed;inset:0;display:none;align-items:center;justify-content:center;background:rgba(0,0,0,.5);z-index:50}
.modal.show{display:flex}
.modal .panel{width:min(900px,95vw);background:linear-gradient(145deg,#ffffff,#f8fafc);border:1px solid rgba(0,0,0,0.1);box-shadow:0 24px 60px rgba(0,0,0,0.15),inset 0 1px 0 rgba(255,255,255,0.8);border-radius:20px;padding:32px;backdrop-filter:blur(20px)}
.panel-hd{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;min-height:40px;position:relative;padding:0;background:transparent;border-radius:0;border:none;backdrop-filter:none;box-shadow:none}
.panel-hd::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:1px;
  background:transparent;
  border-radius:1px;
  pointer-events:none
}
.panel-hd h3{margin:0;font-size:18px;font-weight:700;line-height:1.2;display:flex;align-items:center;gap:12px;color:#ffffff;text-shadow:0 1px 2px rgba(0,0,0,0.5)}
.panel-hd .close-btn{margin-left:10px}
.modal .hint{color:var(--muted);font-size:13px;margin-bottom:8px}
.modal .row{display:flex;gap:10px;margin-top:6px}
.modal input,.modal select{flex:1;padding:14px 16px;border-radius:12px;border:1px solid rgba(0,0,0,0.1);background:linear-gradient(145deg,#ffffff,#f8fafc);color:#1f2937;outline:none;backdrop-filter:blur(8px);box-shadow:0 4px 12px rgba(0,0,0,0.1),inset 0 1px 0 rgba(255,255,255,0.8);transition:all 0.3s ease;font-size:15px}
.modal input:focus,.modal select:focus{border-color:rgba(59,130,246,0.6);box-shadow:0 0 0 3px rgba(59,130,246,0.1),0 4px 12px rgba(0,0,0,0.1),inset 0 1px 0 rgba(255,255,255,0.8);background:linear-gradient(145deg,#ffffff,#f8fafc)}
.modal button{padding:12px 18px;border-radius:12px;border:1px solid rgba(255,255,255,0.1);background:linear-gradient(145deg,rgba(30,42,68,0.9),rgba(15,24,38,0.8));color:#e6eefc;cursor:pointer;backdrop-filter:blur(8px);box-shadow:0 6px 20px rgba(0,0,0,0.4),inset 0 1px 0 rgba(255,255,255,0.1);transition:all 0.3s ease;font-weight:600;font-size:14px}
.modal button:hover{background:linear-gradient(145deg,rgba(30,42,68,0.9),rgba(15,24,38,0.8));border-color:rgba(255,255,255,0.1);transform:none;box-shadow:0 6px 20px rgba(0,0,0,0.4),inset 0 1px 0 rgba(255,255,255,0.1)}
.close-btn{width:40px;height:40px;border-radius:12px;border:1px solid rgba(0,0,0,0.1);background:linear-gradient(145deg,#f3f4f6,#e5e7eb);color:#6b7280;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:.9;flex:0 0 auto;backdrop-filter:blur(8px);box-shadow:0 4px 12px rgba(0,0,0,0.1),inset 0 1px 0 rgba(255,255,255,0.8);transition:all 0.3s ease}
.close-btn:hover{opacity:1;background:linear-gradient(145deg,#fef2f2,#fee2e2);border-color:rgba(239,68,68,0.4);color:#dc2626;transform:translateY(-1px);box-shadow:0 6px 16px rgba(239,68,68,0.2),inset 0 1px 0 rgba(255,255,255,0.8)}
.close-btn:focus-visible{outline:none;box-shadow:var(--ring)}
.close-btn .x{display:block;line-height:1;font-size:18px}

/* toasts */
.toast-wrap{position:fixed;right:20px;bottom:20px;display:grid;gap:12px;z-index:10000}
.toast{
  display:flex;align-items:center;gap:12px;min-width:300px;max-width:min(90vw,420px);
  padding:16px 18px;border-radius:var(--border-radius);border:1px solid var(--glass-bd);
  background:var(--card);box-shadow:var(--shadow);backdrop-filter:blur(12px);
  transform:translateX(100%);opacity:0;transition:all 0.3s ease;
  font-family:var(--font-ui);font-weight:500;
}
.toast.show{transform:translateX(0);opacity:1}
.toast .icon{
  display:flex;align-items:center;justify-content:center;
  width:24px;height:24px;border-radius:50%;flex-shrink:0;
  font-size:14px;font-weight:600;
}
.toast .txt{font-size:var(--fs-300);color:var(--text);line-height:1.4;flex:1}
.toast.ok{border-color:rgba(134,239,172,.4);background:linear-gradient(135deg,var(--card),rgba(134,239,172,.05))}
.toast.ok .icon{background:linear-gradient(135deg,var(--success),#059669);color:white}
.toast.err{border-color:rgba(253,164,175,.5);background:linear-gradient(135deg,var(--card),rgba(253,164,175,.05))}
.toast.err .icon{background:linear-gradient(135deg,var(--error),#dc2626);color:white}
.toast.info{border-color:rgba(154,177,233,.35);background:linear-gradient(135deg,var(--card),rgba(154,177,233,.05))}
.toast.info .icon{background:linear-gradient(135deg,var(--primary),var(--primary-hover));color:white}

/* Responsive Toast */
@media (max-width: 768px) {
  .toast-wrap{right:16px;bottom:16px;left:16px}
  .toast{min-width:auto;max-width:none;padding:14px 16px}
  .toast .icon{width:20px;height:20px;font-size:12px}
  .toast .txt{font-size:var(--fs-200)}
}

/* Smooth Number Animation */
.num-pill .num, .chip .num, .today-pill .val {
  transition: all 0.3s ease;
  transform-origin: center;
}

.num-pill .num.animating {
  animation: numberPulse 0.6s ease-out;
}

@keyframes numberPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* effects (disable number transitions/animations) */
.num,.dval,.chip .num,.today-pill .val{transition:none!important;animation:none!important}
.bump{animation:none!important}
.flash-up,.flash-down{color:inherit!important;transition:none!important}
.animated-number,.stat-value,.num{font-variant-numeric: tabular-nums;}
/* lock number width to prevent chip shifting during updates */
.tchip .num,.chip .num{display:inline-block;min-width:5ch;text-align:right}

/* skeletons moved from JS */
.skel{position:relative;overflow:hidden;background:rgba(255,255,255,.05);border-radius:10px}
.skel-line{height:14px;margin:10px 0;border-radius:8px;background:rgba(255,255,255,.08)}
.skel::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.08),transparent);transform:translateX(-100%);animation:skel 1.2s infinite}
@keyframes skel{to{transform:translateX(100%)}}
.skel-chip{height:36px;width:240px}
.skel-dcard{height:64px}
.skel-card{height:148px}

/* shimmer for first paint before data */
.shimmer{position:relative;overflow:hidden}
.shimmer::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,transparent,rgba(255,255,255,.06),transparent);transform:translateX(-100%);animation:skel 1.2s infinite}

/* tooltip styles moved from JS */
.tt{position:fixed;z-index:9999;pointer-events:none;transform:translate(-50%,-8px);background:linear-gradient(145deg,rgba(30,42,68,0.95),rgba(15,24,38,0.9));color:#e6eefc;border:1px solid rgba(255,255,255,0.15);border-radius:16px;box-shadow:0 20px 40px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);padding:0;min-width:280px;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);opacity:0;transition:opacity .12s ease,transform .12s ease;overflow:hidden}
.tt.show{opacity:1;transform:translate(-50%,0)}
.tt-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid rgba(255,255,255,0.2);background:linear-gradient(145deg,rgba(255,255,255,.12),rgba(255,255,255,.06));backdrop-filter:blur(8px)}
.tt-title{display:flex;align-items:center;gap:12px}
.tt-icon{width:32px;height:32px;border-radius:8px;overflow:hidden;background:linear-gradient(135deg,rgba(0,0,0,0.3),rgba(0,0,0,0.1));border:1px solid rgba(255,255,255,0.1);box-shadow:0 2px 8px rgba(0,0,0,0.2)}
.tt-icon img{width:100%;height:100%;object-fit:contain}
.tt-name{font-size:16px;font-weight:600;color:#e6eefc;text-shadow:0 1px 2px rgba(0,0,0,0.3);margin-right:16px}
.tt-count{font-size:20px;font-weight:700;color:#60a5fa;text-shadow:0 1px 2px rgba(0,0,0,0.3);background:linear-gradient(135deg,rgba(96,165,250,0.1),rgba(96,165,250,0.05));padding:6px 12px;border-radius:8px;border:1px solid rgba(96,165,250,0.2)}
.tt-content{padding:0;background:transparent;border:none;border-radius:0;backdrop-filter:none;box-shadow:none;margin:0}
.tt-info{display:flex;align-items:center;justify-content:center;margin:0;padding:12px 16px;background:transparent;border:none;border-radius:0}
.tt-label{font-size:12px;color:#9cb0d8;opacity:0.8}
.tt-buffs{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}
.tt-buff{font-size:11px;padding:2px 6px;border-radius:6px;font-weight:600}
.tt-buff.dino{background:linear-gradient(135deg,rgba(139,92,246,.2),rgba(168,85,247,.15));border:1px solid rgba(139,92,246,.4);color:#a855f7}
.tt-buff.snow{background:linear-gradient(135deg,rgba(6,182,212,.2),rgba(34,211,238,.15));border:1px solid rgba(6,182,212,.4);color:#06b6d4}
.tt-buff.halloween{background:linear-gradient(135deg,rgba(249,115,22,.2),rgba(251,146,60,.15));border:1px solid rgba(249,115,22,.4);color:#f97316}
.tt-buff-separator{color:#9cb0d8;opacity:0.6;font-size:10px}
.tt-progress{margin:20px 0;padding:16px;background:linear-gradient(145deg,rgba(255,255,255,.06),rgba(255,255,255,.03));border-radius:12px;border:1px solid rgba(255,255,255,.1)}
.tt-bar{position:relative;height:8px;border-radius:999px;background:rgba(255,255,255,0.06);overflow:hidden}
.tt-bar-fill{position:absolute;top:0;bottom:0;transition:width .25s ease}
.tt-bar-fill.dino{left:0;background:linear-gradient(90deg,#8b5cf6,#a855f7)}
.tt-bar-fill.snow{left:0;background:linear-gradient(90deg,#06b6d4,#22d3ee)}
.tt-bar-fill.halloween{left:0;background:linear-gradient(90deg,#f97316,#fb923c)}
.tt-stats{display:flex;gap:0;padding:0;background:transparent;border:none;border-radius:0;backdrop-filter:none;box-shadow:none;margin:0;overflow:hidden}
.tt-stat{display:flex;flex-direction:column;align-items:center;gap:8px;padding:16px 12px;border-radius:0;background:transparent;border:none;backdrop-filter:none;box-shadow:none;transition:all 0.3s ease;min-width:80px;position:relative;flex:1}
.tt-stat:hover{background:transparent;transform:none}
.tt-stat:not(:last-child)::after{content:'';position:absolute;right:0;top:8%;bottom:8%;width:1px;background:linear-gradient(180deg,transparent,rgba(96,165,250,0.8),rgba(255,255,255,0.4),rgba(96,165,250,0.8),transparent);opacity:0.6;transition:all 0.3s ease;box-shadow:0 0 6px rgba(96,165,250,0.3),0 0 12px rgba(96,165,250,0.1)}
.tt-stat:hover::after{opacity:1;box-shadow:0 0 8px rgba(96,165,250,0.5),0 0 16px rgba(96,165,250,0.2)}
.tt-stat-icon{width:24px;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-size:10px}
.tt-stat-icon.dino{background:linear-gradient(135deg,rgba(139,92,246,.2),rgba(168,85,247,.15));border:1px solid rgba(139,92,246,.4);color:#a855f7}
.tt-stat-icon.snow{background:linear-gradient(135deg,rgba(6,182,212,.2),rgba(34,211,238,.15));border:1px solid rgba(6,182,212,.4);color:#06b6d4}
.tt-stat-icon.halloween{background:linear-gradient(135deg,rgba(249,115,22,.2),rgba(251,146,60,.15));border:1px solid rgba(249,115,22,.4);color:#f97316}
.tt-stat-content{display:flex;flex-direction:column;align-items:center;gap:2px;white-space:nowrap}
.tt-stat-label{font-size:11px;color:#9cb0d8;opacity:0.8}
.tt-stat-value{font-size:13px;font-weight:600;color:#e6eefc;font-variant-numeric:tabular-nums;white-space:nowrap}

/* Tooltip loading and error states */
.tt-loading {
  padding: 20px;
  text-align: center;
  color: #999;
  font-style: italic;
}

.tt-error {
  padding: 20px;
  text-align: center;
  color: #ff6b6b;
  font-weight: 500;
}

/* Additional buff colors for new tooltip - matching reference image */
.tt-bar-fill.golden{left:0;background:linear-gradient(90deg,#fbbf24,#fde047)}
.tt-bar-fill.diamond{left:0;background:linear-gradient(90deg,#a855f7,#c084fc)}
.tt-bar-fill.electric{left:0;background:linear-gradient(90deg,#eab308,#facc15)}
.tt-bar-fill.fire{left:0;background:linear-gradient(90deg,#dc2626,#ef4444)}
.tt-bar-fill.none{left:0;background:linear-gradient(90deg,#9cb0d8,#cbd5f5)}

.tt-buff.golden{background:linear-gradient(135deg,rgba(251,191,36,.12),rgba(253,224,71,.08));border:1px solid rgba(251,191,36,.2);color:#fbbf24}
.tt-buff.diamond{background:linear-gradient(135deg,rgba(168,85,247,.12),rgba(192,132,252,.08));border:1px solid rgba(168,85,247,.2);color:#a855f7}
.tt-buff.electric{background:linear-gradient(135deg,rgba(234,179,8,.12),rgba(250,204,21,.08));border:1px solid rgba(234,179,8,.2);color:#eab308}
.tt-buff.fire{background:linear-gradient(135deg,rgba(220,38,38,.12),rgba(239,68,68,.08));border:1px solid rgba(220,38,38,.2);color:#dc2626}
.tt-buff.none{background:linear-gradient(135deg,rgba(156,176,216,.12),rgba(203,213,245,.08));border:1px solid rgba(156,176,216,.2);color:#9cb0d8}

.tt-stat-icon.golden{background:linear-gradient(135deg,rgba(251,191,36,.12),rgba(253,224,71,.08));border:1px solid rgba(251,191,36,.2);color:#fbbf24}
.tt-stat-icon.diamond{background:linear-gradient(135deg,rgba(168,85,247,.12),rgba(192,132,252,.08));border:1px solid rgba(168,85,247,.2);color:#a855f7}
.tt-stat-icon.electric{background:linear-gradient(135deg,rgba(234,179,8,.12),rgba(250,204,21,.08));border:1px solid rgba(234,179,8,.2);color:#eab308}
.tt-stat-icon.fire{background:linear-gradient(135deg,rgba(220,38,38,.12),rgba(239,68,68,.08));border:1px solid rgba(220,38,38,.2);color:#dc2626}
.tt-stat-icon.none{background:linear-gradient(135deg,rgba(156,176,216,.12),rgba(203,213,245,.08));border:1px solid rgba(156,176,216,.2);color:#9cb0d8}


/* Egg Details Modal - Clean & Simple Design */
.egg-modal-content {
  background: rgba(15, 15, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-width: 420px;
  width: 90vw;
}

.egg-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.egg-modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.egg-modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: #ffffff;
  font-size: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.egg-modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.egg-modal-body {
  padding: 20px 24px;
  max-height: 50vh;
  overflow-y: auto;
}

.egg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.15s ease;
}

.egg-item:last-child {
  border-bottom: none;
}

.egg-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.egg-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.egg-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px;
  object-fit: contain;
}

.egg-name {
  font-size: 14px;
  font-weight: 500;
  color: #e5e7eb;
  text-transform: capitalize;
}

.egg-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.egg-buffs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.buff-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.buff-item i {
  font-size: 12px;
}

.buff-item.snow {
  background: rgba(6, 182, 212, 0.2);
  color: #06b6d4;
}

.buff-item.dino {
  background: rgba(139, 92, 246, 0.2);
  color: #a855f7;
}

.buff-item.halloween {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
}

.buff-item.golden {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.buff-item.diamond {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.buff-item.electric {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.buff-item.fire {
  background: rgba(220, 38, 38, 0.2);
  color: #dc2626;
}

.buff-value {
  font-weight: 600;
}

.egg-count {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* smooth fades moved from JS */
.soft-fade{transition:opacity .22s ease,transform .22s ease;will-change:opacity,transform;opacity:1;transform:translateY(0)}
.soft-fade.soft-fade-out{opacity:0;transform:translateY(4px)}
.pop-in{animation:popIn .28s ease both}
@keyframes popIn{from{opacity:0;transform:translateY(6px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}


/* ================= UID list & remove button ================= */
#uidList{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(300px,1fr));
  gap:12px;
  align-items:start;
  margin-top:16px;
  max-height:min(50vh,400px);
  overflow-y:auto;
  overflow-x:hidden;
  padding:8px;
  background:rgba(15,24,38,.2);
  border-radius:12px;
  border:1px solid rgba(59,130,246,.1);
  scrollbar-width:none;
  -ms-overflow-style:none;
}
/* hide scrollbar for UID list */
#uidList::-webkit-scrollbar{width:8px;height:8px}
.uid-chip{
  display:flex;
  align-items:center;
  gap:12px;
  padding:16px 20px;
  border-radius:12px;
  background:linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4));
  border:1px solid rgba(255,255,255,0.08);
  box-shadow:0 4px 16px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.03);
  line-height:1.2;
  user-select:none;
  color:#e6eefc;
  font-size:14px;
  font-weight:500;
  transition:all 0.3s ease;
  backdrop-filter:blur(8px);
}
.uid-chip:hover{
  background:linear-gradient(145deg,rgba(59,130,246,0.15),rgba(37,99,235,0.1));
  border-color:rgba(59,130,246,0.4);
  box-shadow:0 6px 20px rgba(59,130,246,0.3),inset 0 1px 0 rgba(255,255,255,0.05);
  transform:translateY(-1px);
}
.uid-chip .txt{
  flex:1;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
  overflow:hidden;
  text-overflow:ellipsis;
}
.uid-chip .uid-del{
  appearance:none;
  -webkit-appearance:none;
  display:inline-grid;
  place-items:center;
  width:32px;
  height:32px;
  min-width:32px;
  padding:0;
  margin-left:8px;
  border-radius:8px;
  border:1px solid rgba(239,68,68,.3);
  background:rgba(239,68,68,.1);
  cursor:pointer;
  line-height:1;
  transition:all 0.2s ease;
  color:#fca5a5;
}
.uid-chip .uid-del i{
  font-size:14px;
  pointer-events:none;
}
.uid-chip .uid-del:hover{
  background:rgba(239,68,68,.2);
  border-color:rgba(239,68,68,.5);
  color:#f87171;
}
.uid-chip .uid-del:active{ transform:scale(.96); }
.uid-chip .uid-del:focus-visible{
  outline:2px solid rgba(138,180,255,.65);
  outline-offset:2px;
}
@supports (-webkit-touch-callout: none) {
  .uid-chip .uid-del{ line-height:1; }
}

/* add panel */
.panel.add-panel{width:min(900px,95vw);max-height:85vh;overflow:auto}
/* Add UID modal: keep panel within viewport and style its scrollbar */
#addModal .panel{max-height:80vh;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}
#addModal .panel::-webkit-scrollbar{width:8px;height:8px}
.input-group{position:relative;display:flex;align-items:center;gap:12px;padding:20px;background:linear-gradient(145deg,rgba(30,42,68,0.4),rgba(15,24,38,0.2));border:1px solid rgba(255,255,255,0.08);border-radius:16px;margin:20px 0;backdrop-filter:blur(8px);box-shadow:0 4px 16px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.03)}
.ig-prefix{
  width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(145deg,rgba(59,130,246,0.3),rgba(37,99,235,0.2));border:1px solid rgba(59,130,246,0.4);color:#60a5fa;flex:0 0 auto;font-size:18px;backdrop-filter:blur(8px);box-shadow:0 4px 12px rgba(59,130,246,0.2),inset 0 1px 0 rgba(255,255,255,0.1)
}
.ig-input{
  flex:1;padding:14px 16px;border-radius:12px;border:1px solid rgba(255,255,255,0.15);background:linear-gradient(145deg,rgba(15,24,38,0.8),rgba(10,16,28,0.6));color:#e6eefc;font-size:15px;transition:all 0.3s ease;backdrop-filter:blur(8px);box-shadow:0 4px 12px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05)
}
.ig-input:focus{outline:none;border-color:rgba(59,130,246,0.6);box-shadow:0 0 0 3px rgba(59,130,246,0.1),0 4px 12px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05);background:linear-gradient(145deg,rgba(15,24,38,0.9),rgba(10,16,28,0.7))}
.ig-input::placeholder{color:rgba(230,238,252,.65)}
.btn-primary{height:48px;padding:0 24px;border-radius:12px;border:1px solid rgba(255,255,255,0.1);background:linear-gradient(145deg,rgba(30,42,68,0.9),rgba(15,24,38,0.8));color:#e6eefc;cursor:pointer;font-weight:600;font-size:15px;transition:all 0.3s ease;backdrop-filter:blur(8px);min-width:120px;box-shadow:0 6px 20px rgba(0,0,0,0.4),inset 0 1px 0 rgba(255,255,255,0.1)}
.btn-primary:hover{background:linear-gradient(145deg,rgba(30,42,68,0.9),rgba(15,24,38,0.8));border-color:rgba(255,255,255,0.1);box-shadow:0 6px 20px rgba(0,0,0,0.4),inset 0 1px 0 rgba(255,255,255,0.1);transform:none}
.btn-secondary{height:48px;padding:0 24px;border-radius:12px;border:1px solid rgba(255,255,255,0.1);background:linear-gradient(145deg,rgba(30,42,68,0.7),rgba(15,24,38,0.6));color:#e6eefc;cursor:pointer;font-weight:600;font-size:15px;transition:all 0.3s ease;backdrop-filter:blur(8px);min-width:120px;box-shadow:0 6px 20px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05)}
.btn-secondary:hover{background:linear-gradient(145deg,rgba(30,42,68,0.7),rgba(15,24,38,0.6));border-color:rgba(255,255,255,0.1);box-shadow:0 6px 20px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05);transform:none}

/* uid suggest */
#uidSuggest{
  position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:5;background:var(--card-grad);border:1px solid rgba(255,255,255,.12);
  border-radius:12px;box-shadow:0 18px 38px rgba(0,0,0,.45);padding:6px;max-height:320px;overflow-y:auto;
  scrollbar-width:none;-ms-overflow-style:none;overscroll-behavior:contain
}
#uidSuggest[hidden]{visibility:visible!important;opacity:1!important}
#uidSuggest::-webkit-scrollbar{width:8px;height:8px}
#uidSuggest .suggest-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;cursor:pointer;border-radius:10px}
#uidSuggest .suggest-item[aria-selected="true"],#uidSuggest .suggest-item:hover{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12)}
#uidSuggest .si-main{display:flex;align-items:center;gap:10px}
#uidSuggest .si-name{font-weight:800;color:#e6eefc}
#uidSuggest .si-uid{color:#9cb0d8;font-size:12.5px;margin-left:10px}
#uidSuggest mark{background:rgba(99,102,241,.25);color:#e6eefc;padding:0 2px;border-radius:4px}

/* pager */
.pager{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-top:24px;
  padding:16px 0;
  position:relative;
}

.pager::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(96, 165, 250, 0.3) 20%, 
    rgba(96, 165, 250, 0.6) 50%, 
    rgba(96, 165, 250, 0.3) 80%, 
    transparent 100%
  );
  border-radius: 1px;
}

.pg-btn{
  min-width:44px;
  height:44px;
  padding:0 14px;
  border-radius:14px;
  border:1px solid rgba(96, 165, 250, 0.2);
  background: linear-gradient(145deg, rgba(11, 18, 38, 0.9), rgba(15, 24, 38, 0.8));
  color:#e6eefc;
  cursor:pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  font-size:18px;
  font-weight:600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.pg-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  background: linear-gradient(145deg, rgba(11, 18, 38, 0.95), rgba(15, 24, 38, 0.9));
}

.pg-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.pg-btn:disabled{
  opacity:.4;
  cursor:not-allowed;
  transform: none;
}

.pg-text{
  padding:12px 20px;
  border-radius:16px;
  background: linear-gradient(145deg, rgba(30, 42, 68, 0.9), rgba(15, 24, 38, 0.8));
  border:1px solid rgba(96, 165, 250, 0.3);
  font-weight:800;
  color:#c9d6f5;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.pg-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(96, 165, 250, 0.1), 
    transparent
  );
  transition: left 0.6s ease;
}

.pg-text:hover::before {
  left: 100%;
}

/* page transitions */
@media (prefers-reduced-motion:no-preference){
  @keyframes pageIn{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
  @keyframes pageOut{to{opacity:0;transform:translateY(6px) scale(.985)}}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* loading screen removed */


/* status bar */
#status{display:flex;justify-content:center;width:100%;margin-top:20px}
.statusbar{display:flex;flex-direction:column;gap:12px;margin:0 auto;width:max-content;padding:16px 20px;background:transparent;border-radius:0;border:none;backdrop-filter:none;box-shadow:none}
.statusbar .row{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center}
.status-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 18px;
  border-radius:16px;
  background:linear-gradient(145deg, rgba(30, 42, 68, 0.8), rgba(15, 24, 38, 0.6));
  border:1px solid rgba(96, 165, 250, 0.2);
  font-weight:600;
  white-space:nowrap;
  transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter:blur(8px);
  box-shadow:0 4px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  position:relative;
  overflow:hidden;
}

.status-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(96, 165, 250, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

.status-badge:hover {
  transform:translateY(-2px);
  box-shadow:0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  background:linear-gradient(145deg, rgba(30, 42, 68, 0.9), rgba(15, 24, 38, 0.8));
  border-color:rgba(96, 165, 250, 0.3);
}

.status-badge:hover::before {
  left: 100%;
}
.status-badge .num{opacity:.95;font-variant-numeric:tabular-nums;font-weight:700;color:#e6eefc}
.status-badge.action{cursor:pointer}
.status-badge i{opacity:.9;font-size:12px;color:#60a5fa}
.status-badge b{color:#e6eefc;font-weight:600;letter-spacing:0.2px}
@media (min-width:1024px){
  .statusbar{flex-direction:row;align-items:center;gap:16px;padding:12px 16px}
  .statusbar .row{flex-wrap:nowrap}
}

/* top progress */
#topProg{position:fixed;left:0;top:0;height:3px;width:100%;background:linear-gradient(90deg, rgba(99,102,241,.22), rgba(34,211,238,.22));opacity:0;transition:opacity .18s ease;pointer-events:none;z-index:1200}
#topProg.show{opacity:1}
#topProg span{display:block;height:100%;width:22%;background:linear-gradient(90deg, rgba(99,102,241,.9), rgba(34,211,238,.9));animation:tpb 1.05s linear infinite}
@keyframes tpb{0%{margin-left:-22%}55%{margin-left:55%}100%{margin-left:110%}}

/* responsive tweaks */
@media (max-width:520px){
  html,body{max-width:100%;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none}
  html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px;height:8px}
  .wrap,#header,#status,#totals{width:100%;max-width:100%;overflow-x:hidden}
  .chips{flex-wrap:wrap;gap:6px}
  .chips .chip{max-width:100%;padding:5px 6px;border-radius:999px;font-size:var(--fs-300)}
  .chips .chip img{height:14px}
  .chips .ipill{padding:1px 5px;font-size:var(--fs-300)}
  .name-tag .presence{font-size:11px}
  .name-tag .presence .dot{width:7px;height:7px}
  .today-pill{padding:2px 6px;border-radius:10px;font-size:var(--fs-300)}
  .today-pill .num{font-size:15px}
  .avatar-row{gap:8px}
  .avatar-row img{height:auto;max-height:28px;width:auto}
  #totals .tchip{padding:8px 10px;gap:6px;border-radius:12px;flex-shrink:0!important}
  #totals .tchip img{height:16px;width:auto}
  #totals.bar{gap:8px;row-gap:8px}
  .dval .trend{padding:1px 2px;font-size:8px}
  .dval .trend i{font-size:6px}
  #pgInfo{font-size:var(--fs-300)}
  #pager .btn{padding:6px 10px}
  .statusbar{width:100%}
  /* Mobile improvements */
  #listSearch{width:100%!important;max-width:100%!important}
  .uid-toolbar #uidSearch{width:100%!important;max-width:100%!important}
  /* Do not hide Food here; card view in page.css controls layout */
  .status-badge{backdrop-filter:none}
}
@media (max-width:390px){
  .status-badge{padding:3px 6px;font-size:var(--fs-200)}
  #totals .tchip{padding:6px 8px;flex-shrink:0!important}
  .dval{font-size:18px}
  .dval .trend{padding:1px 2px;font-size:7px}
  .dval .trend i{font-size:5px}
  .chip{padding:5px 6px;font-size:11.5px}
  .chip .ipill{--pill-h:24px;padding:0 6px}
  .today-pill{font-size:10.5px;padding:2px 6px}
  .name-tag{font-size:11.5px;gap:6px}
  .name-tag .presence .dot{width:7px;height:7px}
  .egg{width:46px;height:46px}
  .sub{font-size:12px}
}
@media (max-width:360px){
  .wrap{padding:12px 10px}
  .status-badge{font-size:10.5px}
  .chip{padding:4px 6px;font-size:11px}
  .chip .ipill{--pill-h:22px;padding:0 6px}
  .egg{width:42px;height:42px}
  .name-tag{max-width:66%}
}
/* กันล้นแนวนอนบนมือถือ */
@media (max-width:520px){
  html,body{max-width:100%;overflow-x:hidden;scrollbar-width:none;-ms-overflow-style:none}
  html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px;height:8px}
  .wrap,#header,#status,#totals{width:100%;max-width:100%;overflow-x:hidden}
}

/* ===== Card / Section (key modal content) ===== */
.key-info { 
  margin-top: 16px; 
  padding: 20px; 
  background: linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4)); 
  border: 1px solid rgba(255,255,255,0.12); 
  border-radius: 16px; 
  backdrop-filter: blur(12px); 
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}
.section { 
  background: linear-gradient(145deg,rgba(30,42,68,0.4),rgba(15,24,38,0.2)); 
  border: 1px solid rgba(255,255,255,0.08); 
  border-radius: 16px; 
  padding: 18px; 
  margin-bottom: 16px; 
  backdrop-filter: blur(8px); 
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
}
.section-title{
  position: relative;
  font-weight: 700;
  margin: 2px 0 12px;
  padding-left: 12px;
}
.section-title::before{
  content:"";
  position:absolute;
  left:0; top:50%;
  width:1px; height:1px;
  border-radius:999px;
  background: transparent;
  opacity:0;
  transform: translateY(-50%);
}
.section-title::after{
  content:"";
  display:block;
  height:1px;
  margin-top:0;
  background: transparent;
  border-radius:999px;
}
.kv .item { 
  display: grid; 
  gap: 8px; 
  padding: 16px 20px; 
  background: linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4)); 
  border: 1px solid rgba(255,255,255,0.12); 
  border-radius: 16px; 
  backdrop-filter: blur(12px); 
  box-shadow: 0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}
.kv .label{
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .8;
  color: #e6eefc;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.kv .val{
  background: linear-gradient(145deg,rgba(30,42,68,0.4),rgba(15,24,38,0.2));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.kv code{
  background: rgba(0,0,0,0.2);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: .9rem;
  color: #e6eefc;
}
.badge{
  font-size: .75rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge.ok{
  color: #052e16;
  background: #86efac;
  border-color: #4ade80;
  font-weight: 700;
}
.badge.no{
  color: #450a0a;
  background: #fca5a5;
  border-color: #f87171;
  font-weight: 700;
}
.btn-row{ display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.btn-row .btn{
  background: linear-gradient(145deg,rgba(30,42,68,0.8),rgba(15,24,38,0.6));
  border: 1px solid rgba(255,255,255,0.15);
  padding: 12px 20px;
  border-radius: 12px;
  color: #e6eefc;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  min-width: 120px;
  justify-content: center;
}
.btn-row .btn:hover{ 
  background: linear-gradient(145deg,rgba(59,130,246,0.2),rgba(37,99,235,0.15)); 
  border-color: rgba(59,130,246,0.4); 
  transform: translateY(-1px); 
  box-shadow: 0 6px 16px rgba(59,130,246,0.3), inset 0 1px 0 rgba(255,255,255,0.1); 
}
.btn-row .btn.danger{ 
  border-color: rgba(239,68,68,0.4); 
  background: linear-gradient(145deg,rgba(239,68,68,0.2),rgba(220,38,38,0.15)); 
}
.btn-row .btn.danger:hover{ 
  background: linear-gradient(145deg,rgba(239,68,68,0.3),rgba(220,38,38,0.25)); 
  border-color: rgba(239,68,68,0.6); 
  transform: translateY(-1px); 
  box-shadow: 0 6px 16px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.1); 
}
.modal .panel{
  background: #0f172a;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  width: min(900px, 95vw) !important;
  padding: 32px !important;
}

/* ===== Info Panel Styles ===== */
.info-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
  box-shadow: none;
  margin: 20px 0;
}

.info-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, rgba(59,130,246,0.3), rgba(37,99,235,0.2));
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  font-size: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.info-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #e6eefc;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.info-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-status.active {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.info-status.inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.info-content {
  display: grid;
  gap: 0;
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: none;
}

.info-label {
  font-size: 14px;
  font-weight: 600;
  color: #9cb0d8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #e6eefc;
}

.key-display {
  font-family: 'Courier New', monospace;
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  color: #e6eefc;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-indicator.online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-indicator.offline {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.status-text {
  font-weight: 500;
}


.info-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

.logout-btn {
  background: linear-gradient(145deg, rgba(239,68,68,0.8), rgba(220,38,38,0.6));
  border: 1px solid rgba(239,68,68,0.4);
  color: #ffffff;
}

.logout-btn:hover {
  background: linear-gradient(145deg, rgba(239,68,68,1), rgba(220,38,38,0.8));
  border-color: rgba(239,68,68,0.6);
  box-shadow: 0 6px 16px rgba(239,68,68,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Settings Panel Styles ===== */
.settings-panel {
  background: linear-gradient(145deg, rgba(30,42,68,0.8), rgba(15,24,38,0.6));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
  margin: 20px 0;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.settings-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, rgba(59,130,246,0.3), rgba(37,99,235,0.2));
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  font-size: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.settings-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: #e6eefc;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.settings-content {
  margin-bottom: 24px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: #e6eefc;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.settings-hint {
  font-size: 14px;
  color: #9cb0d8;
  margin-bottom: 16px;
  line-height: 1.5;
}

#eggSettingsList{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
  gap:20px;
  align-items:start;
  margin:16px 0;
  max-height:min(60vh,500px);
  overflow:auto;
  padding:20px;
  background:linear-gradient(145deg,rgba(30,42,68,0.4),rgba(15,24,38,0.2));
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.08);
  backdrop-filter:blur(8px);
  box-shadow:0 4px 16px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.03);
  justify-content:center; /* center grid in container */
}
#foodSettingsList{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
  gap:20px;
  align-items:start;
  margin:16px 0;
  max-height:min(60vh,500px);
  overflow:auto;
  padding:20px;
  background:linear-gradient(145deg,rgba(30,42,68,0.4),rgba(15,24,38,0.2));
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.08);
  backdrop-filter:blur(8px);
  box-shadow:0 4px 16px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.03);
  justify-content:center; /* center grid in container */
}
#eggSettingsList .settings-row, #foodSettingsList .settings-row{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  padding:20px 16px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.08);
  background:linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4));
  transition:all 0.3s ease;
  backdrop-filter:blur(8px);
  box-shadow:0 4px 16px rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.03);
  cursor:pointer;
  position:relative;
  overflow:hidden;
}
#eggSettingsList .settings-row:hover, #foodSettingsList .settings-row:hover{
  background:linear-gradient(145deg,rgba(59,130,246,0.15),rgba(37,99,235,0.1));
  border-color:rgba(59,130,246,0.4);
  box-shadow:0 6px 20px rgba(59,130,246,0.3),inset 0 1px 0 rgba(255,255,255,0.05);
  transform:translateY(-2px);
}
#eggSettingsList .settings-row.checked, #foodSettingsList .settings-row.checked{
  background:linear-gradient(145deg,rgba(59,130,246,0.2),rgba(37,99,235,0.15));
  border-color:rgba(59,130,246,0.5);
  box-shadow:0 8px 24px rgba(59,130,246,0.4),inset 0 1px 0 rgba(255,255,255,0.1);
}
#eggSettingsList .settings-row .sicon, #foodSettingsList .settings-row .sicon{
  width:64px;
  height:64px;
  border-radius:16px;
  background:rgba(15,24,38,.9);
  border:2px solid rgba(59,130,246,.3);
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  transition:all 0.3s ease;
}
#eggSettingsList .settings-row:hover .sicon, #foodSettingsList .settings-row:hover .sicon{
  border-color:rgba(59,130,246,.6);
  box-shadow:0 4px 12px rgba(59,130,246,.2);
}
#eggSettingsList .settings-row .sicon img, #foodSettingsList .settings-row .sicon img{
  width:40px;
  height:40px;
  object-fit:contain;
  transition:transform 0.3s ease;
}
#eggSettingsList .settings-row:hover .sicon img, #foodSettingsList .settings-row:hover .sicon img{
  transform:scale(1.1);
}
#eggSettingsList .settings-row input[type="checkbox"], #foodSettingsList .settings-row input[type="checkbox"]{
  position:absolute;
  top:16px;
  right:16px;
  width:20px;
  height:20px;
  margin:0;
  padding:0;
  opacity:0;
  cursor:pointer;
  z-index:2;
}

#eggSettingsList .settings-row::before, #foodSettingsList .settings-row::before{
  content:'';
  position:absolute;
  top:16px;
  right:16px;
  width:20px;
  height:20px;
  border:2px solid rgba(255,255,255,0.3);
  border-radius:6px;
  background:linear-gradient(145deg,rgba(15,24,38,0.8),rgba(10,16,28,0.6));
  backdrop-filter:blur(8px);
  box-shadow:0 2px 8px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05);
  transition:all 0.3s ease;
  z-index:1;
}

#eggSettingsList .settings-row.checked::before, #foodSettingsList .settings-row.checked::before{
  background:linear-gradient(145deg,rgba(59,130,246,0.8),rgba(37,99,235,0.6));
  border-color:rgba(59,130,246,0.8);
  box-shadow:0 4px 12px rgba(59,130,246,0.4),inset 0 1px 0 rgba(255,255,255,0.2);
}

#eggSettingsList .settings-row.checked::after, #foodSettingsList .settings-row.checked::after{
  content:'✓';
  position:absolute;
  top:16px;
  right:16px;
  width:20px;
  height:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#ffffff;
  font-size:12px;
  font-weight:bold;
  z-index:3;
}
#eggSettingsList .settings-row:hover::before, #foodSettingsList .settings-row:hover::before{
  border-color:rgba(59,130,246,0.6);
  box-shadow:0 4px 12px rgba(59,130,246,0.3),inset 0 1px 0 rgba(255,255,255,0.1);
  transform:scale(1.05);
}
#eggSettingsList .settings-row .name, #foodSettingsList .settings-row .name{
  font-weight:800;
  text-transform:capitalize;
  font-size:16px;
  color:#e6eefc;
  text-align:center;
  letter-spacing:.3px;
  transition:all 0.3s ease;
}
#eggSettingsList .settings-row:hover .name, #foodSettingsList .settings-row:hover .name{
  color:#60a5fa;
  text-shadow:0 2px 8px rgba(59,130,246,.5);
}

/* Settings modal: make panel scrollable with a beautiful scrollbar */
#settingsModal .panel{max-height:85vh;overflow:auto;width:min(900px,95vw);scrollbar-width:none;-ms-overflow-style:none}
#settingsModal .panel::-webkit-scrollbar{width:8px;height:8px}

/* Settings modal: compact layout for small screens */
@media (max-width:520px){
  #settingsModal .panel{max-height:88vh; padding:20px !important; width:95vw !important}
  #eggSettingsList, #foodSettingsList{
    grid-template-columns:1fr;          /* single column */
    gap:12px;
    padding:12px;
    max-height:min(70vh,520px);
  }
  #eggSettingsList .settings-row, #foodSettingsList .settings-row{
    gap:12px;
    padding:14px;
    border-radius:12px;
  }
  #eggSettingsList .settings-row .sicon, #foodSettingsList .settings-row .sicon{
    width:48px; height:48px; border-radius:12px; border-width:1px;
  }
  #eggSettingsList .settings-row .sicon img, #foodSettingsList .settings-row .sicon img{
    width:32px; height:32px;
  }
  #eggSettingsList .settings-row .name, #foodSettingsList .settings-row .name{
    font-size:14px;
  }
  #eggSettingsList .settings-row::before, #foodSettingsList .settings-row::before{
    top:12px; right:12px; width:18px; height:18px;
  }
  #eggSettingsList .settings-row.checked::after, #foodSettingsList .settings-row.checked::after{
    top:12px; right:12px; width:18px; height:18px; font-size:11px;
  }
}

@media (max-width:390px){
  #eggSettingsList .settings-row, #foodSettingsList .settings-row{ padding:12px; gap:10px }
  #eggSettingsList .settings-row .sicon, #foodSettingsList .settings-row .sicon{ width:44px; height:44px }
  #eggSettingsList .settings-row .sicon img, #foodSettingsList .settings-row .sicon img{ width:28px; height:28px }
  #eggSettingsList .settings-row .name, #foodSettingsList .settings-row .name{ font-size:13px }
}

/* center the action buttons */
#settingsModal .settings-actions{
  display:flex;
  justify-content:center;
  gap:16px;
  flex-wrap:wrap;
  margin-top:24px;
  padding:20px;
  background:rgba(30,42,68,.3);
  border-radius:16px;
  border:1px solid rgba(59,130,246,.1);
}

/* Settings tabs */
.settings-tabs{display:flex;gap:12px;margin:12px 0 16px;justify-content:center;align-items:center}
.settings-tabs .tab-btn{padding:12px 18px;border-radius:12px;border:1px solid rgba(255,255,255,0.16);background:rgba(255,255,255,0.08);color:#e6eefc;cursor:pointer;font-weight:700;font-size:15px}
.settings-tabs .tab-btn.active{background:rgba(59,130,246,.22);border-color:rgba(59,130,246,.5);color:#bfdbfe;box-shadow:0 6px 16px rgba(59,130,246,.25)}

/* ===== Hardening: เลิก transition ที่ทำให้เลย์เอาท์ไหล ===== */
:root{
  --tr-soft: color .2s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease, transform .2s ease;
}

/* ===== List View ===== */
.list-wrap{display:block}
.list-wrap[hidden]{visibility:visible!important;opacity:1!important}

/* Toolbar: ล็อกความสูงให้คงที่, อย่า transition padding/size */
.list-toolbar{
  display:flex; gap:20px; align-items:center;
  margin:24px 0; padding:16px 24px; /* ลดความแปรผัน */
  min-height:56px;                   /* <<< ล็อกสูง */
  background:linear-gradient(145deg,rgba(30,42,68,0.7),rgba(15,24,38,0.5));
  border-radius:var(--border-radius-lg);
  border:1px solid rgba(255,255,255,0.08);
  backdrop-filter:blur(16px);
  box-shadow:0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  transition:var(--tr-soft);         /* <<< แทน var(--transition) */
}
.list-toolbar:hover{ box-shadow:0 20px 40px rgba(0,0,0,.3) }
.list-toolbar .spacer{ flex:1 }

/* Input: ล็อกสูงและ line-height */
.list-toolbar input{
  flex:1;
  height:44px;                       /* <<< ล็อกสูง */
  padding:0 18px;                    /* ไม่ให้สูงเปลี่ยนจาก padding แนวตั้ง */
  border-radius:var(--border-radius);
  border:1px solid var(--glass-bd);
  background:var(--glass-bg);
  color:var(--text);
  outline:none;
  font-size:15px;
  line-height:1.2;                   /* <<< ข้อความไม่ดันกล่อง */
  transition:var(--tr-soft);
  backdrop-filter:blur(8px);
  /* กันเด้งเพราะ browser สร้าง bold/italic เทียม */
  font-synthesis-weight: none;
  font-synthesis-style: none;
}
.list-toolbar input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(59,130,246,.2);
  background:rgba(15,24,38,.9);
}
.list-toolbar input::placeholder{ color:var(--muted); opacity:.8 }

/* Scroll container: กันสกรอลบาร์โผล่ทีหลังทำเลย์เอาท์ขยับ */
.table-scroll{
  border:1px solid rgba(255,255,255,0.08);
  border-radius:var(--border-radius-lg);
  background:linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4));
  overflow:auto;                     /* <<< เปลี่ยนจาก visible */
  box-shadow:0 6px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter:blur(16px);
  transition:var(--tr-soft);
  scrollbar-gutter: stable both-edges; /* <<< กันกระตุกจากสกรอลบาร์ */
}
.table-scroll:hover{ box-shadow:0 20px 40px rgba(0,0,0,.3) }

/* Table: ล็อกโครงคอลัมน์ให้คงที่และไม่ยืดพรวด */
.list-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  table-layout:fixed;               /* <<< คอลัมน์คงที่ ไม่วิ่งตามเนื้อหา */
}

/* หัวตาราง: ล็อกความสูง + ไม่ transition layout */
.list-table thead th{
  position:sticky; top:0;
  background:linear-gradient(180deg,var(--glass-bg),rgba(15,24,38,.9));
  border-bottom:2px solid var(--primary);
  padding:16px 20px;
  height:52px;                      /* <<< ล็อกสูง */
  color:var(--text);
  font-weight:800;                  /* ใช้ 700/800 ลดเด้งจาก webfont 900 */
  letter-spacing:.4px;
  font-size:16px;
  text-transform:uppercase;
  line-height:1.1;                  /* <<< ไม่ให้บรรทัดดัน */
  vertical-align:middle;
  backdrop-filter:blur(16px);
  box-shadow:0 4px 12px rgba(0,0,0,.15);
  transition:var(--tr-soft);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  font-synthesis-weight: none; font-synthesis-style: none;
}

/* ตัวตาราง: ล็อกความสูงแถว + กันข้อความดัน */
.list-table tbody td{
  padding:16px 20px;
  border-bottom:1px solid var(--line);
  height:48px;                      /* <<< ล็อกสูงแถว */
  line-height:1.2;                  /* <<< ข้อความนิ่ง */
  vertical-align:middle;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  transition:var(--tr-soft);
  font-synthesis-weight: none; font-synthesis-style: none;
}

/* ถ้าใช้ไอคอน/รูปในเซลล์ ให้ขนาดตายตัว */
.list-table .cell-icon{
  width:18px; height:18px; flex:0 0 18px; display:inline-block; vertical-align:middle;
}


.list-table tbody tr{
  background: transparent;
  transition: var(--transition);
}

.list-table tbody tr:nth-child(even){
  background: rgba(59, 130, 246, 0.02);
}

.list-table tbody tr:hover{ background: rgba(59,130,246,0.08); box-shadow: 0 4px 16px rgba(59,130,246,0.2); }

/* Staggered row reveal on load */
.list-table tbody tr.row-stagger{opacity:0;transform:translateY(10px)}
.list-table tbody tr.row-stagger.show{opacity:1;transform:translateY(0);transition:opacity .28s ease, transform .28s ease}

.list-table tbody tr.online{
  background: rgba(34, 197, 94, 0.03);
}

.list-table tbody tr.online:hover{
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.2);
}
.list-table th.left,.list-table td.left{text-align:left}
.list-table th.right,.list-table td.right{text-align:center}
.list-table th{text-align:center}
.list-table .namecell{
  display: flex;
  align-items: center;
  gap: 12px;
}

.list-table .namecell .names{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-table .namecell .primary{
  font-weight: 800;
  color: #e6eefc;
  font-size: 16px;
  letter-spacing: 0.2px;
}
/* hide-names visual handled via JS masking now (no blur) */

.list-table .namecell .sub{
  font-size: 13px;
  color: #9cb0d8;
  opacity: 0.85;
}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.1)}}
.list-pager{display:flex;justify-content:center;gap:16px;margin:24px 0;padding:20px;background:linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4));border-radius:var(--border-radius-lg);border:1px solid rgba(255,255,255,0.08);backdrop-filter:blur(16px);box-shadow:0 6px 20px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05);transition:var(--transition)}
.list-pager:hover{box-shadow:0 15px 30px rgba(0,0,0,.2)}
.list-pager .btn{padding:12px 20px;border-radius:var(--border-radius);border:1px solid var(--glass-bd);background:var(--glass-bg);color:var(--text);cursor:pointer;font-weight:600;transition:var(--transition);backdrop-filter:blur(8px)}
.list-pager .btn:hover{background:var(--primary);border-color:var(--primary);color:white;transform:translateY(-1px);box-shadow:0 6px 20px rgba(59,130,246,.3)}
.list-pager .btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
.num-pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--border-radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  font-weight: 700;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}

.num-pill:hover{
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.num-pill .ico{
  opacity: 0.95;
}
.num-pill.pill-coins{background:linear-gradient(135deg,rgba(251,191,36,.2),rgba(245,158,11,.15));border-color:rgba(251,191,36,.4);color:#fbbf24;box-shadow:0 6px 20px rgba(251,191,36,.25)}
.num-pill.pill-coins .ico{color:#facc15}
.num-pill.pill-eggs{background:linear-gradient(135deg,rgba(59,130,246,.2),rgba(37,99,235,.15));border-color:rgba(59,130,246,.4);color:#60a5fa;box-shadow:0 6px 20px rgba(59,130,246,.25)}
.num-pill.pill-eggs .ico{color:#60a5fa}
.num-pill.pill-foods{background:linear-gradient(135deg,rgba(16,185,129,.2),rgba(5,150,105,.15));border-color:rgba(16,185,129,.4);color:#10b981;box-shadow:0 6px 20px rgba(16,185,129,.25)}
.num-pill.pill-foods .ico{color:#10b981}
.num-pill.pill-producespeed{background:linear-gradient(135deg,rgba(168,85,247,.2),rgba(147,51,234,.15));border-color:rgba(168,85,247,.4);color:#a855f7;box-shadow:0 6px 20px rgba(168,85,247,.25)}
.num-pill.pill-producespeed .ico{color:#a855f7}
.num-pill.clickable{cursor:pointer;transition:all 0.2s ease}
.num-pill.clickable:hover{box-shadow:0 4px 12px rgba(96,165,250,.3)}

/* Egg modal styles */
.egg-modal{position:fixed;top:0;left:0;width:100%;height:100%;height:100dvh; /* better mobile viewport */ background:rgba(0,0,0,0.85);backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:1000;overscroll-behavior:none;touch-action:pan-y}
.egg-modal-content{background:linear-gradient(145deg,#1e2a44,#0f172a);border:1px solid rgba(96,165,250,0.3);border-radius:16px;max-width:520px;width:90%;max-height:80vh;overflow:hidden;box-shadow:0 20px 40px rgba(0,0,0,0.4),0 0 0 1px rgba(255,255,255,0.05)}
.egg-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid rgba(96,165,250,0.2);background:linear-gradient(135deg,#0f172a,#1e2a44);position:relative}
.egg-modal-header::before{content:'';position:absolute;top:0;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent,rgba(96,165,250,0.5),transparent)}
.egg-modal-header h3{margin:0;color:#e6eefc;font-size:20px;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,0.3)}
.egg-modal-close{background:rgba(255,255,255,0.1);border:1px solid rgba(255,255,255,0.2);color:#9cb0d8;font-size:18px;cursor:pointer;padding:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:8px;transition:all 0.2s ease}
.egg-modal-close:hover{background:rgba(239,68,68,0.2);border-color:rgba(239,68,68,0.4);color:#fca5a5}
.egg-modal-body{padding:24px;max-height:60vh;overflow-y:auto;background:rgba(255,255,255,0.02)}
.egg-item{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;margin-bottom:12px;background:linear-gradient(135deg,rgba(255,255,255,0.08),rgba(255,255,255,0.03));border:1px solid rgba(255,255,255,0.15);border-radius:12px;transition:all 0.2s ease}
.egg-item:hover{box-shadow:0 4px 12px rgba(96,165,250,0.15);border-color:rgba(96,165,250,0.3);transform:translateY(-1px)}
.egg-item:last-child{margin-bottom:0}
.egg-info{display:flex;align-items:center;gap:16px}
.egg-icon{width:40px;height:40px;object-fit:contain;border-radius:10px;background:linear-gradient(135deg,rgba(0,0,0,0.3),rgba(0,0,0,0.1));padding:4px;border:1px solid rgba(255,255,255,0.1);box-shadow:0 2px 8px rgba(0,0,0,0.2)}
.egg-name{color:#e6eefc;font-weight:600;text-transform:capitalize;font-size:16px;text-shadow:0 1px 2px rgba(0,0,0,0.3)}
.egg-details{display:flex;flex-direction:row;align-items:center;gap:12px}
.egg-count{color:#60a5fa;font-weight:700;font-variant-numeric:tabular-nums;font-size:18px;text-shadow:0 1px 2px rgba(0,0,0,0.3);background:linear-gradient(135deg,rgba(96,165,250,0.1),rgba(96,165,250,0.05));padding:6px 12px;border-radius:8px;border:1px solid rgba(96,165,250,0.2)}
.egg-buffs{display:flex;gap:6px}
.buff-item{display:flex;align-items:center;gap:4px;padding:4px 8px;border-radius:8px;font-size:12px;font-weight:600;backdrop-filter:blur(10px);box-shadow:0 2px 4px rgba(0,0,0,0.2);transition:all 0.2s ease;min-width:50px;justify-content:center}
.buff-item.dino{background:linear-gradient(135deg,rgba(139,92,246,.2),rgba(168,85,247,.15));border:1px solid rgba(139,92,246,.4);color:#a855f7}
.buff-item.snow{background:linear-gradient(135deg,rgba(6,182,212,.2),rgba(34,211,238,.15));border:1px solid rgba(6,182,212,.4);color:#06b6d4}
.buff-item.halloween{background:linear-gradient(135deg,rgba(249,115,22,.2),rgba(251,146,60,.15));border:1px solid rgba(249,115,22,.4);color:#f97316}
.buff-item.golden{background:linear-gradient(135deg,rgba(251,191,36,.12),rgba(253,224,71,.08));border:1px solid rgba(251,191,36,.2);color:#fbbf24}
.buff-item.diamond{background:linear-gradient(135deg,rgba(168,85,247,.12),rgba(192,132,252,.08));border:1px solid rgba(168,85,247,.2);color:#a855f7}
.buff-item.electric{background:linear-gradient(135deg,rgba(234,179,8,.12),rgba(250,204,21,.08));border:1px solid rgba(234,179,8,.2);color:#eab308}
.buff-item.fire{background:linear-gradient(135deg,rgba(220,38,38,.12),rgba(239,68,68,.08));border:1px solid rgba(220,38,38,.2);color:#dc2626}
.buff-item.none{background:linear-gradient(135deg,rgba(156,176,216,.12),rgba(203,213,245,.08));border:1px solid rgba(156,176,216,.2);color:#9cb0d8}

/* Buff icon styling */
.buff-icon-img {
  width: 12px;
  height: 12px;
  object-fit: contain;
  filter: brightness(1.1);
}

.tt-stat-icon .buff-icon-img {
  width: 16px;
  height: 16px;
}
.buff-item i{font-size:10px;opacity:0.8}
.buff-value{font-size:11px;font-weight:700;text-shadow:0 1px 2px rgba(0,0,0,0.3)}
.no-data{text-align:center;color:#9cb0d8;font-style:italic;padding:60px 20px;font-size:18px;background:linear-gradient(135deg,rgba(255,255,255,0.05),rgba(255,255,255,0.02));border:1px dashed rgba(255,255,255,0.2);border-radius:12px;margin:20px 0}

/* List toolbar styling */
#listSearch, #rowsPerPage {
  background: rgba(15,24,38,.8) !important;
  border: 1px solid rgba(59,130,246,.3) !important;
  color: #e6eefc !important;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.15) !important;
  transition: all 0.3s ease !important;
}

#listSearch::placeholder {
  color: #9cb0d8 !important;
  opacity: 1 !important;
}

#listSearch:focus, #rowsPerPage:focus {
  outline: none !important;
  border-color: rgba(59,130,246,.6) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.1) !important;
  background: rgba(15,24,38,.9) !important;
}

#rowsPerPage {
  cursor: pointer !important;
  min-width: 80px !important;
  min-height: 44px !important;
}

#rowsPerPage option {
  background: rgba(15,24,38,.95) !important;
  color: #e6eefc !important;
  padding: 8px 12px !important;
}

#rowsPerPage option:hover {
  background: rgba(59,130,246,.1) !important;
}

#rowsPerPage option:checked {
  background: rgba(59,130,246,.2) !important;
  color: #60a5fa !important;
}

/* ===== Moved from inline <style> in index.html ===== */
:root{--card-grad-2:linear-gradient(180deg,rgba(16,24,40,.6),rgba(10,16,28,.6));--shadow:0 8px 30px rgba(0,0,0,.15)}
body{margin:0;background:linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%);background-attachment:fixed;color:#e6eefc;font-family:Inter,'Noto Sans Thai',system-ui,-apple-system,Segoe UI,Roboto,'Helvetica Neue',Arial,'Noto Color Emoji','Apple Color Emoji','Segoe UI Emoji'}
.wrap{max-width:min(1400px,100%);margin:0 auto;padding:24px;position:relative;overflow-x:hidden}
.title-row{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px;padding:20px 0}
.title{display:flex;align-items:center;gap:16px;font-weight:800;font-size:28px;background:linear-gradient(135deg,var(--text),var(--primary));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}
/* Modern FAB Button Design */
.fab{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:12px;border:none;background:rgba(30,42,68,0.9);color:#ffffff;transition:all 0.2s ease;position:relative;box-shadow:0 2px 8px rgba(0,0,0,0.3)}
.fab:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,0.4);background:rgba(40,52,78,0.95)}
.fab:active{transform:translateY(0);transition:all 0.1s ease}
.fab i{font-size:18px;color:#ffffff;display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.fab i.fa-discord{color:#5865F2}
.fab i.fa-gear{color:#10B981}
.fab i.fa-calendar-day{color:#F59E0B}
.fab i.fa-plus{color:#EF4444}

/* Discord User Popup */
.discord-user-popup {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  padding: 16px;
  min-width: 200px;
  animation: popupSlideIn 0.2s ease-out;
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.popup-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-color);
}

.popup-user-info {
  flex: 1;
}

.popup-username {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 4px;
}

.popup-user-id {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ff4757, #ff3742);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.popup-logout-btn:hover {
  background: linear-gradient(135deg, #ff3742, #ff2f3a);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.popup-logout-btn:active {
  transform: translateY(0);
}

.popup-logout-btn i {
  font-size: 14px;
}

/* Discord Avatar in FAB Button */
.fab .discord-avatar-btn {
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.fab:hover .discord-avatar-btn {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: scale(1.05);
}
.section-title{margin:32px 0 20px;opacity:.95;font-weight:700;font-size:20px;color:var(--text);display:flex;align-items:center;gap:12px;padding:20px 24px;background:linear-gradient(145deg,rgba(30,42,68,0.6),rgba(15,24,38,0.4));border-radius:var(--border-radius-lg);border:1px solid rgba(255,255,255,0.08);backdrop-filter:blur(12px);box-shadow:0 6px 20px rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.05);position:relative}
.section-title::before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg,var(--primary),var(--primary-hover));border-radius:var(--border-radius-lg) var(--border-radius-lg) 0 0}
.section-title i{color:var(--primary);font-size:18px;opacity:.9;text-shadow:0 0 10px rgba(59,130,246,.5)}
.bar{min-height:20px}

/* ===== Mobile Responsive Design ===== */
@media (max-width:768px){
  .wrap{padding:12px;overflow-x:hidden}
  .title-row{gap:8px;margin-bottom:16px;padding:12px 0;flex-wrap:wrap}
  .title{font-size:20px;gap:8px}
  .fab{width:40px;height:40px;border-radius:8px}
  .section-title{font-size:16px;padding:12px 14px;margin:20px 0 12px}
  .list-toolbar{flex-direction:column;gap:12px;padding:12px 16px;margin:16px 0}
  .list-toolbar input{font-size:16px;padding:10px 14px;width:100%;box-sizing:border-box}
  .list-toolbar select{font-size:16px;padding:10px 14px;width:100%;box-sizing:border-box}
  .table-scroll{overflow:visible;-webkit-overflow-scrolling:touch;border-radius:12px}
  .list-table{min-width:500px;width:100%}
  .list-table thead th{padding:12px 14px;font-size:14px;white-space:nowrap}
  .list-table tbody td{padding:14px 12px;font-size:14px;word-break:break-word}
  .list-table .num-pill{font-size:14px;padding:8px 12px}
  .list-pager{gap:8px;padding:12px;margin:16px 0;flex-wrap:wrap}
  .list-pager .btn{padding:8px 12px;font-size:13px;min-width:40px}
  .num-pill{padding:6px 10px;gap:6px;font-size:12px}
  .egg-modal-content{width:95vw;max-width:500px;margin:10px}
  .egg-modal-header{padding:16px}
  .egg-modal-body{padding:16px;max-height:70vh}
  .egg-item{padding:10px 12px;margin-bottom:8px}
  .egg-icon{width:28px;height:28px}
  .egg-name{font-size:13px}
  .egg-count{font-size:14px;padding:3px 6px}
  .egg-details{gap:8px}
  .egg-buffs{gap:4px}
  .buff-item{padding:3px 6px;font-size:11px;min-width:45px}
  .buff-item i{font-size:9px}
  .buff-value{font-size:10px}
}

@media (max-width:480px){
  .wrap{padding:8px;overflow-x:hidden}
  .title-row{gap:6px;margin-bottom:12px;padding:8px 0;flex-wrap:wrap}
  .title{font-size:18px;gap:6px}
  .fab{width:36px;height:36px;border-radius:6px}
  .section-title{font-size:14px;padding:10px 12px;margin:16px 0 8px}
  .list-toolbar{flex-direction:column;gap:8px;padding:8px 12px;margin:12px 0}
  .list-toolbar input{font-size:16px;padding:8px 12px;width:100%;box-sizing:border-box}
  .list-toolbar select{font-size:16px;padding:8px 12px;width:100%;box-sizing:border-box}
  .table-scroll{overflow:visible;-webkit-overflow-scrolling:touch;border-radius:8px}
  .list-table{min-width:380px;width:100%}
  .list-table thead th{padding:8px 10px;font-size:11.5px;white-space:nowrap}
  .list-table tbody td{padding:8px 10px;font-size:11.5px;word-break:break-word}
  .list-table .num-pill{font-size:10.5px;padding:4px 6px}
  .list-pager{gap:6px;padding:8px;margin:12px 0;flex-wrap:wrap}
  .list-pager .btn{padding:6px 10px;font-size:12px;min-width:36px}
  .num-pill{padding:4px 8px;gap:4px;font-size:11px}
  .egg-modal-content{width:98vw;max-width:350px;margin:5px}
  .egg-modal-header{padding:10px 12px}
  .egg-modal-body{padding:10px;max-height:82vh}
  .egg-item{padding:8px 10px;margin-bottom:6px;min-height:unset}
  .egg-icon{width:22px;height:22px}
  .egg-name{font-size:12.5px}
  .egg-count{font-size:12.5px;padding:2px 6px;min-width:38px}
  .egg-details{gap:6px}
  .egg-buffs{gap:3px}
  .buff-item{padding:2px 4px;font-size:10px;min-width:40px}
  .buff-item i{font-size:8px}
  .buff-value{font-size:9px}
}

@media (max-width:380px){
  .egg-modal-content{width:98vw;max-height:88vh}
  .egg-item{padding:6px 8px;margin-bottom:6px}
  .egg-name{font-size:12px}
  .egg-count{font-size:12px;padding:2px 6px;min-width:36px}
}

/* Mobile table horizontal scroll */
@media (max-width:768px){
  .table-scroll{
    border-radius:12px;
    box-shadow:0 8px 24px rgba(0,0,0,.2);
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }
  .list-table{
    border-spacing:0;
    min-width:500px;
  }
  .list-table thead th{
    position:sticky;
    top:0;
    z-index:10;
    white-space:nowrap;
  }
  .list-table tbody td{
    word-break:break-all;
  }
  .list-table .num-pill{
    font-size:12px;
    padding:4px 8px;
  }
}

/* Mobile modal improvements */
@media (max-width:768px){
  .egg-modal{
    padding:10px;
    align-items:center; /* keep centered by default */
    padding-top:20px;
  }
  .egg-modal-content{
    margin:0;
    width:96vw;
    max-height:88vh; max-height:88dvh; /* account for mobile bars */
    overflow:hidden;
    display:flex;
    flex-direction:column;
  }
  .egg-modal-body{
    flex:1;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain; /* prevent background scroll chaining */
    touch-action:pan-y;          /* improve finger scroll */
    scroll-behavior:smooth;
  }
}

/* Center Food modal on mobile specifically */
@media (max-width:768px){
  .food-modal{align-items:center!important;justify-content:center!important}
}

/* Mobile button improvements */
@media (max-width:768px){
  .btn-primary, .btn-secondary{
    min-height:44px;
    font-size:16px;
    padding:12px 20px;
  }
  .list-pager .btn{
    min-height:44px;
    min-width:44px;
  }
}

/* Mobile input improvements */
@media (max-width:768px){
  .list-toolbar input{
    min-height:44px;
    font-size:16px;
  }
  #rowsPerPage{
    min-height:44px;
    font-size:16px;
  }
}


.panel-hd h3 i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  line-height: 1;
  vertical-align: middle;
  padding: 2px;
}

/* PC Name styling - แสดงใต้ชื่อผู้เล่น */
.pc-name {
  display: inline-block;
  font-size: 9px;
  color: #9cb0d8;
  background: rgba(156, 176, 216, 0.1);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(156, 176, 216, 0.2);
  font-weight: 500;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-top: 4px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.pc-name:hover {
  background: rgba(156, 176, 216, 0.15);
  border-color: rgba(156, 176, 216, 0.3);
  color: #e6eefc;
}

/* Inline style attributes moved from index.html */

/* Mobile responsive for status bar */
@media (max-width:768px){
  .statusbar{padding:12px 16px;gap:8px;margin:12px auto}
  .statusbar .row{gap:8px}
  .status-badge{padding:6px 12px;gap:6px;font-size:13px}
  .status-badge i{font-size:11px}
  .status-badge b{font-size:13px}
  .status-badge .num{font-size:13px}
}
@media (max-width:480px){
  .statusbar{padding:8px 12px;gap:6px;margin:8px auto}
  .statusbar .row{gap:6px}
  .status-badge{padding:5px 10px;gap:5px;font-size:12px}
  .status-badge i{font-size:10px}
  .status-badge b{font-size:12px}
  .status-badge .num{font-size:12px}
}

/* Status badge animations */
@keyframes statusPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.01); }
}

.status-badge.online {
  animation: statusPulse 3s infinite;
}

.status-badge.online i {
  color: #22c55e;
}

.status-badge.online .num {
  color: #22c55e;
}

/* Simple glow effect for online status */
.status-badge.online {
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}

.status-badge.online:hover {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* ===== Login Page Styles ===== */
/* Prevent white flash on page load */
html, body {
  background: linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%) !important;
  background-attachment: fixed !important;
  margin: 0;
  padding: 0;
  transition: background-color 0.1s ease;
}

* {
  box-sizing: border-box;
}

/* Login page styles */
.login-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%);
  background-attachment: fixed;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Prevent closing by clicking outside */
  pointer-events: auto;
}

/* Prevent closing login panel by clicking outside */
.login-page:not(.hidden) .login-panel {
  pointer-events: auto;
}

.login-page:not(.hidden) {
  pointer-events: auto;
}

/* Ensure login page covers everything */
.login-page:not(.hidden) {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
}

.login-panel {
  background: #1e293b;
  border-radius: 16px;
  padding: 48px;
  max-width: 500px;
  width: 95%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border: 1px solid #334155;
}

.discord-welcome h2 {
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  font-family: 'Inter', sans-serif;
}

.discord-welcome p {
  color: #94a3b8;
  font-size: 16px;
  margin: 0 0 32px 0;
  font-family: 'Inter', sans-serif;
}

.btn-discord {
  background: #5865f2;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.btn-discord:hover {
  background: #4752c4;
}

.btn-discord i {
  font-size: 18px;
}

.form-msg {
  margin-top: 16px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

.form-msg.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.form-msg.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* Discord User Info Styling - Like Image 2 */
.discord-user-card {
  background: #1e293b;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border: 1px solid #334155;
  position: relative;
  overflow: hidden;
  max-width: 480px;
  width: 100%;
}

/* Override modal panel size for Discord modal */
#discordModal .panel {
  width: min(560px, 95vw) !important;
  max-width: 560px !important;
  padding: 28px !important;
}
/* Center title for Discord login modal */
#discordModal .panel-hd{ justify-content:center; }
#discordLoginTitle{ text-align:center; width:100%; }
/* Ensure the title truly centers in header */
#discordModal .panel-hd h3{ margin:0 auto !important; text-align:center !important; width:100% !important; display:block !important; }
/* Decorative divider under login title */
#discordModal .panel-hd{ position:relative; margin-bottom:18px }
#discordModal .panel-hd::after{
  content:""; position:absolute; left:8%; right:8%; bottom:-8px; height:1px;
  background:linear-gradient(90deg, transparent, rgba(96,165,250,.7), rgba(255,255,255,.5), rgba(96,165,250,.7), transparent);
  border-radius:1px; opacity:.9; box-shadow:0 0 10px rgba(96,165,250,.35);
}

.discord-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid #334155;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.discord-card-title {
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.discord-card-title i {
  color: #5865f2;
  font-size: 20px;
}

.close-btn {
  background: #475569;
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.close-btn:active {
  transform: scale(0.95);
}

.close-btn .x {
  font-size: 18px;
  font-weight: bold;
}

.discord-user-content {
  padding: 32px;
}

.discord-user-profile {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
}

.discord-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.discord-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #475569;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.discord-avatar:hover {
  transform: scale(1.05);
}

.online-indicator {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  background: #00d4aa;
  border: 3px solid #1e293b;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.6);
}

.discord-user-info {
  flex: 1;
  min-width: 0;
}

.discord-username {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  font-family: 'Inter', sans-serif;
}

.discord-id-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.discord-id-label {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.discord-id-field {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #0f172a;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #334155;
  transition: all 0.2s ease;
}

.discord-id-field:hover {
  border-color: #475569;
  background: #1e293b;
}

.discord-id {
  color: #ffffff;
  font-size: 15px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-weight: 500;
  flex: 1;
  letter-spacing: 0.5px;
}

.copy-btn {
  background: #475569;
  border: none;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: #5865f2;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(88, 101, 242, 0.3);
}

.copy-btn:active {
  transform: translateY(0);
}

.discord-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.btn-logout {
  background: #475569;
  border: none;
  color: #ffffff;
  padding: 16px 32px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  min-width: 160px;
  justify-content: center;
}

.btn-logout:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(220, 38, 38, 0.3);
}

.btn-logout:active {
  transform: translateY(0);
}

.btn-logout i {
  font-size: 16px;
}

/* Hide main content initially */
#mainContent {
  display: none;
}

/* Show main content after login */
#mainContent.show {
  display: grid;
}

/* Hide login page after login */
.login-page.hidden {
  display: none;
}

/* Hide all other elements when login page is visible */
.login-page:not(.hidden) ~ * {
  display: none !important;
}

.login-page:not(.hidden) + * {
  display: none !important;
}

/* Hide footer and status bar when login page is visible */
.login-page:not(.hidden) ~ .footer {
  display: none !important;
}

.login-page:not(.hidden) ~ #status {
  display: none !important;
}

/* Hide all modals except discord modal when login page is visible */
.login-page:not(.hidden) ~ .modal:not(#discordModal) {
  display: none !important;
}

/* Hide toast when login page is visible */
.login-page:not(.hidden) ~ .toast-wrap {
  display: none !important;
}

/* Hide all body children except login page when login is visible */
body:has(.login-page:not(.hidden)) > *:not(.login-page) {
  display: none !important;
}

/* Alternative approach - hide everything when login page is visible */
.login-page:not(.hidden) {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  background: linear-gradient(135deg,#0b1120 0%,#1e293b 50%,#0f172a 100%) !important;
  background-attachment: fixed !important;
}

/* Force hide all other elements */
.login-page:not(.hidden) ~ *,
.login-page:not(.hidden) + *,
body:has(.login-page:not(.hidden)) .wrap,
body:has(.login-page:not(.hidden)) .footer,
body:has(.login-page:not(.hidden)) .modal:not(#discordModal),
body:has(.login-page:not(.hidden)) .toast-wrap {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Responsive design for login modal */
@media (max-width: 768px) {
  .login-panel {
    max-width: 90vw;
    padding: 32px 24px;
    margin: 20px;
  }
  
  .discord-user-card {
    max-width: 100%;
  }
  
  .discord-card-header {
    padding: 20px 24px;
  }
  
  .discord-user-content {
    padding: 24px;
  }
  
  .discord-user-profile {
    gap: 20px;
    margin-bottom: 24px;
  }
  
  .discord-avatar {
    width: 64px;
    height: 64px;
  }
  
  .discord-username {
    font-size: 20px;
    margin-bottom: 16px;
  }
  
  .discord-id-section {
    gap: 12px;
  }
  
  .discord-id-field {
    padding: 14px 16px;
    gap: 12px;
  }
  
  .copy-btn {
    width: 36px;
    height: 36px;
    padding: 8px 10px;
  }
  
  .btn-logout {
    padding: 14px 28px;
    font-size: 15px;
    min-width: 140px;
  }
}

@media (max-width: 480px) {
  .login-panel {
    max-width: 95vw;
    padding: 24px 20px;
    margin: 16px;
  }
  
  .discord-card-header {
    padding: 16px 20px;
  }
  
  .discord-user-content {
    padding: 20px;
  }
  
  .discord-user-profile {
    gap: 16px;
    margin-bottom: 20px;
  }
  
  .discord-avatar {
    width: 56px;
    height: 56px;
  }
  
  .discord-username {
    font-size: 18px;
    margin-bottom: 14px;
  }
  
  .discord-id-field {
    padding: 12px 14px;
    gap: 10px;
  }
  
  .copy-btn {
    width: 32px;
    height: 32px;
    padding: 6px 8px;
  }
  
  .btn-logout {
    padding: 12px 24px;
    font-size: 14px;
    min-width: 120px;
  }
}


/* Updated system styles - ใช้ counts_snapshot_live.updated_at */
.badge-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  font-weight: 700;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  font-size: 12px;
  color: #cfe0ff;
  transition: all 0.2s ease;
}

.badge-time:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.25);
}

.badge-time-recent {
  background: linear-gradient(135deg, rgba(34,197,94,.2), rgba(22,163,74,.15)) !important;
  border-color: rgba(34,197,94,.4) !important;
  color: #22c55e !important;
  box-shadow: 0 6px 20px rgba(34,197,94,.25) !important;
}

.badge-time-old {
  background: linear-gradient(135deg, rgba(239,68,68,.2), rgba(220,38,38,.15)) !important;
  border-color: rgba(239,68,68,.4) !important;
  color: #ef4444 !important;
  box-shadow: 0 6px 20px rgba(239,68,68,.25) !important;
}

.badge-time-never {
  background: linear-gradient(135deg, rgba(75,85,99,.2), rgba(55,65,81,.15)) !important;
  border-color: rgba(75,85,99,.4) !important;
  color: #f9fafb !important;
  box-shadow: 0 6px 20px rgba(75,85,99,.25) !important;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: .8; }
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}

/* ===== NEW LOGIN DESIGN ===== */
.login-panel {
  max-width: 560px;
  width: 95%;
  margin: 0 auto;
}

/* User Info Card */
.user-info {
  display: none;
}

/* HTML5 hidden attribute support - with fallback for older browsers */
[hidden] {
  display: none !important;
}

/* Fallback for browsers that don't support hidden attribute properly */
[hidden="true"] {
  display: none !important;
}

[hidden="false"] {
  display: block !important;
}

/* Handle empty hidden attribute - some browsers treat this as hidden */
[hidden=""] {
  display: none !important;
}

/* Override empty hidden for elements that should be shown */
.user-info[hidden=""]:not([hidden="true"]),
.login-form[hidden=""]:not([hidden="true"]) {
  display: block !important;
}

/* Show when not hidden - multiple selectors for browser compatibility */
.user-info:not([hidden]),
.user-info[hidden="false"] {
  display: block;
}

/* Override hidden for specific cases */
.user-info[hidden="false"] {
  display: block !important;
}

.user-card {
  padding: 20px;
}

.user-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  position: relative;
}

.user-avatar {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #5865f2;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.avatar:hover {
  transform: scale(1.1);
}

.status-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #00d4aa;
  border: 3px solid #1e293b;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 212, 170, 0.6);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.username {
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px 0;
  font-family: 'Inter', sans-serif;
}

.user-id {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.id-text {
  color: #94a3b8;
  font-size: 13px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  flex: 1;
}

.copy-button {
  background: #5865f2;
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 12px;
}

.copy-button:hover {
  background: #4752c4;
  transform: scale(1.1);
}

.close-button {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.close-button:hover {
  background: #dc2626;
  color: #ffffff;
  transform: scale(1.1);
}

.user-actions {
  display: flex;
  justify-content: center;
}

.logout-button {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border: none;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.logout-button:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.logout-button:active {
  transform: translateY(0);
}

/* Discord Account Title */
#discordInfoTitle {
  color: #ffffff !important;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  font-family: 'Inter', sans-serif;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Login Form */
.login-form {
  display: none;
}

/* Show when not hidden - multiple selectors for browser compatibility */
.login-form:not([hidden]),
.login-form[hidden="false"] {
  display: block;
}

/* Override hidden for specific cases */
.login-form[hidden="false"] {
  display: block !important;
}

.login-content {
  padding: 20px;
  text-align: center;
}

/* Keep Discord login subtitle in a single line */
#discordModal .login-header p{
  white-space: normal; /* show full text */
  overflow: visible;
  text-overflow: clip;
  font-size: 15px;
  margin: 0 0 12px 0;
  text-align: center;
}

.login-header {
  margin-bottom: 32px;
}

.logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #5865f2, #4752c4);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 10px 30px rgba(88, 101, 242, 0.3);
}

.logo i {
  font-size: 36px;
  color: #ffffff;
  line-height: 1;
  vertical-align: middle;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-header h1 {
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  font-family: 'Inter', sans-serif;
}

.login-header p {
  color: #ffffff;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.discord-button {
  background: #5865f2;
  border: none;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background-color 0.2s ease;
  width: 100%;
  line-height: 1;
  height: 44px;
}
.discord-button[disabled], .discord-button.loading{
  opacity:.7;
  cursor:default;
  pointer-events:none; /* hover visual still works but no click */
}
.discord-button.no-click{ pointer-events:none; }
.discord-button.loading::after{
  content:' Loading...';
  font-weight:600;
  margin-left:6px;
}

.discord-button:hover {
  background: linear-gradient(135deg, #4752c4, #3c45a5);
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(88, 101, 242, 0.4);
}

.discord-button:active {
  transform: translateY(-1px);
}

.discord-button i {
  font-size: 18px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease;
  margin-top: 16px;
}

.message.error {
  background: rgba(220, 38, 38, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.message.success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .login-panel {
    max-width: 350px;
  }
  
  .user-card {
    padding: 16px;
  }
  
  .login-content {
    padding: 16px;
  }
  
  .user-header {
    gap: 12px;
    margin-bottom: 16px;
  }
  
  .avatar {
    width: 50px;
    height: 50px;
  }
  
  .username {
    font-size: 18px;
  }
  
  .login-header h1 {
    font-size: 24px;
  }
  
  .logo {
    width: 70px;
    height: 70px;
  }
  
  .logo i {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .login-panel {
    max-width: 320px;
  }
  
  .user-card {
    padding: 12px;
  }
  
  .login-content {
    padding: 12px;
  }
  
  .avatar {
    width: 45px;
    height: 45px;
  }
  
  .username {
    font-size: 16px;
  }
  
  .login-header h1 {
    font-size: 22px;
  }
  
  .logo {
    width: 60px;
    height: 60px;
  }
  
  .logo i {
    font-size: 28px;
  }
  
  .discord-button {
    padding: 14px 24px;
    font-size: 15px;
  }
}

.tt .tt-row{display:flex;justify-content:space-between;gap:12px;padding:4px 0;color:#cbd5e1}
.tt .tt-sep{height:1px;background:rgba(255,255,255,0.08);margin:6px 0}

/* Event badge next to player name */
.ev-badge{display:inline-flex;align-items:center;gap:6px;margin-left:0;padding:0 10px;height:22px;border-radius:12px;background:rgba(250,204,21,0.12);border:1px solid rgba(250,204,21,0.3);color:#fde68a;font-weight:700;font-size:12px;vertical-align:middle}
.ev-badge i{color:#fbbf24}
.ev-badge .ev-icon{width:14px;height:14px;border-radius:3px;display:inline-block;object-fit:contain}
.ev-badge .ev-num{line-height:1}

.badges-row{display:inline-flex;align-items:center;gap:8px;margin-left:0;margin-top:4px}

/* Gem badge */
.gem-badge{display:inline-flex;align-items:center;gap:6px;margin-left:0;padding:0 10px;height:22px;border-radius:12px;background:rgba(96,165,250,0.12);border:1px solid rgba(96,165,250,0.3);color:#93c5fd;font-weight:700;font-size:12px;vertical-align:middle}
.gem-badge i{color:#93c5fd}
.gem-badge .gem-num{line-height:1}

/* Account and PC badge alignment */
.namecell{display:flex;justify-content:center;width:100%}
.namecell .names{display:inline-flex;flex-direction:column;align-items:center;gap:6px;text-align:center}
.namecell .names .primary{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:800}
.account-ico{color:#9ca3af;margin-right:6px}
.namecell .names .pc-name{display:inline-flex;align-items:center;justify-content:center;gap:6px;margin-top:6px;padding:4px 10px;border-radius:12px;background:rgba(148,163,184,0.08);border:1px solid rgba(148,163,184,0.25);color:#cbd5e1;font-size:12px;line-height:16px}
.namecell .names .pc-name i{font-size:12px;color:#9ca3af}

