/* ══════════════════════════════════════════════════════════
   Content Check Calendar — styles.css
   Lighter premium dark theme, portrait iPhone 12 Pro Max
   ══════════════════════════════════════════════════════════ */

/* Fonts loaded via <link> in HTML with preconnect for performance */

:root {
  --bg:             #0f0e14;
  --bg-2:           #171520;
  --surface:        rgba(255,255,255,0.065);
  --surface-hover:  rgba(255,255,255,0.10);
  --surface-active: rgba(255,255,255,0.15);
  --border:         rgba(255,255,255,0.09);
  --border-hover:   rgba(255,255,255,0.16);

  --violet:         #9B8AFF;
  --pink:           #FF6B8A;
  --cyan:           #22D3EE;
  --violet-dim:     rgba(155,138,255,0.16);
  --cyan-dim:       rgba(34,211,238,0.10);

  --text-1:         #F0F0F5;
  --text-2:         #C0C0D2;
  --text-3:         #7878A0;

  --font-display:   'Syne', system-ui, sans-serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  --spring-snap:    cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --spring-soft:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-crisp:   cubic-bezier(0.4, 0, 0.2, 1);
  --spring-bounce:  cubic-bezier(0.68, -0.55, 0.265, 1.55);

  --t-fast:   0.12s var(--spring-crisp);
  --t-normal: 0.22s var(--spring-soft);
  --t-slow:   0.35s var(--spring-crisp);
  --r-sm:  6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --header-h:    60px;
  --footer-h:    64px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* GLOBAL [hidden]-SKYDD
   Många komponenter här sätter display:flex/grid i sin klass-regel,
   vilket har högre CSS-specificitet än webbläsarens inbyggda
   [hidden]{display:none}-regel (attributselektor). Resultatet: JS
   sätter element.hidden=true korrekt, men elementet syns ändå
   eftersom klassen vinner över attributet. Den här regeln tvingar
   [hidden] att alltid vinna, oavsett vilken display-klass som annars
   ligger på elementet. Detta är roten till flera "element syns trots
   hidden=true"-buggar i appen (t.ex. console-header, vs-wrapper). */
[hidden] { display: none !important; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  overflow: hidden;
  /* Crisp subpixel rendering on iPhone Retina */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Prevent iOS bounce scroll on wrong elements */
  overscroll-behavior: none;
  /* Dark scrollbars / keyboard on iOS */
  color-scheme: dark;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; }
ul, ol { list-style: none; }
img, svg { display: block; }

/* ══ AMBIENT ══ */
.bg-ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow {
  position: absolute; border-radius: 50%;
  filter: blur(90px);
  opacity: 0.18;
  animation: glowDrift 24s ease-in-out infinite alternate;
}
.glow-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(155,138,255,0.75), transparent 68%);
  top: -140px; left: -100px;
}
.glow-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, rgba(0,211,238,0.65), transparent 68%);
  bottom: 60px; right: -80px;
  animation-duration: 19s; animation-delay: -10s;
}
.glow-3 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,107,138,0.4), transparent 70%);
  top: 44%; left: 30%;
  animation-duration: 28s; animation-delay: -16s;
}
@keyframes glowDrift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(28px,16px) scale(1.1); }
}

