/* PlayStream - spelaren */
:root {
  --bg: #12151c;
  --panel: #1b202a;
  --panel2: #232a36;
  --text: #e8ecf2;
  --muted: #8b95a7;
  --accent: #2fbf71;
  --accent2: #1f8f53;
  --warn: #e0a030;
  --danger: #e04848;
  --sel: #2b4a7a;
}

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

#ps-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  #ps-app {
    grid-template-columns: 420px 1fr;
    grid-template-areas:
      "top top"
      "select list"
      "player list";
  }
  .ps-top { grid-area: top; }
  .ps-select { grid-area: select; }
  .ps-player { grid-area: player; }
  .ps-listpanel { grid-area: list; }
}

.ps-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.ps-brand { font-weight: 700; letter-spacing: .5px; color: var(--accent); }
.ps-clock {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 10px;
}
.ps-clock-sep { font-size: .35em; color: var(--muted); margin-right: 18px; }
.ps-status { color: var(--muted); font-size: 14px; width: 100%; }

.ps-panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 14px;
}

.ps-select { display: grid; gap: 12px; }
.ps-field { display: grid; gap: 6px; }
.ps-field > span { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

select {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid #333c4b;
  border-radius: 8px;
  font-size: 18px;
  padding: 10px;
}

.ps-stepper { display: flex; align-items: center; gap: 6px; }
.ps-value {
  min-width: 70px; text-align: center;
  font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ps-narrow { min-width: 44px; }

.ps-btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid #333c4b;
  border-radius: 10px;
  font-size: 18px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ps-btn:hover { border-color: #4a566b; }
.ps-btn:active { transform: translateY(1px); background: #2c3443; }
.ps-small { min-width: 52px; }
.ps-wide { width: 100%; }
.ps-primary { background: var(--accent2); border-color: var(--accent); font-weight: 600; }
.ps-primary:hover { background: var(--accent); }

.ps-now {
  font-size: 20px; font-weight: 600; min-height: 1.4em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ps-prog {
  height: 22px; background: var(--panel2); border-radius: 11px;
  overflow: hidden; margin-top: 10px; cursor: pointer;
}
.ps-prog-bar { height: 100%; width: 0%; background: var(--accent); transition: width .25s linear; }
.ps-prog-bar.warn { background: linear-gradient(90deg, var(--accent), var(--danger)); }
.ps-prog-bar.end  { background: var(--danger); }
.ps-times {
  display: flex; justify-content: space-between;
  font-size: 22px; font-variant-numeric: tabular-nums; margin-top: 6px;
}
#timeLeft { font-weight: 700; }

.ps-controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.ps-ctrl { font-size: 22px; padding: 16px 0; }
.ps-play { background: var(--accent2); border-color: var(--accent); font-weight: 700; }
.ps-play.playing { background: var(--warn); border-color: var(--warn); color: #1a1a1a; }

.ps-volume { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); }
.ps-volume input { flex: 1; }

.ps-listpanel { display: flex; flex-direction: column; min-height: 300px; }
.ps-listhead { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.ps-list {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; max-height: 70vh;
}
.ps-list li {
  display: grid; grid-template-columns: 48px 1fr auto;
  gap: 10px; align-items: center;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  border-bottom: 1px solid #222835;
}
.ps-list li:hover { background: var(--panel2); }
.ps-list li.sel { background: var(--sel); }
.ps-list li.playing { background: var(--accent2); }
.ps-list .t { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.ps-list li.playing .t, .ps-list li.sel .t { color: var(--text); }
.ps-list .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-list .a { color: var(--muted); }
.ps-list li.playing .a, .ps-list li.sel .a { color: #cfd6e2; }
.ps-list .nr { color: var(--muted); font-size: 13px; }

.ps-code { color: var(--muted); font-size: 15px; }
.ps-code b {
  color: var(--text); font-size: 22px; letter-spacing: 3px;
  background: var(--panel2); padding: 4px 10px; border-radius: 8px; margin-left: 6px;
}

.ps-code.linked b { background: var(--accent2); }
.ps-toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -150%);
  background: var(--accent2); color: #fff; border: 1px solid var(--accent);
  font-size: 22px; font-weight: 700; padding: 16px 28px; border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: transform .35s ease; z-index: 1000; pointer-events: none;
}
.ps-toast.show { transform: translate(-50%, 0); }

.ps-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ps-rstate { font-size: 14px; color: var(--muted); }
.ps-code.linked .ps-rstate { color: var(--accent); font-weight: 600; }
.ps-swap { font-size: 14px; padding: 6px 10px; }

.ps-hidden { display: none !important; }
.ps-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 12, 18, .94);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.ps-overlay-box { text-align: center; display: grid; gap: 14px; padding: 24px; }
.ps-big-brand { font-size: 40px; }
.ps-ov-label { color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.ps-ov-code { font-size: clamp(64px, 16vw, 140px); font-weight: 800; letter-spacing: 12px; font-variant-numeric: tabular-nums; }
.ps-ov-btn { font-size: 26px; padding: 20px 32px; }
.ps-ov-hint { color: var(--muted); font-size: 15px; line-height: 1.5; }

.ps-approve { z-index: 950; cursor: default; }
.ps-ov-icon { font-size: 64px; }
.ps-ov-title { font-size: 30px; font-weight: 700; }
.ps-ov-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.ps-deny { font-size: 26px; padding: 20px 32px; background: #5a2323; border-color: var(--danger); }

/* Startsida: två val */
.ps-choice { z-index: 960; cursor: default; }
.ps-listmode { z-index: 955; cursor: default; }
.ps-choice-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 10px; max-width: 760px; }
.ps-choice-btn { display: grid; gap: 8px; padding: 28px 22px; text-align: center; }
.ps-choice-icon { font-size: 44px; }
.ps-choice-title { font-size: 28px; font-weight: 700; }
.ps-choice-sub { font-size: 15px; color: #cfd6e2; font-weight: 400; }

/* ---------- Listläget ---------- */
.ps-listmode {
  position: fixed; inset: 0; z-index: 955; overflow-y: auto;
  background: var(--bg); padding: 12px 16px 24px; box-sizing: border-box;
}
.lb-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 1300px; margin: 0 auto 12px; }
.lb-title { font-size: 26px; font-weight: 700; }
.lb-free { color: var(--accent); font-size: 14px; }
.lb-grid { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 1300px; margin: 0 auto; }
@media (min-width: 1000px) { .lb-grid { grid-template-columns: 1fr 1fr; } }
.lb-col { display: flex; flex-direction: column; gap: 10px; min-height: 60vh; }
.lb-search { display: grid; gap: 8px; }
.lb-tempo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lb-listhead { display: flex; gap: 8px; }
.lb-listhead .lb-input { flex: 1; min-width: 0; }
.lb-input {
  background: var(--panel2); color: var(--text); border: 1px solid #333c4b;
  border-radius: 8px; font-size: 17px; padding: 10px; box-sizing: border-box; width: 100%;
}
.lb-sub { color: var(--muted); font-size: 14px; min-height: 1.2em; }
.lb-msg { color: var(--warn); margin-left: 8px; }
.lb-rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 62vh; }
.lb-rows li {
  display: grid; grid-template-columns: auto 44px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 4px; border-bottom: 1px solid #222835;
}
#lbList li { grid-template-columns: 28px auto 44px 1fr auto; }
.lb-rows li.lb-playing { background: #1f3a2a; }
.lb-t { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.lb-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-a { color: var(--muted); }
.lb-nr { color: var(--muted); font-size: 13px; text-align: right; }
.lb-ic { font-size: 15px; padding: 6px 10px; min-width: 38px; }
.lb-add { background: var(--accent2); border-color: var(--accent); font-weight: 700; }
.lb-del { background: #4a2020; border-color: #7a3030; }
.lb-move { display: flex; gap: 4px; }
