* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0a0f; --surface: #14141f; --border: #2a2a3f; --text: #e0e0f0;
  --muted: #8888aa; --accent: #7b5cff; --accent2: #ff5caa; --glow: rgba(123,92,255,.35);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(1200px 800px at 70% -10%, #1a1330, var(--bg));
  color: var(--text); overflow: hidden; user-select: none;
}

/* update bar */
.update-bar {
  display: flex; align-items: center; gap: .6rem; padding: .4rem 1rem;
  background: linear-gradient(135deg, rgba(123,92,255,.25), rgba(255,92,170,.25));
  border-bottom: 1px solid var(--accent); font-size: .82rem; position: relative; z-index: 6;
}
.update-bar button {
  padding: .25rem .8rem; border-radius: .4rem; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; font-size: .78rem;
}
.update-bar .dismiss { margin-left: auto; background: none; border: 0; color: var(--muted); padding: .25rem .5rem; }

/* version list in Settings */
.vlist { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .3rem; }
.vrow { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .7rem; border: 1px solid var(--border); border-radius: .5rem; font-size: .85rem; }
.vbtn { padding: .3rem .7rem; border-radius: .4rem; border: 1px solid var(--accent);
  background: none; color: var(--accent); cursor: pointer; font-size: .78rem; }
.vbtn:hover { background: rgba(123,92,255,.15); }
.vtag { color: var(--muted); font-size: .78rem; }

/* menu bar */
.menubar {
  height: 40px; display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
  background: rgba(20,20,31,.75); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); position: relative; z-index: 5;
}
.menubar .brand { font-weight: 800; background: linear-gradient(135deg,var(--accent),var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-btn { display: flex; align-items: center; gap: .3rem; background: none; border: 0;
  padding: .3rem .55rem; border-radius: .4rem; cursor: pointer; font-size: 1rem; }
.brand-btn:hover { background: rgba(255,255,255,.07); }
.brand-btn .caret { color: var(--muted); font-size: .7rem; }
.pill { font-variant-numeric: tabular-nums; color: var(--muted) !important; }
.menubar .crumbs { color: var(--muted); font-size: .85rem; }
.menubar .crumbs a { color: var(--accent); cursor: pointer; }
.menubar .spacer { flex: 1; }
.menubar button {
  padding: .3rem .8rem; border-radius: .4rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: .8rem;
}
.menubar button:hover { border-color: var(--accent); box-shadow: 0 0 16px var(--glow); }

/* desktop surface */
#desktop {
  position: absolute; inset: 40px 0 0 0; overflow: hidden;
}
#desktop.dragover::after {
  content: 'Drop files to add them to your desktop';
  position: absolute; inset: 1.5rem; border: 2px dashed var(--accent); border-radius: 1rem;
  display: flex; align-items: center; justify-content: center; color: var(--accent);
  font-size: 1.1rem; background: rgba(123,92,255,.06); pointer-events: none;
}

/* icons */
.icon {
  position: absolute; width: 96px; display: flex; flex-direction: column; align-items: center;
  gap: .35rem; padding: .4rem; border-radius: .6rem; cursor: pointer; text-align: center;
  touch-action: none; /* touch drags move the icon, not the page */
}
.icon:hover { background: rgba(255,255,255,.05); }
.icon.selected { background: rgba(123,92,255,.18); outline: 1px solid var(--accent); }
.icon .thumb {
  width: var(--isize, 64px); height: var(--isize, 64px); display: flex; align-items: center; justify-content: center;
  border-radius: .5rem; overflow: hidden; background: rgba(255,255,255,.04);
  border: 1px solid var(--border); font-size: calc(var(--isize, 64px) * .5);
}
.icon .thumb img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.icon.folder .thumb { background: rgba(123,92,255,.12); border-style: dashed; }
.icon .label {
  font-size: .78rem; max-width: 92px; word-break: break-word; line-height: 1.15;
  max-height: 2.4em; overflow: hidden;
}
.icon .label input {
  font: inherit; width: 88px; text-align: center; border: 1px solid var(--accent);
  border-radius: .3rem; background: var(--surface); color: var(--text);
}
.icon.drop-target .thumb { outline: 2px solid var(--accent2); }

/* context menu */
.ctx {
  position: absolute; z-index: 20; background: var(--surface); border: 1px solid var(--border);
  border-radius: .5rem; padding: .3rem; min-width: 150px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.ctx button {
  display: block; width: 100%; text-align: left; padding: .45rem .7rem; border: 0; border-radius: .35rem;
  background: none; color: var(--text); cursor: pointer; font-size: .85rem;
}
.ctx button:hover { background: rgba(123,92,255,.2); }
.ctx .sep { height: 1px; background: var(--border); margin: .3rem .2rem; }
.ctx button.danger { color: #ff7b7b; }

/* modal */
.modal-bg {
  position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: .8rem;
  padding: 1.6rem; max-width: 420px; text-align: center;
}
.modal h3 { margin-bottom: .6rem; }
.modal p { color: var(--muted); font-size: .9rem; margin-bottom: 1.2rem; line-height: 1.45; }
.modal p a { color: var(--accent); }
.modal button {
  padding: .5rem 1.4rem; border-radius: .5rem; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
}
.modal.wide { max-width: 560px; width: 92vw; max-height: 86vh; overflow-y: auto; text-align: left; }
.modal.wide h3 { text-align: center; }
.modal.wide h4 { margin: .2rem 0 .5rem; font-size: .95rem; }
.add-actions { display: flex; gap: .5rem; margin-bottom: .4rem; }
.add-actions button { flex: 1; padding: .6rem; border-radius: .5rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; }
.add-actions button:hover { border-color: var(--accent); }
.add-sep { height: 1px; background: var(--border); margin: 1rem 0; }
.add-help { color: var(--muted); font-size: .82rem; line-height: 1.4; margin-bottom: .6rem; }
.modal.wide textarea, .modal.wide input {
  width: 100%; box-sizing: border-box; padding: .55rem .7rem; border-radius: .5rem;
  border: 1px solid var(--border); background: #0a0a0f; color: var(--text); font: inherit; margin-bottom: .5rem;
}
.modal.wide textarea { resize: vertical; }
.modal.wide textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; color: var(--muted); }
.modal.wide .widebtn { width: 100%; padding: .55rem; border-radius: .5rem; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; margin-bottom: .3rem; }
#ad-create { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.modal-actions { display: flex; flex-direction: column; gap: .5rem; }
.modal-actions button { width: 100%; }
.modal-actions button.danger { background: #a12626; border-color: #a12626; }
.modal-actions button.danger:hover { background: #c22e2e; }
.modal-actions button.ghost { background: none; border-color: var(--border); color: var(--muted); }

/* empty hint */
.hint {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: .8rem; pointer-events: none;
}
