/* ==========================================================================
   GD-Remote — glass admin panel for iPhone.

   Built for one-handed use in standalone (home screen) mode:
   - native iOS type sizes, sized to the iPhone's 390–430pt widths
   - frosted surfaces over a soft colour field
   - system font only: nothing to download, so a cold launch paints at once

   Performance rule for the glass: real blur (backdrop-filter) goes only on a
   handful of large surfaces — header, tab bar, sheets, dialog, keypad, toasts.
   Cards and list rows get translucent fills instead. Blurring every row makes
   scrolling stutter on a phone, and over this backdrop the result looks the
   same, because the colour field behind them is already soft.
   ========================================================================== */

:root {
  --ink:        #08070d;

  --glass:      rgba(255, 255, 255, .075);
  --glass-2:    rgba(255, 255, 255, .11);
  --glass-3:    rgba(255, 255, 255, .17);
  --stroke:     rgba(255, 255, 255, .13);
  --stroke-2:   rgba(255, 255, 255, .22);
  --hairline:   rgba(255, 255, 255, .08);
  --highlight:  rgba(255, 255, 255, .10);
  --panel:      rgba(22, 20, 32, .58);
  --panel-2:    rgba(26, 23, 38, .80);

  --text:       #ffffff;
  --text-2:     rgba(255, 255, 255, .72);
  --text-3:     rgba(255, 255, 255, .48);

  --accent:     #ff8a3d;
  --accent-ink: #1d0d02;

  /* iOS system colours, so status reads the way it does everywhere else on the phone. */
  --green:  #30d158;
  --teal:   #64d2ff;
  --blue:   #0a84ff;
  --violet: #bf5af2;
  --pink:   #ff375f;
  --yellow: #ffd60a;
  --orange: #ff9f0a;
  --red:    #ff453a;

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --blur: saturate(170%) blur(24px);

  --gutter: 16px;
  --head-h: 104px;
  --tab-h:  58px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Keep inputs at 16px or more, or iOS zooms the page when one is focused. */
input, textarea, select { font-size: 17px; }

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

.is-hidden { display: none !important; }

.ic {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Decide the first screen before any script runs (see the head of index.html). */
html.boot-app #screen-pin { display: none !important; }
html.boot-app #app.is-hidden { display: block !important; }

/* --------------------------------------------------------------------------
   Backdrop — the colour field every glass surface sits on
   -------------------------------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(62vmax 58vmax at 6% -8%,   rgba(255, 138, 61, .52), transparent 62%),
    radial-gradient(56vmax 52vmax at 108% 28%, rgba(255, 45, 120, .40), transparent 62%),
    radial-gradient(70vmax 60vmax at -6% 108%, rgba(94, 92, 246, .44), transparent 60%),
    radial-gradient(44vmax 44vmax at 76% 112%, rgba(191, 90, 242, .30), transparent 60%),
    var(--ink);
}

/* --------------------------------------------------------------------------
   Shared surfaces
   -------------------------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .105), rgba(255, 255, 255, .055));
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--highlight), 0 10px 28px rgba(0, 0, 0, .18);
}

.glass-panel {
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 var(--highlight), 0 20px 50px rgba(0, 0, 0, .35);
}

/* --------------------------------------------------------------------------
   PIN — modelled on the iOS passcode screen
   -------------------------------------------------------------------------- */

.lock {
  --key:   min(22vw, 84px);
  --gap-x: min(6.6vw, 28px);
  --gap-y: min(3.8vw, 16px);

  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding:
    calc(var(--safe-t) + clamp(24px, 6vh, 64px))
    24px
    calc(var(--safe-b) + clamp(14px, 3vh, 28px));
  -webkit-user-select: none;
  user-select: none;
}

.lock__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.lock__mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffb07a, var(--accent) 55%, #d9621c);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .5px;
  box-shadow: 0 10px 30px rgba(255, 138, 61, .35), inset 0 1px 0 rgba(255, 255, 255, .45);
}

.lock__title {
  margin-top: 18px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.01em;
}

.lock__sub {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-2);
}

.lock__dots {
  display: flex;
  gap: 22px;
  margin-top: 30px;
  height: 14px;
}

.pin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .9);
  transition: background-color .12s;
}

