/* ═══════════════════════════════════════════════════════
   FNF Sprite Studio — Main Stylesheet
   Paleta inspirada en Friday Night Funkin'
   Mobile-first · Responsive · Accesible en touch
   ═══════════════════════════════════════════════════════ */

/* ── Variables — Tema oscuro (default) ── */
:root {
  --accent:       #a259ff;
  --accent-dark:  #7c3fd6;
  --accent-glow:  rgba(162, 89, 255, .25);
  --red:          #ff4f4f;
  --red-dark:     #cc3333;
  --green:        #4cca7d;
  --green-dark:   #3aaa64;
  --orange:       #f0a060;
  --bg:           #0a0a0f;
  --bg-1:         #111118;
  --bg-2:         #18181f;
  --bg-3:         #1f1f28;
  --bg-4:         #27272f;
  --border:       #2a2a38;
  --border-light: #33334a;
  --text:         #eeeef5;
  --text-muted:   #9090a8;
  --text-dim:     #55556a;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 4px 24px rgba(0,0,0,.5);
  --topbar-h:     52px;
}

/* ── Tema claro — aplicado con data-theme="light" ── */
[data-theme="light"] {
  --accent:       #7c3fd6;
  --accent-dark:  #5f27b0;
  --accent-glow:  rgba(124, 63, 214, .18);
  --red:          #d93636;
  --red-dark:     #b02a2a;
  --green:        #2a9c5e;
  --green-dark:   #1e7a49;
  --orange:       #c47020;
  --bg:           #f4f4f8;
  --bg-1:         #ffffff;
  --bg-2:         #ededf2;
  --bg-3:         #e2e2ea;
  --bg-4:         #d4d4e0;
  --border:       #c4c4d4;
  --border-light: #b0b0c8;
  --text:         #13131e;
  --text-muted:   #4a4a6a;
  --text-dim:     #8888aa;
  --shadow:       0 4px 24px rgba(0,0,0,.12);
}