/* ══ GLASS ══ */
.glass-panel {
  background: rgba(16, 13, 28, 0.88);
  backdrop-filter: blur(28px) saturate(180%) brightness(1.04);
  -webkit-backdrop-filter: blur(28px) saturate(180%) brightness(1.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 4px 24px rgba(0,0,0,0.3);
}

/* ══ GRADIENT TEXT ══ */
.gradient-text {
  background: linear-gradient(110deg, var(--violet), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ══ APP SHELL ══ */
.app-shell {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column; overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(160deg, #181526 0%, #0f0e14 55%, #09080f 100%);
}

/* ══ HEADER ══ */
.app-header {
  height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-3);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-radius: 0; z-index: 100; flex-shrink: 0;
  background: rgba(12, 10, 22, 0.94);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 -1px 0 rgba(155,138,255,0.06), 0 1px 0 rgba(0,0,0,0.2);
  transform: translateZ(0);
  will-change: transform;
}
.sidebar-toggle {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); color: var(--text-2); flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-toggle:hover { background: var(--surface); color: var(--text-1); }

/* Header-actions döljs på välkomstsidan, visas när spel är aktiva */
.header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.welcome-visible .header-actions { display: none; }

/* Liten CCC-badge centrerad i headern på välkomstsidan */
.welcome-visible .app-header::after {
  content: 'CCC';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  background: linear-gradient(110deg, var(--violet), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
}

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  border-radius: var(--r-md); font-size: 13px; font-weight: 600;
  height: 38px; padding: 0 var(--sp-4);
  transition:
    transform    0.15s var(--spring-snap),
    box-shadow   0.15s var(--spring-crisp),
    background   0.15s var(--spring-crisp),
    border-color 0.15s var(--spring-crisp),
    filter       0.15s ease;
  white-space: nowrap; flex-shrink: 0;
  -webkit-user-select: none; user-select: none;
}
.btn:active {
  transform: scale(0.93);
  transition: transform 0.07s var(--spring-crisp);
}

.btn-icon {
  width: 34px; height: 34px; padding: 0;
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.13);
  color: var(--text-2);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  transition: all var(--t-fast);
  position: relative;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.btn-icon svg { width: 14px; height: 14px; }
.btn-icon:active {
  transform: scale(0.86);
  background: rgba(255,255,255,0.1);
  transition: transform 0.07s var(--spring-crisp);
}

.btn-upload:active  { border-color: rgba(139,115,255,0.5); color: var(--violet); }
.btn-export:active  { border-color: rgba(0,229,255,0.4);   color: var(--cyan); }
.btn-home:active    { border-color: rgba(255,107,138,0.5);  color: var(--pink); }
.btn-paste:active   { border-color: rgba(100,220,160,0.5);  color: #64DCa0; }
.btn-backup:active  { border-color: rgba(34,211,238,0.5);   color: var(--cyan); }
.btn-restore:active { border-color: rgba(139,115,255,0.5);  color: var(--violet); }

.btn-primary {
  background: linear-gradient(135deg, #7B55FF 0%, #8B73FF 60%, #6A90FF 100%);
  color: #fff;
  border: 1px solid rgba(139,115,255,0.4);
  border-top-color: rgba(180,160,255,0.5);
  box-shadow:
    0 2px 12px rgba(123,85,255,0.4),
    inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:active {
  filter: brightness(1.1);
  box-shadow:
    0 4px 20px rgba(123,85,255,0.55),
    inset 0 1px 0 rgba(255,255,255,0.22);
  transform: scale(0.95);
}
.btn-primary:focus-visible {
  outline: 3px solid rgba(139,92,246,0.5);
  outline-offset: 2px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.15);
  color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.btn-ghost:active {
  background: rgba(255,255,255,0.07);
  color: var(--text-1);
  border-color: rgba(255,255,255,0.18);
}

.btn-danger {
  background: linear-gradient(135deg, #c0392b, #922b21);
  color: #fff;
  border: 1px solid rgba(255,80,80,0.3);
  box-shadow: 0 2px 12px rgba(192,57,43,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-danger:active {
  filter: brightness(1.12);
  box-shadow: 0 4px 20px rgba(192,57,43,0.5);
}

.btn-sm  { height: 34px; padding: 0 var(--sp-3); font-size: 12px; border-radius: var(--r-sm); }
.btn-lg  { height: 48px; padding: 0 var(--sp-6); font-size: 15px; border-radius: var(--r-lg); min-width: 130px; }

/* ══ LAYOUT ══ */
.layout-main { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ══ SIDEBAR OVERLAY ══ */
.sidebar-overlay {
  position: absolute; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: none;
}
.sidebar-overlay.visible { display: block; }

/* ══ SIDEBAR ══ */
.sidebar {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 82vw; max-width: 320px;
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
  border-radius: 0 var(--r-xl) var(--r-xl) 0;
  z-index: 80;
  transform: translateX(-102%) translateZ(0);
  transition: transform 0.38s var(--spring-soft);
  overflow: hidden;
  padding-left: var(--safe-left);
  background: rgba(14, 11, 26, 0.97);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 4px 0 32px rgba(0,0,0,0.4), inset -1px 0 0 rgba(139,115,255,0.06);
  will-change: transform;
  backface-visibility: hidden;
}
.sidebar.open { transform: translateX(0); transition: transform 0.32s var(--spring-snap); }

.sidebar-header {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  background: rgba(139,115,255,0.06);
  box-shadow: inset 0 -1px 0 rgba(139,115,255,0.08), 0 1px 0 rgba(0,0,0,0.15);
}
.sidebar-title {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3);
  flex: 1;
}
.console-count-badge {
  background: var(--violet-dim);
  border: 1px solid rgba(139,115,255,0.3);
  color: var(--violet);
  font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 1px 7px;
  font-family: var(--font-display);
  box-shadow: 0 0 8px rgba(139,115,255,0.1);
}
.sidebar-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: all var(--t-fast);
}
.sidebar-close:hover { background: var(--surface); color: var(--text-1); }

/* ══ CONSOLE LIST ══ */
.console-list {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.console-list::-webkit-scrollbar { width: 3px; }
.console-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Category separator ── */
.console-category-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  margin-top: var(--sp-2);
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-3);
  font-family: var(--font-display);
  position: relative;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}
.console-category-label:active { opacity: 0.55; }
.console-category-label span { flex: 1; }
.cat-chevron {
  width: 12px; height: 12px; flex-shrink: 0;
  transition: transform 0.22s var(--spring-crisp);
  opacity: 0.45;
}
.console-category-label.collapsed .cat-chevron { transform: rotate(-90deg); }
.console-category-label::before {
  content: '';
  display: block;
  height: 1px;
  width: 100%;
  position: absolute;
  top: 0; left: 0; right: 0;
  background: linear-gradient(90deg, rgba(139,115,255,0.4), transparent);
}
.console-category-label:first-child::before { display: none; }

/* Färgad accent per kategori */
.console-category-label[data-cat^="home_"]   { color: rgba(139,115,255,0.85); }
.console-category-label[data-cat="addon"]    { color: rgba(144,238,144,0.75); }
.console-category-label[data-cat="handheld"] { color: rgba(0,229,255,0.8); }
.console-category-label[data-cat="computer"] { color: rgba(255,165,0,0.8); }
.console-category-label[data-cat="amiga"]    { color: rgba(255,165,0,0.7); }
.console-category-label[data-cat="pc"]       { color: rgba(200,200,220,0.7); }
.console-category-label[data-cat="arcade"]   { color: rgba(255,107,138,0.85); }
.console-category-label[data-cat="niche"]    { color: rgba(255,220,100,0.8); }
.console-category-label[data-cat="imported"] { color: rgba(240,240,248,0.45); }

.console-category-label[data-cat^="home_"]::before   { background: linear-gradient(90deg, rgba(139,115,255,0.45), transparent); }
.console-category-label[data-cat="addon"]::before    { background: linear-gradient(90deg, rgba(144,238,144,0.3), transparent); }
.console-category-label[data-cat="handheld"]::before { background: linear-gradient(90deg, rgba(0,229,255,0.4), transparent); }
.console-category-label[data-cat="computer"]::before { background: linear-gradient(90deg, rgba(255,165,0,0.4), transparent); }
.console-category-label[data-cat="amiga"]::before    { background: linear-gradient(90deg, rgba(255,165,0,0.3), transparent); }
.console-category-label[data-cat="pc"]::before       { background: linear-gradient(90deg, rgba(200,200,220,0.25), transparent); }
.console-category-label[data-cat="arcade"]::before   { background: linear-gradient(90deg, rgba(255,107,138,0.4), transparent); }
.console-category-label[data-cat="niche"]::before    { background: linear-gradient(90deg, rgba(255,220,100,0.3), transparent); }
.console-category-label[data-cat="imported"]::before { background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent); }

/* Console-rad */
.console-item {
  display: block; width: 100%;
  padding: 10px var(--sp-4) 10px var(--sp-5);
  cursor: pointer; text-align: left;
  border-left: 3px solid transparent;
  transition:
    background    0.15s var(--spring-crisp),
    border-color  0.15s var(--spring-crisp),
    box-shadow    0.15s var(--spring-crisp);
}
.console-item:active {
  background: rgba(139,115,255,0.08);
  transform: none;
}
.console-item.active {
  background: rgba(139,115,255,0.1);
  border-left-color: var(--violet);
  box-shadow: inset 3px 0 12px rgba(139,115,255,0.08);
}
.console-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; margin-bottom: 4px; line-height: 1.25;
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.console-item.active .console-item-name {
  color: #d4c4ff;
  text-shadow: 0 0 12px rgba(139,115,255,0.25);
}
.console-item-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); margin-bottom: 5px; }
.ci-checked { color: rgba(0,229,255,0.7); font-weight: 600; }
.console-item-bar {
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.console-item-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 4px rgba(139,115,255,0.3);
  transition: width 0.4s var(--spring-crisp);
}

.sidebar-empty { padding: var(--sp-8) var(--sp-5); text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.7; }
.sidebar-empty .empty-icon { font-size: 28px; margin-bottom: var(--sp-3); }

/* ══ CONTENT AREA ══ */
.content-area { flex: 1; overflow: hidden; position: relative; display: flex; flex-direction: column; }

/* Drop overlay */
.drop-overlay {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(6, 4, 16, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  display: none; align-items: center; justify-content: center;
}
.drop-overlay.active { display: flex; }
.drop-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-5); padding: var(--sp-8) var(--sp-6);
  border: 2px dashed rgba(155,138,255,0.45);
  border-radius: var(--r-xl);
  background: rgba(155,138,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 0 40px rgba(155,138,255,0.04);
  animation: dropPulse 1.5s ease-in-out infinite;
}
.drop-inner p { font-size: 18px; font-weight: 700; color: var(--text-2); }
@keyframes dropPulse {
  0%,100% { border-color: rgba(155,138,255,0.35); box-shadow: inset 0 0 40px rgba(155,138,255,0.04); }
  50%      { border-color: rgba(34,211,238,0.55);  box-shadow: inset 0 0 60px rgba(34,211,238,0.06); }
}

/* ══ WELCOME STATE ══ */
.welcome-state {
  position: absolute;
  inset: 0;
  top: var(--header-h);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 28px 0 120px;
  background: transparent;
}
.welcome-inner {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  width: 100%; max-width: 340px;
  padding: 0 16px; gap: 0;
}
.welcome-gfx { position: relative; width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; }
.ring { position: absolute; border-radius: 50%; border: 1px solid; animation: ringPulse 3s ease-in-out infinite; }
.ring-1 { inset: 0;    border-color: rgba(155,138,255,0.5); }
.ring-2 { inset: -10px; border-color: rgba(34,211,238,0.28); animation-delay: 0.9s; }
.ring-3 { inset: -22px; border-color: rgba(255,107,138,0.16); animation-delay: 1.8s; }
@keyframes ringPulse { 0%,100% { opacity:0.5; transform:scale(1); } 50% { opacity:1; transform:scale(1.04); } }
.welcome-emoji { font-size: 36px; position: relative; z-index: 1; }
.welcome-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text-1); line-height: 1.2; letter-spacing: 0.015em; }
.welcome-desc { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.welcome-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }
.chip {
  background: rgba(255,255,255,0.055);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.14);
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  display: flex; flex-direction: column; gap: 2px; min-width: 88px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.chip-cat { font-size: 10px; font-weight: 700; color: var(--cyan); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-display); }
.chip-n { font-size: 18px; font-weight: 800; color: var(--text-1); font-family: var(--font-display); }
.welcome-btns { display: flex; gap: var(--sp-3); }

/* ══ WELCOME STATS ══ */
.welcome-stats {
  display: flex; gap: var(--sp-2);
  width: 100%; margin: var(--sp-4) 0;
}
.ws-item {
  flex: 1;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.14);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-2);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 4px 12px rgba(0,0,0,0.2);
}
.ws-num {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: var(--text-1);
  background: linear-gradient(110deg, var(--violet) 0%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em; line-height: 1;
}
.ws-label {
  font-size: 9px; font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-family: var(--font-display);
}

/* ══ GAMES VIEW ══ */
.games-view { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ══ TXT UPLOAD PANEL ══ */
.txt-upload-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--sp-8) var(--sp-5); }
.txt-upload-panel[hidden] { display: none; }
.tup-inner { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); text-align: center; max-width: 300px; }
.tup-icon { font-size: 44px; }
.tup-title { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--text-1); }
.tup-desc { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.tup-desc strong { color: var(--cyan); font-weight: 600; }
.tup-hint {
  background: rgba(139,115,255,0.1);
  border: 1px solid rgba(139,115,255,0.25);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 12px; color: var(--text-2); line-height: 1.6;
  text-align: left; width: 100%;
}
.tup-hint code { color: var(--cyan); font-family: monospace; font-size: 12px; }

/* ══ TXT PREVIEW PANEL ══ */
.txt-preview-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.txt-preview-panel[hidden] { display: none; }
.tpp-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.tpp-count { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--violet); }
.tpp-sub { font-size: 11px; color: var(--text-3); margin-left: 6px; }
.tpp-list { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-3) var(--sp-4); -webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch; }
.tpp-list::-webkit-scrollbar { width: 3px; }
.tpp-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.tpp-item { display: flex; align-items: center; gap: var(--sp-3); padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; color: var(--text-1); }
.tpp-item:last-child { border-bottom: none; }
.tpp-num { font-size: 11px; color: var(--text-3); min-width: 28px; text-align: right; font-family: var(--font-display); font-weight: 600; }
.tpp-footer {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.tpp-footer .btn { flex: 1; justify-content: center; height: 46px; border-radius: 14px; }
.tpp-game { flex: 1; }

/* ══ CONSOLE HEADER ══ */
.console-header {
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  background: rgba(10, 8, 20, 0.6);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  display: flex; align-items: center; gap: var(--sp-3);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.04), 0 1px 0 rgba(0,0,0,0.2);
}
.ch-left { flex: 1; min-width: 0; }
.ch-export-btn {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(34,211,238,0.07);
  border: 1px solid rgba(34,211,238,0.18);
  border-top-color: rgba(34,211,238,0.28);
  color: var(--cyan);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.08), 0 0 8px rgba(34,211,238,0.04);
  transition: transform 0.12s var(--spring-crisp), background 0.15s ease, box-shadow 0.15s ease;
}
.ch-export-btn svg { width: 17px; height: 17px; }
.ch-export-btn:active {
  transform: scale(0.88);
  background: rgba(34,211,238,0.16);
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.14), 0 0 14px rgba(34,211,238,0.1);
}
.ch-title-row { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.ch-emoji { font-size: 16px; }
.ch-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(139,115,255,0.15);
}
.ch-category { display: none; }
.ch-progress-row { display: flex; align-items: center; gap: var(--sp-2); }

