/* /system/style.css */
/* Optional custom font (uncomment if you have /system/melted.monster.ttf)
@font-face{
  font-family:"MeltedMonster";
  src:url("/system/melted.monster.ttf") format("truetype");
  font-weight:normal;
  font-style:normal;
  font-display:swap;
}
*/
:root{
  --bg0:#05040a;
  --bg1:#0a0812;
  --panel:rgba(8,8,12,.62);
  --panel2:rgba(14,12,20,.72);
  --fg:rgba(245,245,255,.94);
  --muted:rgba(245,245,255,.66);
  --faint:rgba(245,245,255,.46);
  --line:rgba(255,255,255,.09);
  --line2:rgba(255,255,255,.14);
  --accent:#9b4dff;
  --accent2:#4b2bff;
  --accent3:#2a1a55;
  --r:14px;
  --pad:12px;
  --pad2:10px;
  --mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
  --ui:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  --logo:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  --shadow: 0 18px 60px rgba(0,0,0,.55);
}
*{box-sizing:border-box}
html,body{height:100%;width:100%;overflow:hidden}

body{
  margin:0;
  color:var(--fg);
  font-family:var(--ui);
  background:
    radial-gradient(1400px 900px at 20% 15%, rgba(155,77,255,.12), transparent 60%),
    radial-gradient(1200px 900px at 75% 75%, rgba(75,43,255,.10), transparent 62%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-image:
    url("/system/bg-dystopia.png"),
    radial-gradient(1400px 900px at 20% 15%, rgba(155,77,255,.12), transparent 60%),
    radial-gradient(1200px 900px at 75% 75%, rgba(75,43,255,.10), transparent 62%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-repeat:no-repeat;
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
  overflow:hidden;
  overscroll-behavior:none;
}
body.no-scroll{overflow:hidden}

.fx{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:1;
}
.fx-scan{
  opacity:.10;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255,255,255,.06) 0px,
      rgba(255,255,255,.02) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 5px
    );
  mix-blend-mode:overlay;
}
.fx-grain{
  opacity:.10;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,.08), transparent 42%),
    radial-gradient(circle at 85% 25%, rgba(155,77,255,.08), transparent 46%),
    radial-gradient(circle at 35% 85%, rgba(75,43,255,.07), transparent 44%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0, rgba(255,255,255,0) 2px);
  filter: blur(.2px);
  animation: drift 10s linear infinite;
  mix-blend-mode:soft-light;
}
@keyframes drift{
  0%{transform:translate3d(0,0,0)}
  100%{transform:translate3d(-32px,18px,0)}
}

