:root {
  /* light (default) */
  --bg: #f5f5f3;
  --panel: #ffffff;
  --panel2: #f0f0ed;
  --line: #deded9;
  --line-strong: #c4c4be;
  --text: #17181a;
  --text2: #3a3b40;
  --dim: #5b5d63;
  --faint: #85878d;
  --link: #b14d07;
  --accent: #ff7a1a;        /* Sony menu cursor orange */
  --accent-ink: #1a0d02;
  --ok: #1d8a4c;
  --ok-line: #b5dcc4;
  --warn: #8a6100;
  --warn-line: #e6d39c;
  --primary-line: #f1c9a6;
  --primary-shadow: 0 0 0 1px rgba(255,122,26,.12), 0 10px 30px rgba(40,30,20,.10);
  --tip-bg: #fff4ea;
  --tip-line: #f3d2b5;
  --tip-text: #5a3210;
  --glyph-filter: none;     /* Sony glyphs are black on transparent */
  --radius: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0c0d;
  --panel: #161618;
  --panel2: #1e1f22;
  --line: #2c2d31;
  --line-strong: #444;
  --text: #f1f1f2;
  --text2: #cfd0d4;
  --dim: #a3a4a9;
  --faint: #6f7076;
  --link: #ffb37a;
  --ok: #47c27a;
  --ok-line: #1f4a31;
  --warn: #f2c14e;
  --warn-line: #4a3d1c;
  --primary-line: #3a2a1d;
  --primary-shadow: 0 0 0 1px rgba(255,122,26,.15), 0 12px 40px rgba(0,0,0,.35);
  --tip-bg: #1f1810;
  --tip-line: #3a2a1d;
  --tip-text: #f4dcc6;
  --glyph-filter: invert(1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* components set display: flex etc.; hidden must still win */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--link); }
button { font: inherit; color: inherit; }

/* ---------- header ---------- */
.top {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  max-width: 920px; margin: 0 auto; padding: 16px 16px 8px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  font: 700 12px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--accent-ink);
  background: var(--accent); border-radius: 6px; padding: 7px 8px;
}
h1 { font-size: 19px; margin: 0; letter-spacing: -.01em; }
.sub { margin: 0; color: var(--dim); font-size: 13px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { border-color: var(--line-strong); }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--dim);
  white-space: nowrap;
}
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

main { max-width: 920px; margin: 0 auto; padding: 0 16px 40px; }
.views { display: flex; gap: 4px; margin: 10px 0 14px; border-bottom: 1px solid var(--line); }
.views button {
  background: none; border: 0; padding: 10px 12px; cursor: pointer; color: var(--dim); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.views button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- ask ---------- */
#form { display: flex; gap: 8px; }
#q, #filter {
  flex: 1; min-width: 0; font-size: 17px; padding: 13px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none;
}
#q:focus, #filter:focus { border-color: var(--accent); }
#go {
  border: 0; border-radius: var(--radius); padding: 0 18px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; cursor: pointer;
}
#filter { width: 100%; margin-bottom: 12px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.examples button {
  background: var(--panel); border: 1px solid var(--line); color: var(--dim); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; cursor: pointer;
}
.examples button:hover { color: var(--text); border-color: var(--line-strong); }
.status { color: var(--faint); font-size: 13px; min-height: 20px; margin: 10px 2px 6px; }
.status .unsure { color: var(--warn); }