.pin-dot.is-on { background: #fff; }

.lock__dots.is-busy .pin-dot { animation: pulse 1s ease-in-out infinite; background: #fff; }
.lock__dots.is-busy .pin-dot:nth-child(2) { animation-delay: .12s; }
.lock__dots.is-busy .pin-dot:nth-child(3) { animation-delay: .24s; }
.lock__dots.is-busy .pin-dot:nth-child(4) { animation-delay: .36s; }
.lock__dots.is-busy .pin-dot:nth-child(5) { animation-delay: .48s; }
.lock__dots.is-busy .pin-dot:nth-child(6) { animation-delay: .60s; }

.lock__dots.is-wrong { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
.lock__dots.is-wrong .pin-dot { border-color: var(--red); background: var(--red); }

@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-10px); }
  40%, 60% { transform: translateX(10px); }
}

.lock__error {
  min-height: 22px;
  max-width: 300px;
  margin-top: 16px;
  font-size: 15px;
  color: #ffb0aa;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, var(--key));
  column-gap: var(--gap-x);
  row-gap: var(--gap-y);
}

.key {
  width: var(--key);
  height: var(--key);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background-color .18s ease-out;
}

/* iOS flashes a pressed key lighter and lets it fade back. */
.key:active,
.key.is-pressed {
  background: rgba(255, 255, 255, .42);
  transition: none;
}

.key__digit {
  font-size: calc(var(--key) * .44);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.key__letters {
  margin-top: 3px;
  font-size: calc(var(--key) * .12);
  font-weight: 700;
  letter-spacing: .2em;
  line-height: 1;
  padding-left: .2em;
  opacity: .9;
}

.keypad__gap { width: var(--key); height: var(--key); }

.lock__foot {
  width: calc(var(--key) * 3 + var(--gap-x) * 2);
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.lock__link {
  min-width: var(--key);
  padding: 12px 0;
  font-size: 17px;
  color: var(--text);
  text-align: center;
}

.lock__link.is-invisible { visibility: hidden; }

/* Shorter phones (SE, mini): shrink the pad so everything still fits. */
@media (max-height: 740px) {
  .lock { --key: min(20vw, 76px); --gap-y: min(3vw, 13px); }
  .lock__dots { margin-top: 22px; }
}

@media (max-height: 620px) {
  .lock { --key: min(18vw, 66px); --gap-y: 10px; }
  .lock__mark { width: 42px; height: 42px; border-radius: 13px; font-size: 16px; }
  .lock__title { margin-top: 12px; }
}

/* --------------------------------------------------------------------------
   Server address (setup)
   -------------------------------------------------------------------------- */

.setup {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px);
}

.setup__card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px 24px;
  border-radius: var(--r-xl);
  text-align: center;
}

.setup__title { margin-top: 16px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.setup__sub   { margin-top: 6px; font-size: 16px; color: var(--text-2); }

.stack { display: grid; gap: 12px; margin-top: 24px; text-align: left; }

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(255, 69, 58, .16);
  border: 1px solid rgba(255, 69, 58, .4);
  color: #ffb4ae;
  font-size: 15px;
  text-align: left;
}

/* --------------------------------------------------------------------------
   App frame: content scrolls beneath a blurred header and tab bar
   -------------------------------------------------------------------------- */

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding:
    calc(var(--safe-t) + var(--head-h) + 14px)
    calc(var(--gutter) + var(--safe-r))
    calc(var(--safe-b) + var(--tab-h) + 28px)
    calc(var(--gutter) + var(--safe-l));
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: calc(var(--safe-t) + 8px) calc(var(--gutter) + var(--safe-r)) 12px calc(var(--gutter) + var(--safe-l));
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
}

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}

.topbar__title {
  margin-top: 6px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.12;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px 0 11px;
  border-radius: 16px;
  background: var(--glass-2);
  border: 1px solid var(--stroke);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  max-width: calc(100% - 56px);
}

.live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.live.is-up   .live__dot { background: var(--green); box-shadow: 0 0 0 0 rgba(48, 209, 88, .6); animation: ping 2s infinite; }
.live.is-down .live__dot { background: var(--red); }

@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(48, 209, 88, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass-2);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 20px;
}

.icon-btn:active { background: var(--glass-3); }
.icon-btn.is-spinning .ic { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 0 calc(4px + var(--safe-r)) var(--safe-b) calc(4px + var(--safe-l));
  background: var(--panel);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-top: 1px solid var(--hairline);
}

.tab {
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 26px;
  transition: color .15s;
}

.tab__label { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.tab.is-active { color: var(--accent); }

/* --------------------------------------------------------------------------
   Section headers
   -------------------------------------------------------------------------- */

.section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 4px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.view > .section:first-child { margin-top: 4px; }

.section__note {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--yellow);
}

.section--danger { color: var(--red); }