.app{
  position:fixed;
  inset:0;
  z-index:2;
  height:100vh;
  height:100dvh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.topbar{
  position:relative;
  top:0;
  z-index:30;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background:
    radial-gradient(900px 200px at 30% 0%, rgba(155,77,255,.18), transparent 58%),
    rgba(0,0,0,.42);
  border-bottom:1px solid rgba(255,255,255,.10);
  backdrop-filter:saturate(115%) blur(8px);
}

.iconbtn{
  appearance:none;
  border:none;
  cursor:pointer;
  width:42px;
  height:42px;
  border-radius:12px;
  background:rgba(0,0,0,.35);
  border:1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  display:grid;
  place-items:center;
  padding:0;
}
.iconbtn:active{transform:translateY(1px)}
.iconbtn .icon{
  width:18px;
  height:12px;
  display:block;
  background:
    linear-gradient(var(--fg),var(--fg)) 0 0/100% 2px no-repeat,
    linear-gradient(var(--fg),var(--fg)) 0 50%/100% 2px no-repeat,
    linear-gradient(var(--fg),var(--fg)) 0 100%/100% 2px no-repeat;
  opacity:.9;
}

.brand{display:flex;flex-direction:column;min-width:0;gap:2px}
.brand-mark{
  font-family:var(--logo);
  letter-spacing:2px;
  font-size:28px;
  line-height:1;
  text-transform:uppercase;
  color:rgba(245,245,255,.96);
  text-shadow: 0 12px 30px rgba(0,0,0,.70);
}
.brand-sub{font-size:12px;color:var(--muted);letter-spacing:.6px;text-transform:uppercase}

.mono{font-family:var(--mono)}

.stats{
  margin-left:auto;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.stat{
  display:flex;
  align-items:baseline;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(0,0,0,.28);
  border:1px solid var(--line);
}
.stat .k{
  font-size:11px;
  letter-spacing:1px;
  color:var(--faint);
}
.stat .v{font-weight:800; white-space:nowrap; max-width: 34vw; overflow:hidden; text-overflow:ellipsis}

.shell{
  flex:1;
  display:grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap:10px;
  padding:10px;
  align-items:stretch;
  min-height:0;
  overflow:hidden;
}

.sidebar{
  border-radius:16px;
  border:1px solid var(--line);
  background:var(--panel);
  box-shadow: var(--shadow);
  overflow:hidden;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.side-head{
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(700px 220px at 40% 0%, rgba(155,77,255,.16), transparent 60%),
    rgba(0,0,0,.20);
}
.side-title{
  font-size:12px;
  letter-spacing:1.2px;
  text-transform:uppercase;
  color:rgba(245,245,255,.86);
  font-weight:900;
}
.side-path{margin-top:4px;font-size:12px;color:var(--muted);opacity:.9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.side-controls{padding:10px 12px;border-bottom:1px solid rgba(255,255,255,.08);background:rgba(0,0,0,.18)}
.select{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.30);
  color:var(--fg);
  font-family:var(--ui);
  font-weight:800;
  letter-spacing:.2px;
  outline:none;
  appearance: base-select;
  color-scheme: dark;
}
.select::picker(select){
  appearance: base-select;
  background: rgba(0,0,0,.30);
  border:1px solid var(--line);
  color:#fff;
  border-radius:12px;
  padding:6px;
}
.select option{background:rgba(0,0,0,.40);color:#fff}

.thumbs{
  padding:10px;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap:6px;
  overflow:auto;
  align-content:start;
  min-height:0;
}
.thumb{
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.32);
  aspect-ratio: 1 / 1;
  cursor:pointer;
  position:relative;
}
.thumb img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  opacity:.88;
  transition: transform .12s ease, opacity .12s ease, filter .12s ease;
  filter:saturate(1.05) contrast(1.05);
}
.thumb:hover img{opacity:1; transform:scale(1.03)}
.thumb.is-active{border-color: rgba(155,77,255,.70)}
.thumb.is-active::after{
  content:"";
  position:absolute;
  inset:0;
  border:2px solid rgba(75,43,255,.50);
  border-radius:12px;
  pointer-events:none;
}

.viewer{
  border-radius:16px;
  border:1px solid var(--line);
  background:var(--panel2);
  box-shadow: var(--shadow);
  overflow:hidden;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.stage{
  position:relative;
  flex:1;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:
    radial-gradient(900px 300px at 50% 0%, rgba(155,77,255,.10), transparent 65%),
    rgba(0,0,0,.32);
  border-bottom:1px solid rgba(255,255,255,.08);
}
#viewer{
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  opacity:0;
  transition:opacity .16s ease;
  cursor:zoom-in;
  touch-action:none;
  -webkit-tap-highlight-color: transparent;
  user-select:none;
}
#viewer.ready{opacity:1}

.hud{
  position:absolute;
  left:10px;
  right:10px;
  bottom:10px;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.hud > div{
  padding:8px 10px;
  border-radius:12px;
  background:rgba(0,0,0,.50);
  border:1px solid rgba(255,255,255,.12);
  color:rgba(245,245,255,.86);
  max-width:70%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.controls{
  display:flex;
  gap:8px;
  padding:10px;
  align-items:center;
  justify-content:center;
}
.btn{
  appearance:none;
  border:none;
  cursor:pointer;
  border-radius:12px;
  padding:10px 14px;
  color:var(--fg);
  font-family:var(--ui);
  font-weight:900;
  letter-spacing:.2px;
  background: linear-gradient(135deg, rgba(155,77,255,.74), rgba(75,43,255,.52));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
  transition: transform .10s ease, filter .10s ease, opacity .10s ease;
}
.btn:hover{filter:brightness(1.06)}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.55; cursor:not-allowed}
.btn.ghost{background:rgba(0,0,0,.22); border:1px solid rgba(255,255,255,.12)}

.note{
  padding:0 12px 12px;
  min-height:22px;
  color:var(--muted);
  font-size:13px;
}

/* mobile off-canvas library */
.backdrop{
  position:fixed;
  inset:0;
  z-index:35;
  background:rgba(0,0,0,.62);
  backdrop-filter: blur(2px);
}
@media (max-width: 900px){
  .shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    top:64px;
    left:10px;
    bottom:10px;
    width:min(92vw, 360px);
    z-index:40;
    transform: translate3d(-110%,0,0);
    transition: transform .18s ease;
  }
  body.panel-open .sidebar{transform: translate3d(0,0,0)}
  .stats .stat .v{max-width: 42vw}
}
@media (max-width: 520px){
  .topbar{gap:8px}
  .brand-mark{font-size:24px}
  .stats{gap:8px}
  .stat{padding:7px 9px}
  .controls{padding:10px 8px}
  .btn{padding:10px 12px}
}

/* fullscreen overlay */
.lightbox{
  position:fixed;
  inset:0;
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,.92);
  touch-action:none;
  -webkit-tap-highlight-color: transparent;
}
.lightbox[hidden]{display:none}
.lightbox img{
  width:100vw;
  height:100vh;
  max-width:100vw;
  max-height:100vh;
  object-fit:contain;
  object-position:center center;
  cursor: zoom-out;
  user-select:none;
  -webkit-user-drag:none;
  touch-action:none;
}
.lightbox .lb-close{
  position:fixed;
  top:12px;
  right:12px;
  z-index:10000;
  width:54px;
  height:54px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.40);
  color:rgba(255,255,255,.92);
  font-family:var(--ui);
  font-size:38px;
  font-weight:900;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.lightbox .lb-close:active{transform: translateY(1px)}
.lightbox .lb-close:focus{outline:none}
.lightbox.cover img{width:100vw;height:100vh;object-fit:cover}
