/* Seek: the classic Soulseek 157 Windows client (as in the 157 NS 13e screenshot on Wikipedia):
   white title bar, menu bar, a row of raised toolbar buttons, a row of window buttons, maximised MDI
   windows with white list views, the Rooms / users panel on the right, and a plain status bar.
   Light only, like the original. */

:root {
  --font: "Segoe UI", Tahoma, "MS Sans Serif", Geneva, Verdana, sans-serif;
  --fs: 12px;
  --row: 17px;
  --face: #f0f0f0;
  --white: #ffffff;
  --text: #000000;
  --grey: #6d6d6d;
  --edge: #828790;
  --hdr-line: #e5e5e5;
  --light: #ffffff;
  --shadow: #a0a0a0;
  --dark: #696969;
  --sel: #0078d7;
  --sel-soft: #cce8ff;
  --done: #008000;
  --active: #0000ff;
  --queued: #8080ff;
  --held: #800080;
  --bad: #c00000;
  --user: #0000c0;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--face); color: var(--text); font: var(--fs)/1.3 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: #0000ee; }

.window { display: flex; flex-direction: column; height: 100dvh; background: var(--face); }
.window > * { flex: none; }
.window > .body { flex: 1; min-height: 0; display: flex; }

/* ---------------------------------------------------------------- title bar + menu bar */
.titlebar { display: flex; align-items: center; gap: 7px; height: 30px; padding-left: 8px; background: var(--white); user-select: none; }
.ttext { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.tctl { display: flex; height: 100%; }
.tctl span { width: 46px; display: grid; place-items: center; font-size: 11px; color: #222; }
.tctl span:hover { background: #e5e5e5; }
.tctl .tx:hover { background: #e81123; color: #fff; }
.menubar { display: flex; align-items: center; height: 21px; background: var(--white); padding-left: 2px; user-select: none; }
.menubar .mitem { padding: 1px 7px; border: 1px solid transparent; cursor: default; }
.menubar .mitem:hover, .menubar .mitem.open { background: #cce8ff; border-color: #99d1ff; }
.menubar .mitem u { text-decoration: underline; }
.menubar .grow { flex: 1; }
.menubar .childctl { display: flex; gap: 2px; padding-right: 4px; }
.menubar .childctl button { width: 16px; height: 14px; padding: 0; border: none; background: none; font-size: 9px; line-height: 14px; color: #333; cursor: default; }
.menubar .childctl button:hover { background: #e5e5e5; }

/* ---------------------------------------------------------------- toolbar rows */
.toolbar, .taskbar { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px 4px; align-items: center; border-bottom: 1px solid #d9d9d9; }
.taskbar { padding-top: 2px; padding-bottom: 3px; border-bottom: 1px solid var(--edge); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.btn { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 6px; background: var(--face); border: 1px solid; border-color: var(--light) var(--dark) var(--dark) var(--light); box-shadow: inset -1px -1px var(--shadow); cursor: default; white-space: nowrap; color: #000; text-decoration: none; }
.btn:hover { background: #e5f1fb; }
.btn:active, .btn[aria-pressed="true"] { border-color: var(--dark) var(--light) var(--light) var(--dark); box-shadow: inset 1px 1px var(--shadow); background: #e8e8e8; }
.btn:disabled { color: #a0a0a0; }
.btn:disabled .ico { opacity: 0.4; }
.btn .ico { width: 16px; height: 16px; flex: none; }
.btn.logo { width: 58px; padding: 0 3px; justify-content: center; }
.btn.logo .bar { width: 50px; height: 15px; background: linear-gradient(#5fbf5f, #1e8b1e); border: 1px solid #165f16; display: grid; place-items: center; }
.btn.logo .bar.off { background: linear-gradient(#cf6060, #9b1c1c); border-color: #6d1010; }
.btn.logo .bar.away { background: linear-gradient(#f0d060, #c79a00); border-color: #8a6a00; }
.btn.logo svg { width: 22px; height: 12px; }
.task { min-width: 0; max-width: 200px; }
.task .t { overflow: hidden; text-overflow: ellipsis; }
.task.unread .t { color: #c00000; font-weight: 700; }
.task.default { color: var(--user); }
.btn.def { outline: 1px solid #000; outline-offset: -3px; }

/* ---------------------------------------------------------------- MDI area */
.mdi { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #ababab; }
.mdi > .win { flex: 1; }
.win { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: var(--face); }
.mdi.tiled { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 3px; padding: 3px; }
.child { border: 1px solid #6e6e6e; display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: var(--face); }
.child-title { display: flex; align-items: center; gap: 5px; height: 21px; padding: 0 2px 0 5px; background: linear-gradient(90deg, #bfcddb, #dbe4ed); color: #3b3b3b; user-select: none; }
.child.active .child-title { background: linear-gradient(90deg, #0a246a, #3a6ea5); color: #fff; font-weight: 600; }
.child-title .t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.child-title button { width: 16px; height: 14px; border: 1px solid; border-color: #fff #404040 #404040 #fff; background: var(--face); font-size: 9px; line-height: 10px; padding: 0; color: #000; }
.child-title .ico { width: 14px; height: 14px; }
.child-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pad { padding: 4px; }

/* ---------------------------------------------------------------- list views (virtualised) */
.lv { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--edge); position: relative; }
.lv-head { display: grid; background: var(--white); border-bottom: 1px solid var(--hdr-line); user-select: none; flex: none; overflow: hidden; }
.th { height: 22px; line-height: 22px; padding: 0 6px; border-right: 1px solid var(--hdr-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #000; }
.th.sortable:hover { background: #d9ebf9; }
.th.sorted { background: #f2f8fd; }
.th.num, .td.num { text-align: right; }
.th.ctr, .td.ctr { text-align: center; }
.lv-body { flex: 1; overflow: auto; position: relative; overscroll-behavior: contain; }
.lv-body .spacer { position: relative; min-width: 100%; }
.tr { display: grid; position: absolute; left: 0; right: 0; height: var(--row); line-height: var(--row); cursor: default; white-space: nowrap; }
.tr.sel { background: var(--sel); color: #fff !important; }
.tr.sel * { color: #fff !important; }
.tr.group { background: #f4f4f4; font-weight: 700; color: var(--user); border-bottom: 1px solid #ececec; }
.tr.group .td { overflow: visible; }
.td { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.td.num { font-variant-numeric: tabular-nums; }
.tr.c-done { color: var(--done); }
.tr.c-active { color: var(--active); }
.tr.c-queued { color: var(--queued); }
.tr.c-held { color: var(--held); }
.tr.c-bad { color: var(--bad); }
.tr.c-user { color: var(--user); }
.tr.playing .td.c-file { font-weight: 700; }
.y { color: var(--done); }
.n { color: var(--grey); }
.empty-lv { position: absolute; inset: 24px 0 0; display: grid; place-items: center; color: var(--grey); text-align: center; padding: 12px; }
.empty-lv .inner { max-width: 420px; }
.empty-lv b { color: #000; }
.sw { display: inline-block; width: 7px; height: 7px; margin-right: 4px; vertical-align: 0; border: 1px solid rgba(0, 0, 0, 0.35); }
.st { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; border: 1px solid rgba(0, 0, 0, 0.3); }
.st.online { background: #2fbf2f; }
.st.away { background: #f2c300; }
.st.offline { background: #bdbdbd; }
.chip { color: #0000ee; text-decoration: underline; cursor: pointer; background: none; border: none; padding: 0; }

/* ---------------------------------------------------------------- forms */
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row .grow { flex: 1; min-width: 120px; }
.bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 4px 5px; }
.bar label { white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.input { height: 21px; padding: 0 4px; border: 1px solid #7a7a7a; background: #fff; outline: none; min-width: 0; }
.input:focus { border-color: var(--sel); }
select.input { padding: 0 2px; }
textarea.input { height: auto; padding: 3px 4px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { margin: 0; accent-color: #0078d7; }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid #c8c8c8; border-top-color: var(--sel); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: var(--bad); }
.note { color: var(--grey); }
.banner { padding: 3px 6px; border: 1px solid #e3c96d; background: #fff8d6; margin: 0 4px 4px; }
.banner.bad { border-color: #e0a0a0; background: #ffecec; }

/* ---------------------------------------------------------------- transfers */
.transfers { flex: 1; min-height: 0; display: grid; grid-template-rows: 1fr 1fr auto; gap: 4px; padding: 4px; }
.tpane { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 4px; }
.knobs { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.knob { display: flex; align-items: center; }
.knob .v { width: 34px; height: 19px; border: 1px solid #7a7a7a; background: #fff; text-align: left; padding: 1px 3px; font-size: 11px; }
.knob .ud { display: flex; flex-direction: column; margin-left: 1px; }
.knob .ud span { width: 12px; height: 9px; border: 1px solid; border-color: #fff #696969 #696969 #fff; background: var(--face); font-size: 6px; line-height: 7px; text-align: center; }
.tfoot { padding: 2px 4px; }

/* ---------------------------------------------------------------- browse */
.browse { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(170px, 260px) minmax(0, 1fr); gap: 4px; padding: 0 4px 4px; }
.tree { background: #fff; border: 1px solid var(--edge); overflow: auto; padding: 2px 0; }
.node { display: flex; align-items: center; gap: 3px; height: 18px; padding-left: calc(4px + var(--d, 0) * 16px); padding-right: 6px; white-space: nowrap; cursor: default; }
.node .pm { width: 9px; height: 9px; border: 1px solid #919191; font-size: 8px; line-height: 7px; text-align: center; color: #333; background: #fff; flex: none; }
.node .pm.blank { border-color: transparent; background: none; }
.node .ico { width: 16px; height: 16px; flex: none; }
.node .nm { padding: 0 2px; }
.node.sel .nm { background: var(--sel); color: #fff; }
.node .c { color: var(--grey); margin-left: 3px; }

/* ---------------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 240px; grid-template-rows: minmax(0, 1fr) auto; gap: 4px; padding: 4px; }
.chat.private { grid-template-columns: minmax(0, 1fr); }
.log { background: #fff; border: 1px solid var(--edge); overflow: auto; padding: 2px 4px; font-size: 12px; }
.log .l { white-space: pre-wrap; word-break: break-word; line-height: 16px; }
.log .tm { color: var(--grey); }
.log .who { color: var(--user); }
.log .me .who { color: #c00000; }
.log .sys { color: var(--grey); }
.log .hl { background: #fff2a8; }
.chat .say { grid-column: 1 / -1; display: flex; gap: 4px; }
.chat .say .input { flex: 1; }
.chat .ul { min-height: 0; display: flex; }

/* ---------------------------------------------------------------- user info */
.uinfo { flex: 1; min-height: 0; overflow: auto; padding: 6px; display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px; align-content: start; }
.pic { width: 160px; height: 160px; border: 1px solid var(--edge); background: #fff; display: grid; place-items: center; font-size: 64px; font-weight: 700; color: #fff; }
.fieldset { border: 1px solid #d5dfe5; padding: 6px 8px 8px; margin: 0 0 8px; background: transparent; }
.fieldset legend { padding: 0 3px; color: #0046d5; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 2px 8px; }
.kv .k { color: var(--grey); }
.likes { margin: 0; padding-left: 18px; }

/* ---------------------------------------------------------------- right panel */
.side { width: 300px; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 4px; padding: 4px 4px 4px 0; }
.side .lv { min-height: 0; }
.side .join { display: flex; gap: 3px; }
.side .join .input { flex: 1; }

/* ---------------------------------------------------------------- player dock */
.dock { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 6px; border-top: 1px solid var(--edge); background: var(--face); }
.dock .art { width: 52px; height: 52px; border: 1px solid var(--edge); background: #fff center/cover no-repeat; display: grid; place-items: center; color: #9a9a9a; font-size: 22px; }
.dock .meta { min-width: 0; display: grid; gap: 2px; }
.dock .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .lbl { color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock .srcs { display: flex; flex-wrap: wrap; gap: 3px; }
.dock .srcs .btn { height: 19px; font-size: 11px; }
.dock .side2 { display: flex; gap: 3px; }
.dock .stage { grid-column: 1 / -1; }
.dock iframe { width: 100%; border: 0; display: block; }
.audio { display: flex; align-items: center; gap: 6px; }
.audio .seekbar { flex: 1; height: 8px; border: 1px solid var(--edge); background: #fff; position: relative; cursor: default; }
.audio .seekbar .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#57c757, #06b025); }
.audio .time { font-variant-numeric: tabular-nums; color: var(--grey); min-width: 74px; text-align: right; }

/* ---------------------------------------------------------------- status bar */
.statusbar { display: flex; height: 22px; align-items: center; border-top: 1px solid #d9d9d9; background: var(--face); white-space: nowrap; overflow: hidden; }
.statusbar .cell { padding: 0 6px; overflow: hidden; text-overflow: ellipsis; }
.statusbar .cell.grow { flex: 1; }
.statusbar .cell + .cell { border-left: 1px solid #d0d0d0; }

/* ---------------------------------------------------------------- menus + dialogs */
.menu { position: fixed; z-index: 30; min-width: 180px; padding: 2px; background: #f2f2f2; border: 1px solid #ccc; box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3); }
.menu button { display: flex; width: 100%; gap: 20px; padding: 3px 20px 3px 24px; border: 1px solid transparent; background: none; text-align: left; cursor: default; white-space: nowrap; }
.menu button:hover:not(:disabled) { background: #cce8ff; border-color: #99d1ff; }
.menu button:disabled { color: #a0a0a0; }
.menu button .k { margin-left: auto; color: var(--grey); }
.menu hr { border: none; border-top: 1px solid #d7d7d7; margin: 2px 2px 2px 24px; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 12px; background: rgba(0, 0, 0, 0.08); }
.modal.inline { position: absolute; background: transparent; }
.dialog { width: min(520px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; background: var(--face); border: 1px solid #6e6e6e; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 3px 3px 12px rgba(0, 0, 0, 0.35); }
.dialog .dtitle { display: flex; align-items: center; gap: 6px; height: 28px; padding-left: 8px; background: #fff; user-select: none; flex: none; }
.dialog .dtitle .t { flex: 1; }
.dialog .dtitle .x { width: 40px; height: 28px; border: none; background: none; font-size: 11px; }
.dialog .dtitle .x:hover { background: #e81123; color: #fff; }
.dialog .dbody { padding: 10px 12px; display: grid; gap: 8px; overflow: auto; }
.dialog .dfoot { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 12px 10px; flex: none; }
.dialog .dfoot .btn { min-width: 75px; justify-content: center; }
.dialog p { margin: 0; }
.opts { display: grid; gap: 4px; }
.opts label { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: start; }
.opts small { color: var(--grey); display: block; }
.picklist { background: #fff; border: 1px solid var(--edge); max-height: 190px; overflow: auto; }
.picklist label { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; padding: 1px 4px; align-items: center; }
.picklist label:hover { background: #e5f3ff; }
.fine { color: var(--grey); font-size: 11px; }
.fine ul { margin: 3px 0 0; padding-left: 16px; }
.mdi-dialog { position: relative; flex: 1; display: grid; place-items: center; padding: 12px; overflow: auto; }

/* ---------------------------------------------------------------- phone width */
@media (max-width: 760px) {
  :root { --row: 24px; --fs: 13px; }
  .tctl { display: none; }
  .side { display: none; position: fixed; z-index: 15; right: 0; top: 0; bottom: 0; width: min(320px, 92vw); padding: 6px; background: var(--face); border-left: 1px solid var(--edge); box-shadow: -2px 0 8px rgba(0, 0, 0, 0.25); }
  body.show-side .side { display: grid; }
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .toolbar .btn .lbl { display: none; }
  .tpane { grid-template-columns: minmax(0, 1fr); }
  .knobs { display: none; }
  .browse { grid-template-columns: 1fr; grid-template-rows: 130px minmax(0, 1fr); }
  .chat { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 110px auto; }
  .uinfo { grid-template-columns: 1fr; }
  .pic { width: 90px; height: 90px; font-size: 40px; }
  .dock { grid-template-columns: auto minmax(0, 1fr); }
  .dock .side2 { grid-column: 1 / -1; justify-content: flex-end; }
  .statusbar .cell.wide { display: none; }
  .menubar .childctl { display: none; }
}

/* Tiled windows are narrow: chat user lists and side knobs shrink with the window, not the screen. */
.child-body, .mdi > .win { container-type: inline-size; }
@container (max-width: 560px) {
  .chat { grid-template-columns: minmax(0, 1fr) 130px; }
  .tpane { grid-template-columns: minmax(0, 1fr); }
  .knobs { display: none; }
  .browse { grid-template-columns: minmax(110px, 0.6fr) minmax(0, 1fr); }
}