.footnote {
  margin: 8px 6px 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Players
   -------------------------------------------------------------------------- */

.summary {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  padding: 16px 6px;
}

.summary__stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 12px;
  min-width: 0;
}

.summary__stat + .summary__stat { border-left: 1px solid var(--hairline); }

.summary__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.meter {
  display: block;
  height: 5px;
  margin-top: 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}

.meter__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--teal));
  transition: width .4s ease;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  margin: 14px 0;
  padding: 0 16px;
  border-radius: var(--r-md);
  background: var(--glass);
  border: 1px solid var(--stroke);
}

.search:focus-within { border-color: rgba(255, 138, 61, .6); }

.search__icon { font-size: 20px; color: var(--text-3); }

.search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.search__input::placeholder { color: var(--text-3); }
.search__input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

/* minmax(0, 1fr), not the default auto: a grid column otherwise refuses to be
   narrower than its longest unwrapped line, and rows ran off the right edge. */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 74px;
  padding: 12px 14px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, .095), rgba(255, 255, 255, .05));
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 var(--highlight);
  transition: transform .1s, background-color .15s;
}

button.row:active { transform: scale(.985); background: var(--glass-3); }
.row.is-blocked { opacity: .42; }

.row__main { flex: 1; min-width: 0; }

.row__title {
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__sub {
  margin-top: 2px;
  font-size: 14.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__end {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.idchip {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.avatar {
  --a1: #ff8a3d;
  --a2: #ff375f;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--a1), var(--a2));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 12px rgba(0, 0, 0, .22);
}

.avatar .ic { font-size: 22px; }
.avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.avatar--xl { width: 76px; height: 76px; font-size: 26px; }
.avatar--empty { --a1: rgba(255, 255, 255, .18); --a2: rgba(255, 255, 255, .08); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-2);
}

.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.pill--ok   { color: var(--green); }
.pill--mid  { color: var(--yellow); }
.pill--bad  { color: var(--orange); }
.pill--info { color: var(--teal); }
.pill--down { color: #fff; background: rgba(255, 69, 58, .85); border-color: transparent; }
.pill--muted { color: var(--text-2); }
.pill--danger { color: var(--red); }

.empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 15.5px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */

.target {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  text-align: left;
  border-radius: 22px;
}

.target:active { background: var(--glass-2); }

.target__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.target__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.target__name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target__meta {
  font-size: 14.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target__change {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 138, 61, .16);
  border: 1px solid rgba(255, 138, 61, .35);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  --tint: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  min-height: 118px;
  padding: 15px 15px 14px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .05));
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--highlight), 0 10px 26px rgba(0, 0, 0, .16);
  transition: transform .1s, background-color .15s;
}

.tile:active { transform: scale(.97); background: var(--glass-3); }

.tile__well {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 14px;
  color: var(--tint);
  font-size: 24px;
  background: rgba(255, 255, 255, .1);
  background: color-mix(in srgb, var(--tint) 20%, transparent);
  border: 1px solid rgba(255, 255, 255, .14);
  border: 1px solid color-mix(in srgb, var(--tint) 38%, transparent);
}

.tile__label { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.tile__note  { font-size: 13.5px; color: var(--text-3); }

/* A lone tile in a two-column grid spans the row instead of leaving a hole,
   laid out sideways so it does not become a tall empty slab. */
.tiles > .tile:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  min-height: 78px;
  column-gap: 14px;
}

.tiles > .tile:last-child:nth-child(odd) .tile__well { margin-bottom: 0; }
.tiles > .tile:last-child:nth-child(odd) .tile__label { flex: 1; }
.tiles > .tile:last-child:nth-child(odd) .tile__note { width: 100%; padding-left: 60px; margin-top: -18px; }

.tile--danger .tile__label { color: #ff8f88; }

.tile:disabled,
.tile.is-unavailable { opacity: .45; }
.tile.is-unavailable { border-style: dashed; }

/* --------------------------------------------------------------------------
   Grouped lists (iOS Settings style)
   -------------------------------------------------------------------------- */

.group {
  overflow: hidden;
  border-radius: 18px;
  padding: 0;
}

.group + .group { margin-top: 14px; }

.cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 10px 16px;
  text-align: left;
}

/* Inset separator that starts after the icon, like iOS. */
.cell + .cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 62px;
  right: 0;
  height: 1px;
  background: var(--hairline);
}

/* Rows with no icon: the separator runs from the text edge instead. */
.cell--plain + .cell--plain::before { left: 16px; }
.cell--plain { min-height: 52px; }

