/* UO Files — dashboard styles. Dark "Britannian night" theme with brass accents. */
:root {
  --bg: #0d1016;
  --bg2: #11151d;
  --panel: #161b25;
  --panel2: #1c2230;
  --panel3: #232b3b;
  --line: #2a3344;
  --line2: #364055;
  --text: #e9e3d6;
  --muted: #98a2b3;
  --dim: #6b7487;
  --gold: #d7b05a;
  --gold2: #f1d58e;
  --goldbg: rgba(215, 176, 90, .12);
  --blue: #7cb8ff;
  --green: #7fd18b;
  --red: #ff7b72;
  --radius: 10px;
  --side: 236px;
  --top: 56px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; margin: 0 0 .4em; }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- layout */
#app { display: grid; grid-template-columns: var(--side) 1fr; height: 100vh; overflow: hidden; }
#side {
  background: linear-gradient(180deg, #121722, #0e1219 60%); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 14px 10px 24px; z-index: 30;
}
#mainwrap { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
#top {
  height: var(--top); flex: 0 0 var(--top); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(17, 21, 29, .92);
}
#main { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.page { padding: 20px 22px 60px; max-width: 1600px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand b { font-family: var(--serif); font-size: 19px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 11px; }
.nav-sec { margin: 14px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--dim); }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px; color: var(--text);
  font-size: 13.5px;
}
.nav a:hover { background: var(--panel2); text-decoration: none; }
.nav a.on { background: var(--goldbg); color: var(--gold2); box-shadow: inset 2px 0 0 var(--gold); }
.nav a .n { margin-left: auto; color: var(--dim); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
#menuBtn { display: none; }
.crumbs { font-family: var(--serif); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sp { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap;
}
.pill b { color: var(--text); font-weight: 600; }

/* ---------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px;
  border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer;
  white-space: nowrap; color: var(--text); text-decoration: none; font-size: 13px;
}
.btn:hover { background: var(--panel3); text-decoration: none; }
.btn.primary { background: linear-gradient(180deg, #e2bd67, #c79a3e); color: #1b1407; border-color: #b88c35; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.on { border-color: var(--gold); color: var(--gold2); background: var(--goldbg); }
.btn:disabled { opacity: .45; cursor: default; }
input[type=search], input[type=text], input[type=number], select {
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 10px; outline: none;
  min-width: 0;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215, 176, 90, .15); }
.search { width: 280px; max-width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.toolbar .grow { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chip {
  padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel);
  cursor: pointer; font-size: 12.5px; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--dim); }
.chip.on { background: var(--goldbg); border-color: var(--gold); color: var(--gold2); }
.chip .c { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel2); padding: 5px 10px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line2); }
.seg button.on { background: var(--goldbg); color: var(--gold2); }
.count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- cards / home */
.hero {
  position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 22px; margin-bottom: 20px;
  background:
    radial-gradient(1200px 300px at 10% -40%, rgba(215, 176, 90, .18), transparent 60%),
    radial-gradient(700px 300px at 100% 0%, rgba(124, 184, 255, .10), transparent 60%),
    linear-gradient(180deg, #171d29, #121722);
  overflow: hidden;
}
.hero h1 { font-size: 32px; margin-bottom: 6px; }
.hero p { color: var(--muted); max-width: 820px; margin: 0 0 14px; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .art { position: absolute; right: 18px; bottom: 0; height: 150px; opacity: .95; pointer-events: none; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  display: block; position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px;
  background: linear-gradient(180deg, var(--panel), #131822); color: var(--text); overflow: hidden; min-height: 116px;
}
.card:hover { border-color: var(--gold); text-decoration: none; transform: translateY(-1px); }
.card h3 { margin: 0 0 2px; }
.card .big { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--gold2); }
.card .desc { color: var(--muted); font-size: 12.5px; }
.card .thumbs { position: absolute; right: 10px; bottom: 8px; display: flex; gap: 4px; align-items: flex-end; opacity: .9; }
.card .thumbs img { max-height: 56px; max-width: 56px; image-rendering: pixelated; }
.section { margin: 26px 0 10px; display: flex; align-items: baseline; gap: 12px; }
.section h2 { margin: 0; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.note { color: var(--muted); font-size: 12.5px; }
.callout { border-left: 3px solid var(--gold); background: var(--goldbg); padding: 10px 14px; border-radius: 6px; margin: 10px 0; }

/* ---------- virtual grid */
.vg { position: relative; }
.vg-inner { position: relative; width: 100%; }
.cell {
  position: absolute; display: flex; flex-direction: column; align-items: stretch; border: 1px solid var(--line);
  background: var(--panel); border-radius: 9px; cursor: pointer; overflow: hidden; padding: 0; text-align: left;
  color: var(--text);
}
.cell:hover { border-color: var(--gold); }
.cell.sel { border-color: var(--gold2); box-shadow: 0 0 0 2px rgba(241, 213, 142, .35); }
.cell .th { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: 6px; }
.cell .th img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.cell .th img.smooth { image-rendering: auto; }
.cell .lb { padding: 3px 7px 5px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.cell .lb .id { font-family: var(--mono); font-size: 11px; color: var(--gold2); }
.cell .lb .nm { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-dark .th, .bg-dark.stage { background: #0b0e13; }
.bg-light .th, .bg-light.stage { background: #d9d4c7; }
.bg-check .th, .bg-check.stage {
  background-color: #2a2f3a;
  background-image: linear-gradient(45deg, #3a404d 25%, transparent 25%), linear-gradient(-45deg, #3a404d 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #3a404d 75%), linear-gradient(-45deg, transparent 75%, #3a404d 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.bg-grass .th, .bg-grass.stage { background: #3d5a2a; }

/* list rows (sounds, music, files, cliloc) */
.row {
  position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-bottom: 1px solid var(--line); background: var(--panel); font-size: 13px;
}
.row:hover { background: var(--panel2); }
.row .id { font-family: var(--mono); color: var(--gold2); width: 64px; flex: 0 0 auto; }
.row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .tag { font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel3); color: var(--muted); white-space: nowrap; }
.row.playing { background: var(--goldbg); }
.play {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line2); background: var(--panel3);
  cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.play:hover { border-color: var(--gold); }
.play svg { width: 12px; height: 12px; fill: var(--gold2); }
.listhead {
  display: flex; gap: 10px; padding: 6px 12px; font-size: 11.5px; color: var(--dim); text-transform: uppercase;
  letter-spacing: .8px; border-bottom: 1px solid var(--line);
}
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--dim); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.kv td:first-child { color: var(--muted); width: 38%; white-space: nowrap; }

/* ---------- drawer (detail) */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 50; background: var(--bg2);
  border-left: 1px solid var(--line2); box-shadow: -20px 0 50px rgba(0, 0, 0, .45); transform: translateX(105%);
  transition: transform .18s ease; display: flex; flex-direction: column;
}
#drawer.open { transform: none; }
#drawer.wide { width: min(980px, 100vw); }
.dr-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dr-head h2 { margin: 0; font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-body { flex: 1; overflow-y: auto; padding: 14px; }
.stage {
  position: relative; border: 1px solid var(--line); border-radius: 10px; min-height: 220px; display: flex;
  align-items: center; justify-content: center; overflow: auto; padding: 14px;
}
.stage canvas, .stage img { image-rendering: pixelated; max-width: none; }
.stage.fit canvas, .stage.fit img { max-width: 100%; max-height: 62vh; image-rendering: auto; }
.dr-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.kvwrap { margin-top: 12px; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.flag { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--panel3); color: var(--muted); }
#scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 45; display: none; }
#scrim.on { display: block; }

/* hue picker */
.hue-ramp { height: 16px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .4); }
.huepick { display: flex; gap: 6px; align-items: center; }
.huepick input { width: 82px; }
.hue-pop {
  position: fixed; z-index: 70; width: 360px; max-width: calc(100vw - 20px); height: 420px; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); display: flex;
  flex-direction: column;
}
.hue-pop .hp-top { padding: 10px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); }
.hue-pop .hp-list { flex: 1; overflow-y: auto; position: relative; }
.hrow { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; cursor: pointer; font-size: 12.5px; }
.hrow:hover { background: var(--panel2); }
.hrow .hid { font-family: var(--mono); width: 48px; color: var(--gold2); }
.hrow .hue-ramp { flex: 1; }
.hrow .hn { width: 120px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcell .th { padding: 0; }
.hcell .sw { width: 100%; height: 100%; }

/* animation player */
.ap { display: grid; grid-template-columns: 1fr 250px; gap: 14px; }
.ap .side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.acts { display: flex; flex-direction: column; gap: 2px; max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.acts button { text-align: left; border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text); display: flex; gap: 8px; }
.acts button:hover { background: var(--panel2); }
.acts button.on { background: var(--goldbg); color: var(--gold2); }
.acts button .a { font-family: var(--mono); color: var(--dim); width: 20px; }
.acts button .fc { margin-left: auto; color: var(--dim); font-size: 11px; }
.compass { display: grid; grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); gap: 4px; justify-content: center; }
.compass button { border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; cursor: pointer; font-size: 17px; color: var(--muted); }
.compass button.on { border-color: var(--gold); color: var(--gold2); background: var(--goldbg); }
.compass .mid { border: 0; background: transparent; cursor: default; font-size: 11px; color: var(--dim); }
.player-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-ctl input[type=range] { width: 120px; accent-color: var(--gold); }
.fr { font-family: var(--mono); color: var(--muted); font-size: 12px; min-width: 64px; }

/* maps */
#map { height: calc(100vh - var(--top) - 150px); min-height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #000; }
.leaflet-container { background: #05070a; font: 12px var(--sans); }
.leaflet-tile { image-rendering: pixelated; }
.map-coord { position: absolute; z-index: 500; left: 10px; bottom: 10px; background: rgba(13, 16, 22, .85); padding: 4px 9px; border-radius: 6px; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line2); }

/* misc */
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--gold); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line2); border-radius: 4px; background: var(--panel2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel3); border: 1px solid var(--gold); padding: 8px 14px; border-radius: 8px; z-index: 90; }
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.client { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.client.feat { border-color: var(--gold); background: linear-gradient(180deg, #1c2130, var(--panel)); }
.client h3 { margin: 0; font-size: 18px; }
.client .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.client .dl { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.client .dl a { display: flex; gap: 8px; align-items: center; padding: 6px 9px; border-radius: 7px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.client .dl a:hover { border-color: var(--gold); text-decoration: none; }
.client .dl a .sz { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.client .dl a .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--gold); width: 64px; flex: 0 0 auto; }
.textview { white-space: pre; font-family: var(--mono); font-size: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; max-height: 70vh; }
.cliloc-row { position: absolute; left: 0; right: 0; display: flex; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 13px; overflow: hidden; }
.cliloc-row .id { font-family: var(--mono); color: var(--gold2); width: 80px; flex: 0 0 auto; cursor: pointer; }
.cliloc-row .tx { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
mark { background: rgba(215, 176, 90, .35); color: inherit; border-radius: 2px; }
.fontsheet { background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; margin-bottom: 18px; }
.fontsheet img { image-rendering: pixelated; }

/* ---------- responsive */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  #side { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; transform: translateX(-102%); transition: transform .18s; }
  #side.open { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, .5); }
  #menuBtn { display: inline-flex; }
  .page { padding: 14px 16px 50px; }
  .ap { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .hero .art { display: none; }
  .search { width: 100%; }
  .top-pills { display: none; }
  .clients { grid-template-columns: 1fr; }
}