/* Progress track — djupare spår, glassmorphism-känsla */
.progress-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
/* Progress fill — violet→cyan gradient med subtil shimmer via inset */
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg,
    var(--violet) 0%,
    rgba(139,115,255,0.9) 40%,
    var(--cyan) 100%
  );
  box-shadow: 0 0 8px rgba(139,115,255,0.35), 0 0 4px rgba(34,211,238,0.2);
  transition: width 0.55s cubic-bezier(0.4,0,0.2,1);
}
.progress-pct {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
  font-family: var(--font-display);
  min-width: 32px;
  text-align: right;
  letter-spacing: 0.02em;
}
.progress-detail { font-size: 11px; color: var(--text-3); }

/* ══ VS WRAPPER — håller scroll + alfa-nav sida vid sida ══ */
.vs-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
}

/* ══ VIRTUAL SCROLL ══ */
.virtual-scroll-container {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative;
  padding: var(--sp-3) var(--sp-3);
  padding-bottom: calc(var(--sp-2) + 16px + var(--safe-bottom) + 64px);
  outline: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: pan-y;
  transform: translateZ(0);
  will-change: scroll-position;
}
.virtual-scroll-container::-webkit-scrollbar { width: 2px; }
.virtual-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(139,115,255,0.2);
  border-radius: 2px;
}
.virtual-scroll-spacer { width: 100%; position: absolute; top: 0; left: 0; pointer-events: none; }
.virtual-scroll-items { position: absolute; left: var(--sp-3); right: var(--sp-3); top: var(--sp-3); }


/* ══ GAME CARD ══ */
.game-card {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--r-lg);
  padding: 7px 10px 8px;
  display: flex; flex-direction: column; gap: 5px;
  position: absolute; left: 0; right: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.22);
  transition:
    background   var(--t-normal),
    border-color var(--t-normal),
    box-shadow   var(--t-normal),
    transform    0.18s var(--spring-soft);
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

/* Premium tap — lyft + djupare shadow, spring-soft ger en liten "pop" */
.game-card:active {
  transform: scale(0.978) translateY(-2px);
  background: rgba(255,255,255,0.085);
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.13),
    0 2px 6px rgba(0,0,0,0.25),
    0 10px 28px rgba(0,0,0,0.38),
    0 0 0 1px rgba(255,255,255,0.05);
  transition:
    background   0.08s var(--spring-crisp),
    border-color 0.08s var(--spring-crisp),
    box-shadow   0.08s var(--spring-crisp),
    transform    0.08s var(--spring-crisp);
}

/* Påbörjat (minst 1 plattform checkad, inte alla) — svag violet-puls */
.game-card.has-checks {
  border-color: rgba(139,115,255,0.22);
  box-shadow:
    inset 0 1px 0 rgba(139,115,255,0.1),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 16px rgba(0,0,0,0.22),
    0 0 0 1px rgba(139,115,255,0.06);
}

/* Fullt klar — cyan accent, tydligare än has-checks */
.game-card.fully-checked {
  border-color: rgba(34,211,238,0.3);
  background: rgba(34,211,238,0.045);
  box-shadow:
    inset 0 1px 0 rgba(34,211,238,0.12),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 16px rgba(0,0,0,0.22),
    0 0 12px rgba(34,211,238,0.07);
}
.game-card.fully-checked:active {
  background: rgba(34,211,238,0.09);
  border-color: rgba(34,211,238,0.45);
  box-shadow:
    inset 0 1px 0 rgba(34,211,238,0.2),
    0 10px 28px rgba(0,0,0,0.35),
    0 0 16px rgba(34,211,238,0.12);
}