button.cell:active { background: var(--glass-2); }

.cell__icon {
  --tint: var(--blue);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--tint);
  color: #fff;
  font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}

.cell__label { flex: 1; min-width: 0; font-size: 17px; }
.cell__label--danger { color: var(--red); }

.cell__value {
  max-width: 55%;
  font-size: 16px;
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.cell__chev { font-size: 18px; color: var(--text-3); }

.card--danger {
  background: linear-gradient(180deg, rgba(255, 69, 58, .14), rgba(255, 69, 58, .06));
  border-color: rgba(255, 69, 58, .35);
}

.version {
  margin-top: 30px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   Server
   -------------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px 16px 15px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .105), rgba(255, 255, 255, .05));
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 var(--highlight);
}

.stat__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat__label {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.compose { padding: 14px; }

.compose__input {
  display: block;
  width: 100%;
  min-height: 100px;
  padding: 13px 15px;
  resize: none;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--stroke);
  color: var(--text);
  line-height: 1.4;
  outline: 0;
}

.compose__input:focus { border-color: rgba(255, 138, 61, .6); }
.compose__input::placeholder { color: var(--text-3); }

.compose__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.compose__count { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Activity
   -------------------------------------------------------------------------- */

.log-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chips {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 15px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  text-transform: capitalize;
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch__track {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  transition: background-color .2s;
}

.switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  transition: transform .2s;
}

.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); }
.switch__label { font-size: 15px; color: var(--text-2); }

.feed { padding: 2px 0; overflow: hidden; border-radius: 18px; }

.entry {
  position: relative;
  padding: 12px 16px 13px;
}

.entry + .entry::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--hairline);
}

.entry__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.entry__tag {
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .09);
  color: var(--text-2);
}

.entry__time {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.entry__msg { font-size: 15.5px; line-height: 1.4; word-break: break-word; }

.entry--action .entry__tag { background: rgba(255, 138, 61, .18); color: var(--accent); }
.entry--warn   .entry__tag { background: rgba(255, 214, 10, .16); color: var(--yellow); }
.entry--error  .entry__tag { background: rgba(255, 69, 58, .18);  color: var(--red); }
.entry--error  .entry__msg { color: #ffc2bd; }

/* --------------------------------------------------------------------------
   Buttons & fields
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 600;
  transition: transform .08s, opacity .15s;
}

.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn .ic { font-size: 19px; }

.btn--lg    { min-height: 56px; }
.btn--block { width: 100%; }

.btn--primary {
  background: linear-gradient(180deg, #ffa468, var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 8px 22px rgba(255, 138, 61, .32), inset 0 1px 0 rgba(255, 255, 255, .38);
}

.btn--danger {
  background: linear-gradient(180deg, #ff6d63, var(--red));
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 69, 58, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.btn--glass {
  background: var(--glass-2);
  border-color: var(--stroke);
  color: var(--text);
}

.field { display: grid; gap: 8px; }

.field__label {
  padding-left: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.field__input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, .24);
  border: 1px solid var(--stroke);
  color: var(--text);
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
}

.field__input:focus {
  border-color: rgba(255, 138, 61, .7);
  box-shadow: 0 0 0 3px rgba(255, 138, 61, .22);
}

.field__input::placeholder { color: var(--text-3); }
.field__input--area { min-height: 110px; resize: none; line-height: 1.4; }

select.field__input {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-opacity='.6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}

select.field__input option { background: #1c1a26; color: #fff; }

.hint { padding: 0 4px; font-size: 14px; color: var(--text-3); line-height: 1.4; }

/* --------------------------------------------------------------------------
   Sheets
   -------------------------------------------------------------------------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .45);
  animation: fade .18s ease;
}

.sheet--center {
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px);
}

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8%); opacity: .6; } }
@keyframes pop  { from { transform: scale(.94); opacity: 0; } }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } }

.sheet__panel {
  width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--panel-2);
  -webkit-backdrop-filter: saturate(170%) blur(30px);
  backdrop-filter: saturate(170%) blur(30px);
  border: 1px solid var(--stroke);
  border-bottom: 0;
  box-shadow: inset 0 1px 0 var(--highlight), 0 -20px 50px rgba(0, 0, 0, .35);
  animation: rise .26s cubic-bezier(.2, .9, .3, 1);
}

.sheet__panel--tall { height: 92vh; height: 92dvh; }

.sheet__grabber {
  width: 38px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, .28);
  flex-shrink: 0;
}

.sheet__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 10px;
  flex-shrink: 0;
}

.sheet__cancel {
  width: 80px;
  padding: 10px 6px;
  text-align: left;
  font-size: 17px;
  color: var(--accent);
}

.sheet__title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet__spacer { width: 80px; flex-shrink: 0; }

.sheet__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px var(--gutter) 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

/* Spectate feed */

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-md);
  background: #000;
  border: 1px solid var(--stroke);
}

