/* Deckarr: a night-shift control panel for a home media server.
   Navy ink surfaces, one sodium-amber signal colour, posters carry the rest. */

:root {
  color-scheme: light dark;

  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #e3e8ef;
  --surface-3: #d3dae4;
  --text: #15212d;
  --text-2: #566473;
  --text-3: #8592a0;
  --line: rgba(21, 33, 45, 0.11);
  --accent: #9a6209;
  --amber: #f2b14a;
  --on-amber: #2a1a02;
  --ok: #1f8a5a;
  --warn: #c2570c;
  --bad: #c8372f;
  --scrim: rgba(13, 21, 32, 0.42);
  --ticket-bg: rgba(13, 21, 32, 0.74);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --tabbar-h: 54px;
  --r-group: 14px;
  --r-poster: 9px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1520;
    --surface: #152131;
    --surface-2: #1e2c3e;
    --surface-3: #2a3b50;
    --text: #e7edf4;
    --text-2: #97a6b7;
    --text-3: #64758a;
    --line: rgba(231, 237, 244, 0.1);
    --accent: #f2b14a;
    --ok: #3cc488;
    --warn: #ff8f4d;
    --bad: #f06a5f;
    --scrim: rgba(0, 0, 0, 0.55);
    --ticket-bg: rgba(5, 10, 16, 0.78);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

html.locked,
html.locked body {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}

body.gate-mode {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
}

.ico {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.ico svg {
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- page frame ---------- */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 2px 4px;
}

.large-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 33px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 3px 0 0;
  color: var(--text-2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.page-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 4px;
}

.section {
  margin-top: 28px;
}

.section:first-of-type {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 9px;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-aside {
  color: var(--text-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.section-aside a,
.link-btn {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 0;
  font-size: 15px;
}

.section-note {
  margin: 8px 4px 0;
  color: var(--text-2);
  font-size: 13.5px;
}

/* ---------- grouped lists ---------- */

.list {
  background: var(--surface);
  border-radius: var(--r-group);
  overflow: hidden;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  background: none;
  border: 0;
  text-align: left;
  text-decoration: none;
  color: inherit;
}

.row + .row::before,
.row + .field::before,
.field + .row::before,
.field + .field::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 14px;
  border-top: 1px solid var(--line);
}

.row.has-lead + .row::before {
  left: 62px;
}

button.row:active,
a.row:active {
  background: var(--surface-2);
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  display: block;
  font-weight: 560;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-sub {
  display: block;
  margin-top: 1px;
  color: var(--text-2);
  font-size: 13.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-sub.wrap {
  white-space: normal;
}

.row-sub.warn {
  color: var(--warn);
}

.row-sub.bad {
  color: var(--bad);
}

.mark {
  width: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mark .ico {
  margin: 0 -6px;
}

.mark.warn {
  color: var(--warn);
}

.mark.bad {
  color: var(--bad);
}

.row-trail {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-trail b {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.row .chev {
  color: var(--text-3);
  margin-right: -4px;
}

.row.action {
  justify-content: center;
  font-size: 17px;
  font-weight: 560;
  color: var(--accent);
  min-height: 54px;
}

.row.action.destructive {
  color: var(--bad);
}

.row.add {
  color: var(--accent);
  font-weight: 600;
}

.lead {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
}

.lead img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead.thumb {
  width: 36px;
  height: 54px;
  border-radius: 6px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
  color: var(--text-2);
  font-size: 15px;
}

/* ---------- signal lights ---------- */

.light {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
  color: var(--text-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
}

.light.ok {
  background: var(--ok);
  color: var(--ok);
}

.light.warn {
  background: var(--warn);
  color: var(--warn);
}

.light.bad {
  background: var(--bad);
  color: var(--bad);
}

.light.active {
  background: var(--amber);
  color: var(--amber);
}

/* ---------- progress ---------- */

.bar {
  height: 4px;
  margin-top: 7px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  border-radius: inherit;
  background: var(--amber);
  transition: width 0.5s ease;
}

.bar.paused > i,
.bar.queued > i {
  background: var(--text-3);
}

.bar.warn > i {
  background: var(--warn);
}

.bar.bad > i {
  background: var(--bad);
}

.bar.ok > i {
  background: var(--ok);
}

.meter {
  height: 10px;
  margin: 10px 0 6px;
  border-radius: 5px;
}

/* ---------- the poster shelf (home hero) ---------- */

.shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 122px;
  gap: 12px;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  scrollbar-width: none;
}

.shelf::-webkit-scrollbar {
  display: none;
}

.shelf-item {
  position: relative;
  align-self: start;
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
}

.ticket {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 3px 8px 3px;
  border-radius: 999px;
  background: var(--ticket-bg);
  color: #f3f6fa;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.ticket.today {
  background: var(--amber);
  color: var(--on-amber);
}

.shelf-title {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-sub {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

/* ---------- posters ---------- */

.poster-wrap {
  position: relative;
}

.poster {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--r-poster);
  background: var(--surface-2);
}

.poster-empty {
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
}

.poster-done {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: 16px 11px;
  margin-top: 14px;
}

.tile {
  align-self: start;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  content-visibility: auto;
  contain-intrinsic-size: 102px 200px;
}

.tile.dim .poster {
  opacity: 0.45;
}

.tile-flag {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px rgba(13, 21, 32, 0.6);
}

.tile-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-sub {
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ---------- controls ---------- */

.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin-top: 14px;
  border-radius: 10px;
  background: var(--surface-2);
}

.seg button {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.chips {
  display: flex;
  gap: 8px;
  margin: 12px -16px 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  margin-top: 14px;
  padding: 0 10px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text-3);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 16px;
}

.search input::placeholder {
  color: var(--text-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
}

.btn > span:not(.ico) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn:active {
  filter: brightness(0.94);
}

.btn:disabled {
  opacity: 0.5;
}

.btn-primary {
  background: var(--amber);
  color: var(--on-amber);
}

.btn-danger {
  color: var(--bad);
}

.btn-block {
  width: 100%;
}

.btn-small {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14.5px;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn.accent {
  background: var(--amber);
  color: var(--on-amber);
}

.icon-btn.plain {
  background: none;
  color: var(--accent);
}

.spin svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- forms ---------- */

.field {
  position: relative;
  display: block;
  padding: 9px 14px 10px;
}

.field > span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.field input,
.field select {
  display: block;
  width: 100%;
  padding: 2px 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
}

.field input::placeholder {
  color: var(--text-3);
}

.field.with-btn {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.field.with-btn > label {
  flex: 1;
  min-width: 0;
}

.field.with-btn > label > span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.hint {
  margin: 7px 16px 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}

.group-label {
  margin: 22px 16px 7px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 560;
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--surface-3);
  transition: background 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s;
}

.switch:checked {
  background: var(--ok);
}

.switch:checked::after {
  transform: translateX(20px);
}

.result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--r-group);
  background: var(--surface);
  font-size: 14.5px;
}

.result .light {
  margin-top: 6px;
}

/* ---------- feedback ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-group);
  background: color-mix(in srgb, var(--bad) 11%, var(--surface));
  font-size: 14.5px;
}

.notice.warn {
  background: color-mix(in srgb, var(--warn) 13%, var(--surface));
}

.notice .ico {
  color: var(--bad);
  margin-top: 1px;
}

.notice.warn .ico {
  color: var(--warn);
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice .link-btn {
  display: inline-block;
  margin-top: 6px;
  font-size: 14.5px;
}

.empty {
  padding: 30px 22px;
  text-align: center;
  color: var(--text-2);
  font-size: 15px;
  border-radius: var(--r-group);
  background: var(--surface);
}

.empty h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 650;
}

.empty p {
  margin: 0 auto;
  max-width: 34ch;
}

.empty .btn {
  margin-top: 16px;
}

.quiet {
  padding: 14px 4px;
  color: var(--text-2);
  font-size: 15px;
}

.skel {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.skel-row {
  height: 50px;
  margin: 0 14px;
  border-radius: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.skel-row::before {
  content: "";
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tag.warn {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
}

.tag.bad {
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--bad);
}

.tag.ok {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.stat {
  padding: 11px 14px 12px;
  background: var(--surface);
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: var(--text-2);
  font-size: 13px;
}

.panel {
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.panel-sub {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  backdrop-filter: saturate(1.6) blur(20px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
}

.tab[aria-current="page"] {
  color: var(--accent);
}

/* ---------- sheets ---------- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 0.25s;
}

.sheet-scrim.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 18px);
  margin: 0 auto;
  border-radius: 16px 16px 0 0;
  background: var(--bg);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(105%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet.tall {
  height: calc(100dvh - env(safe-area-inset-top, 0px) - 18px);
}

.sheet.open {
  transform: translateY(0);
}

.sheet.dragging {
  transition: none;
}

.sheet-grab {
  width: 36px;
  height: 5px;
  margin: 7px auto 0;
  border-radius: 3px;
  background: var(--surface-3);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 4px 14px 6px 18px;
  touch-action: none;
}

.sheet-title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 650;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 16px calc(22px + env(safe-area-inset-bottom, 0px));
}

.sheet-msg {
  margin: 0 4px 14px;
  color: var(--text-2);
  font-size: 15px;
}

.sheet .cancel {
  margin-top: 10px;
}

/* ---------- detail sheet ---------- */

.detail-head {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

.detail-head .poster-wrap {
  width: 108px;
  flex-shrink: 0;
}

.detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.detail-meta {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 14.5px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.overview {
  margin: 16px 2px 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.overview.open {
  -webkit-line-clamp: unset;
}

.result-thumb {
  width: 46px;
  flex-shrink: 0;
}

.result-thumb .poster {
  border-radius: 6px;
}

/* ---------- toast ---------- */

.toast-root {
  position: fixed;
  right: 0;
  left: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 60;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 11px 17px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.bad {
  background: var(--bad);
  color: #fff;
}

/* ---------- sign-in gate ---------- */

.gate {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 20px;
}

.gate-card {
  width: min(380px, 100%);
}

.gate-icon {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  display: block;
}

.gate h1 {
  margin: 18px 0 6px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate p {
  margin: 0 0 20px;
  color: var(--text-2);
}

.gate .error {
  margin: 10px 4px 0;
  color: var(--bad);
  font-size: 14.5px;
}

@media (min-width: 700px) {
  .shelf {
    grid-auto-columns: 140px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }
}

.auth-mode .seg {
  margin: 0 0 14px;
}

.row-trail.wrap {
  max-width: 62%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.log {
  max-height: 55vh;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

.container-list .btn-row {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.vm-row {
  cursor: pointer;
}

.updates .notice-body > div:first-child {
  white-space: pre-line;
}

.server-picker .chips {
  margin-top: 0;
  margin-bottom: 8px;
}