/* Status-kant — 3px, tydligare hierarki, accent-glow följer färgen */
.game-card.status-red {
  border-left: 3px solid rgba(255,80,100,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.22),
    -1px 0 8px rgba(255,80,100,0.06);
}
.game-card.status-yellow {
  border-left: 3px solid rgba(255,190,50,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.22),
    -1px 0 8px rgba(255,190,50,0.06);
}
.game-card.status-green {
  border-left: 3px solid rgba(34,211,130,0.4);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 1px 3px rgba(0,0,0,0.2),
    0 4px 12px rgba(0,0,0,0.22),
    -1px 0 8px rgba(34,211,130,0.06);
}

/* Global search console badge */
.global-console-badge {
  font-size: 10px;
  color: var(--text-3);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.game-card-top { display: flex; align-items: flex-start; gap: var(--sp-2); }
.game-info { flex: 1; min-width: 0; }
.game-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.game-date {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 1px;
}
.complete-badge { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); flex-shrink: 0; margin-top: 4px; opacity: 0; transition: opacity var(--t-normal); }
.game-card.fully-checked .complete-badge { opacity: 1; }

/* ══ PLATFORM ICONS ══ */
.platform-icons { display: flex; gap: 4px; }
.platform-btn {
  flex: 1; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  transition:
    transform    0.18s var(--spring-snap),
    box-shadow   0.18s var(--spring-crisp),
    border-color 0.18s var(--spring-crisp),
    background   0.18s var(--spring-crisp);
  position: relative; overflow: hidden; cursor: pointer;
  -webkit-tap-highlight-color: transparent; min-width: 0;
  will-change: transform;
}
.platform-btn::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  transition: opacity 0.22s var(--spring-crisp);
}
.platform-btn:active {
  transform: scale(0.84);
  transition: transform 0.07s var(--spring-crisp);
}
.platform-btn.checked { transform: scale(1.0); }
.platform-icon {
  width: 15px; height: 15px; position: relative; z-index: 1;
  font-size: 12px; line-height: 1;
  color: rgba(255,255,255,0.3);
  transition: color 0.18s var(--spring-crisp), transform 0.25s var(--spring-bounce);
  display: flex; align-items: center; justify-content: center;
}
.platform-btn.checked .platform-icon { transform: scale(1.18); }

/* ══════════════════════════════════════════════════════════
   PLATFORM IDENTITY MICRO-COLORWAYS
   Vila: monokrom + subtil border
   Checked: varumärkesfärger + glow + icon-color
   URL sparad: extra ring + starkare glow
   ══════════════════════════════════════════════════════════ */

/* ── TikTok — cyan/magenta glitch ── */
.platform-btn[data-platform="tiktok"]::before {
  background: linear-gradient(135deg, #ff0050 0%, #000 50%, #00f2ea 100%);
}
.platform-btn[data-platform="tiktok"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="tiktok"].checked {
  border-color: rgba(255,0,80,0.6);
  box-shadow: 0 0 14px rgba(255,0,80,0.35), 0 0 28px rgba(0,242,234,0.12);
}
.platform-btn[data-platform="tiktok"].checked::before { opacity: 0.28; }
.platform-btn[data-platform="tiktok"].checked .platform-icon {
  color: #ff2d6b;
  filter: drop-shadow(0 0 4px rgba(0,242,234,0.7));
}
/* URL-sparad: cyan ring */
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="tiktok"].checked {
  box-shadow: 0 0 0 1.5px rgba(0,242,234,0.6), 0 0 16px rgba(255,0,80,0.4);
}

/* ── Instagram — solnedgångsgradient ── */
.platform-btn[data-platform="instagram"]::before {
  background: linear-gradient(135deg, #f58529 0%, #dd2a7b 50%, #8134af 100%);
}
.platform-btn[data-platform="instagram"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="instagram"].checked {
  border-color: rgba(221,42,123,0.6);
  box-shadow: 0 0 14px rgba(221,42,123,0.35), 0 0 28px rgba(245,133,41,0.12);
}
.platform-btn[data-platform="instagram"].checked::before { opacity: 0.28; }
.platform-btn[data-platform="instagram"].checked .platform-icon {
  color: #f58529;
  filter: drop-shadow(0 0 4px rgba(221,42,123,0.8));
}
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="instagram"].checked {
  box-shadow: 0 0 0 1.5px rgba(245,133,41,0.7), 0 0 18px rgba(221,42,123,0.4);
}

/* ── YouTube — signal-röd ── */
.platform-btn[data-platform="youtube"]::before {
  background: linear-gradient(135deg, #ff0000 0%, #c4302b 100%);
}
.platform-btn[data-platform="youtube"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="youtube"].checked {
  border-color: rgba(255,0,0,0.55);
  box-shadow: 0 0 14px rgba(255,0,0,0.35), 0 0 28px rgba(196,48,43,0.12);
}
.platform-btn[data-platform="youtube"].checked::before { opacity: 0.24; }
.platform-btn[data-platform="youtube"].checked .platform-icon {
  color: #ff4444;
  filter: drop-shadow(0 0 4px rgba(255,0,0,0.7));
}
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="youtube"].checked {
  box-shadow: 0 0 0 1.5px rgba(255,68,68,0.7), 0 0 18px rgba(255,0,0,0.4);
}

/* ── Facebook — djupblå ── */
.platform-btn[data-platform="facebook"]::before {
  background: linear-gradient(135deg, #1877f2 0%, #0c4a9e 100%);
}
.platform-btn[data-platform="facebook"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="facebook"].checked {
  border-color: rgba(24,119,242,0.55);
  box-shadow: 0 0 14px rgba(24,119,242,0.35), 0 0 28px rgba(12,74,158,0.15);
}
.platform-btn[data-platform="facebook"].checked::before { opacity: 0.24; }
.platform-btn[data-platform="facebook"].checked .platform-icon {
  color: #5ba4f5;
  filter: drop-shadow(0 0 4px rgba(24,119,242,0.8));
}
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="facebook"].checked {
  box-shadow: 0 0 0 1.5px rgba(91,164,245,0.7), 0 0 18px rgba(24,119,242,0.4);
}

/* ── X — stål-vit ── */
.platform-btn[data-platform="x"]::before {
  background: linear-gradient(135deg, #e7e9ea 0%, #657786 100%);
}
.platform-btn[data-platform="x"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="x"].checked {
  border-color: rgba(231,233,234,0.38);
  box-shadow: 0 0 12px rgba(231,233,234,0.15), 0 0 24px rgba(101,119,134,0.08);
}
.platform-btn[data-platform="x"].checked::before { opacity: 0.16; }
.platform-btn[data-platform="x"].checked .platform-icon {
  color: #e7e9ea;
  filter: drop-shadow(0 0 3px rgba(231,233,234,0.6));
}
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="x"].checked {
  box-shadow: 0 0 0 1.5px rgba(231,233,234,0.5), 0 0 14px rgba(231,233,234,0.18);
}