.screen__frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.screen__frame:not([src]),
.screen__frame[src=""] { visibility: hidden; }

.screen__live {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 55, 95, .9);
}

.screen__live.is-stale { background: rgba(120, 120, 128, .85); }

.screen__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-size: 15px;
  color: var(--text-2);
  background: rgba(0, 0, 0, .55);
}

.search--sheet { margin: 2px var(--gutter) 10px; flex-shrink: 0; }
.chips--sheet  { flex: none; padding: 0 var(--gutter) 10px; }

.list--sheet {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px var(--gutter) 16px;
  align-content: start;
}

.sheet__count {
  flex-shrink: 0;
  padding: 8px var(--gutter) 10px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

/* Player detail */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0 2px;
  text-align: center;
}

.hero .avatar { margin-bottom: 8px; }
.hero__name { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.hero__sub  { font-size: 15.5px; color: var(--text-2); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fact {
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--stroke);
  min-width: 0;
}

.fact__label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.fact__value {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.minis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini {
  --tint: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 12px 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--stroke);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.mini:active { background: var(--glass-3); }

.mini__well {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--tint);
  font-size: 21px;
  background: rgba(255, 255, 255, .1);
  background: color-mix(in srgb, var(--tint) 20%, transparent);
}

.mini.is-unavailable { opacity: .45; border-style: dashed; }
.mini--danger { color: #ff8f88; }

/* Confirmation dialog */

.dialog {
  width: 100%;
  max-width: 400px;
  padding: 24px 20px 20px;
  border-radius: var(--r-xl);
  background: var(--panel-2);
  -webkit-backdrop-filter: saturate(170%) blur(30px);
  backdrop-filter: saturate(170%) blur(30px);
  border: 1px solid var(--stroke-2);
  box-shadow: inset 0 1px 0 var(--highlight), 0 30px 70px rgba(0, 0, 0, .5);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}

.dialog__title { font-size: 22px; font-weight: 700; text-align: center; letter-spacing: -.01em; }

.dialog__body {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text-2);
  text-align: center;
}

.dialog__facts {
  margin-top: 18px;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--stroke);
}

.dialog__fact {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  font-size: 16px;
}

.dialog__fact + .dialog__fact::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15px;
  right: 0;
  height: 1px;
  background: var(--hairline);
}

.dialog__fact span:first-child { color: var(--text-2); flex-shrink: 0; }
.dialog__fact span:last-child  { font-weight: 600; text-align: right; word-break: break-word; }

.dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

/* --------------------------------------------------------------------------
   Toasts & busy
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  top: calc(var(--safe-t) + 10px);
  left: 12px;
  right: 12px;
  z-index: 90;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--panel-2);
  -webkit-backdrop-filter: saturate(170%) blur(30px);
  backdrop-filter: saturate(170%) blur(30px);
  border: 1px solid var(--stroke-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.35;
  animation: drop .25s cubic-bezier(.2, .9, .3, 1);
  transition: opacity .25s, transform .25s;
}

.toast__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--teal); }
.toast--ok    .toast__dot { background: var(--green); }
.toast--error .toast__dot { background: var(--red); }
.toast.is-leaving { opacity: 0; transform: translateY(-10px); }

.busy {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .35);
}

.busy__spin {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}

/* --------------------------------------------------------------------------
   No backdrop-filter: fall back to near-opaque panels so text stays readable.
   -------------------------------------------------------------------------- */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .tabbar, .sheet__panel, .dialog, .toast, .glass-panel { background: rgba(24, 22, 34, .96); }
  .key { background: rgba(255, 255, 255, .16); }
}

/* --------------------------------------------------------------------------
   Desktop (a real mouse): keep the phone layout in a centred column.
   Width alone is not used — a phone in desktop-site mode reports a wide
   viewport, and that squeezed the app on a real iPhone before.
   -------------------------------------------------------------------------- */

@media (min-width: 640px) and (pointer: fine) {
  .app {
    left: 50%;
    right: auto;
    width: 480px;
    margin-left: -240px;
    border-left: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
  }

  .sheet__panel { max-width: 480px; margin: 0 auto; }
  .toasts { left: 50%; right: auto; width: 456px; margin-left: -228px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
