:root {
  --bg1: #071a1a;
  --bg2: #0e2a2a;
  --accent: #2cf5a2;
  --accent-2: #6ad6ff;
  --accent-3: #ffbd6a;
  --ink: #e8fff7;
  --muted: #9ce4cc;
  --chip: #0d2626aa;
  --glass: #0b2020bb;
  --glass-2: #103030cc;
  --ring: #163d3d;
}

/* === Base Reset === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: 
    radial-gradient(1200px at 80% -10%, #123f3f 0%, transparent 60%),
    radial-gradient(900px at -10% 110%, #103535 0%, transparent 55%),
    linear-gradient(to bottom, var(--bg1), var(--bg2));
  transform: translateZ(0); /* OBS fix */
}

/* === Sparkles (Behind Panels) === */
.sparkle {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  z-index: 0;
  background-image: 
    radial-gradient(2px at 20% 30%, var(--accent) 50%, transparent 52%),
    radial-gradient(2px at 80% 10%, var(--accent-2) 50%, transparent 52%),
    radial-gradient(3px at 60% 70%, var(--accent-3) 50%, transparent 52%);
  animation: drift 26s linear infinite;
}

@keyframes drift {
  to { transform: translateY(-100px); }
}

/* === Panel Grid === */
.frame {
  position: absolute;
  inset: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 300px 300px 300px 1fr 300px;
  grid-auto-rows: minmax(min-content, max-content);
  align-items: start;
  gap: 12px;
}

/* === Fixed Panel Styling === */
.panel {
  background: var(--glass);
  border: 1px solid var(--ring);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  overflow: hidden; /* Critical for rounded corners */
  isolation: isolate; /* Contains blending */
  position: relative;
}

/* Double bg layer for perfect corners */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--glass);
  border-radius: 18px;
  z-index: -1;
}

/* === Panel Header === */
.panel .head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-2);
  border-bottom: 1px solid var(--ring);
  flex-shrink: 0;
}

.panel .head .title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.panel .head .live {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-2);
  text-shadow: 0 0 8px rgba(106, 214, 255, 0.4);
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* === Panel Body === */
.panel .body {
  flex: 0 1 auto;
  padding: 12px;
  overflow: visible;
  background: transparent; /* Ensure clean bg */
}

/* === Content Styles === */
.list {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  background: #0b2323aa;
  border: 1px solid var(--ring);
}

.row img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: #0a1e1e;
  border: 1px solid #1a4d4d;
}

.name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qty {
  margin-left: auto;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  background: #092b20;
  color: var(--accent);
  border: 1px solid #1b5b49;
  font-size: 12px;
}

/* === Rarity Colors === */
.r-common { background: #a1b2b8; color: #021a14; }
.r-uncommon { background: #7ce6ad; color: #021a14; }
.r-rare { background: #86a4ff; color: #021a14; }
.r-divine { background: #ffc07a; color: #021a14; }

/* === Weather Panel === */
.weather {
  max-height: 650px;
  grid-column: 4 / span 1;
}

.wxgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.wcard {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: #0b2020bb;
  border: 1px solid var(--ring);
  font-size: 13px;
}

.wico {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.wname {
  flex: 1;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wlast {
  font-size: 11px;
  color: var(--muted);
}

/* === Ticker === */
.ticker {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--ring);
  overflow: hidden;
}

.ticker::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--glass);
  border-radius: inherit;
  z-index: -1;
}

.ticker .lamp {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}

.ticker .text {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: #0f2a2a;
  border: 1px solid var(--ring);
  font-size: 11px;
  color: #b7ffee;
  font-weight: 800;
}

/* === Responsive === */
@media (max-width: 1400px) {
  .frame {
    grid-template-columns: repeat(3, 1fr);
  }
  .weather {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .frame {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .frame {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion) {
  .sparkle, .dot {
    animation: none !important;
  }
}