/* ── Snapchat — elektrisk gul ── */
.platform-btn[data-platform="snapchat"]::before {
  background: linear-gradient(135deg, #fffc00 0%, #29cc41 100%);
}
.platform-btn[data-platform="snapchat"]:not(.checked) .platform-icon { color: rgba(255,255,255,0.28); }
.platform-btn[data-platform="snapchat"].checked {
  border-color: rgba(255,252,0,0.55);
  box-shadow: 0 0 14px rgba(255,252,0,0.28), 0 0 28px rgba(41,204,65,0.1);
}
.platform-btn[data-platform="snapchat"].checked::before { opacity: 0.2; }
.platform-btn[data-platform="snapchat"].checked .platform-icon {
  color: #fffc00;
  filter: drop-shadow(0 0 5px rgba(255,252,0,0.7));
}
.platform-cell:has(.url-dot.has-url) .platform-btn[data-platform="snapchat"].checked {
  box-shadow: 0 0 0 1.5px rgba(255,252,0,0.7), 0 0 18px rgba(255,252,0,0.3);
}

@keyframes platformPulse {
  0%   { transform: scale(0.86); }
  40%  { transform: scale(1.18); }
  65%  { transform: scale(0.95); }
  82%  { transform: scale(1.06); }
  100% { transform: scale(1.0); }
}
.platform-btn.pulse {
  animation: platformPulse 0.42s var(--spring-snap) forwards;
}



/* ══ FOOTER ══ */
/* Borttagen ur layoutflödet permanent — thumb-bar täcker redan
   samma funktioner (BACKUP/ÅTERSTÄLL/Min progress). Detta är ett
   CSS-skyddsnät: oavsett vilken JS-kodväg som råkar sätta
   hidden=false ska elementet aldrig ta plats eller synas. */
.app-footer {
  display: none !important;
}

/* Reset */
.btn-reset {
  flex: 1; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600; font-family: var(--font-body);
  letter-spacing: 0.01em; color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: all 0.15s var(--spring-crisp);
  -webkit-user-select: none; user-select: none;
}
.btn-reset:active {
  background: rgba(255,60,90,0.1);
  border-color: rgba(255,60,90,0.3);
  color: #ff6b8a;
  transform: scale(0.95);
  transition: transform 0.07s var(--spring-crisp);
}

/* Save */
.btn-save {
  flex: 2; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14px; font-weight: 700; font-family: var(--font-body);
  letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(135deg, #9B8AFF 0%, #7B61FF 45%, #5B45D4 100%);
  border: 1px solid rgba(155,138,255,0.35);
  border-top-color: rgba(180,165,255,0.45);
  box-shadow: 0 4px 18px rgba(123,97,255,0.38), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.15s var(--spring-crisp);
  -webkit-user-select: none; user-select: none;
}
.btn-save:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(123,97,255,0.28);
  transition: transform 0.07s var(--spring-crisp);
}

/* ══ TOAST ══ */
.toast-container {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom) + 10px);
  left: var(--sp-4); right: var(--sp-4);
  z-index: 999;
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  background: rgba(16, 13, 30, 0.97);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.15);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13px; font-weight: 500;
  color: var(--text-1);
  display: flex; align-items: center; gap: var(--sp-3);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 16px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08);
  animation: toastIn 0.26s var(--spring-soft);
  pointer-events: auto;
}
.toast.toast-out { animation: toastOut 0.2s var(--spring-crisp) forwards; }
.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-success {
  border-left: 3px solid var(--cyan);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 16px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08),
    -1px 0 12px rgba(34,211,238,0.08);
}
.toast-error {
  border-left: 3px solid var(--pink);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 16px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08),
    -1px 0 12px rgba(255,107,138,0.08);
}
.toast-info {
  border-left: 3px solid var(--violet);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 16px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.08),
    -1px 0 12px rgba(139,115,255,0.08);
}
@keyframes toastIn  { from { opacity:0; transform:translateY(12px) scale(0.94); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); } to { opacity:0; transform:translateY(6px) scale(0.96); } }

/* ══ MODAL ══ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  display: flex; align-items: flex-end; justify-content: center;
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-4) + var(--safe-bottom));
  animation: fadeIn 0.18s var(--spring-crisp);
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal {
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  width: 100%; max-width: 420px;
  background: rgba(16, 13, 28, 0.97);
  backdrop-filter: blur(32px) saturate(180%) brightness(1.05);
  -webkit-backdrop-filter: blur(32px) saturate(180%) brightness(1.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-top: 1px solid rgba(255,255,255,0.18);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.4),
    0 24px 64px rgba(0,0,0,0.55),
    0 48px 80px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 0 0 1px rgba(139,115,255,0.05);
  animation: sheetUp 0.36s var(--spring-soft);
}
@keyframes sheetUp {
  from { opacity:0; transform: translateY(56px) scale(0.95); }
  to   { opacity:1; transform: translateY(0) scale(1); }
}

.modal-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800;
  margin-bottom: var(--sp-2);
  letter-spacing: 0.01em;
}
.modal-desc {
  font-size: 14px; color: var(--text-2);
  line-height: 1.65; margin-bottom: var(--sp-5);
}
.modal-actions {
  display: flex; gap: var(--sp-3);
  padding-top: var(--sp-1);
}
.modal-actions .btn {
  flex: 1; justify-content: center;
  height: 46px; border-radius: 14px;
  font-size: 14px; font-weight: 700;
}

/* Modal ikon-header */
.modal-icon-header {
  display: flex; align-items: center;
  gap: 14px; margin-bottom: var(--sp-5);
}
.modal-icon {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 13px;
  background: rgba(139,115,255,0.12);
  border: 1px solid rgba(139,115,255,0.28);
  border-top-color: rgba(139,115,255,0.45);
  display: flex; align-items: center; justify-content: center;
  color: var(--violet);
  box-shadow: inset 0 1px 0 rgba(139,115,255,0.15), 0 0 16px rgba(139,115,255,0.08);
}
.modal-icon svg { width: 22px; height: 22px; }
.modal-icon-header .modal-title { margin-bottom: 2px; }
.modal-subtitle {
  font-size: 12px; font-weight: 600;
  color: var(--cyan); margin: 0;
  letter-spacing: 0.02em;
}
.modal-icon.modal-icon-danger {
  background: rgba(255,107,138,0.12);
  border-color: rgba(255,107,138,0.28);
  border-top-color: rgba(255,107,138,0.45);
  color: var(--pink);
  box-shadow: inset 0 1px 0 rgba(255,107,138,0.15), 0 0 16px rgba(255,107,138,0.07);
}
.modal-icon.modal-icon-cyan {
  background: rgba(34,211,238,0.1);
  border-color: rgba(34,211,238,0.26);
  border-top-color: rgba(34,211,238,0.42);
  color: var(--cyan);
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.13), 0 0 16px rgba(34,211,238,0.07);
}

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
::selection { background: rgba(139,115,255,0.35); color: var(--text-1); }

.welcome-text { display: flex; flex-direction: column; gap: 4px; align-items: center; margin-bottom: 24px; margin-top: 8px; }
.welcome-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.welcome-desc  { font-size: 12px; color: var(--text-3); line-height: 1.5; margin-top: 2px; letter-spacing: 0.01em; }

/* ══ FUNKTIONSKNAPPAR — 2 rader, 3 per rad ══ */
.welcome-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
}
.welcome-actions-3 {
  grid-template-columns: repeat(3, 1fr);
}
.wag-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.wag-item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.8; }
.wag-item span {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  text-align: center;
  line-height: 1.2;
  color: var(--text-3);
}
.wag-item:active { transform: scale(0.93); background: rgba(255,255,255,0.09); transition: transform 0.08s var(--spring-crisp), background 0.1s var(--spring-crisp); }
#wag-sidebar {
  border-color: rgba(139,115,255,0.22);
  background: rgba(139,115,255,0.07);
  color: var(--violet);
}
#wag-sidebar span { color: var(--violet); opacity: 0.9; }
.wag-accent {
  border-color: rgba(34,211,238,0.22);
  background: rgba(34,211,238,0.06);
  color: var(--cyan);
}
.wag-accent span { color: var(--cyan); opacity: 0.9; }

.welcome-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 14px;
  text-align: center;
}
.welcome-hint strong { color: var(--cyan); }