/* ── Auto sistema: si no hay data-theme forzado, sigue la preferencia del SO ── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --accent:       #7c3fd6;
    --accent-dark:  #5f27b0;
    --accent-glow:  rgba(124, 63, 214, .18);
    --red:          #d93636;
    --red-dark:     #b02a2a;
    --green:        #2a9c5e;
    --green-dark:   #1e7a49;
    --orange:       #c47020;
    --bg:           #f4f4f8;
    --bg-1:         #ffffff;
    --bg-2:         #ededf2;
    --bg-3:         #e2e2ea;
    --bg-4:         #d4d4e0;
    --border:       #c4c4d4;
    --border-light: #b0b0c8;
    --text:         #13131e;
    --text-muted:   #4a4a6a;
    --text-dim:     #8888aa;
    --shadow:       0 4px 24px rgba(0,0,0,.12);
  }
}

/* ── Custom Fonts ── */
@font-face {
  font-family: 'Phantomuff';
  src: url('/Assets/font/Phantomuff Difficult Font.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--topbar-h) + 16px) 12px 40px;
  gap: 14px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

@media (min-width: 640px) {
  body { padding-top: calc(var(--topbar-h) + 24px); gap: 18px; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 8px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-brand .brand-fnf { color: var(--accent); }
.topbar-brand .brand-sep { color: var(--accent); opacity: .5; font-weight: 400; margin: 0 1px; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, color .2s, background .15s;
  touch-action: manipulation;
  min-height: 44px;
  white-space: nowrap;
}

/* Compact topbar on small screens */
@media (max-width: 480px) {
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar-brand { font-size: .88rem; }
  .topbar-btn { padding: 6px 10px; font-size: .75rem; }
}

.topbar-btn:hover { border-color: var(--accent); color: var(--text); background: var(--bg-4); }
.topbar-btn .tier-dot { flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   APP HEADER
   ═══════════════════════════════════════════════════════ */
.app-header-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  width: 100%;
  max-width: 900px;
}

h1 {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1.1;
  font-family: 'Phantomuff', 'Segoe UI', system-ui, sans-serif;
}

h1 .hl { color: var(--accent); }
h1 .hl-red { color: var(--red); }

.sub {
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}

.help-text {
  font-size: .79rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 580px;
  margin: 2px auto 0;
  line-height: 1.6;
}

.lbl2 { font-size: .76rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  touch-action: manipulation;
  min-height: 42px;
  white-space: nowrap;
  letter-spacing: .01em;
}

.btn:active  { transform: scale(.95); }
.btn:disabled { opacity: .3; cursor: not-allowed; pointer-events: none; }

.btn-p {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-p:hover:not(:disabled) {
  background: var(--accent-dark);
  box-shadow: 0 0 14px var(--accent-glow);
}

.btn-s { background: var(--bg-4); color: var(--text-muted); border: 1px solid var(--border); }
.btn-s:hover:not(:disabled) { background: #313142; color: var(--text); border-color: var(--border-light); }

.btn-g { background: var(--green); color: #fff; }
.btn-g:hover:not(:disabled) { background: var(--green-dark); }

.btn-r { background: var(--red); color: #fff; }
.btn-r:hover:not(:disabled) { background: var(--red-dark); }

/* ═══════════════════════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════════════════════ */
select,
input[type="number"],
input[type="text"] {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-size: .83rem;
  outline: none;
  min-height: 40px;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Prevent iOS zoom-in on focus */
@media (max-width: 600px) {
  select,
  input[type="number"],
  input[type="text"] { font-size: 16px; }
}

/* ── Row layout ── */
.row {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════
   FOLDER DROP ZONE (principal)
   ═══════════════════════════════════════════════════════ */
.folder-drop {
  width: 100%;
  max-width: 900px;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
  position: relative;
  background: var(--bg-2);
  touch-action: manipulation;
}

.folder-drop:active,
.folder-drop.over {
  border-color: var(--accent);
  background: #1a1428;
  transform: scale(.998);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.folder-drop.ok   { border-color: var(--green); background: #0d1a12; }
.folder-drop.warn { border-color: var(--orange); background: #1a1308; }

.folder-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.folder-ico { font-size: 2.4rem; margin-bottom: 10px; }

.folder-lbl {
  font-size: .86rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.folder-lbl b { color: var(--text); }
.folder-lbl span { font-size: .76rem; color: var(--text-dim); }

.folder-status {
  margin-top: 10px;
  font-size: .73rem;
  color: var(--text-dim);
  font-family: monospace;
  line-height: 1.9;
}

.folder-status .hit  { color: var(--green); }
.folder-status .miss { color: var(--red); }
.folder-status .warn { color: var(--orange); }

/* ═══════════════════════════════════════════════════════
   MODO CLÁSICO — DROP GRID
   ═══════════════════════════════════════════════════════ */
.classic-section { width: 100%; max-width: 900px; }

.classic-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.classic-section-title {
  font-size: .82rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.drop-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

@media (max-width: 500px) {
  .drop-area { grid-template-columns: 1fr 1fr; }
}

.dz {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .1s;
  position: relative;
  background: var(--bg-2);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dz:hover, .dz.over { border-color: var(--accent); background: #1a1428; }
.dz:active          { transform: scale(.97); }
.dz.ok              { border-color: var(--green); background: #0d1a12; }

.dz input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dz .ico { font-size: 1.6rem; }
.dz .lbl { font-size: .73rem; color: var(--text-muted); line-height: 1.4; }
.dz .lbl b { color: var(--text); }
.dz .fn  { font-size: .68rem; color: var(--green); word-break: break-all; }

/* ═══════════════════════════════════════════════════════
   CHARACTER FILE DROP
   ═══════════════════════════════════════════════════════ */
.char-drop-row {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dz-char-inline {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 10px 14px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  border-style: dashed;
  border-color: var(--border);
}

.dz-char-inline .ico { flex-shrink: 0; font-size: 1.2rem; }
.dz-char-inline .lbl { text-align: left; flex: 1; min-width: 0; }
.dz-char-inline .fn  { text-align: left; margin-top: 0; min-width: 0; }

.lbl-opt { color: var(--text-dim); font-weight: 400; }
@media (max-width: 480px) { .lbl-opt { display: none; } }

.char-badge {
  background: #1a1a2e;
  border: 1px solid #4a4a7a;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: .72rem;
  color: #9090cc;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

#char-badge    { display: none; }
#btn-char-clear { display: none; }
.btn-char-clear { font-size: .78rem; min-height: 40px; }

/* ═══════════════════════════════════════════════════════
   STATUS + PROGRESS
   ═══════════════════════════════════════════════════════ */
.status {
  width: 100%;
  max-width: 900px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .79rem;
  color: var(--text-muted);
  min-height: 38px;
  display: flex;
  align-items: center;
  transition: border-color .3s, color .3s;
}

.status.ok   { color: var(--green);  border-color: #1a3024; }
.status.err  { color: var(--red);    border-color: #2a1010; }
.status.info { color: var(--accent); border-color: #1e1a3a; }

.pw {
  width: 100%;
  max-width: 900px;
  background: var(--bg-3);
  border-radius: 99px;
  height: 4px;
  overflow: hidden;
  display: none;
}
.pw.vis { display: block; }

.pb {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .12s;
  border-radius: 99px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════
   TABS + PANELS
   ═══════════════════════════════════════════════════════ */
.tabs {
  width: 100%;
  max-width: 900px;
  display: flex;
  gap: 4px;
}

.tab {
  padding: 10px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  font-size: .83rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-2);
  color: var(--text-dim);
  touch-action: manipulation;
  flex: 1;
  text-align: center;
  min-height: 44px;
  transition: color .2s, background .2s, border-color .2s;
  letter-spacing: .01em;
}

.tab:hover { color: var(--text-muted); background: var(--bg-3); }

.tab.active {
  background: var(--bg-1);
  color: var(--text);
  border-color: var(--border);
  border-bottom-color: var(--bg-1);
  position: relative;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.panel {
  width: 100%;
  max-width: 900px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 14px;
  display: none;
}

.panel.active { display: block; }

body.sprites-hidden .tab[data-tab='sprites'] { display: none; }
body.sprites-hidden #panel-sprites           { display: none !important; }

/* ── Extra mobile tweaks ── */
@media (max-width: 380px) {
  .folder-drop { padding: 20px 14px; }
  .folder-ico  { font-size: 1.8rem; }
}

/* Row (load + scale) — stack nicely on tiny screens */
@media (max-width: 380px) {
  .row { flex-direction: column; align-items: stretch; }
  .row .btn-p { width: 100%; justify-content: center; }
}

/* Classic drop area: single column on very small screens */
@media (max-width: 340px) {
  .drop-area { grid-template-columns: 1fr; }
}

/* Settings box: full-screen on small phones */
@media (max-width: 380px) {
  .settings-box { border-radius: 0; max-height: 100vh; }
  .overlay { padding: 0; }
}

/* ═══════════════════════════════════════════════════════
   SPRITES PANEL
   ═══════════════════════════════════════════════════════ */
.sprites-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#search {
  flex: 1;
  min-width: 120px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 7px;
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 5px; }
}

.sc {
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  touch-action: manipulation;
}

.sc:hover  { border-color: var(--border-light); }
.sc:active { transform: scale(.96); }
.sc.sel    { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }

.sc canvas {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: repeating-conic-gradient(var(--bg-3) 0% 25%, var(--bg-2) 0% 50%) 0 0 / 12px 12px;
  display: block;
}

.sc .cn {
  font-size: .6rem;
  color: var(--text-muted);
  padding: 3px 5px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sc .cs { font-size: .57rem; color: var(--text-dim); padding: 0 5px 4px; text-align: center; }

/* ═══════════════════════════════════════════════════════
   ANIMATION PANEL — LAYOUT RESPONSIVO
   Mobile: sidebar encima (scroll horizontal) + preview abajo
   Desktop: sidebar izquierda fija + main a la derecha
   ═══════════════════════════════════════════════════════ */
.anim-panel-inner {
  display: flex;
  gap: 14px;
  flex-direction: column;
}

@media (min-width: 640px) {
  .anim-panel-inner { flex-direction: row; align-items: flex-start; }
}

/* ── Sidebar ── */
.anim-sidebar {
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
}

@media (min-width: 640px) {
  .anim-sidebar {
    width: 200px;
    position: sticky;
    top: calc(var(--topbar-h) + 8px);
    max-height: calc(100vh - var(--topbar-h) - 30px);
    overflow-y: auto;
  }
}

@media (min-width: 800px) {
  .anim-sidebar { width: 220px; }
}

/* ── Sidebar toolbar rows ── */
.anim-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.anim-bar-sel {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  margin-bottom: 8px;
}

#anim-cnt     { flex: 1; font-size: .72rem; color: var(--text-muted); }
#anim-sel-cnt { flex: 1; font-size: .72rem; color: var(--text-muted); }
.btn-anim-sm  { font-size: .74rem; padding: 6px 10px; min-height: 44px; }

/* ── Anim visibility ── */
#anim-bar-sel { display: none; }
.anim-sel-mode #anim-bar-sel    { display: flex !important; }
.anim-sel-mode #anim-bar-normal { display: none !important; }

/* ── Anim list: horizontal scroll on mobile, vertical on desktop ── */
.anim-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: thin;
  /* Snap to cards on mobile for easier browsing */
  scroll-snap-type: x mandatory;
}

.anim-list .ai { scroll-snap-align: start; }

@media (min-width: 640px) {
  .anim-list {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - var(--topbar-h) - 160px);
    padding-bottom: 0;
    scroll-snap-type: none;
  }
  .anim-list .ai { scroll-snap-align: none; }
}

/* ── Animation item cards ── */
.ai {
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  touch-action: manipulation;
  transition: background .15s, border-color .15s;
  /* Mobile: card horizontal pill */
  flex-shrink: 0;
  min-width: 130px;
  max-width: 200px;
  min-height: 44px;
}

@media (min-width: 640px) {
  .ai { flex-shrink: 1; min-width: 0; max-width: none; min-height: 46px; }
}

.ai:hover              { background: var(--bg-4); }
.ai:active             { background: var(--bg-4); transform: scale(.97); }
.ai.sel                { border-color: var(--green); background: #0d1a12; }
.ai.preview-active     { border-color: var(--accent); background: #1a1428; }
.ai.sel.preview-active { border-color: var(--green); background: #0d1a12; }

.ai-check {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  transition: background .15s, border-color .15s;
}

.anim-sel-mode .ai-check { display: flex; }
.ai.sel .ai-check { background: var(--green); border-color: var(--green); color: #fff; }

.ai-name  { font-size: .8rem; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-info  { font-size: .66rem; color: var(--text-dim); white-space: nowrap; }

.ai-part         { opacity: .55; border-style: dashed; }
.ai-part .ai-name { color: var(--text-muted); font-weight: 500; }

.ai-combined           { border-color: var(--accent) !important; background: #1a1428; }
.ai-combined .ai-name  { color: #c4b0ff; }

.ai-timeline-full                  { border: 2px solid var(--accent) !important; background: #1a1428; cursor: pointer; }
.ai-timeline-full:hover            { background: #221940; }
.ai-timeline-full.preview-active   { background: #2a2050; box-shadow: 0 0 0 2px var(--accent-glow); }

/* ═══════════════════════════════════════════════════════
   ANIMATION MAIN — PREVIEW + EXPORT SECTIONS
   ═══════════════════════════════════════════════════════ */
.anim-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

/* ── Preview canvas ── */
.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

#pcanvas {
  border-radius: var(--radius-sm);
  background: repeating-conic-gradient(var(--bg-3) 0% 25%, var(--bg-2) 0% 50%) 0 0 / 16px 16px;
  max-width: 100%;
  touch-action: none;
  display: block;
  margin: 0 auto;
}

/* On mobile, cap canvas height so it doesn't dominate the screen */
@media (max-width: 639px) {
  #pcanvas { max-height: 56vw; width: auto; max-width: 100%; }
}

.preview-controls {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.char-offset-info {
  font-size: .68rem;
  color: #8888cc;
  background: var(--bg-1);
  border: 1px solid #2a2a44;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  width: 100%;
  text-align: center;
  display: none;
}

.char-offset-info.vis { display: block; }

/* ── Export sections ── */
.anim-section {
  width: 100%;
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.anim-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.anim-section-icon  { font-size: .9rem; }

.anim-section-title {
  font-size: .8rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.anim-section-title.orange { color: var(--orange); }

.anim-section-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.anim-section-row:last-of-type { margin-bottom: 0; }

.anim-section-hint {
  font-size: .69rem;
  color: var(--text-dim);
  display: block;
  margin-top: 6px;
  line-height: 1.5;
}

/* BTA hidden by default — shown by JS */
#bta-blur-row { display: none; }

/* Specific inputs */
#gif-fps         { width: 70px; }
#gif-scale,
#gif-fmt,
#spritesheet-fmt { font-size: .82rem; }

@media (max-width: 639px) {
  /* En móvil los selects del panel de export son más fáciles de tocar con más altura */
  #gif-scale,
  #gif-fmt,
  #spritesheet-fmt { min-height: 44px; font-size: 16px; }
  #gif-fps { min-height: 44px; font-size: 16px; width: 80px; }
}

#bta-blur-slider { flex: 1; min-width: 90px; accent-color: var(--orange); }
#bta-blur-display { font-size: .83rem; color: var(--orange); min-width: 28px; text-align: right; }

.lbl-format-sep { margin-left: 2px; }

/* ── GIF log ── */
.gif-log {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: .7rem;
  color: var(--text-dim);
  font-family: monospace;
  max-height: 110px;
  overflow-y: auto;
  white-space: pre-wrap;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════
   PREVIEW BACKGROUND BUTTONS
   ═══════════════════════════════════════════════════════ */
.preview-bg-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: border-color .15s, transform .1s;
  touch-action: manipulation;
}

.preview-bg-btn:active { transform: scale(.88); }
.preview-bg-btn.active { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent-glow); }

#preview-bg-custom {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
}

/* ═══════════════════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════════════════ */
.s-toggle { position: relative; width: 42px; height: 22px; flex-shrink: 0; }
.s-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.s-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}

.s-toggle input:checked + .s-toggle-track { background: var(--accent); border-color: var(--accent); }

.s-toggle-track::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.s-toggle input:checked + .s-toggle-track::after { transform: translateX(20px); }

/* ── Tier dots ── */
.tier-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tier-dot.high { background: var(--green); }
.tier-dot.mid  { background: #f0c060; }
.tier-dot.low  { background: var(--red); }

/* ═══════════════════════════════════════════════════════
   OVERLAYS (Settings, Error)
   ═══════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(env(safe-area-inset-top), 16px) 12px 16px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay.open { display: flex; }
.overlay.show { display: flex; } /* Alias for consistency */

.box-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: -.01em;
}

.box-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  min-height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, background .2s;
}

.box-close:hover { color: var(--text); background: var(--bg-4); }

/* ── Settings box ── */
.settings-box {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 500px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

@media (max-width: 480px) {
  .settings-box { padding: 16px; border-radius: var(--radius); }
}

/* ── Settings sections ── */
.s-section { display: flex; flex-direction: column; gap: 10px; }

.s-section-title {
  font-size: .68rem;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.s-section-title-experimental {
  font-size: .68rem;
  color: var(--orange);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.s-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.s-row-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.s-row-info label { font-size: .82rem; color: var(--text); font-weight: 600; }
.s-row-info small { font-size: .69rem; color: var(--text-dim); margin-top: 2px; line-height: 1.4; }

.s-row select,
.s-row input[type="number"] { min-width: 90px; max-width: 150px; }
.s-input-sm { width: 80px; }

#s-bta-blur     { flex: 1; min-width: 90px; max-width: 120px; accent-color: var(--accent); }
#s-bta-blur-val { font-size: .74rem; color: var(--text-muted); min-width: 28px; text-align: right; }

#btn-settings-apply { width: 100%; }

.s-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: .71rem;
  font-weight: 800;
  white-space: nowrap;
}

.s-badge.high { background: #0d1a12; color: var(--green); border: 1px solid var(--green); }
.s-badge.mid  { background: #1a180a; color: #f0c060; border: 1px solid #f0c060; }
.s-badge.low  { background: #1a0a0a; color: var(--red); border: 1px solid var(--red); }

.s-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.s-info-item { background: var(--bg); border-radius: var(--radius-sm); padding: 8px 10px; border: 1px solid var(--border); }
.s-info-item .s-info-label { font-size: .67rem; color: var(--text-dim); }
.s-info-item .s-info-val   { font-size: .8rem; color: var(--text); font-weight: 700; margin-top: 3px; }

/* ═══════════════════════════════════════════════════════
   ERROR MODAL
   ═══════════════════════════════════════════════════════ */
.error-box {
  background: var(--bg-1);
  border: 2px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  max-width: 540px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 0 32px rgba(255, 79, 79, .2);
}

@media (max-width: 480px) { .error-box { padding: 16px; border-radius: var(--radius); } }

.error-title {
  font-size: .95rem;
  font-weight: 800;
  color: var(--red);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.6; }

.error-pre {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: .7rem;
  color: #f08080;
  font-family: monospace;
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #2a1010;
  -webkit-overflow-scrolling: touch;
}

.error-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-copy {
  background: var(--bg-4);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: .82rem;
  cursor: pointer;
  touch-action: manipulation;
  font-weight: 700;
  min-height: 42px;
  transition: background .15s, color .15s;
}

.btn-copy:hover    { background: #313142; color: var(--text); }
.btn-copy.copied   { background: #0d1a12; color: var(--green); border-color: var(--green); }

/* ═══════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, .96);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.loading-overlay.show { display: flex; }

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  box-shadow: 0 0 16px var(--accent-glow);
}

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

.loading-text {
  font-size: .9rem;
  color: var(--text);
  text-align: center;
  max-width: 320px;
  line-height: 1.6;
  font-weight: 700;
}

.loading-steps {
  font-size: .74rem;
  color: var(--text-dim);
  text-align: center;
  font-family: monospace;
  line-height: 2;
  max-width: 400px;
}

.loading-steps .step           { opacity: .4; transition: all .3s; }
.loading-steps .step.active    { color: var(--accent); opacity: 1; font-weight: 700; }
.loading-steps .step.done      { color: var(--green); opacity: .8; }
.loading-steps .step.done::before { content: '✓ '; color: var(--green); }

.loading-progress {
  width: 260px;
  height: 3px;
  background: var(--bg-3);
  border-radius: 99px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .3s ease-out;
  border-radius: 99px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════ */
footer {
  width: 100%;
  max-width: 900px;
  text-align: center;
  font-size: .7rem;
  color: var(--text-dim);
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   LUCIDE ICONS
   ═══════════════════════════════════════════════════════ */
i[data-lucide] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
}

/* Default size — inherited by buttons */
i[data-lucide] svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* Larger icons in drop zone cards */
.dz .ico i[data-lucide] svg,
.folder-ico i[data-lucide] svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

/* Tabs — slightly bigger */
.tab i[data-lucide] svg { width: 15px; height: 15px; }

/* Section header icons in export panels */
.anim-section-icon i[data-lucide] svg { width: 14px; height: 14px; }

/* Box close button — centered */
.box-close i[data-lucide] svg { width: 18px; height: 18px; stroke-width: 2.5; }

/* Settings section title icon */
.s-section-title i[data-lucide] svg,
.s-section-title-experimental i[data-lucide] svg { width: 13px; height: 13px; }

/* ═══════════════════════════════════════════════════════
   ANIM PANEL REDISEÑO — sidebar bars + export sections
   ═══════════════════════════════════════════════════════ */

/* ── Sidebar bars layout ── */
.anim-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.anim-sel-actions {
  display: flex;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.anim-sel-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Export main button (siempre visible, ancho completo) ── */
.anim-export-main {
  width: 100%;
  justify-content: center;
  margin: 6px 0 4px;
  font-size: .84rem;
  gap: 8px;
}

/* ── Export sel-actions (oculto por defecto, visible en modo selección) ── */
.anim-export-sel-actions {
  display: none;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.anim-export-sel-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: .82rem;
}

/* Mostrar sel-actions cuando estamos en modo selección */
.anim-sel-mode .anim-export-sel-actions {
  display: flex;
}

/* Hint con más separación cuando hay sel-actions visible */
.anim-sel-mode .anim-section-hint {
  margin-top: 8px;
}

/* ── anim-bar-sel: layout de dos filas en pantallas pequeñas ── */
.anim-bar-sel {
  flex-wrap: wrap;
  gap: 5px;
}

/* En modo selección la barra normal se oculta y viceversa — ya manejado por JS,
   pero reforzamos visualmente la transición */
#anim-bar-sel  { display: none; }
.anim-sel-mode #anim-bar-sel    { display: flex !important; }
.anim-sel-mode #anim-bar-normal { display: none  !important; }

/* ── Indicador visual de cuántas anims seleccionadas ── */
#anim-sel-cnt {
  font-size: .72rem;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

/* Cuando no hay nada seleccionado, color neutro */
#anim-sel-cnt:empty,
#anim-sel-cnt[data-empty] {
  color: var(--text-dim);
  font-weight: 400;
}

@media (max-width: 639px) {
  .anim-export-main { font-size: .82rem; padding: 10px 14px; }
  .anim-export-sel-actions .btn { font-size: .8rem; }
}

/* ── Botón swap normal ↔ selección ── */
.anim-dl-row {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  align-items: center;
  margin: 6px 0 4px;
}

.anim-dl-row .btn {
  flex: 1;
  justify-content: center;
  font-size: .82rem;
  white-space: nowrap;
  min-width: 0;
}

/* En modo normal: "esta" visible, "sel" oculto */
.anim-btn-sel-only { display: none !important; }
.anim-btn-single   { display: inline-flex; }

/* En modo selección: swap */
.anim-sel-mode .anim-btn-sel-only { display: inline-flex !important; }
.anim-sel-mode .anim-btn-single   { display: none !important; }

/* ── ZIP drop zone (iOS) ── */
.dz-zip-zone {
  border-color: var(--border-light);
  padding: 22px 20px;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.dz-zip-zone .folder-ico {
  margin-bottom: 4px;
}

.dz-zip-zone .folder-ico i[data-lucide] svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
  stroke-width: 1.5;
}

.dz-zip-zone .folder-lbl {
  font-size: .84rem;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.dz-zip-zone .folder-lbl b {
  color: var(--text);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.dz-zip-zone .folder-lbl span {
  font-size: .74rem;
  color: var(--text-dim);
}

#fn-zip {
  font-size: .72rem;
  color: var(--green);
  font-family: monospace;
  text-align: center;
  word-break: break-all;
  max-width: 100%;
}


/* ═══════════════════════════════════════════════════════
   CHANGELOG MODAL
   ═══════════════════════════════════════════════════════ */

.changelog-box {
  background: var(--bg-2);
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease-out;
}

.changelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.changelog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.changelog-title i[data-lucide] {
  color: var(--accent);
}

.changelog-version-badge {
  position: absolute;
  top: 1.3rem;
  right: 3.5rem;
  background: var(--accent);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.changelog-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  color: var(--text);
  line-height: 1.6;
}

.changelog-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-dim);
}

.changelog-loading .loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Markdown styling ── */
.changelog-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.changelog-content h2:first-child {
  margin-top: 0;
}

.changelog-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.8rem;
}

.changelog-content ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

.changelog-content li {
  padding: 0.4rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.changelog-content li::before {
  content: "•";
  position: absolute;
  left: 0.5rem;
  color: var(--accent);
  font-weight: bold;
}

.changelog-content strong {
  color: var(--text);
  font-weight: 600;
}

.changelog-content code {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
  color: var(--accent);
}

.changelog-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.changelog-content p {
  margin: 0.5rem 0;
}

/* ── Emoji icons en headers ── */
.changelog-content h3:has-emoji {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .changelog-box {
    width: 95%;
    max-height: 90vh;
  }
  
  .changelog-header {
    padding: 1rem;
  }
  
  .changelog-title {
    font-size: 1.1rem;
  }
  
  .changelog-version-badge {
    top: 1.1rem;
    right: 3rem;
    font-size: 0.7rem;
    padding: 3px 8px;
  }
  
  .changelog-content {
    padding: 1rem;
  }
  
  .changelog-content h2 {
    font-size: 1.2rem;
  }
  
  .changelog-content h3 {
    font-size: 1rem;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ═══════════════════════════════════════════════════════
   SIDEBAR DRAWER (MOBILE/TABLET HAMBURGER MENU)
   ═══════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ── */
.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.topbar-hamburger:hover {
  background: var(--bg-3);
  color: var(--accent);
}

.topbar-hamburger i[data-lucide] svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* ── Show hamburger on mobile/tablet, hide regular buttons ── */
@media (max-width: 768px) {
  .topbar-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .topbar-actions {
    display: none;
  }
}

/* ── Sidebar overlay (background oscuro) ── */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sidebar drawer ── */
.sidebar-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-2);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-drawer.show {
  transform: translateX(0);
}

/* ── Sidebar header ── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-brand .brand-fnf {
  color: var(--accent);
}

.sidebar-brand .brand-sep {
  color: var(--text-dim);
  margin: 0 4px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  background: var(--bg-3);
  color: var(--text);
}

.sidebar-close i[data-lucide] svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* ── Sidebar content ── */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 0 1.2rem 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 0.95rem;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-3);
  color: var(--accent);
}

.sidebar-item:active {
  background: var(--bg-4);
}

.sidebar-item i[data-lucide] {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.2s;
}

.sidebar-item:hover i[data-lucide] {
  color: var(--accent);
}

.sidebar-item i[data-lucide] svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.sidebar-item span:first-of-type {
  flex: 1;
}

.sidebar-badge {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ── Sidebar footer ── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.2rem;
  flex-shrink: 0;
}

.sidebar-footer-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

/* ── Desktop: hide sidebar completely ── */
@media (min-width: 769px) {
  .sidebar-overlay,
  .sidebar-drawer {
    display: none !important;
  }
}

/* ── Mobile landscape: narrower drawer ── */
@media (max-width: 768px) and (max-height: 500px) {
  .sidebar-drawer {
    width: 240px;
  }
  
  .sidebar-item {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }
}

/* ── Prevent body scroll when sidebar is open ── */
body.sidebar-open {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   VERSION NOTES DISPLAY (version.json)
   ═══════════════════════════════════════════════════════ */
.version-notes {
  padding: 0;
}

.version-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.version-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.5rem;
  letter-spacing: -.02em;
}

.version-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.version-meta .badge {
  background: var(--bg-3);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.version-meta .release-date {
  font-size: .8rem;
  color: var(--text-dim);
  font-family: monospace;
}

/* ── Highlights section ── */
.highlights-section {
  margin-bottom: 1.5rem;
}

.highlights-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.8rem;
  letter-spacing: .02em;
}

.highlights-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.highlights-list li {
  background: var(--bg-3);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  font-size: .88rem;
  color: var(--text);
  line-height: 1.5;
  transition: background .15s, border-color .15s;
}

.highlights-list li:hover {
  background: var(--bg-4);
  border-left-color: var(--accent-dark);
}

/* ── Changes section ── */
.changes-section {
  margin-bottom: 1.5rem;
}

.changes-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.8rem;
  letter-spacing: .02em;
}

.change-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
  transition: border-color .2s;
}

.change-item:last-child {
  margin-bottom: 0;
}

.change-item:hover {
  border-color: var(--border-light);
}

.change-item h4 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.change-item p {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ── Full changelog button container ── */
.full-changelog-btn-container {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-full-changelog {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.btn-full-changelog:hover {
  background: var(--bg-4);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.btn-full-changelog:active {
  transform: scale(.96);
}

/* ── Mobile responsive ── */
@media (max-width: 639px) {
  .version-header h2 {
    font-size: 1.3rem;
  }
  
  .highlights-list li {
    font-size: .84rem;
    padding: 0.6rem 0.8rem;
  }
  
  .change-item {
    padding: 0.8rem;
  }
  
  .change-item h4 {
    font-size: .9rem;
  }
  
  .change-item p {
    font-size: .82rem;
  }
}
