/* SHELL LAYOUT */
html, body { 
  background-color: var(--bg); 
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text); font-family: 'Segoe UI', sans-serif; 
  height: 100vh; overflow: hidden; display: flex; flex-direction: column; margin: 0; padding: 0; font-size: clamp(14px, 1.2vw, 20px);
  transition: background-color 0.5s ease;

  /* CHANGE THIS VALUE 👇 */
  font-size: 20px;

  /* DYNAMIC PLAYER VARIABLES (Defaults) */
  :root {
    --p1-color: #ff4444;
    --p2-color: #4488ff;
}
}

/* Overlay for text readability */



/* --- TOP BAR (TRUE CENTERED LAYOUT) --- */

/* --- TOP BAR (TRUE CENTERED LAYOUT) --- */
.top-bar {
    height: 75px;
    width: 100%;
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) 160px;
    align-items: center;
    padding: 0 15px;
    background: rgba(10,10,10,0.6);
    backdrop-filter: blur(6px);
    border-bottom: var(--border);
    z-index: 1000;
    box-sizing: border-box;
    overflow: hidden;
}

.top-left,
.top-right {
    min-width: 0;
    display: flex;
    align-items: center;
}

.top-left {
    justify-content: flex-start;
}

.top-right {
    justify-content: flex-end;
}

.top-center {
    min-width: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    gap: 80px; 
}


.top-center-inner {
    width: min(100%, 1180px);
    display: grid;
    grid-template-columns: 215px minmax(420px, 520px) 215px;
    align-items: center;
    justify-content: center;
    gap: 90px;
    margin: 0 auto;
}

.top-score-box {
    width: 100%;
    min-width: 0;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 5px 12px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}



.ts-name {
    font-weight: 780;
    font-size: 1.5rem;
    text-transform: uppercase;
    text-shadow:
        -1px -1px 0 color-mix(in srgb, currentColor 100%, black 80%),
         1px -1px 0 color-mix(in srgb, currentColor 100%, black 80%),
        -1px  1px 0 color-mix(in srgb, currentColor 100%, black 80%),
         1px  1px 0 color-mix(in srgb, currentColor 100%, black 80%),
         0 0 5px currentColor;
}

.ts-score {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    text-shadow:
        -1px -1px 0 color-mix(in srgb, var(--streak-color) 100%, black 65%),
         1px -1px 0 color-mix(in srgb, var(--streak-color) 100%, black 65%),
        -1px  1px 0 color-mix(in srgb, var(--streak-color) 100%, black 65%),
         1px  1px 0 color-mix(in srgb, var(--streak-color) 100%, black 65%),
         0 0 10px var(--streak-color);
}

.ts-ctrls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.np-widget {
    width: auto;
    min-width: 0;
    max-width: none;
    height: 60px;
    background: rgba(0,0,0,0.6);
    border: var(--border);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    padding: 0 12px 0 0;
    justify-self: center;
}