/* ══ SOCIALA PLATTFORMAR ══ */
.welcome-platforms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  width: 100%;
}
.wp-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 9px;
  border-radius: 13px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.04);
}
.wp-item svg  { width: 20px; height: 20px; }
.wp-item span { font-size: 9px; font-weight: 700; letter-spacing: 0.05em; font-family: var(--font-display); }
.wp-tiktok { border-color: rgba(255,0,80,0.2);     background: rgba(255,0,80,0.07);    color: #ff6b9d; }
.wp-ig     { border-color: rgba(221,42,123,0.2);   background: rgba(221,42,123,0.07);  color: #f58529; }
.wp-yt     { border-color: rgba(255,0,0,0.2);      background: rgba(255,0,0,0.07);     color: #ff4444; }
.wp-fb     { border-color: rgba(24,119,242,0.2);   background: rgba(24,119,242,0.07);  color: #4e9ff2; }
.wp-x      { border-color: rgba(231,233,234,0.12); background: rgba(231,233,234,0.04); color: #e7e9ea; }
.wp-snap   { border-color: rgba(255,252,0,0.2);    background: rgba(255,252,0,0.06);   color: #fffc00; }

/* ══ PLATFORM ICON SVG sizing ══ */
.platform-icon { width: 16px !important; height: 16px !important; display: flex; align-items: center; justify-content: center; }
.platform-icon svg { width: 16px; height: 16px; display: block; }

/* ══ PLATFORM CELL — wraps btn + url-dot ══ */
.platform-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-width: 0;
}
/* platform-btn takes full width inside cell */
.platform-cell .platform-btn {
  flex: none;
  width: 100%;
}

/* ══ URL DOT ══ */
.url-dot {
  width: 100%;
  height: 14px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast), background var(--t-fast);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.url-dot svg {
  width: 9px;
  height: 9px;
  color: rgba(255,255,255,0.25);
  transition: color var(--t-fast);
}
/* Show dot only when platform is checked */
.platform-btn.checked ~ .url-dot,
.platform-cell:has(.platform-btn.checked) .url-dot {
  opacity: 1;
  pointer-events: auto;
}
/* Has a saved URL — glow cyan */
.url-dot.has-url {
  opacity: 1;
  pointer-events: auto;
}
.url-dot.has-url svg {
  color: var(--cyan);
  filter: drop-shadow(0 0 3px rgba(34,211,238,0.6));
}
.url-dot:active { background: rgba(255,255,255,0.08); transform: scale(0.9); }

/* ══ URL MODAL ══ */
.url-modal-game {
  font-size: 12px; color: var(--cyan); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; letter-spacing: 0.02em;
}
.url-modal-input-wrap { position: relative; margin-bottom: var(--sp-4); }
.url-modal-input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
  transition: color 0.15s ease;
}
.url-modal-input-wrap:focus-within .url-modal-input-icon { color: var(--violet); }
.url-modal-input {
  width: 100%; height: 48px;
  background: rgba(255,255,255,0.055);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.14);
  border-radius: var(--r-md);
  color: var(--text-1); font-size: 14px;
  padding: 0 var(--sp-4) 0 38px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}
.url-modal-input:focus {
  border-color: rgba(155,138,255,0.55);
  background: rgba(155,138,255,0.07);
  box-shadow: inset 0 1px 0 rgba(155,138,255,0.08), 0 0 0 3px rgba(155,138,255,0.12);
}
.url-modal-input::placeholder { color: var(--text-3); }
.url-modal-actions { justify-content: space-between; }
.url-modal-main-actions { display: flex; gap: var(--sp-2); }
.url-modal-delete-btn {
  color: var(--pink); font-size: 13px; font-weight: 600;
  gap: 5px; height: 46px; padding: 0 var(--sp-3);
  border: 1px solid rgba(255,107,138,0.22);
  border-top-color: rgba(255,107,138,0.35);
  border-radius: 14px;
  background: rgba(255,107,138,0.07);
  box-shadow: inset 0 1px 0 rgba(255,107,138,0.08);
  transition: all var(--t-fast);
}
.url-modal-delete-btn:active { background: rgba(255,107,138,0.18); transform: scale(0.95); }
.url-modal-cancel { min-width: 72px; flex: 0 0 auto !important; }
.url-modal-save   { min-width: 80px; flex: 0 0 auto !important; }

/* ══════════════════════════════════════════════════════════
   RADIAL ACTION MENU — long-press på spelkort
   ══════════════════════════════════════════════════════════ */

.radial-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  pointer-events: all;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.radial-overlay[hidden] { display: none; }

.radial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 12, 0.72);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  animation: radialFadeIn 0.16s var(--spring-crisp) forwards;
}
@keyframes radialFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.radial-ring {
  position: absolute;
  width: 0; height: 0;
}

.radial-item {
  position: absolute;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  border: 1px solid rgba(255,255,255,0.14);
  border-top: 1px solid rgba(255,255,255,0.22);
  background: rgba(18, 14, 36, 0.97);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow:
    0 4px 16px rgba(0,0,0,0.45),
    0 16px 40px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.25);
  cursor: pointer;
  color: var(--text-1);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition:
    transform 0.38s var(--spring-bounce),
    opacity   0.22s var(--spring-crisp),
    box-shadow 0.18s var(--spring-crisp),
    background 0.15s var(--spring-crisp);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.radial-item.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.radial-item:active {
  transform: translate(-50%, -50%) scale(0.84);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transition:
    transform  0.07s var(--spring-crisp),
    box-shadow 0.07s var(--spring-crisp);
}
.radial-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
}
.radial-item-label {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1;
  white-space: nowrap;
}

/* Färgprofiler per åtgärd */
.radial-item.action-note {
  border-color: rgba(255,200,80,0.28);
  border-top-color: rgba(255,200,80,0.45);
  background: rgba(32, 24, 6, 0.97);
  color: #ffd060;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.45),
    0 16px 40px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,200,80,0.15),
    0 0 16px rgba(255,200,80,0.06);
}
.radial-item.action-note .radial-item-label { color: #ffd060; opacity: 0.7; }
.radial-item.action-note:active {
  background: rgba(50, 36, 8, 0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,200,80,0.1);
}

.radial-item.action-delete-game {
  border-color: rgba(255,70,70,0.28);
  border-top-color: rgba(255,70,70,0.45);
  background: rgba(32, 6, 6, 0.97);
  color: #ff5555;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.45),
    0 16px 40px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,70,70,0.15),
    0 0 16px rgba(255,70,70,0.06);
}
.radial-item.action-delete-game svg { color: #ff5555; }
.radial-item.action-delete-game .radial-item-label { color: #ff5555; opacity: 0.85; }
.radial-item.action-delete-game:active {
  background: rgba(50, 8, 8, 0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,70,70,0.1);
}

/* Speltitel under menyn */
.radial-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 15%;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.38);
  font-family: var(--font-body);
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: radialFadeIn 0.25s 0.1s var(--spring-crisp) both;
}

/* Fingercentrum-dot — subtil violet istf vit */
.radial-ring::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(139,115,255,0.5);
  top: -5px; left: -5px;
  box-shadow: 0 0 10px rgba(139,115,255,0.4), 0 0 20px rgba(139,115,255,0.15);
  animation: radialFadeIn 0.15s var(--spring-crisp) forwards;
}


/* ══════════════════════════════════════════════════════════
   THUMB BAR — svävande bottenmeny, alltid i tumzonen
   ══════════════════════════════════════════════════════════ */

.thumb-bar {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(14, 11, 26, 0.88);
  backdrop-filter: blur(32px) saturate(200%) brightness(1.08);
  -webkit-backdrop-filter: blur(32px) saturate(200%) brightness(1.08);
  border: 1px solid rgba(255,255,255,0.13);
  border-top: 1px solid rgba(255,255,255,0.17);
  border-radius: 28px;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 16px 48px rgba(0,0,0,0.45),
    0 32px 64px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 0 0 1px rgba(139,115,255,0.06);
  animation: thumbBarIn 0.4s var(--spring-snap) forwards;
}

