/* Welux web app. Edit freely - phones pick changes up on next launch. */

:root {
  --bg: #171310;
  --surface: #241e19;
  --surface2: #2f2822;
  --text: #f3e9dc;
  --muted: #b3a695;
  --accent: #e8c68f;
  --accent-dark: #5c4a2e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, Roboto, sans-serif;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }

.view {
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(150px + env(safe-area-inset-bottom));
  max-width: 900px;
  margin: 0 auto;
}

/* Material Symbols icon glyphs (font loads from Google Fonts; falls back to nothing). */
.ms {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 17px; margin: 20px 0 10px; }

/* Round bottom-anchored search, same style as the native app. */
.search {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  max-width: 868px;
  margin: 0 auto;
  padding: 14px 20px;
  border-radius: 28px;
  border: 1px solid var(--accent-dark);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  z-index: 30;
}
.search:focus { border-color: var(--accent); }

/* Poster grids */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 14px;
}
.card { cursor: pointer; }
.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  background: var(--surface);
  object-fit: cover;
  display: block;
}
.square { aspect-ratio: 1; }
.card .t { font-size: 13px; margin-top: 6px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .s { font-size: 12px; color: var(--muted); }

/* Rows (tracks, episodes, people) */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; cursor: pointer;
}
.row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface); }
.row img.tall { height: 72px; }
.row img.circle { border-radius: 50%; }
.row .t { font-size: 15px; }
.row .s { font-size: 13px; color: var(--muted); }
.row .grow { flex: 1; min-width: 0; }
.row .grow div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  padding: 7px 14px; border-radius: 20px; font-size: 13px;
  background: var(--surface2); color: var(--text);
  border: none; cursor: pointer; text-decoration: none;
}
.chip.on { background: var(--accent); color: #241a0d; }
/* A chip that reports state rather than doing something when tapped. */
.chip.static { cursor: default; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border-radius: 26px; border: none;
  background: var(--accent); color: #241a0d; font-size: 16px; font-weight: 600;
  cursor: pointer; margin: 12px 0;
}

.backdrop { width: calc(100% + 32px); margin: -16px -16px 12px; aspect-ratio: 16/9; object-fit: cover; display: block; }
.meta { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.plot { color: var(--muted); font-size: 15px; line-height: 1.5; }
.error { color: #e08f8f; margin-top: 10px; font-size: 14px; }
.mutedtext { color: var(--muted); font-size: 14px; }

.castrow { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.cast { min-width: 84px; max-width: 84px; text-align: center; cursor: pointer; }
.cast img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.cast .t { font-size: 12px; margin-top: 4px; }
.cast .s { font-size: 11px; color: var(--muted); }

/* Bottom tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: var(--surface);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.tabs a { color: var(--muted); text-decoration: none; text-align: center; line-height: 1; }
.tabs a .ms {
  display: inline-block; padding: 4px 18px; border-radius: 14px;
  transition: background .15s;
}
.tabs a span { display: block; font-size: 11px; margin-top: 4px; font-weight: 500; }
.tabs a.on { color: var(--text); }
.tabs a.on .ms { background: var(--accent-dark); color: var(--accent); }

/* Audio player bar */
.playerbar {
  position: fixed; left: 8px; right: 8px;
  bottom: calc(56px + env(safe-area-inset-bottom));
  z-index: 35;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface2); border-radius: 14px; padding: 8px 10px;
}
.pb-art { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface); }
.pb-meta { flex: 1; min-width: 0; }
.pb-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-artist { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { background: none; border: none; color: var(--text); font-size: 20px; padding: 8px; cursor: pointer; }
.iconbtn.big { font-size: 26px; }

/* Video overlay */
.videowrap { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; }
.videowrap video { width: 100%; max-height: 100%; }
.video-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; z-index: 61;
  background: rgba(0,0,0,.5); color: #fff; border: none; border-radius: 50%;
  width: 40px; height: 40px; font-size: 16px; cursor: pointer;
}

/* Login */
.login {
  position: fixed; inset: 0; z-index: 70; background: var(--bg);
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px; max-width: 420px; margin: 0 auto;
}
.login .wordmark { color: #fff; }
.login .wordmark .k { color: var(--accent); }
.login p { color: var(--muted); }
.login input {
  margin: 8px 0; padding: 14px 18px; border-radius: 26px;
  border: 1px solid var(--accent-dark); background: var(--surface); color: var(--text); font-size: 16px;
}
.login button {
  margin-top: 14px; padding: 14px; border-radius: 26px; border: none;
  background: var(--accent); color: #241a0d; font-size: 16px; font-weight: 600; cursor: pointer;
}


/* Settings */
.setting {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; cursor: pointer;
}
.setting .ms { color: var(--muted); }
.setting .grow { flex: 1; }
.setting .t { font-size: 15px; }
.setting .s { font-size: 13px; color: var(--muted); }
.sectionlabel { color: var(--accent); font-size: 13px; font-weight: 600; margin: 18px 0 4px; }


/* Page header with trailing actions (history) */
.pagehead { display: flex; align-items: center; justify-content: space-between; }
.pagehead h1 { margin: 8px 0 16px; }
.pagehead a { color: var(--muted); text-decoration: none; }

/* Embedded in the native shell: the app draws the bars, and the WebView is
   already inset inside them - so the page must NOT add safe-area or nav-bar
   spacing of its own, or every screen gains phantom gaps. */
.embedded .tabs { display: none; }
.embedded .view { padding-top: 16px; padding-bottom: 24px; }
.embedded .pagetitle { display: none; }  /* the native app bar already says it */
.embedded .search { bottom: 16px; }
.embedded .playerbar { bottom: 76px; }

/* First-visit loading state for a pane */
.spinner {
  width: 32px; height: 32px;
  margin: 40vh auto 0;
  border: 3px solid var(--surface2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.iconbtn { color: var(--muted); display: inline-flex; padding: 8px; }

/* Auto Mix hero + feature tiles (shown inside the native shell) */
.automix {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, #f0d9ac, #e8c68f 60%, #d9ae6e);
  color: #2a1f12;
  border-radius: 20px; padding: 18px 16px; margin: 4px 0 14px;
  cursor: pointer;
}
.automix .amt { font-size: 22px; font-weight: 800; }
.automix .ams { font-size: 13px; margin-top: 4px; opacity: .85; }
.automix .amplay {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(42, 31, 18, .85); color: #f0d9ac;
  display: flex; align-items: center; justify-content: center;
}
.tiles { display: flex; gap: 10px; margin-bottom: 18px; }
.tile {
  flex: 1; background: var(--surface); border-radius: 16px; padding: 14px 12px;
  cursor: pointer; color: var(--accent);
}
.tile .t { color: var(--fg); font-weight: 700; margin-top: 10px; font-size: 15px; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Sort/filter chip rail on Films & Shows */
.filterbar {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px;
  scrollbar-width: none;
}
.filterbar::-webkit-scrollbar { display: none; }
.filterbar .chip { flex: none; }

/* Admin panel */
.admincard {
  background: var(--surface); border-radius: 16px;
  padding: 14px 16px; margin: 8px 0 14px;
}
.admincard .t { font-weight: 700; margin-bottom: 8px; }
/* Admin section drawer: a menu button showing the current section, and a
   slide-in list - one section at a time instead of one endless page. */
.adminbar { display: flex; align-items: center; gap: 10px; padding: 4px 0 12px; }
.adminmenubtn {
  display: flex; align-items: center; gap: 10px; flex: 1;
  background: var(--surface); color: var(--text); border: 0; border-radius: 12px;
  padding: 12px 14px; font: inherit; font-weight: 600; text-align: left;
}
.adminmenubtn .bars { display: inline-flex; flex-direction: column; gap: 3px; }
.adminmenubtn .bars i { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.55); }
.drawerpanel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(78vw, 300px);
  background: var(--surface);
  padding: calc(12px + var(--inset-top, env(safe-area-inset-top, 0px))) 0 calc(12px + var(--inset-bottom, env(safe-area-inset-bottom, 0px)));
  display: flex; flex-direction: column;
  box-shadow: 2px 0 24px rgba(0,0,0,.4);
}
.drawertitle { padding: 6px 18px 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; flex: 0 0 auto; }
.draweritems { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.draweritem {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; color: var(--text); font: inherit;
  padding: 14px 18px; text-align: left; cursor: pointer;
}
.draweritem.on { background: var(--accent); color: var(--accent-dark); font-weight: 700; }
.drawerdivider { height: 1px; background: rgba(128, 128, 128, .15); margin: 6px 0; flex: 0 0 auto; }
.draweritem-exit { flex: 0 0 auto; color: var(--muted); }
.draweritem-exit:hover, .draweritem-exit:active { color: var(--text); background: var(--surface2); }

/* Identify: a full-screen panel (a bottom sheet collapsed unpredictably in
   the app's WebView), with its own scrolling body. */
.modal { position: fixed; inset: 0; background: var(--bg); z-index: 70; display: flex; flex-direction: column; }
.modalbox { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: calc(10px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }
.modalhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex: 0 0 auto; }
.modalhead .t { font-weight: 700; flex: 1; word-break: break-word; font-size: 15px; }
.modalseg { display: flex; gap: 8px; margin-bottom: 10px; flex: 0 0 auto; }
.modalscroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.admintab {
  flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; font: inherit; font-weight: 600;
  background: var(--surface); color: var(--muted); border: 1px solid transparent; white-space: nowrap;
}
.admintab.on { background: var(--accent); color: var(--accent-dark); }
.adminput.half { width: auto; flex: 1; }
.adminput.grow { flex: 1; margin: 0; }
.epfields { margin-bottom: 8px; }
.postergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.postercard { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--surface); text-align: left; font: inherit; cursor: pointer; }
.postercard.sel { border-color: var(--accent); }
.postercard img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface2); }
.postercard .noposter { aspect-ratio: 2/3; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.postercard .pt { font-size: 12px; font-weight: 600; padding: 4px 6px 0; }
.postercard .py { font-size: 11px; color: var(--muted); padding: 0 6px 6px; }

.unreclist { margin-top: 10px; }
.unrec { padding: 10px 0; border-top: 1px solid var(--surface2); }
.unrec .t { font-weight: 600; margin-bottom: 2px; word-break: break-word; }
.unrec .path { font-size: 11px; opacity: .55; margin-top: 4px; word-break: break-all; }
.unrec .chips { margin-top: 8px; }
.chip.ghost { background: transparent; border: 1px solid var(--surface2); }
.adminput {
  display: block; width: 100%; box-sizing: border-box;
  background: var(--surface2); color: var(--fg);
  border: 1px solid transparent; border-radius: 12px;
  padding: 10px 12px; margin: 6px 0; font: inherit;
}
.adminput:focus { outline: none; border-color: var(--accent); }
.adminlabel { display: block; color: var(--muted); font-size: 14px; margin: 8px 0; }

/* One feedback report, opened for triage: what they wrote, what they attached,
   and the technical blobs folded away until asked for. */
.fbbody { white-space: pre-wrap; word-break: break-word; margin: 10px 0; }
.fbshots { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.fbshot { height: 200px; border-radius: 10px; background: var(--surface2); flex: none; }
.fbdetails { margin: 8px 0; }
.fbdetails summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; }
.fbpre {
  white-space: pre-wrap; word-break: break-word; font-size: 11px; line-height: 1.45;
  background: var(--surface2); border-radius: 10px; padding: 10px; margin: 8px 0 0;
  max-height: 50vh; overflow-y: auto;
}
.adminselect {
  background: var(--surface2); color: var(--fg); border: none;
  border-radius: 10px; padding: 8px 10px; font: inherit;
}
.tabrow { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.tabrow .tabname { width: 64px; flex: none; }
.tabrow .adminput.slim { flex: 1; margin: 0; }
.setting .rowchips { flex: none; display: flex; gap: 6px; }
.setting .rowchips .chip { font-size: 12px; padding: 6px 10px; }


/* Admin user rows: identity on top, actions underneath - chips beside wrapping
   names collide on a phone. */
.userrow { background: var(--surface); border-radius: 16px; padding: 12px 14px; margin: 8px 0; }
.userhead { display: flex; align-items: center; gap: 12px; }
.userhead .ms { color: var(--accent); }
.userhead .t { font-weight: 600; }
.userhead .s { color: var(--muted); font-size: 13px; }
.useractions { margin-top: 10px; }
.useractions .chip { font-size: 13px; padding: 7px 12px; }


/* The shell hands us the device's real insets (--inset-*), so one layout fits
   a notch, a gesture bar or a landscape cutout without knowing the device. */
.embedded .view {
  padding-left: calc(16px + var(--inset-left, 0px));
  padding-right: calc(16px + var(--inset-right, 0px));
  padding-bottom: calc(24px + var(--inset-bottom, 0px));
}

/* A header the PAGE draws (inside the native shell there's no browser chrome).
   Hides on the way down, returns on the way up - and because it's part of the
   page, content is spaced for it exactly. */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center;
  padding: calc(8px + var(--inset-top, 0px)) calc(12px + var(--inset-right, 0px)) 8px
           calc(12px + var(--inset-left, 0px));
  background: var(--bg);
  transition: transform .2s ease;
}
.appbar.up { transform: translateY(-100%); }
.has-appbar .view { padding-top: calc(64px + var(--inset-top, 0px)); }

.appbarmenubtn {
  display: inline-flex; align-items: center; gap: 12px;
  background: none; border: 0; color: var(--text);
  padding: 6px 10px; margin-left: -6px; border-radius: 12px;
  font: inherit; cursor: pointer; text-align: left;
  transition: background .15s ease;
}
.appbarmenubtn:hover, .appbarmenubtn:active { background: var(--surface); }
.appbarmenubtn.static { cursor: default; pointer-events: none; background: none !important; }
.appbarmenubtn.static .bars { display: none; }
.appbarmenubtn .bars { display: inline-flex; flex-direction: column; gap: 3.5px; flex: 0 0 auto; }
.appbarmenubtn .bars i { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.appbarmenubtn .t { font-size: 20px; font-weight: 700; color: var(--text); }


/* The native shell overrides the palette variables with the app's live theme;
   these few rules cover what a colour swap alone can't (borders that only read
   on light backgrounds, and the login/video overlays). */
.lighttheme .chip { border: 1px solid rgba(0, 0, 0, .12); }
.lighttheme .adminput, .lighttheme .adminselect { border: 1px solid rgba(0, 0, 0, .12); }
.lighttheme .userrow, .lighttheme .admincard, .lighttheme .setting { border: 1px solid rgba(0, 0, 0, .06); }

/* Bottom-bar editor */
.navpreview {
  display: flex; justify-content: space-around; align-items: center;
  background: var(--surface2); border-radius: 999px;
  padding: 10px 6px; margin-bottom: 14px;
}
.navpv {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 11px; min-width: 0;
}
.navpv span:last-child { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navpv .ic { display: flex; }
.navpv.on { color: var(--accent); }

.navitem { background: var(--surface2); border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.navitem.fixed { opacity: .55; }
.navmain { display: flex; align-items: center; gap: 10px; }
.navmain .grow { flex: 1; font-weight: 600; }
.navmain .adminput { flex: 1; margin: 0; }
.iconpick {
  flex: none; width: 44px; height: 44px; border-radius: 12px; border: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--accent); cursor: pointer;
}
.iconpick.still { cursor: default; }
.rowbtn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); cursor: pointer;
}
.rowbtn:hover { background: var(--surface); }
.rowbtn[disabled] { opacity: .25; pointer-events: none; }
.navdetail { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-left: 54px; flex-wrap: wrap; }
.navkind { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.navdetail .adminput { flex: 1; min-width: 120px; margin: 0; }
.navmode .chip { padding: 6px 12px; }
.icongrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(128, 128, 128, .15);
}
.icongrid[hidden] { display: none; }
.iconopt {
  height: 44px; border-radius: 10px; border: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.iconopt.on { color: var(--accent-dark); background: var(--accent); }

/* The admin user list shows real profile pictures; sized to match the icon it
   replaces so rows keep their rhythm whether someone has one or not. */
.userhead .useravatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--surface);
}