/* ---------- answer card ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 0 0 14px;
}
.card.primary { border-color: var(--primary-line); box-shadow: var(--primary-shadow); }
.card h2 { font-size: 20px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .glyph { height: 22px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.badge {
  font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
}
.badge.cam { color: var(--text); }
.badge.only { color: var(--warn); border-color: var(--warn-line); }
.badge.p { color: var(--ok); border-color: var(--ok-line); }

.pathrow { margin: 8px 0 4px; }
.pathrow .who { font-size: 12px; color: var(--faint); margin: 0 0 5px; letter-spacing: .04em; font-weight: 600; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 9px;
  background: var(--panel2); border: 1px solid var(--line); font-size: 15px; line-height: 1.2;
}
.crumb.menu { font: 700 12px/1 ui-monospace, Menlo, monospace; letter-spacing: .06em; padding: 9px 9px; }
.crumb.item { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.crumb.item .glyph { filter: none; }
.crumb.tail { background: transparent; border-style: dashed; color: var(--dim); }
.crumb .num {
  font: 700 12px/1 ui-monospace, Menlo, monospace; background: #000; color: #fff; border: 1px solid #555;
  border-radius: 4px; padding: 2px 5px;
}
.sep { color: var(--faint); font-size: 14px; }
.modehint { font-size: 13px; color: var(--warn); margin: 6px 0 0; }
.then { font-size: 14px; color: var(--dim); margin: 8px 0 0; }

.glyph { height: 1.15em; width: auto; vertical-align: -0.2em; filter: var(--glyph-filter); }
.crumb .glyph { height: 18px; }
.desc { margin: 14px 0 0; color: var(--text2); }
.tip {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--tip-bg); border: 1px solid var(--tip-line); color: var(--tip-text);
  font-size: 15px;
}
.tip b { color: var(--accent); }

details { margin: 10px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; color: var(--dim); font-size: 14px; padding: 4px 0; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "▸ "; color: var(--faint); }
details[open] > summary::before { content: "▾ "; }
ol.steps { margin: 8px 0 0; padding-left: 22px; }
ol.steps li { margin: 4px 0; }
ol.steps li.sub { list-style: none; margin-left: -4px; color: var(--text2); font-size: 15px; }
ol.steps li.sub::before { content: "↳ "; color: var(--faint); }
.proc h4 { margin: 10px 0 0; font-size: 14px; color: var(--dim); font-weight: 600; }
dl.opts { margin: 6px 0 0; }
dl.opts dt { font-weight: 600; margin-top: 8px; }
dl.opts dd { margin: 2px 0 0 0; color: var(--text2); font-size: 15px; }
ul.notes { margin: 6px 0 0; padding-left: 20px; color: var(--text2); font-size: 15px; }
.tbl { overflow-x: auto; margin: 8px 0; }
.tbl table { border-collapse: collapse; font-size: 13px; }
.tbl td { border: 1px solid var(--line); padding: 4px 6px; white-space: nowrap; }
.tbl h5 { margin: 8px 0 4px; color: var(--dim); font-size: 13px; }
.src { margin-top: 12px; font-size: 13px; color: var(--faint); }
.camtabs { display: flex; gap: 6px; margin: 8px 0 0; }
.camtabs button { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: var(--dim); }
.camtabs button.on { color: var(--text); border-color: var(--accent); }

.also h3 { font-size: 14px; color: var(--dim); font-weight: 600; margin: 18px 2px 8px; letter-spacing: .04em; }
.card.mini { padding: 12px 14px; }
.card.mini h2 { font-size: 16px; }

/* ---------- camera screen mock ---------- */
.screen {
  margin: 14px 0 0; background: #000; border: 6px solid #222; border-radius: 14px; overflow: hidden;
  font-size: 13px; max-width: 520px;
}
.screen .title {
  display: flex; justify-content: space-between; padding: 6px 10px; background: #111; color: #ddd; font-size: 12px;
  border-bottom: 1px solid #262626;
}
.screen .body { display: grid; grid-template-columns: 34px 30px 1fr; min-height: 180px; }
.screen .tabs, .screen .groups { border-right: 1px solid #262626; padding: 4px 0; }
.screen .tabs div, .screen .groups div { height: 24px; display: flex; align-items: center; justify-content: center; }
.screen .tabs img { height: 16px; max-width: 28px; object-fit: contain; filter: invert(1); opacity: .55; }
.screen .tabs .on { background: var(--accent); }
.screen .tabs .on img { filter: none; opacity: 1; }
.screen .groups div { font: 600 11px/1 ui-monospace, Menlo, monospace; color: #888; }
.screen .groups .on { background: #444; color: #fff; }
.screen .items { padding: 4px 0; max-height: 260px; overflow-y: auto; }
.screen .items div {
  height: 24px; display: flex; align-items: center; gap: 6px; padding: 0 10px; color: #cfcfcf; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.screen .items .on { background: var(--accent); color: #000; font-weight: 650; }
.screen .glyph { filter: invert(1); }     /* the camera screen is always dark */
.screen .items .on .glyph { filter: none; }
.screen .items .glyph { height: 14px; }
.screen-cap { font-size: 12px; color: var(--faint); margin: 6px 0 0; }

/* ---------- browse ---------- */
.tree-tab { margin: 0 0 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; }
.tree-tab > summary { font-size: 16px; color: var(--text); display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.tree-tab > summary .glyph { height: 18px; }
.tree-group { margin: 2px 0 8px 6px; }
.tree-group h4 { margin: 8px 0 4px; font-size: 13px; color: var(--dim); font-weight: 600; }
.tree-group h4 .num { font: 600 11px ui-monospace, Menlo, monospace; color: var(--faint); margin-right: 4px; }
.tree-item {
  display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; gap: 8px; align-items: center; color: var(--text); font-size: 15px;
}
.tree-item:hover { background: var(--panel2); }
.tree-item .cams { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }
#treeCard { margin-top: 8px; }

.foot { max-width: 920px; margin: 0 auto; padding: 0 16px 30px; color: var(--faint); font-size: 12px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  h1 { font-size: 17px; }
  .top { padding-top: 12px; }
  .controls { width: 100%; justify-content: space-between; }
  .seg button { padding: 6px 10px; font-size: 13px; }
  .crumb { font-size: 14px; padding: 6px 8px; }
  .examples { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .examples::-webkit-scrollbar { display: none; }
  .examples button { flex: none; }
  .card { padding: 14px 12px; }
}

/* ---------- multi-camera: picker, comparisons, classic-menu mock ---------- */
.cambtn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 12px; cursor: pointer;
  font-size: 14px; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cambtn:hover { border-color: var(--line-strong); }
.caret { color: var(--faint); font-size: 11px; }
.picker { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 6px 0 12px; }
.pickhead { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.pickhead span { color: var(--dim); font-size: 13px; flex: 1 1 240px; }
h3.sys { font-size: 13px; color: var(--dim); font-weight: 600; margin: 14px 0 6px; }
.clusters { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.cluster { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--panel2); }
.ctitle { font-size: 11px; color: var(--faint); margin: 0 0 6px; }
.cchips { display: flex; flex-wrap: wrap; gap: 5px; }
.camchip {
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 10px; cursor: pointer;
  font-size: 13px; display: inline-flex; gap: 5px; align-items: baseline;
}
.camchip small { color: var(--faint); font-size: 10px; }
.camchip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.camchip.on small { color: var(--accent-ink); opacity: .7; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; }
details.others { margin-top: 12px; }
.otherlist { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.otherlist li { padding: 6px 0; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 2px; }
.otherlist span { color: var(--dim); }
.screen.legacy .tabrow { display: flex; gap: 2px; background: #111; padding: 4px 6px; border-bottom: 1px solid #262626; }
.screen.legacy .tabrow span { padding: 3px 8px; border-radius: 4px; }
.screen.legacy .tabrow img { height: 16px; filter: invert(1); opacity: .55; }
.screen.legacy .tabrow .on { background: var(--accent); }
.screen.legacy .tabrow .on img { filter: none; opacity: 1; }
.screen.legacy .items { padding: 4px 0; }
.browsebar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.browsebar select { font: inherit; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.browsebar #filter { flex: 1; margin: 0; min-width: 180px; }
.tree-item.child { padding-left: 22px; font-size: 14px; }
.tree-item .pa { color: var(--faint); font-size: 12px; }
.intro { color: var(--dim); font-size: 14px; }
.famcard h2 { font-size: 16px; }
.camtable { border-collapse: collapse; font-size: 13px; width: 100%; }
.camtable th, .camtable td { text-align: left; border-bottom: 1px solid var(--line); padding: 6px 8px 6px 0; vertical-align: top; }
.camtable td { white-space: normal; }
.camtable small { color: var(--faint); }

/* ---------- search box keyboard hint ---------- */
.qwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.qwrap #q { width: 100%; padding-right: 42px; }
.khint {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font: 600 12px/1 ui-monospace, Menlo, monospace; color: var(--faint); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; background: var(--panel2);
}
.qwrap:focus-within .khint { display: none; }
@media (hover: none) { .khint { display: none; } }

/* ---------- install banner ---------- */
.install {
  display: flex; gap: 12px; align-items: flex-start; margin: 12px 0 4px; padding: 12px 14px; border-radius: 14px;
  background: var(--tip-bg); border: 1px solid var(--tip-line); color: var(--text); position: relative;
}
.install .appicon { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install .itext { display: flex; flex-direction: column; gap: 3px; font-size: 14px; padding-right: 22px; }
.install .itext span { color: var(--text2); }
.install .how { margin-top: 2px; }
.install .btn {
  align-self: flex-start; margin-top: 6px; border: 0; border-radius: 999px; padding: 6px 16px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.install .x {
  position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 20px; line-height: 1;
  color: var(--faint); cursor: pointer; padding: 4px;
}
.shareicon { display: inline-block; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; font-size: 12px; }

/* ---------- search history chips ---------- */
.chiplabel { font-size: 12px; color: var(--faint); align-self: center; margin-right: 2px; }
.hchip { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); flex: none; }
.examples .hchip button { border: 0; background: none; padding: 5px 4px 5px 11px; border-radius: 999px 0 0 999px; }
.examples .hchip .forget { padding: 5px 9px 5px 4px; border-radius: 0 999px 999px 0; color: var(--faint); }
.examples .hchip .forget:hover { color: var(--text); }
.examples .clearh { border: 0; background: none; font-size: 12px; padding: 5px 4px; align-self: center; }
