/* 群控投屏 Web — black rack, lime = live / selected / linked.
   Lime is reserved for state: the server link is up, a phone is checked, phones are linked in sync mode,
   the primary action. Everything else stays black, graphite and grey. */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("/fonts/BigShouldersDisplay-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}

:root {
  --black: #000;
  --panel: #101210;
  --raised: #1a1d18;
  --hover: #23271f;
  --line: #2a2e26;
  --line-strong: #3e4537;
  --text: #eef3e7;
  --muted: #8d9584;
  --lime: #b8ff3d;
  --lime-hover: #ccff75;
  --lime-wash: rgba(184, 255, 61, .09);
  --amber: #ffb83d;
  --red: #ff5b4f;
  --ui: "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", system-ui, sans-serif;
  --num: "Big Shoulders Display", var(--ui);
  --tile-w: 200px;
  /* radius by size of the thing: phones look like phones, panels are softer, controls are tight */
  --r-phone: 18px;
  --r-screen: 12px;
  --r-panel: 14px;
  --r-ctl: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
@supports (height: 100dvh) { body { height: 100dvh; } } /* phones: the visible height, not behind the address bar */
body {
  background: var(--black);
  color: var(--text);
  font: 13px/1.5 var(--ui);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--lime); color: #000; }

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

button {
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 5px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
button:hover:not(:disabled) { background: var(--hover); border-color: var(--line-strong); }
button:disabled { opacity: .32; cursor: default; }
button.primary { background: var(--lime); border-color: var(--lime); color: #000; font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--lime-hover); border-color: var(--lime-hover); }
button.danger { color: var(--red); border-color: #4a201c; background: transparent; }
button.danger:hover:not(:disabled) { background: #261210; border-color: var(--red); }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 5px 9px;
  min-width: 0;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--lime); }
input::placeholder, textarea::placeholder { color: #5d6456; }
input[type=range] { accent-color: var(--lime); padding: 0; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* square checkboxes: lime box with a black tick */
input[type=checkbox]:not(.switch input) {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--black) center / 12px no-repeat;
  cursor: pointer;
}
input[type=checkbox]:not(.switch input):hover { border-color: var(--muted); }
input[type=checkbox]:not(.switch input):checked {
  background-color: var(--lime);
  border-color: var(--lime);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
input[type=checkbox]:disabled { opacity: .35; cursor: default; }

code { background: var(--raised); padding: 1px 6px; border-radius: 5px; font-size: .95em; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.err { color: var(--red); margin: 0; }
.num { font-family: var(--num); font-weight: 700; font-size: 19px; line-height: 1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }

/* the 5 × 4 rack mark: one block per phone */
.logo { width: 17px; height: 18px; flex: none; color: var(--red); transition: color .2s; }
.logo.on { color: var(--lime); }

/* ---- top bar ---- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 9px 16px;
  padding-top: max(9px, env(safe-area-inset-top, 0px));
  background: var(--black);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15px; letter-spacing: .04em; white-space: nowrap; }
.group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.right { margin-left: auto; }
.stat { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: baseline; gap: 3px; }
#stat .num:first-child { color: var(--lime); }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input:not([type=checkbox]) { flex: 1; width: 180px; }
.size { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-left: 8px; }
.size input { width: 110px; }
.menu-btn { display: none; }
.logout { color: var(--muted); text-decoration: none; padding: 5px 2px; }
.logout:hover { color: var(--text); }
.bar a.link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 5px 11px;
  background: var(--raised);
}
.bar a.link:hover { background: var(--hover); border-color: var(--line-strong); }
.who { background: transparent; border-color: transparent; color: var(--muted); max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.who:hover:not(:disabled) { color: var(--text); }

/* batch keys read as one instrument: a joined strip */
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: var(--r-ctl) 0 0 var(--r-ctl); margin-left: 0; }
.seg button:last-child { border-radius: 0 var(--r-ctl) var(--r-ctl) 0; }
.seg button:hover:not(:disabled) { position: relative; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 34px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: background-color .16s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); transition: transform .16s, background-color .16s;
}
.switch input:checked + .track { background: var(--lime); }
.switch input:checked + .track::after { transform: translateX(14px); background: #000; }
.switch input:focus-visible + .track { outline: 2px solid var(--lime); outline-offset: 2px; }
body.sync .switch span:last-child { color: var(--lime); font-weight: 700; }

.banner { padding: 9px 16px; background: #1d1606; color: var(--amber); border-bottom: 1px solid #4a3711; }
.banner a { color: var(--text); font-weight: 700; word-break: break-all; }

/* ---- the rack: phone tiles ---- */

main { flex: 1; display: flex; min-height: 0; position: relative; }
.grid {
  flex: 1;
  overflow: auto;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: grid;
  /* --tile-w (the 畫面 slider) is the smallest a tile gets; columns then stretch to use the full width */
  grid-template-columns: repeat(auto-fill, minmax(min(var(--tile-w), 100%), 1fr));
  grid-auto-rows: max-content;
  gap: 14px;
  align-content: start;
}
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.empty p { margin: 0; font-size: 14px; }

.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-phone);
  overflow: hidden;
  transition: border-color .16s;
  container-type: inline-size;
  cursor: pointer; /* the frame and header toggle selection; the screen keeps the default cursor and operates the phone */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .tile:not(.selected):hover { border-color: var(--line-strong); }
}
/* the header follows the tile's own width: narrow tiles drop the model, wide ones get bigger numbers */
@container (max-width: 175px) {
  .tile-model { visibility: hidden; }
  .tile-head { padding-left: 9px; gap: 6px; }
  .tile-name { font-size: 22px; max-width: none; }
}
@container (min-width: 300px) {
  .tile-head { height: 46px; }
  .tile-name { font-size: 30px; }
}
.tile-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 7px 0 11px;
  transition: background-color .16s, color .16s;
}
.tile-name {
  font-family: var(--num);
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}
.tile-model { color: var(--muted); font-size: 11px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .16s; }
.tile-zoom { padding: 0; width: 26px; height: 26px; line-height: 1; font-size: 13px; border-radius: 7px; }
.tile .screen { margin: 0 6px 6px; border-radius: var(--r-screen); }

.tile.selected { border-color: var(--lime); }
.tile.selected .tile-name { color: var(--lime); }
/* the zoom button stays lit while this phone is open in the large panel */
.tile.focused .tile-zoom { background: var(--lime); border-color: var(--lime); color: #000; }

/* sync mode: every checked phone's header turns solid lime, so the linked set is unmistakable */
body.sync .tile.selected .tile-head { background: var(--lime); color: #000; }
body.sync .tile.selected .tile-name { color: #000; }
body.sync .tile.selected .tile-model { color: rgba(0, 0, 0, .62); }
body.sync .tile.selected .tile-head input[type=checkbox]:checked {
  background-color: #000;
  border-color: #000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23b8ff3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.sync .tile.selected .tile-zoom { background: #000; border-color: #000; color: var(--lime); }

.screen { position: relative; background: #000; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.screen canvas { display: block; width: 100%; height: auto; outline: none; cursor: default; }
.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  text-align: center; padding: 12px;
  background: rgba(0, 0, 0, .8); color: var(--muted); font-size: 12px;
}
.overlay .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.overlay .acts button { font-size: 12px; padding: 3px 9px; }

/* ---- large control panel ---- */

.focus {
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  min-height: 0;
  max-width: 70vw;
}
.focus-head { display: flex; align-items: baseline; gap: 10px; min-height: 34px; }
.focus-head strong { font-family: var(--num); font-size: 32px; font-weight: 800; line-height: 1; color: var(--lime); }
.focus-head .muted { font-size: 12px; }
#focusClose { align-self: center; width: 30px; height: 30px; padding: 0; }
.focus-head .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* phone sound: off = struck-through speaker; on = level bars that follow what is playing */
.audio-btn { align-self: center; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; color: var(--muted); }
.audio-btn svg { width: 22px; height: 16px; flex: none; overflow: visible; }
.audio-btn .spk, .audio-btn .lv { fill: currentColor; }
.audio-btn .mute { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.audio-btn .lv { display: none; transform-box: fill-box; transform-origin: center; transform: scaleY(.25); }
.audio-btn[aria-pressed=true] .lv { display: inline; }
.audio-btn[aria-pressed=true] .mute { display: none; }
.audio-btn[data-state=connecting] { color: var(--lime); border-color: rgba(184, 255, 61, .45); }
.audio-btn[data-state=connecting] .lv { animation: audio-wait 1.1s ease-in-out infinite; }
.audio-btn[data-state=connecting] .lv:nth-of-type(2) { animation-delay: .18s; }
.audio-btn[data-state=connecting] .lv:nth-of-type(3) { animation-delay: .36s; }
.audio-btn[data-state=playing] { background: var(--lime); border-color: var(--lime); color: #000; font-weight: 700; }
.audio-btn[data-state=playing]:hover:not(:disabled) { background: var(--lime-hover); border-color: var(--lime-hover); }
.audio-btn[data-state=playing] .lv:nth-of-type(1) { transform: scaleY(min(1, calc(.25 + var(--level, 0) * 1))); }
.audio-btn[data-state=playing] .lv:nth-of-type(2) { transform: scaleY(min(1, calc(.25 + var(--level, 0) * 1.6))); }
.audio-btn[data-state=playing] .lv:nth-of-type(3) { transform: scaleY(min(1, calc(.25 + var(--level, 0) * .7))); }
.audio-btn[data-state=blocked] { color: var(--amber); border-color: var(--amber); }
@keyframes audio-wait { 50% { transform: scaleY(.6); } }
.focus-body { display: flex; gap: 12px; flex: 1; min-height: 0; align-items: flex-start; }
.focus .screen { border-radius: 20px; box-shadow: 0 0 0 1px var(--line); flex: none; }
.focus .screen canvas { width: auto; height: auto; }
.focus .screen canvas:focus { box-shadow: inset 0 0 0 2px var(--lime); }
.tools { display: flex; flex-direction: column; gap: 4px; overflow: hidden auto; max-height: 100%; scrollbar-width: thin; flex: none; }
.tools button { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 54px; height: 50px; padding: 0; font-size: 16px; line-height: 1.1; }
.tools small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.tools button:hover:not(:disabled) small { color: var(--text); }
.tools hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 3px 0; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

/* ---- dialogs and notices ---- */

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-panel); padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dlg { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; }
.dlg h3 { margin: 0; font-size: 16px; }
.dlg p { margin: 0; }
.dlg textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; }
.dlg-results { max-height: 220px; overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.dlg-results div { display: flex; gap: 8px; padding: 2px 0; }
.dlg-results .ok { color: var(--lime); }
.dlg-results .fail { color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg label, .card-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.dlg label input, .card-form label input { color: var(--text); padding: 9px 11px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--raised); border: 1px solid var(--line-strong); border-left: 3px solid var(--lime);
  border-radius: 10px; padding: 9px 16px; z-index: 10; max-width: calc(100vw - 32px);
}

.badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.badge.admin { color: var(--lime); border-color: rgba(184, 255, 61, .45); }

/* accounts: shown to admins only (body.admin is set once the server says who we are) */
body:not(.admin) .admin-only { display: none !important; }

/* ---- sign in / first-run setup ---- */

body.center-page { align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.card-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 28px 28px 30px;
  width: min(390px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card-form .logo { width: 34px; height: 36px; margin-bottom: 6px; }
.card-form h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: .03em; }
.card-form p { margin: 0; }
.card-form small { font-size: 12px; }
.card-form button { padding: 10px; font-size: 14px; margin-top: 4px; }

/* ---- admin ---- */

body.admin-page { overflow: hidden; }
.admin-main { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-list { display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
.user-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 10px; background: transparent; border-color: transparent; }
.user-row:hover:not(:disabled) { background: var(--raised); border-color: transparent; }
.user-row.active { background: var(--raised); box-shadow: inset 3px 0 0 var(--lime); }
.user-row .email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.form-grid input, .form-grid select { padding: 8px 10px; color: var(--text); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; min-width: 140px; }
.dev-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.dev-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--black);
  cursor: pointer;
  min-width: 0;
  transition: border-color .12s, background-color .12s;
}
.dev-item:hover { border-color: var(--line-strong); }
.dev-item.on { border-color: var(--lime); background: var(--lime-wash); }
.dev-item.disabled { opacity: .45; cursor: default; }
.dev-item input { margin-top: 4px; }
.dev-item .info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dev-item .title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dev-item .label { font-family: var(--num); font-size: 22px; font-weight: 800; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-item.on .label { color: var(--lime); }
.dev-item .model { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; }
.dev-item .sub { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-item .owners { color: var(--amber); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: #4a5142; flex: none; }
.state-dot.on { background: var(--lime); }
.note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--raised); color: var(--muted); }
.empty-note { color: var(--muted); padding: 24px 0; text-align: center; margin: 0; }
#editor { display: flex; flex-direction: column; gap: 16px; }
#devSection { display: flex; flex-direction: column; gap: 12px; }
.editor-section { padding-top: 16px; border-top: 1px solid var(--line); }
#devFilter { width: 210px; }

/* the save bar stays reachable while scrolling a long phone list */
.save-row { position: sticky; bottom: 0; z-index: 2; padding: 10px 0; background: var(--panel); border-top: 1px solid var(--line); }

/* ---- phones (portrait or landscape) ---- */
@media (max-width: 760px), (max-height: 500px) {
  .bar {
    position: relative;
    gap: 8px 12px;
    padding: max(8px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
  }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; order: 2; margin-left: auto; width: 40px; height: 34px; padding: 0; }
  .menu-btn svg { width: 18px; height: 14px; }
  .bar.menu-open .menu-btn { border-color: var(--lime); color: var(--lime); }
  .sel { order: 3; }
  .batch { order: 4; }
  /* secondary actions fold into a dropdown under the menu button */
  #menu {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    right: max(12px, env(safe-area-inset-right, 0px));
    z-index: 40;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 220px;
    padding: 8px;
    background: var(--raised);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .7);
  }
  .bar.menu-open #menu { display: flex; }
  #menu > * { text-align: left; }
  #menu .who { max-width: none; color: var(--text); padding: 8px 11px; }
  #menu a.link, #menu .logout { display: block; padding: 8px 11px; }
  #menu button.primary { padding: 8px 11px; }
  /* the batch keys only matter once phones are checked; the strip scrolls sideways instead of wrapping */
  body:not(.has-sel) .batch { display: none; }
  .seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; }
  .sel .size span { display: none; }
  /* iOS zooms into inputs smaller than 16px */
  input:not([type=checkbox]):not([type=range]), textarea, select { font-size: 16px; }
  /* the large panel takes the whole screen */
  .focus {
    position: fixed;
    inset: 0;
    z-index: 30;
    max-width: none;
    border-left: 0;
    padding: max(10px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }
  .focus .hint { display: none; }
}

/* phone portrait */
@media (max-width: 760px) {
  .sel { flex-basis: 100%; }
  .sel .size { margin-left: auto; }
  .sel .size input { width: 96px; }
  .batch { flex-basis: 100%; min-width: 0; flex-direction: column; align-items: stretch; }
  .batch .inline-form { min-width: 0; }
  .batch .inline-form input:not([type=checkbox]) { width: auto; }
  .grid { padding: 10px; gap: 10px; }
  .focus-body { flex-direction: column; align-items: center; }
  .tools { flex-direction: row; flex-wrap: wrap; justify-content: center; max-height: none; }
  .tools hr { display: none; }
  .tools button { width: 48px; height: 46px; }
  .admin-main { grid-template-columns: 1fr; padding: 12px; }
  .dev-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .dev-item { padding: 9px 10px; gap: 8px; }
  #devFilter { width: 100%; order: 5; }
  .who { max-width: 150px; }
}

/* phone landscape: little height, so keep the header to as few rows as possible and the tools in columns */
@media (max-height: 500px) and (min-width: 761px) {
  .bar { gap: 6px 14px; padding-bottom: 6px; }
  .tools { display: grid; grid-template-columns: repeat(3, 50px); grid-auto-rows: 44px; gap: 4px; align-content: start; }
  .tools hr { display: none; }
  .tools button { width: 50px; height: 44px; }
  .focus-head { min-height: 0; }
  .focus-head strong { font-size: 26px; }
}

/* touch screens: bigger targets */
@media (pointer: coarse) {
  button { min-height: 36px; }
  .tile-head { height: 44px; }
  .tile-zoom { width: 34px; height: 34px; min-height: 0; }
  input[type=checkbox]:not(.switch input) { width: 20px; height: 20px; background-size: 14px; }
  .switch .track { width: 40px; height: 24px; border-radius: 12px; }
  .switch .track::after { width: 18px; height: 18px; }
  .switch input:checked + .track::after { transform: translateX(16px); }
  .hint { display: none; }
}

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