@keyframes thumbBarIn {
  from { opacity: 0; transform: translateX(-50%) translateY(24px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.thumb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  transition:
    background  0.18s var(--spring-crisp),
    color       0.18s var(--spring-crisp),
    box-shadow  0.18s var(--spring-crisp),
    transform   0.2s var(--spring-snap);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  min-width: 52px;
}
.thumb-btn svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  transition: transform 0.25s var(--spring-bounce);
}
.thumb-btn span {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}
/* Micro-bounce vid tryck — snabb ned, spring-snap på release */
.thumb-btn:active {
  transform: scale(0.84);
  transition: transform 0.07s var(--spring-crisp);
}
.thumb-btn:active svg {
  transform: scale(1.18);
}

/* Konsoler — aktiv-färg violet */
.thumb-consoles { color: rgba(255,255,255,0.4); }
.thumb-consoles.active {
  color: var(--violet);
  background: rgba(139,115,255,0.14);
  box-shadow: inset 0 1px 0 rgba(139,115,255,0.12);
}
.thumb-consoles:active {
  background: rgba(139,115,255,0.2);
  color: var(--violet);
  transform: scale(0.84);
}

/* Importera */
.thumb-import:active {
  background: rgba(255,255,255,0.09);
  color: var(--text-1);
  transform: scale(0.84);
}

/* Backup — cyan accent */
.thumb-backup.accent {
  color: var(--cyan);
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.16);
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.08), 0 0 8px rgba(34,211,238,0.06);
}
.thumb-backup.accent:active {
  background: rgba(34,211,238,0.16);
  box-shadow: inset 0 1px 0 rgba(34,211,238,0.14), 0 0 14px rgba(34,211,238,0.1);
  transform: scale(0.84);
}

/* Återställ */
.thumb-restore:active {
  background: rgba(139,115,255,0.14);
  color: var(--violet);
  transform: scale(0.84);
}

/* Exportera */
.thumb-export:active {
  background: rgba(255,255,255,0.08);
  color: var(--text-1);
  transform: scale(0.84);
}

/* Dölj thumb-bar på välkomstsidan — wag-grid tar över */
.welcome-visible .thumb-bar { display: none; }

/* App-footer borttagen permanent (se huvuddefinition ovan) */

/* ══════════════════════════════════════════════════════════
   NO-INTRO IMPORT
   ══════════════════════════════════════════════════════════ */

/* Thumb bar knapp */
.thumb-nointro {
  color: #a78bfa;
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: 20px;
}
.thumb-nointro:active {
  background: rgba(139,92,246,0.2);
  color: #c4b5fd;
  transform: scale(0.88);
  transition: transform 0.07s var(--spring-crisp);
}

/* Modal */
.nointro-modal {
  padding: 0;
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.nointro-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(155,138,255,0.04);
  flex-shrink: 0;
  box-shadow: inset 0 -1px 0 rgba(155,138,255,0.07);
}
.nointro-badge {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: rgba(155,138,255,0.12);
  border: 1px solid rgba(155,138,255,0.28);
  border-top-color: rgba(155,138,255,0.45);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--violet);
  box-shadow: inset 0 1px 0 rgba(155,138,255,0.15), 0 0 16px rgba(155,138,255,0.08);
}
.nointro-badge svg { width: 22px; height: 22px; }
.nointro-console-name {
  font-size: 12px;
  color: var(--cyan);
  margin-top: 2px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nointro-stats {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
}
.nointro-stat {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 12px 8px;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.nointro-stat:last-child { border-right: none; }
.nointro-stat-val {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: var(--text-1); line-height: 1;
  letter-spacing: -0.02em;
  transition: all 0.2s var(--spring-snap);
}
.nointro-stat-val.cyan {
  background: linear-gradient(110deg, var(--violet), var(--cyan));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nointro-stat-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-3); font-family: var(--font-display);
}

.nointro-preview { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.nointro-preview-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px 8px;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); font-family: var(--font-display);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
}
.nointro-preview-header svg { color: var(--violet); }
.nointro-preview-list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}
.nointro-preview-list::-webkit-scrollbar { width: 2px; }
.nointro-preview-list::-webkit-scrollbar-thumb { background: rgba(155,138,255,0.2); border-radius: 2px; }

.nointro-preview-item {
  display: grid;
  grid-template-columns: 1fr 16px 1fr;
  align-items: center; gap: 6px;
  padding: 5px 16px;
  animation: niItemIn 0.2s var(--spring-snap) forwards;
  opacity: 0;
}
@keyframes niItemIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}
.ni-raw {
  font-size: 10px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: 'Courier New', monospace;
}
.ni-arrow { color: var(--violet); opacity: 0.45; display: flex; align-items: center; justify-content: center; }
.ni-arrow svg { width: 10px; height: 10px; }
.ni-clean {
  font-size: 11px; font-weight: 600; color: var(--cyan);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ni-dupe .ni-clean { color: var(--text-3); text-decoration: line-through; opacity: 0.5; }

.nointro-modal .modal-actions {
  padding: 14px 20px calc(14px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.ni-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}
.ni-text-btn {
  font-size: 11px; font-weight: 700;
  color: var(--violet);
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  transition: background 0.12s ease, opacity 0.1s ease;
}
.ni-text-btn:active { opacity: 0.55; background: rgba(155,138,255,0.1); }
.ni-selected-count {
  margin-left: auto;
  font-size: 11px; color: var(--text-3); font-family: var(--font-body);
}

.ni-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease;
}
.ni-row:active { background: rgba(155,138,255,0.07); }

.ni-cb {
  width: 18px; height: 18px;
  flex-shrink: 0; accent-color: var(--violet); cursor: pointer;
}
.ni-clean-text {
  flex: 1; font-size: 12px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ni-strikethrough { text-decoration: line-through; color: var(--text-3); }
.ni-raw-text {
  font-size: 9px; color: var(--text-3);
  font-family: 'Courier New', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 35%;
}

.ni-separator {
  padding: 9px 16px 6px;
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(255,107,138,0.7); font-family: var(--font-display);
  background: rgba(255,60,90,0.04);
  border-top: 1px solid rgba(255,60,90,0.12);
  border-bottom: 1px solid rgba(255,60,90,0.07);
}

.ni-row-filtered { opacity: 0.6; }
.ni-row-filtered .ni-cb { accent-color: var(--pink); }

.ni-badge-reason {
  font-size: 8px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(255,80,100,0.12);
  color: var(--pink);
  border: 1px solid rgba(255,80,100,0.2);
  flex-shrink: 0; font-family: var(--font-display);
}

.ni-more-hint {
  text-align: center; padding: 12px 16px;
  font-size: 11px; color: var(--text-3); font-style: italic;
}

/* ══ RECENT CONSOLES ══ */
.recent-section {
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.recent-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--cyan);
  font-family: var(--font-display);
  margin-bottom: 8px;
}
.recent-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.recent-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(34,211,238,0.07);
  border: 1px solid rgba(34,211,238,0.18);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s var(--spring-crisp), background 0.15s ease;
}
.recent-chip:active { transform: scale(0.94); background: rgba(34,211,238,0.15); }
.recent-chip.active {
  background: rgba(139,115,255,0.12);
  border-color: rgba(139,115,255,0.35);
}
.recent-chip-emoji { font-size: 13px; }
.recent-chip-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-chip-pct {
  font-size: 10px;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-display);
}
.recent-chip.active .recent-chip-pct { color: var(--violet); }