.mini-plus { 
    width: 25px; height: 25px; background: rgba(255,255,255,0.1); 
    cursor: pointer; display: flex; align-items: center; justify-content: center; 
    font-size: 1rem; border-radius: 4px; color: #aaa; transition: 0.2s;
}
.mini-plus:hover { background: var(--accent); color: #000; }


/* Combined Status Badge */
.status-badge { 
    display: flex; align-items: center; gap: 10px; 
    font-weight: bold; color: #fff; font-size: 0.9rem; 
    background: rgba(0,0,0,0.6); padding: 8px 16px; 
    border-radius: 30px; border: 1px solid #444; 
    text-transform: uppercase; letter-spacing: 1px;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #444; transition: 0.3s; }
.status-dot.active { background: #ff0044; box-shadow: 0 0 10px #ff0044; }
.online-count { font-size: 0.8rem; color: #aaa; border-left: 1px solid #555; padding-left: 10px; display: flex; align-items: center; gap: 5px; }

/* NOW PLAYING WIDGET (UPDATED FOR SCROLLING) */

/* NOW PLAYING WIDGET (UPDATED FOR SCROLLING) */
.np-thumb-mini {
    width: 90px;
    height: 100%;
    background: #111;
    object-fit: cover;
    border-right: 1px solid #333;
}

.np-info { 
    flex: 0 1 160px;
    overflow: hidden; 
    padding: 0 15px; 
    white-space: nowrap; 
    position: relative;
    mask-image: linear-gradient(90deg, transparent, #fff 5%, #fff 95%, transparent); 
}

.np-scroll-wrapper {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    width: 100%;
}

.np-text { 
    font-size: 1.1rem; 
    font-weight: 700; 
    display: inline-block; 
    color: var(--accent);
    /* SCROLLING ANIMATION */
    padding-left: 100%;
    animation: marquee 15s linear infinite;
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

.np-controls { display: flex; align-items: center; gap: 8px; margin-right: 12px; border-right: 1px solid #333; padding-right: 12px; }
.media-tiny-btn { width: 32px; height: 32px; border-radius: 6px; border: none; background: rgba(255,255,255,0.05); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.media-tiny-btn:hover { background: rgba(255,255,255,0.15); color: var(--accent); }
.media-tiny-btn .material-icons { font-size: 20px; }

.top-vol {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-vol-slider {
    -webkit-appearance: none;
    width: 56px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    outline: none;
}

.theme-btn-group { display: flex; gap: 10px; }
.theme-color-btn, .theme-party-btn, .theme-gear-btn { width: 36px; height: 36px; border-radius: 50%; background: #222; border: 1px solid #444; color: #888; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; font-size: 1rem; }
.theme-color-btn:hover, .theme-party-btn:hover, .theme-gear-btn:hover { color: #fff; border-color: var(--accent); background: rgba(255,255,255,0.1); }

/* MAIN STAGE */
.stage { 
    flex: 1; 
    display: grid; 
    
    /* 👇 WIDENED to 220px - 260px (Comfortable size) */
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) minmax(220px, 260px);
    
    gap: 25px; 
    padding: 25px 30px 30px 30px; 
    height: calc(100vh - 75px); 
    box-sizing: border-box; 
}

/* tighter side widths when collapsed */
.stage.side-collapsed {
    grid-template-columns: 150px minmax(0, 1fr) 150px;
    gap: 60px;
}



/* GLASS COLUMN */
.col-p { 
    background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(6px); 
    border: 1px solid #333; 
    border-radius: 16px; 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);


    /* ANIMATION MAGIC 👇 */
    max-height: 1500px; /* A value larger than your content will ever be */
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.col-popout-corner {
    position: absolute;
    top: 8px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    background: rgba(255,255,255,0.04);
    color: #7d7d7d;
    cursor: pointer;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.18s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.col-popout-corner.left {
    left: 8px;
}

.col-popout-corner.right {
    right: 8px;
}

.col-popout-corner i {
    font-size: 11px;
}

.col-popout-corner:hover {
    color: #fff;
    border-color: var(--accent);
    background: rgba(255,255,255,0.08);
    box-shadow:
        0 0 10px color-mix(in srgb, var(--accent) 28%, transparent),
        0 2px 8px rgba(0,0,0,0.25);
}

.col-p.collapsed-view .col-popout-corner {
    opacity: 0;
    pointer-events: none;
}

.col-p.collapsed-view {
    max-height: 86px !important;
    min-height: 9px !important;
    padding: 8px 6px !important;
    align-self: start;
    overflow: hidden !important;
}

.col-p.collapsed-view .clear-btn { display: none !important; }

/* CORRECTED RULE: Targets .collapsed-view */
.col-p.collapsed-view .ctrl-row,
.col-p.collapsed-view .mini-row,
.col-p.collapsed-view .slot-list,
.col-p.collapsed-view .clear-btn {
    display: none !important;
    opacity: 0 !important;   /* Fixed spelling from opatity */
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* 2. Hide specifically the EXPORT button (keep the collapse button) */
.col-p.collapsed-view .export {
    display: none !important;
}

/* 3. Ensure the button row stays visible */
.col-p.collapsed-view .ctrl-row {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
}

.col-p.collapsed-view .collapse-btn {
    width: 64px !important;
    min-width: 64px;
}

/* NOTE: Removed .p-header styles as they are no longer in the columns */

/* --- SIDE BUTTONS --- */
.ctrl-row {
    display: flex;
    gap: 8px;
    margin-bottom: 5px;
    justify-content: center;
}

.col-btn.collapse-btn {

    /* 👇 MAKE IT BIGGER */
    width: 125px;        /* Wider (was 36px) */
    height: 40px;        /* Taller */
    font-size: 1.2rem;   /* Bigger Icon */

    flex-shrink: 0;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(255,255,255,0.05); border: 1px solid #444; color: #888; 
    cursor: pointer; border-radius: 8px; transition: 0.2s;
}
.col-btn.collapse-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }

/* EXPORT BUTTON - HIDDEN */
.col-btn.export { 
    display: none !important; /* 👇 This hides it completely */
    font-size: 1.2rem;   /* Bigger Icon */

    /* ... keep the rest of the code just in case ... */
    flex: 1; margin: 0; padding: 6px; 
    background: rgba(255,255,255,0.05); border: 1px solid #444; 
    color: #888; font-weight: 800; cursor: pointer; border-radius: 8px; 
    transition: 0.2s; align-items: center; justify-content: center; gap: 8px;
    text-transform: uppercase; letter-spacing: 1px;
}

.col-btn.export:hover { background: var(--accent); color: #000; border-color: var(--accent); box-shadow: 0 0 15px var(--accent); }

/* --- SLOT LIST --- */
.slot-list { 
    display: flex; flex-direction: column; gap: 10px; flex: 1; 
    overflow: hidden;
    max-height: 1000px; 
    opacity: 1;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease;
}

.slot-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    gap: 0;
}

/* --- UPDATED MINI ROW (GRID LAYOUT 2x3) --- */
.mini-row {
    display: none; 
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    justify-items: center;
    background: rgba(0,0,0,0.6);
    padding: 12px; 
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    animation: fadeIn 0.4s ease;
}

.mini-row.active { display: grid; }

.mini-slot {
    width: 60px; /* Increased size for comfortable fit in 300px col */
    height: 60px; 
    border-radius: 50%;
    background: #111;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    flex-shrink: 0; 
}

.mini-slot img { width: 120%; height: 120%; object-fit: contain; }
.mini-slot.empty { opacity: 0.2; border-style: dashed; }

.slot { flex: 1; min-height: 65px; background: rgba(8,8,8,0.6); border: 1px dashed #333; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: 0.2s; position: relative; overflow: hidden; }
.slot:hover { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.slot.drag-over { border-color: var(--accent) !important; background: rgba(255,255,255, 0.05) !important; box-shadow: 0 0 15px var(--accent); transform: scale(1.02); }
.slot.filled { border-style: solid; border-color: var(--accent); box-shadow: 0 0 10px var(--accent); background: rgba(17,17,17,0.8); }
@keyframes snapIn { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.slot img { height: 90%; width: auto; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.8)); z-index: 2; pointer-events: none; animation: snapIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.slot-txt { display: none; }

.col-btn.clear-btn { width: 100%; padding: 10px; background: #1a1a1a; border: 1px solid #333; color: #666; font-weight: 800; cursor: pointer; border-radius: 8px; font-size: 0.75rem; letter-spacing: 1px; transition: 0.2s; margin-top: 5px;}
.col-btn.clear-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* --- CENTER COLUMN (DYNAMIC) --- */
.col-c { 
    display: flex; flex-direction: column; 
    background: rgba(15,15,15,0.6); backdrop-filter: blur(6px); 
    border: var(--border); border-radius: 16px; 
    overflow: hidden; position: relative; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.8); 
    
    /* ADDED FOR ANIMATION */
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.4s ease;
    height: 100%;
    min-height: 0;
}

/* MINIMIZED STATE */
.col-c.minimized {
    height: 57px !important; /* Tab bar height + borders */
    min-height: 57px !important;
    align-self: flex-start; /* Stops grid from stretching it */
}

/* COLLAPSED CENTER STATE (OLD CLASS, KEPT FOR SAFETY) */
.col-c.collapsed-view {
    height: auto !important;
    align-self: start;
    padding-bottom: 0;
}
.col-c.collapsed-view .tab-content { display: none !important; }

/* UPDATED TAB BAR (Centered + Scrollable) */
/* UPDATED TAB BAR */
.tab-bar { 
    display: flex; 
    height: 55px; 
    padding: 0 10px; 
    align-items: center; 
    gap: 15px; 
    
    background: rgba(0, 0, 0, 0.6); 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    flex-shrink: 0; 
    
    /* SCROLL LOGIC */
    justify-content: flex-start; 
    
    overflow-x: auto;   /* Allow Horizontal Scroll */
    overflow-y: hidden; /* BLOCK Vertical Scroll */
    
    white-space: nowrap; 
    
    /* FIREFOX: Thinnest possible standard setting */
    scrollbar-width: thin; 
    scrollbar-color: var(--accent) transparent;
}

/* --- WEBKIT (Chrome, Safari, Edge) SCROLLBAR STYLING --- */

/* 1. The Track (Invisible) */
.tab-bar::-webkit-scrollbar { 
    height: 2px; /* 👇 HORIZONTAL: Controls thickness (2px is very thin) */
    width: 2px;  /* VERTICAL: Controls thickness */
    background: transparent;
}

/* 2. The Slider (Visible Part) */
.tab-bar::-webkit-scrollbar-thumb { 
    background: var(--accent); /* Make it pop so it's visible despite being small */
    border-radius: 1px; 
}

/* 3. Hover Effect */
.tab-bar::-webkit-scrollbar-thumb:hover { 
    background: var(--accent); 
}
.tab-bar::-webkit-scrollbar-thumb:hover { background: var(--accent); }


/* UPDATED TAB */
.tab { 
    position: relative; 
    padding: 10px 15px; 
    font-weight: 800; 
    color: #666; 
    cursor: pointer; 
    transition: 0.3s; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-size: 1.1rem;
    flex-shrink: 0; 
    min-width: max-content; /* 2. Always be as wide as the text needs */
}

/* --- THE CENTERING MAGIC --- */
/* This pushes the group to the center when there is space, */
/* but allows them to be squished safely when there isn't. */

/* Select the FIRST element inside tab-bar (Your collapse button) */
.tab-bar > :first-child {
    margin-left: auto;
}

/* Select the LAST element inside tab-bar (Your last tab) */
.tab-bar > :last-child {
    margin-right: auto;
}

.tab:hover { color: #ccc; }
.tab.active { color: #fff; text-shadow: 0 0 15px rgba(255,255,255,0.3); }
.tab.active::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 50px; height: 5px; background: var(--accent); border-radius: 2px; box-shadow: 0 -2px 10px var(--accent); }

/* New Tab Button (Collapse) */
.tab-btn-collapse {
    background: transparent; border: none; color: #888; font-size: 1.2rem; cursor: pointer; margin-right: 15px; transition: 0.2s;
}
.tab-btn-collapse:hover { color: #fff; transform: scale(1.1); }

.tab-content { flex: 1; overflow: hidden; display: none; height: 100%; width: 100%; position:relative; }
.tab-content.active { display: block; }

/* LOADING SPINNER FOR BUTTON */
@keyframes spin { to { transform: rotate(360deg); } }
.fa-spinner { animation: spin 1s linear infinite; }

/* --- SETTINGS MODAL (CLEAN & COMPACT) --- */
#settings-modal{
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 5000;
  display: none; justify-content: center; align-items: center;
  backdrop-filter: blur(8px);
}
.modal-box{
  background: rgba(18,18,18,0.98);
  border: 1px solid #444;
  border-radius: 16px;
  width: 700px;
  padding: 30px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

/* --- SETTINGS TABS --- */
.st-tab{
  flex:1;
  padding:12px 10px;
  background:#151515;
  border:1px solid #333;
  color:#888;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:1px;
  border-radius:10px;
  cursor:pointer;
  transition:0.2s;
}

.st-tab:hover{
  border-color: var(--accent);
  color:#fff;
}

.st-tab.active{
  background: var(--accent);
  color:#000;
  border-color: var(--accent);
  box-shadow: 0 0 15px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Panels */
.st-panel{ display:none; margin-top: 15px; }
.st-panel.active{ display:block; }


/* --- WALLPAPER GRID (Theme tab) --- */
.wallpaper-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.wallpaper-tile{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 16px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}

/* Big color pickers inside the wallpaper tile */
.color-row{
  display:flex;
  gap: 14px;
  align-items:flex-start;
  justify-content:space-between;
}

.color-block{
  flex:1;
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.color-name{
  font-size: 0.75rem;
  font-weight: 800;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.st-color-lg{
  width: 100%;
  height: 46px;
  padding: 0;
  background: none;
  border: 1px solid #333;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
}

/* Keep drop-zone nice inside tile */
#drop-zone{
  border: 2px dashed #444;
  border-radius: 10px;
  background: rgba(0,0,0,0.3);
  padding: 25px;
  text-align: center;
  color: #666;
  font-weight: 700;
  font-size: 0.8rem;
  transition: 0.2s;
  cursor: default;
}
#drop-zone.drag-over{
  border-color: var(--accent);
  background: rgba(0, 255, 157, 0.1);
  color: var(--accent);
}

/* --- THEME QUICK CONTROLS (wide buttons) --- */
#settings-modal .theme-quick-row{
  display:flex;
  gap:10px;
}

#settings-modal .theme-quick-btn{
  flex:1;
  height:auto;
  width:auto;
  padding:12px 14px;
  border-radius:10px;
  background:#151515;
  border:1px solid #333;
  color:#ddd;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:1px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

#settings-modal .theme-quick-btn:hover{
  border-color:var(--accent);
  background:rgba(255,255,255,0.08);
}

#settings-modal .party-active-btn{
  background:var(--accent);
  color:#000;
  border-color:var(--accent);
}

/* Mobile: stack wallpaper tiles */
@media (max-width: 700px){
  .wallpaper-grid{ grid-template-columns: 1fr; }
}

/* Header */
.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom: 1px solid #333;
  padding-bottom: 15px;
  margin-bottom: 5px;
}
.modal-title{
  font-weight: 900;
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: 1.5px;
}
.modal-close{
  cursor:pointer;
  color:#666;
  transition:0.2s;
  font-size: 1.4rem;
}

.modal-close:hover{ color:#fff; }

/* Header right-side actions (fullscreen + X) */
.modal-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.modal-fs-btn{
  width:36px;
  height:36px;
  border-radius:10px;
  background:#222;
  border:1px solid #444;
  color:#888;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:0.2s;
}

.modal-fs-btn:hover{
  color:#fff;
  border-color:var(--accent);
  background:rgba(255,255,255,0.1);
}

/* Theme buttons inside Settings should be wide (override the top-bar circular style) */
#settings-modal .theme-quick-row{
  display:flex;
  gap:10px;
}

#settings-modal .theme-quick-btn{
  flex:1;
  height:auto;
  width:auto;
  padding:12px 14px;
  border-radius:10px;
  background:#151515;
  border:1px solid #333;
  color:#ddd;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:1px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

#settings-modal .theme-quick-btn:hover{
  border-color:var(--accent);
  background:rgba(255,255,255,0.08);
}

/* Optional: visual state when Party mode is active (theme-manager.js toggles this class) */
#settings-modal .party-active-btn{
  background:var(--accent);
  color:#000;
  border-color:var(--accent);
}

/* New Section Box Styling */
.section-box {
    background: rgba(255,255,255,0.03); 
    border: 1px solid rgba(255,255,255,0.05);
    padding: 20px; border-radius: 12px;
    display: flex; flex-direction: column; gap: 12px;
}

.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-label { font-size: 0.75rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; margin-bottom: 5px; }

.player-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.flex-row { display: flex; gap: 10px; align-items: center; }

/* Updated Inputs */
.st-input {
    background: #000; border: 1px solid #333; color: #fff; padding: 12px; border-radius: 8px;
    flex: 1; font-family: inherit; font-size: 0.95rem; transition: 0.2s;
}
.st-input:focus { outline: none; border-color: var(--accent); background: #111; }

.st-color { 
    width: 45px; height: 42px; padding: 0; background: none; border: none; cursor: pointer; 
    border-radius: 8px; overflow: hidden;
}

.st-btn {
    padding: 10px 15px; background: #222; border: 1px solid #444; color: #ccc; 
    cursor: pointer; border-radius: 6px; font-weight: 700; transition: 0.2s;
    text-align: center; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.st-btn:hover { background: #333; color: #fff; border-color: #666; }
.st-btn.action { border-color: var(--accent); color: var(--accent); }
.st-btn.action:hover { background: var(--accent); color: #000; }

/* Mascot toggle selected states */
.st-btn.is-selected {
    border-color: var(--accent);
    color: #fff;
    background: rgba(0,255,157,0.12);
    box-shadow: 0 0 14px rgba(0,255,157,0.18);
}

.st-btn.is-selected.off {
    border-color: #ff5d5d;
    background: rgba(255,93,93,0.14);
    box-shadow: 0 0 14px rgba(255,93,93,0.24);
}

/* WHO ARE YOU BUTTONS */
.who-btn {
    flex: 1; padding: 15px; background: #1a1a1a; border: 1px solid #333; color: #666;
    border-radius: 8px; cursor: pointer; font-weight: 800; text-transform: uppercase; transition: 0.2s;
    font-size: 0.9rem; letter-spacing: 1px;
}
.who-btn:hover { background: #222; color: #aaa; border-color: #555; }
.who-btn.active { 
    border-color: var(--accent); 
    background: rgba(0, 255, 157, 0.1); 
    color: #fff; 
    box-shadow: 0 0 15px rgba(0,0,0,0.5); 
}

/* Drag Drop Zone */
#drop-zone {
    border: 2px dashed #444; border-radius: 8px; background: rgba(0,0,0,0.3);
    padding: 25px; text-align: center; color: #666; font-weight: 700; font-size: 0.8rem;
    transition: 0.2s; cursor: default;
}
#drop-zone.drag-over { border-color: var(--accent); background: rgba(0, 255, 157, 0.1); color: var(--accent); }

/* Saved Wallpapers */
.saved-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 5px; }
.saved-thumb { 
    aspect-ratio: 16/9; background: #111; border: 1px solid #333; border-radius: 6px; 
    cursor: pointer; background-size: cover; background-position: center; position: relative;
    transition: 0.2s;
}
.saved-thumb:hover { border-color: var(--accent); transform: scale(1.05); }
.del-thumb {
    position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; background: #f44336; 
    color: white; border-radius: 50%; font-size: 10px; display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: 0.2s;
}
.saved-thumb:hover .del-thumb { opacity: 1; }

/* --- PRESENCE MARKERS (DOT ONLY) --- */
.tab-badges {
    display: flex; gap: 4px; position: absolute; top: 4px; right: 4px;
}
.p-dot {
    width: 8px; height: 8px; border-radius: 50%;
    box-shadow: 0 0 5px currentColor;
    animation: pulseDot 2s infinite;
}
.p-dot.p1 { background-color: var(--p1-color); color: var(--p1-color); }
.p-dot.p2 { background-color: var(--p2-color); color: var(--p2-color); }

@keyframes pulseDot { 0% { opacity: 0.6; } 50% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0.6; } }

/* --- MOBILE RESPONSIVE OVERRIDES --- */
@media (max-width: 800px) {
    /* 1. Hide the desktop Top Bar to save space */
    .top-bar {
        height: 50px;
        padding: 0 10px;
        grid-template-columns: 1fr auto;
    }
    .top-center { display: none; } /* Hide music widget on mobile top */

    /* 2. Change Stage from Grid to Single Column */
    .stage {
        display: block;
        padding: 10px;
        height: calc(100vh - 110px); /* Account for top bar and bottom nav */
        overflow-y: auto;
    }

    /* 3. Make Player Columns stack and take full width */
    .col-p {
        width: 100%;
        margin-bottom: 20px;
        min-height: auto;
    }

    /* 4. Center Window takes full width */
    .col-c {
        width: 100%;
        height: 600px; /* Give it a fixed height on mobile */
    }

    /* 5. Adjust Tab Bar for touch */
    .tab-bar {
        overflow-x: auto;
        justify-content: flex-start;
        gap: 10px;
    }
    .tab {
        font-size: 1rem;
        padding: 10px 15px;
    }

    /* 6. Bottom Mobile Navigation */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: #0a0a0a;
        border-top: 1px solid #333;
        justify-content: space-around;
        align-items: center;
        z-index: 2000;
    }
    .mobile-nav button {
        background: none;
        border: none;
        color: #666;
        font-size: 1.5rem;
    }
    .mobile-nav button.active { color: var(--accent); }
}

/* Hide mobile nav on Desktop */
@media (min-width: 801px) {
    .mobile-nav { display: none; }
}


/* --- CHAT SYSTEM --- */

/* --- CHAT SYSTEM --- */

/* Hover Trigger in Top Bar */
.status-badge {
    position: relative;
    transition: padding 0.3s, border-color 0.3s;
}

.chat-trigger {
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-left: 0;
}

.status-badge:hover {
    padding-right: 10px;
    border-color: var(--accent);
}

.status-badge:hover .chat-trigger {
    width: 34px;
    opacity: 1;
    margin-left: 10px;
    border-left: 1px solid #555;
    padding-left: 10px;
}

.chat-trigger:hover {
    color: #fff;
    text-shadow: 0 0 10px var(--accent);
}

/* Main Chat Window */
.chat-window {
    --chat-message-size: 15px;

    display: none;
    position: fixed;
    top: 90px;
    left: 90px;
    width: 500px;
    height: 640px;
    min-width: 430px;
    min-height: 500px;
    max-width: 90vw;
    max-height: 84vh;
    background: linear-gradient(180deg, rgba(10,10,12,0.98), rgba(6,6,8,0.96));
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.10);
    border-top: 1px solid var(--accent);
    border-radius: 16px;
    box-shadow:
        0 18px 56px rgba(0,0,0,0.72),
        0 0 24px rgba(255,255,255,0.04);
    z-index: 9999;
    flex-direction: column;
    resize: both;
    overflow: hidden;
}

.chat-window.dragging {
    user-select: none;
}

/* Compact Header */
.chat-header {
    height: 52px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.chat-header:active {
    cursor: grabbing;
}

.chat-room-tabs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
}

.chat-room-tabs::-webkit-scrollbar {
    display: none;
}

.chat-room-tab {
    flex: 0 0 auto;
    height: 30px;
    padding: 0 12px;
    border: none;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: #8c8c8c;
    font-size: 0.70rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.9px;
    cursor: pointer;
    transition: 0.18s;
}

.chat-room-tab:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.chat-room-tab.active {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 14px rgba(255,255,255,0.06);
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chat-local-clear {
    display: none;
}

.chat-local-clear:hover {
    border-color: #ff4444;
    color: #fff;
    background: rgba(255,68,68,0.12);
}

.chat-icon-btn,
.chat-close {
    width: 30px;
    height: 30px;
    border: 1px solid #333;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: #888;
    cursor: pointer;
    transition: 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-icon-btn {
    font-size: 0.72rem;
}

.chat-icon-btn:hover,
.chat-close:hover {
    color: #fff;
    border-color: var(--accent);
    background: rgba(255,255,255,0.08);
}

.chat-icon-btn:active {
    transform: scale(0.96);
}

.chat-close {
    font-size: 1rem;
}

/* Content */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-output {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.02), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0));
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    padding: 20px;
}

.chat-row {
    display: flex;
    flex-direction: column;
    max-width: 78%;
    gap: 3px;
    animation: chatPopIn 0.16s ease-out;
}

.chat-row.self {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-row.other {
    align-self: flex-start;
    align-items: flex-start;
}

@keyframes chatPopIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    padding: 0 2px;
}

.chat-name {
    text-transform: uppercase;
    letter-spacing: 0.65px;
}

.chat-time {
    color: #666;
    font-weight: 600;
}

.chat-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    line-height: 1.42;
    font-size: var(--chat-message-size);
    word-break: break-word;
    white-space: pre-wrap;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.chat-output,
.chat-bubble,
.chat-input {
    user-select: text;
    -webkit-user-select: text;
}

.chat-row.local-note .chat-bubble {
    background: rgba(255,255,255,0.05);
    border-style: dashed;
}

.chat-row.local-note .chat-name {
    color: var(--accent) !important;
}

.chat-row.other .chat-bubble {
    background: rgba(255,255,255,0.06);
    color: #f0f0f0;
    border-top-left-radius: 6px;
}

.chat-row.self .chat-bubble {
    background: rgba(255,255,255,0.10);
    color: #fff;
    border-top-right-radius: 6px;
}

/* Input area */
.chat-input-area {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 140px;
    height: 40px;
    resize: none;
    overflow-y: auto;
    background: #070707;
    border: 1px solid #2b2b2b;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    outline: none;
    font-size: 0.92rem;
    line-height: 1.35;
    font-family: inherit;
    transition: 0.18s;
}

.chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.03), 0 0 14px rgba(0,0,0,0.25);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #000;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 900;
    transition: 0.18s;
    flex-shrink: 0;
    box-shadow: 0 0 14px rgba(255,255,255,0.06);
}

.chat-send-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.chat-send-btn:active {
    transform: scale(0.96);
}


/* --- GLOWING NAME OVERLAY --- */

/* 1. Ensure slots allow positioning */
.slot {
    position: relative !important;
}

/* 2. The Text Style */
.slot-overlay-name {
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 100%;
    text-align: center;
    
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    /* 1. FACE COLOR: White looks best with a black outline */
    color: #fff; 

    white-space: normal;
    line-height: 1;
    
    /* 2. LAYERING THE EFFECTS */
    text-shadow: 
        /* LAYER A: Heavy Black Outline (Sharp, no blur) */
        2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000,
        1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000,
        
        /* LAYER B: The Glow (Blurred, using your variable) */
        0 0 15px var(--accent),
        0 0 25px var(--accent);
        
    
    z-index: 10;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 5px;
}

/* --- MASCOT SYSTEM V2 (Multiple Entry Points) --- */

.mascot {
    position: fixed;
    z-index: 2000; /* High enough to be over glass columns */
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
    width: 70px; /* Default size */
}

/* 1. RUNNER (Bottom) */
.mascot.run-bottom {
    bottom: -10px;
    animation: runAcross 10s linear forwards;
}
.mascot.run-bottom[data-dir="left"] {
    animation: runLeft 10s linear forwards;
    left: auto; 
}

/* 2. PEEK BOTTOM (Classic) */
.mascot.peek-bottom {
    bottom: -100px;
    left: 20%; /* Randomize this in JS if you want, defaults left-ish */
    animation: peekUp 5s ease-in-out forwards;
}

/* 3. PEEK TOP (The Scoreboard Peepers) */
.mascot.peek-top-L {
    top: -100px; /* Start hidden above */
    left: 150px; /* Near P1 Score */
    transform: rotate(180deg); /* Upside down! Like a bat */
    animation: peekDown 5s ease-in-out forwards;
}
.mascot.peek-top-R {
    top: -100px;
    right: 150px; /* Near P2 Score */
    transform: rotate(180deg);
    animation: peekDown 5s ease-in-out forwards;
}

/* 4. PEEK SIDES (The Column Peepers) */
.mascot.peek-side-L {
    left: -100px; /* Start hidden left */
    /* Top is set by JS randomly */
    transform: rotate(90deg); /* Sideways */
    animation: peekRight 5s ease-in-out forwards;
}
.mascot.peek-side-R {
    right: -100px; /* Start hidden right */
    /* Top is set by JS randomly */
    transform: scaleX(-1) rotate(90deg); /* Flipped & Sideways */
    animation: peekLeft 5s ease-in-out forwards;
}


/* --- KEYFRAME ANIMATIONS --- */

@keyframes runAcross { 0% { left: -100px; } 100% { left: 110vw; } }
@keyframes runLeft   { 0% { right: -100px; } 100% { right: 110vw; } }

@keyframes peekUp {
    0% { bottom: -90px; }
    20% { bottom: -10px; } /* Pop up */
    80% { bottom: -10px; } /* Stay */
    100% { bottom: -90px; }
}

@keyframes peekDown {
    0% { top: -90px; }
    20% { top: -10px; } /* Drop down */
    80% { top: -10px; }
    100% { top: -90px; }
}

@keyframes peekRight { /* From Left Wall */
    0% { left: -80px; }
    20% { left: -10px; } /* Peek out */
    80% { left: -10px; }
    100% { left: -80px; }
}

@keyframes peekLeft { /* From Right Wall */
    0% { right: -80px; }
    20% { right: -10px; } /* Peek out */
    80% { right: -10px; }
    100% { right: -80px; }
}

/* --- PLAYER-LINKED STREAK COLOR --- */
.top-score-box.p1-win { --streak-color: var(--p1-color); }
.top-score-box.p2-win { --streak-color: var(--p2-color); }

/* --- HOT STREAK SCORE FX --- */
/* --- HOT STREAK SCORE FX (PLAYER-COLOR THEMED) --- */
.top-score-box {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.top-score-box .ts-row {
    position: relative;
    z-index: 3;
}

.top-score-box .ts-row::before {
    content: '';
    position: absolute;
    inset: -16%;
    pointer-events: none;
    opacity: 0;
    z-index: -1;
}

.top-score-box::before,
.top-score-box::after {
    content: '';
    position: absolute;
    inset: -12%;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
    transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

/* 1 WIN = themed sparks */
.top-score-box.streak-1::after {
    inset: -8%;
    opacity: 0.92;
    background:
        radial-gradient(circle at 8% 88%,  color-mix(in srgb, var(--streak-color) 86%, white 14%) 0 2px, transparent 3px),
        radial-gradient(circle at 18% 70%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 28% 50%, color-mix(in srgb, var(--streak-color) 70%, white 30%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 38% 24%, color-mix(in srgb, var(--streak-color) 90%, white 10%) 0 2px, transparent 3px),
        radial-gradient(circle at 48% 82%, color-mix(in srgb, var(--streak-color) 78%, white 22%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 58% 60%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 68% 34%, color-mix(in srgb, var(--streak-color) 68%, white 32%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 78% 18%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 88% 70%, color-mix(in srgb, var(--streak-color) 84%, white 16%) 0 2px, transparent 3px),
        radial-gradient(circle at 94% 42%, color-mix(in srgb, var(--streak-color) 72%, white 28%) 0 1.5px, transparent 3px);
    animation: streakSparkDrift 3.2s linear infinite;
}

/* 2 WINS = small dynamic fire + themed border */
.top-score-box.streak-2 {
    border-color: color-mix(in srgb, var(--streak-color) 60%, rgba(255,255,255,0.14));
    box-shadow:
        0 0 12px color-mix(in srgb, var(--streak-color) 18%, transparent),
        inset 0 0 10px color-mix(in srgb, var(--streak-color) 6%, transparent);
}

.top-score-box.streak-2::before {
    opacity: 0.78;
    inset: -6% -5% -10% -5%;
    background:
        radial-gradient(circle at 50% 112%, color-mix(in srgb, var(--streak-color) 86%, white 14%) 0 18%, transparent 42%),
        radial-gradient(circle at 24% 116%, color-mix(in srgb, var(--streak-color) 72%, white 28%) 0 12%, transparent 28%),
        radial-gradient(circle at 76% 116%, color-mix(in srgb, var(--streak-color) 72%, white 28%) 0 12%, transparent 28%),
        linear-gradient(to top, color-mix(in srgb, var(--streak-color) 24%, transparent), transparent 55%);
    filter: blur(8px) saturate(1.15);
    animation: streakFlameSmall 2s ease-in-out infinite;
}

/* 3 WINS = bigger dynamic fire + sparks + neon border */
.top-score-box.streak-3 {
    border-color: color-mix(in srgb, var(--streak-color) 75%, white 10%);
    box-shadow:
        0 0 14px color-mix(in srgb, var(--streak-color) 35%, transparent),
        0 0 28px color-mix(in srgb, var(--streak-color) 18%, transparent),
        inset 0 0 16px color-mix(in srgb, var(--streak-color) 7%, transparent);
}

.top-score-box.streak-3::before {
    opacity: 0.95;
    inset: -15% -8% -17% -8%;
    background:
        radial-gradient(circle at 50% 112%, color-mix(in srgb, var(--streak-color) 82%, white 18%) 0 24%, transparent 44%),
        radial-gradient(circle at 25% 116%, color-mix(in srgb, var(--streak-color) 66%, white 34%) 0 18%, transparent 34%),
        radial-gradient(circle at 75% 116%, color-mix(in srgb, var(--streak-color) 66%, white 34%) 0 18%, transparent 34%),
        radial-gradient(circle at 50% 104%, color-mix(in srgb, var(--streak-color) 54%, white 46%) 0 12%, transparent 28%),
        linear-gradient(to top, color-mix(in srgb, var(--streak-color) 28%, transparent), transparent 62%);
    filter: blur(11px) saturate(1.28);
    animation: streakFlameBig 1.45s ease-in-out infinite;
}

.top-score-box.streak-3::after {
    inset: -10%;
    opacity: 0.95;
    background:
        radial-gradient(circle at 12% 86%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 25% 65%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 35% 45%, color-mix(in srgb, var(--streak-color) 74%, white 26%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 46% 20%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 58% 78%, color-mix(in srgb, var(--streak-color) 84%, white 16%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 68% 54%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 30%, color-mix(in srgb, var(--streak-color) 76%, white 24%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 89% 72%, color-mix(in srgb, var(--streak-color) 90%, white 10%) 0 2px, transparent 3px);
    animation: streakSparkDriftFast 2.1s linear infinite;
}

/* 4 WINS = 3 wins + aura */
.top-score-box.streak-4 {
    border-color: color-mix(in srgb, var(--streak-color) 78%, white 10%);
    box-shadow:
        0 0 16px color-mix(in srgb, var(--streak-color) 38%, transparent),
        0 0 34px color-mix(in srgb, var(--streak-color) 22%, transparent),
        0 0 56px color-mix(in srgb, var(--streak-color) 10%, transparent),
        inset 0 0 18px color-mix(in srgb, var(--streak-color) 8%, transparent);
    animation: streakAuraPulse 1.85s ease-in-out infinite;
}

.top-score-box.streak-4::before {
    opacity: 1;
    inset: -16% -8% -18% -8%;
    background:
        radial-gradient(circle at 50% 112%, color-mix(in srgb, var(--streak-color) 84%, white 16%) 0 25%, transparent 45%),
        radial-gradient(circle at 25% 116%, color-mix(in srgb, var(--streak-color) 68%, white 32%) 0 18%, transparent 34%),
        radial-gradient(circle at 75% 116%, color-mix(in srgb, var(--streak-color) 68%, white 32%) 0 18%, transparent 34%),
        radial-gradient(circle at 50% 102%, color-mix(in srgb, var(--streak-color) 52%, white 48%) 0 13%, transparent 29%),
        linear-gradient(to top, color-mix(in srgb, var(--streak-color) 32%, transparent), transparent 62%);
    filter: blur(12px) saturate(1.32);
    animation: streakFlameBig 1.25s ease-in-out infinite;
}

.top-score-box.streak-4::after {
    inset: -10%;
    opacity: 1;
    background:
        radial-gradient(circle at 12% 86%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 25% 65%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 35% 45%, color-mix(in srgb, var(--streak-color) 74%, white 26%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 46% 20%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 58% 78%, color-mix(in srgb, var(--streak-color) 84%, white 16%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 68% 54%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 30%, color-mix(in srgb, var(--streak-color) 76%, white 24%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 89% 72%, color-mix(in srgb, var(--streak-color) 90%, white 10%) 0 2px, transparent 3px);
    animation: streakSparkDriftFast 1.9s linear infinite;
}

/* 5 WINS = 4 wins + more lightning */
.top-score-box.streak-5 {
    border-color: color-mix(in srgb, var(--streak-color) 82%, white 10%);
    box-shadow:
        0 0 18px color-mix(in srgb, var(--streak-color) 42%, transparent),
        0 0 40px color-mix(in srgb, var(--streak-color) 26%, transparent),
        0 0 68px color-mix(in srgb, var(--streak-color) 14%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--streak-color) 9%, transparent);
    animation: streakAuraPulseStrong 1.35s ease-in-out infinite;
}

.top-score-box.streak-5::before {
    opacity: 1;
    inset: -18% -9% -20% -9%;
    background:
        radial-gradient(circle at 50% 112%, color-mix(in srgb, var(--streak-color) 86%, white 14%) 0 26%, transparent 46%),
        radial-gradient(circle at 25% 116%, color-mix(in srgb, var(--streak-color) 70%, white 30%) 0 18%, transparent 34%),
        radial-gradient(circle at 75% 116%, color-mix(in srgb, var(--streak-color) 70%, white 30%) 0 18%, transparent 34%),
        radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--streak-color) 56%, white 44%) 0 13%, transparent 29%),
        linear-gradient(to top, color-mix(in srgb, var(--streak-color) 34%, transparent), transparent 60%);
    filter: blur(13px) saturate(1.38);
    animation: streakFlameStorm 1.05s ease-in-out infinite;
}

.top-score-box.streak-5::after {
    inset: -8%;
    opacity: 0.96;
    background:
        radial-gradient(circle at 8% 88%,  color-mix(in srgb, var(--streak-color) 86%, white 14%) 0 2px, transparent 3px),
        radial-gradient(circle at 18% 70%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 28% 50%, color-mix(in srgb, var(--streak-color) 70%, white 30%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 38% 24%, color-mix(in srgb, var(--streak-color) 90%, white 10%) 0 2px, transparent 3px),
        radial-gradient(circle at 48% 82%, color-mix(in srgb, var(--streak-color) 78%, white 22%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 58% 60%, color-mix(in srgb, var(--streak-color) 88%, white 12%) 0 2px, transparent 3px),
        radial-gradient(circle at 68% 34%, color-mix(in srgb, var(--streak-color) 68%, white 32%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 78% 18%, color-mix(in srgb, var(--streak-color) 92%, white 8%) 0 2px, transparent 3px),
        radial-gradient(circle at 88% 70%, color-mix(in srgb, var(--streak-color) 84%, white 16%) 0 2px, transparent 3px),
        radial-gradient(circle at 94% 42%, color-mix(in srgb, var(--streak-color) 72%, white 28%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 16% 36%, color-mix(in srgb, var(--streak-color) 80%, white 20%) 0 1.5px, transparent 3px),
        radial-gradient(circle at 72% 84%, color-mix(in srgb, var(--streak-color) 86%, white 14%) 0 2px, transparent 3px);
    animation: streakSparkDrift 3.1s linear infinite;
}

.top-score-box.streak-5 .ts-row::before {
    opacity: 0;
    background:
        linear-gradient(118deg,
            transparent 0 42%,
            rgba(255,255,255,0) 42% 45%,
            rgba(255,255,255,0.96) 45% 46.2%,
            color-mix(in srgb, var(--streak-color) 82%, white 18%) 46.2% 48.5%,
            rgba(255,255,255,0.96) 48.5% 49.6%,
            rgba(255,255,255,0) 49.6% 54%,
            transparent 54% 100%
        ),
        linear-gradient(76deg,
            transparent 0 58%,
            rgba(255,255,255,0) 58% 61%,
            rgba(255,255,255,0.92) 61% 62.1%,
            color-mix(in srgb, var(--streak-color) 78%, white 22%) 62.1% 64.5%,
            rgba(255,255,255,0.92) 64.5% 65.6%,
            rgba(255,255,255,0) 65.6% 69%,
            transparent 69% 100%
        ),
        linear-gradient(134deg,
            transparent 0 46%,
            rgba(255,255,255,0) 46% 48%,
            rgba(255,255,255,0.95) 48% 49%,
            color-mix(in srgb, var(--streak-color) 75%, white 25%) 49% 51.5%,
            rgba(255,255,255,0.95) 51.5% 52.4%,
            rgba(255,255,255,0) 52.4% 56%,
            transparent 56% 100%
        );
    background-repeat: no-repeat;
    background-size: 34% 100%, 22% 100%, 28% 100%;
    background-position: 6% 0, 56% 0, 80% 0;
    mix-blend-mode: screen;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--streak-color) 65%, white 35%));
    animation: streakLightningFlash 1.25s steps(1, end) infinite;
}

@keyframes streakLightningFlash {
    0%, 54%, 100% { opacity: 0; }
    56% { opacity: 0.95; }
    58% { opacity: 0.12; }
    60% { opacity: 1; }
    62% { opacity: 0; }

    72% { opacity: 0.75; }
    73% { opacity: 0.10; }
    74% { opacity: 0.92; }
    76% { opacity: 0; }

    86% { opacity: 0.55; }
    87% { opacity: 0.08; }
    88% { opacity: 0.75; }
    90% { opacity: 0; }
}

@keyframes streakSparkDrift {
    0%   { transform: translateY(10px) scale(0.98); }
    50%  { transform: translateY(-7px) scale(1.02); }
    100% { transform: translateY(-20px) scale(0.96); }
}

@keyframes streakSparkDriftFast {
    0%   { transform: translateY(12px) scale(0.96); }
    50%  { transform: translateY(-9px) scale(1.04); }
    100% { transform: translateY(-26px) scale(0.94); }
}

@keyframes streakFlameSmall {
    0%, 100% { transform: scaleY(1) translateY(0); opacity: 0.62; }
    50%      { transform: scaleY(1.08) translateY(-2px); opacity: 0.84; }
}

@keyframes streakFlameBig {
    0%, 100% { transform: scaleY(1) translateY(0); opacity: 0.82; }
    50%      { transform: scaleY(1.18) translateY(-5px); opacity: 1; }
}

@keyframes streakFlameStorm {
    0%, 100% { transform: scaleY(1) translateY(0); opacity: 0.86; }
    50%      { transform: scaleY(1.22) translateY(-7px); opacity: 1; }
}

@keyframes streakAuraPulse {
    0%, 100% {
        box-shadow:
            0 0 16px color-mix(in srgb, var(--streak-color) 38%, transparent),
            0 0 34px color-mix(in srgb, var(--streak-color) 22%, transparent),
            0 0 56px color-mix(in srgb, var(--streak-color) 10%, transparent),
            inset 0 0 18px color-mix(in srgb, var(--streak-color) 8%, transparent);
    }
    50% {
        box-shadow:
            0 0 22px color-mix(in srgb, var(--streak-color) 48%, transparent),
            0 0 46px color-mix(in srgb, var(--streak-color) 28%, transparent),
            0 0 74px color-mix(in srgb, var(--streak-color) 14%, transparent),
            inset 0 0 24px color-mix(in srgb, var(--streak-color) 10%, transparent);
    }
}

@keyframes streakAuraPulseStrong {
    0%, 100% {
        box-shadow:
            0 0 18px color-mix(in srgb, var(--streak-color) 42%, transparent),
            0 0 40px color-mix(in srgb, var(--streak-color) 26%, transparent),
            0 0 68px color-mix(in srgb, var(--streak-color) 14%, transparent),
            inset 0 0 20px color-mix(in srgb, var(--streak-color) 9%, transparent);
    }
    50% {
        box-shadow:
            0 0 26px color-mix(in srgb, var(--streak-color) 56%, transparent),
            0 0 58px color-mix(in srgb, var(--streak-color) 34%, transparent),
            0 0 92px color-mix(in srgb, var(--streak-color) 18%, transparent),
            inset 0 0 28px color-mix(in srgb, var(--streak-color) 12%, transparent);
    }
}