/* ══ SWIPE FEEDBACK PÅ SPELKORT ══ */
.game-card {
  touch-action: pan-y;
}
.game-card.swipe-check {
  box-shadow:
    inset 0 1px 0 rgba(34,211,130,0.15),
    0 0 0 1.5px rgba(34,211,130,0.4),
    0 4px 16px rgba(34,211,130,0.2);
}
.game-card.swipe-clear {
  box-shadow:
    inset 0 1px 0 rgba(255,80,100,0.15),
    0 0 0 1.5px rgba(255,80,100,0.4),
    0 4px 16px rgba(255,80,100,0.2);
}

/* ══ WELCOME PLATFORMS — nu klickbara knappar ══ */
.wp-item {
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.07);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  transition: transform 0.12s var(--spring-crisp), background 0.15s ease;
}
.wp-item:active { transform: scale(0.92); }
.wp-hint {
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  margin-top: 8px;
  font-style: italic;
}

/* ══ PROFILE MODAL ══ */
.profile-modal { max-width: 380px; }
.profile-fields { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.pf-row { display: flex; align-items: center; gap: 10px; }
.pf-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  font-family: var(--font-display); color: white;
  background: rgba(255,255,255,0.08);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.pf-tiktok    { background: linear-gradient(135deg, #ff0050, #00f2ea); }
.pf-instagram { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
.pf-youtube   { background: linear-gradient(135deg, #ff0000, #c4302b); }
.pf-facebook  { background: linear-gradient(135deg, #1877f2, #0c4a9e); }
.pf-x         { background: linear-gradient(135deg, #444, #111); }
.pf-snapchat  { background: linear-gradient(135deg, #fffc00, #29cc41); color: #222; }

.pf-row input {
  flex: 1; height: 42px;
  padding: 0 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.09);
  border-top-color: rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.05);
  color: var(--text-1); font-size: 13px; outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}
.pf-row input:focus {
  border-color: rgba(155,138,255,0.5);
  background: rgba(155,138,255,0.06);
  box-shadow: inset 0 1px 0 rgba(155,138,255,0.06), 0 0 0 2px rgba(155,138,255,0.1);
}
.pf-row input::placeholder { color: var(--text-3); }

/* ══ FAMILY GROUPING — Atari / Amiga som egna toppnivå-flikar ══ */
.family-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 2px;
}
.family-group:nth-of-type(2) {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.family-row {
  position: relative;
  padding-right: 36px;
  background: rgba(255,255,255,0.035);
}
.family-count {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.family-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px; height: 13px;
  color: var(--text-3);
  transition: transform 0.25s var(--spring-snap);
  pointer-events: none;
}
.family-row.family-open .family-chevron {
  transform: translateY(-50%) rotate(180deg);
  color: var(--cyan);
}

/* Distinkt accentkant per familj — Atari gul/orange, Amiga blå/cyan */
.family-row {
  border-left: 3px solid rgba(255, 165, 0, 0.4);
}
.family-row.family-open {
  background: rgba(255, 165, 0, 0.07);
}
.family-group:has(.family-row .console-item-name:first-child) {}

/* Amiga-specifik accentfärg — andra family-group i listan */
.family-group:nth-of-type(2) .family-row {
  border-left-color: rgba(34, 211, 238, 0.4);
}
.family-group:nth-of-type(2) .family-row.family-open {
  background: rgba(34, 211, 238, 0.07);
}
.family-group:nth-of-type(2) .family-chevron {
  color: var(--text-3);
}
.family-group:nth-of-type(2) .family-row.family-open .family-chevron {
  color: var(--cyan);
}

.family-children {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: familyExpand 0.25s var(--spring-crisp);
}
.family-children[hidden] {
  display: none !important;
  animation: none;
}
@keyframes familyExpand {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 1000px; }
}

.console-item.family-child {
  padding-left: 30px;
  background: rgba(255,255,255,0.015);
  border-left: 3px solid rgba(255, 165, 0, 0.15);
}
.family-group:nth-of-type(2) .console-item.family-child {
  border-left-color: rgba(34, 211, 238, 0.15);
}
.console-item.family-child .console-item-name {
  font-size: 13px;
  opacity: 0.92;
}

/* ══ KLICKBARA STAT-RUTOR I NO-INTRO MODAL ══ */
.nointro-stat-clickable {
  cursor: pointer;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, transform 0.1s var(--spring-crisp);
  position: relative;
}
.nointro-stat-clickable:active {
  background: rgba(255,255,255,0.05);
  transform: scale(0.96);
}
.nointro-stat-clickable::after {
  content: '↗';
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  color: var(--text-3);
  opacity: 0.5;
}

/* ══ NI DETAIL MODAL ══ */
.ni-detail-modal {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}
.ni-detail-modal .modal-actions {
  padding: 14px 0 calc(14px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,0.07);
  margin: 0 calc(-1 * var(--sp-6));
  padding-left: var(--sp-6);
  padding-right: var(--sp-6);
  flex-shrink: 0;
}
.ni-detail-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.ni-detail-row {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-2);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ni-detail-row:last-child { border-bottom: none; }
.ni-detail-row .ni-detail-reason {
  color: var(--pink);
  font-weight: 700;
  margin-left: 6px;
}

/* ══ NI TABS — Spel / Filtrerade & duplikat ══ */
.ni-tabs {
  display: flex; gap: 4px;
  padding: 10px 16px 0;
  flex-shrink: 0;
  background: rgba(0,0,0,0.1);
}
.ni-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 9px 8px;
  border-radius: 10px 10px 0 0;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom: none;
  color: var(--text-3);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s var(--spring-crisp);
}
.ni-tab.active {
  background: rgba(155,138,255,0.1);
  border-color: rgba(155,138,255,0.28);
  border-top-color: rgba(155,138,255,0.45);
  color: var(--text-1);
  box-shadow: inset 0 1px 0 rgba(155,138,255,0.12);
}
.ni-tab-count {
  font-size: 10px; font-weight: 800;
  padding: 1px 6px; border-radius: 8px;
  background: rgba(255,255,255,0.07); color: var(--text-3);
}
.ni-tab.active .ni-tab-count {
  background: rgba(155,138,255,0.22);
  color: var(--violet);
}

.ni-panel { display: flex; flex-direction: column; }
.ni-panel[hidden] { display: none !important; }

.ni-badge-reason.ni-badge-duplikat {
  background: rgba(255,80,100,0.12);
  color: var(--pink);
  border: 1px solid rgba(255,80,100,0.2);
}
.ni-badge-reason.ni-badge-filtrerad {
  background: rgba(255,165,0,0.1);
  color: #ffb84d;
  border: 1px solid rgba(255,165,0,0.2);
}

.ni-cb-filtered { accent-color: var(--pink); }

.ni-empty-hint {
  text-align: center; padding: 24px 16px;
  font-size: 12px; color: var(--text-3);
}

/* ══ CONSOLE DELETE — long-press popover-meny i sidebaren ══ */
.console-delete-menu {
  position: absolute; top: calc(100% + 4px); left: 12px; right: 12px; z-index: 50;
  background: rgba(20, 8, 14, 0.98);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,80,100,0.3);
  border-top-color: rgba(255,80,100,0.45);
  border-radius: 12px;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.5),
    0 16px 40px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,80,100,0.1),
    0 0 16px rgba(255,60,90,0.06);
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
  transition: opacity 0.16s var(--spring-crisp), transform 0.16s var(--spring-snap);
  overflow: hidden;
}
.console-delete-menu.visible {
  opacity: 1; transform: translateY(0) scale(1);
}
.console-delete-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  background: none; border: none;
  color: var(--pink); font-size: 13px; font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none;
  transition: background 0.1s ease;
}
.console-delete-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.console-delete-btn:active { background: rgba(255,80,100,0.12); }
