:root {
  color-scheme: light;
  --page: #eceeeb;
  --paper: #f8f8f6;
  --surface: #ffffff;
  --surface-muted: #f1f2ef;
  --ink: #1c211e;
  --ink-soft: #5f6862;
  --ink-faint: #909892;
  --line: rgba(31, 39, 34, 0.13);
  --line-strong: rgba(31, 39, 34, 0.22);
  --accent: #397563;
  --accent-soft: #dce9e3;
  --danger: #c95c55;
  --danger-soft: #f4dfdc;
  --warning: #b7893b;
  --warning-soft: #f2e8d5;
  --map: #171b19;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 1px 2px rgba(20, 26, 22, 0.15);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "Microsoft YaHei UI", "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
select {
  font: inherit;
}

button,
select,
.target-row {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
.target-row:focus-visible {
  outline: 2px solid rgba(57, 117, 99, 0.42);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 324px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

body.map-fullscreen .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

body.map-fullscreen .sidebar {
  display: none;
}

body.map-fullscreen .map-workspace {
  padding: 0;
}

body.map-fullscreen .map-stage {
  border: 0;
  border-radius: 0;
}

.sidebar {
  z-index: 3;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--line-strong);
  box-shadow: 1px 0 2px rgba(20, 26, 22, 0.08);
}

.brand {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 13px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid rgba(24, 31, 27, 0.24);
  border-radius: 6px 2px 6px 2px;
  background: #262d29;
  color: #f7f7f4;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 760;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.brand-copy > strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy > span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-faint);
  font-size: 11px;
}

.brand-copy b {
  font-weight: 560;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7ada9;
  box-shadow: 0 0 0 3px rgba(122, 132, 126, 0.11);
  transition: background 240ms var(--ease), box-shadow 240ms var(--ease);
}

.status-dot.live,
.status-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 117, 99, 0.14);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(201, 92, 85, 0.14);
}

.source-section,
.wireless-adb-section,
.license-section,
.share-section,
.calibration-section,
.display-section,
.loot-section,
.targets-section {
  flex-shrink: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.source-section {
  padding-top: 20px;
}

.license-section {
  padding-top: 13px;
  padding-bottom: 13px;
  background: #f3f4f1;
}

.license-expiry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.license-expiry span {
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 9px;
  font-weight: 650;
}

.license-expiry strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 620;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-notice {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  gap: 7px;
  margin-top: 9px;
  color: #7b643a;
}

.license-notice svg {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  stroke-width: 1.8;
}

.license-notice p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.share-section {
  padding-top: 14px;
  padding-bottom: 14px;
}

.share-section .section-heading {
  margin-bottom: 9px;
}

.share-state-dot {
  width: 8px;
  height: 8px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: #a7ada9;
  box-shadow: 0 0 0 3px rgba(122, 132, 126, 0.11);
  transition: background 220ms var(--ease), box-shadow 220ms var(--ease);
}

.share-state-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 117, 99, 0.14);
}

.share-state-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(201, 92, 85, 0.14);
}

.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 7px;
}

.share-link-row input {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  background: var(--surface);
  color: var(--ink-soft);
  font: 10px/1.2 Consolas, "SFMono-Regular", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(20, 26, 22, 0.05);
}

.share-link-row input:focus {
  border-color: rgba(57, 117, 99, 0.55);
}

.share-link-row button:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
}

.share-status-text {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.remote-view .share-section,
body.remote-view .license-section,
body.remote-view .wireless-adb-section,
body.remote-view .source-section .field-label,
body.remote-view .source-section .select-wrap,
body.remote-view .source-section .source-actions,
body.remote-view .source-section .section-heading .icon-button,
body.remote-view .calibration-section {
  display: none;
}

body.remote-view .source-section {
  padding-top: 14px;
  padding-bottom: 14px;
}

body.remote-view .source-section .section-heading {
  margin-bottom: 5px;
}

body.remote-view .source-status {
  margin-top: 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading.compact {
  align-items: flex-end;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 680;
  line-height: 1.2;
}

.eyebrow {
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 9px;
  font-weight: 650;
}

.icon-button,
.map-button,
.selected-target button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 220ms var(--ease), border-color 220ms var(--ease),
    box-shadow 220ms var(--ease), color 220ms var(--ease), background 220ms var(--ease);
}

.icon-button {
  width: 30px;
  height: 30px;
  border-radius: 5px;
}

.icon-button svg,
.selected-target button svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.icon-button:hover,
.map-button:hover,
.selected-target button:hover {
  z-index: 1;
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: 0 2px 3px rgba(20, 26, 22, 0.17);
  transform: translateY(-1px);
}

.icon-button:active,
.map-button:active,
.selected-target button:active,
.primary-button:active,
.secondary-button:active {
  transform: scale(0.97);
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 590;
}

.select-wrap,
.map-select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  height: 39px;
  appearance: none;
  padding: 0 34px 0 11px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(20, 26, 22, 0.06);
  transition: border-color 220ms var(--ease), box-shadow 220ms var(--ease);
}

.select-wrap > svg {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 15px;
  height: 15px;
  pointer-events: none;
  color: var(--ink-faint);
}

.select-wrap select:hover,
.select-wrap select:focus {
  border-color: rgba(57, 117, 99, 0.55);
}

.source-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.capture-action-stack {
  display: grid;
  gap: 8px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-width: 0;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease),
    background 220ms var(--ease), border-color 220ms var(--ease);
}

.primary-button {
  border: 1px solid #2f6353;
  background: var(--accent);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.primary-button svg,
.secondary-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke-width: 1.8;
}

.primary-button:hover,
.secondary-button:hover {
  box-shadow: 0 2px 3px rgba(20, 26, 22, 0.17);
  transform: translateY(-1px);
}

.primary-button.stop {
  border-color: #a84944;
  background: var(--danger);
}

.source-status {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  margin-top: 14px;
  padding: 10px 0 0;
  color: var(--ink-faint);
}

.source-status > svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  stroke-width: 1.9;
}

.source-status > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.source-status strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.source-status span {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-status[data-mode="live"],
.source-status[data-mode="offline"] {
  color: var(--accent);
}

.source-status[data-mode="error"] {
  color: var(--danger);
}

.wireless-adb-section {
  padding-top: 14px;
  padding-bottom: 14px;
}

.wireless-adb-section .section-heading {
  margin-bottom: 9px;
}

.wireless-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 8px;
}

.wireless-actions button {
  min-width: 0;
}

.wireless-status-text,
.wireless-fingerprint {
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wireless-fingerprint {
  margin-top: 3px;
  color: var(--ink-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 8px;
}

.wireless-key-timestamp {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wireless-state-dot {
  width: 8px;
  height: 8px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: #a7ada9;
  box-shadow: 0 0 0 3px rgba(122, 132, 126, 0.11);
}

.wireless-state-dot.paired,
.wireless-state-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 117, 99, 0.14);
}

.wireless-state-dot.busy {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(183, 137, 59, 0.14);
}

.wireless-state-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(201, 92, 85, 0.14);
}

.percent {
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  font-weight: 650;
}

.progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: #dfe2de;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 300ms var(--ease), background 240ms var(--ease);
}

.session-line {
  margin: 10px 0 14px;
  overflow: hidden;
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 9px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 10px 6px 9px;
  border-right: 1px solid var(--line);
}

.metric:first-child {
  padding-left: 0;
}

.metric:last-child {
  padding-right: 0;
  border-right: 0;
  text-align: right;
}

.metric span {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  overflow: hidden;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
  font-weight: 620;
  text-overflow: ellipsis;
}

.metric.emphasis strong {
  color: var(--danger);
}

.display-section {
  padding-top: 14px;
  padding-bottom: 14px;
}

.display-section .section-heading {
  margin-bottom: 10px;
}

.display-heading-icon {
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  stroke-width: 1.7;
}

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

.display-option {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 10px;
  user-select: none;
}

.display-option.wide {
  grid-column: 1 / -1;
  max-width: calc(50% - 7px);
}

.display-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.loot-section {
  padding-top: 14px;
  padding-bottom: 14px;
}

.loot-section .section-heading {
  margin-bottom: 8px;
}

.loot-total {
  min-width: 30px;
  color: var(--warning);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.loot-master {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}

.loot-master > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.loot-master strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.loot-master small {
  color: var(--ink-faint);
  font-size: 9px;
}

.loot-master input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.loot-master > i {
  position: relative;
  width: 31px;
  height: 17px;
  flex: 0 0 31px;
  border: 1px solid rgba(43, 52, 47, 0.2);
  border-radius: 9px;
  background: #dfe2de;
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease);
}

.loot-master > i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 26, 22, 0.2);
  content: "";
  transition: transform 220ms var(--ease);
}

.loot-master input:checked + i {
  border-color: rgba(57, 117, 99, 0.55);
  background: var(--accent);
}

.loot-master input:checked + i::after {
  transform: translateX(14px);
}

.loot-master input:focus-visible + i {
  outline: 2px solid rgba(57, 117, 99, 0.34);
  outline-offset: 2px;
}

.loot-filter-group {
  margin-top: 10px;
}

.loot-filter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.loot-filter-heading > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 620;
}

.loot-filter-heading > small {
  color: var(--ink-faint);
  font-size: 8px;
}

.segmented-control {
  display: grid;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  transition: opacity 220ms var(--ease);
}

.quality-control {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.value-control {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented-control button {
  min-width: 0;
  height: 25px;
  padding: 0 2px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-faint);
  box-shadow: none;
  cursor: pointer;
  font-size: 8px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 220ms var(--ease), color 220ms var(--ease),
    box-shadow 220ms var(--ease), transform 180ms var(--ease);
}

.segmented-control button:hover {
  color: var(--ink-soft);
  transform: translateY(-1px);
}

.segmented-control button:active {
  transform: scale(0.97);
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(20, 26, 22, 0.13);
}

.loot-disabled .loot-filter-group,
.loot-disabled .loot-legend {
  opacity: 0.48;
}

.loot-legend {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  margin-top: 11px;
  transition: opacity 220ms var(--ease);
}

.loot-legend span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  color: var(--ink-faint);
  font-size: 7px;
  white-space: nowrap;
}

.loot-legend i {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border: 0.5px solid rgba(20, 26, 22, 0.25);
  border-radius: 50%;
}

.loot-legend i[data-quality="5"] { background: #ff4c58; }
.loot-legend i[data-quality="4"] { background: #b452ff; }
.loot-legend i[data-quality="3"] { background: #3f91ff; }
.loot-legend i[data-quality="2"] { background: #48d66c; }
.loot-legend i[data-quality="1"] { background: #ffffff; }
.loot-legend i[data-quality="0"] { background: #ffd240; }

.display-option > i {
  position: relative;
  width: 27px;
  height: 15px;
  flex: 0 0 27px;
  border: 1px solid rgba(43, 52, 47, 0.2);
  border-radius: 8px;
  background: #dfe2de;
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease);
}

.display-option > i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 26, 22, 0.2);
  content: "";
  transition: transform 220ms var(--ease);
}

.display-option input:checked + i {
  border-color: rgba(57, 117, 99, 0.55);
  background: var(--accent);
}

.display-option input:checked + i::after {
  transform: translateX(12px);
}

.display-option input:focus-visible + i {
  outline: 2px solid rgba(57, 117, 99, 0.34);
  outline-offset: 2px;
}

.targets-section {
  display: flex;
  min-height: 230px;
  flex: 1 0 230px;
  flex-direction: column;
  padding-bottom: 10px;
}

.target-total {
  min-width: 30px;
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  text-align: right;
}

.target-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.target-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-height: 76px;
  align-items: center;
  gap: 9px;
  padding: 6px 5px 6px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 220ms var(--ease), padding 220ms var(--ease);
}

.target-row:hover,
.target-row.selected {
  padding-left: 5px;
  background: rgba(57, 117, 99, 0.07);
}

.target-row.friendly {
  background: rgba(57, 117, 99, 0.1);
}

.target-row.friendly .target-index {
  border-color: rgba(57, 117, 99, 0.72);
  background: rgba(57, 117, 99, 0.12);
}

.target-row.friendly .target-copy strong {
  color: #2f6756;
}

.target-index {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid rgba(201, 92, 85, 0.42);
  border-radius: 50%;
  background: var(--danger-soft);
}

.target-index.equipment-visible {
  border-top-color: rgba(255, 255, 255, 0.65);
  border-bottom-color: rgba(255, 255, 255, 0.65);
  border-left-width: 2px;
  border-right-width: 2px;
}

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

.target-index small {
  position: absolute;
  right: -1px;
  bottom: -1px;
  min-width: 13px;
  padding: 1px 2px;
  border-radius: 3px 0 0;
  background: rgba(24, 28, 26, 0.84);
  color: #fff;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 7px;
  line-height: 10px;
  text-align: center;
}

.target-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.target-copy strong {
  font-size: 11px;
  font-weight: 660;
}

.target-copy span {
  overflow: hidden;
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-copy .target-health {
  display: block;
  width: min(100%, 150px);
  overflow: visible;
}

.target-health-track {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #dfe2de;
  box-shadow: inset 0 0 0 0.5px rgba(31, 39, 34, 0.13);
}

.target-health-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 240ms var(--ease), background-color 240ms var(--ease);
}

.target-equipment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  align-items: center;
  gap: 8px;
  width: min(100%, 170px);
  color: var(--ink-soft) !important;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 8px !important;
  line-height: 1.2;
}

.equipment-item {
  display: grid;
  grid-template-columns: auto minmax(22px, 1fr);
  min-width: 0;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.equipment-label {
  color: var(--ink-soft) !important;
  overflow: visible !important;
}

.equipment-durability-track {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: #dfe2de;
  box-shadow: inset 0 0 0 0.5px rgba(31, 39, 34, 0.13);
}

.equipment-durability-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 240ms var(--ease), background-color 240ms var(--ease);
}

.target-distance {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  text-align: right;
}

.target-distance small {
  color: var(--ink-faint);
  font-size: 8px;
}

.target-empty {
  display: none;
  min-height: 150px;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-faint);
  text-align: center;
}

.target-empty.visible {
  display: flex;
}

.target-empty svg {
  width: 24px;
  height: 24px;
  margin-bottom: 3px;
  stroke-width: 1.35;
}

.target-empty strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 620;
}

.target-empty span {
  font-size: 9px;
}

.sidebar-footer {
  display: flex;
  min-height: 37px;
  align-items: center;
  gap: 7px;
  padding: 0 20px;
  color: var(--ink-faint);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 9px;
}

.sidebar-footer i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.sidebar-footer b {
  margin-left: auto;
  font-weight: 560;
}

.map-workspace,
.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--map);
}

#radarCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: 0;
}

#radarCanvas.dragging {
  cursor: grabbing;
}

#radarCanvas.marker-hover {
  cursor: pointer;
}

.map-toolbar {
  position: absolute;
  top: 18px;
  z-index: 2;
  display: flex;
  height: 42px;
  align-items: center;
  border: 1px solid rgba(25, 31, 27, 0.18);
  border-radius: 6px;
  background: rgba(250, 250, 248, 0.95);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(7, 10, 8, 0.24);
  backdrop-filter: blur(8px);
}

.left-toolbar {
  left: 18px;
  max-width: calc(100% - 250px);
}

.right-toolbar {
  right: 18px;
  padding: 4px;
}

.map-select-wrap {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
  padding-left: 11px;
  border-right: 1px solid var(--line);
}

.map-select-wrap > svg:first-child {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--accent);
  stroke-width: 1.8;
}

.map-select-wrap select {
  width: 94px;
  height: 100%;
  appearance: none;
  padding: 0 20px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 630;
}

.map-select-wrap .select-chevron {
  position: absolute;
  right: 7px;
  width: 13px;
  height: 13px;
  pointer-events: none;
  color: var(--ink-faint);
}

.map-name-block {
  display: flex;
  min-width: 118px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 0 12px;
}

.map-name-block span {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-name-block b {
  color: var(--accent);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 8px;
  font-weight: 700;
}

.map-button {
  width: 31px;
  height: 31px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
}

.map-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.8;
}

.map-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.toolbar-separator {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--line);
}

.map-legend,
.coordinate-readout {
  position: absolute;
  bottom: 18px;
  z-index: 2;
  display: flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(25, 31, 27, 0.19);
  border-radius: 5px;
  background: rgba(250, 250, 248, 0.94);
  box-shadow: 0 1px 2px rgba(7, 10, 8, 0.24);
  backdrop-filter: blur(8px);
}

.map-legend {
  left: 18px;
  gap: 14px;
  padding: 0 12px;
  color: var(--ink-soft);
  font-size: 9px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-local,
.legend-target {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-loot {
  width: 7px;
  height: 7px;
  background: #ffd240;
  box-shadow: 0 0 0 1px rgba(23, 27, 25, 0.48);
  transform: rotate(45deg);
}

.legend-local {
  background: #4f8b92;
  box-shadow: 0 0 0 2px rgba(79, 139, 146, 0.17);
}

.legend-target {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(201, 92, 85, 0.16);
}

.legend-vector {
  width: 13px;
  height: 1px;
  background: var(--warning);
}

.coordinate-readout {
  right: 18px;
  gap: 10px;
  padding: 0 11px;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.coordinate-readout span {
  color: var(--ink-faint);
  font-size: 8px;
}

.coordinate-readout strong {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 590;
}

.stage-message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  width: 250px;
  min-height: 148px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px 3px 7px 3px;
  background: rgba(24, 29, 26, 0.86);
  color: #eef1ee;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 8px));
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
  backdrop-filter: blur(8px);
}

.stage-message.visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.stage-glyph {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 5px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: #91b5aa;
}

.stage-glyph svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.5;
}

.stage-message strong {
  font-size: 13px;
  font-weight: 640;
}

.stage-message > span {
  color: rgba(238, 241, 238, 0.57);
  font-size: 9px;
}

.selected-target {
  position: absolute;
  top: 74px;
  right: 18px;
  z-index: 2;
  width: 190px;
  padding: 12px;
  border: 1px solid rgba(25, 31, 27, 0.19);
  border-radius: 7px 3px 7px 3px;
  background: rgba(250, 250, 248, 0.95);
  box-shadow: 0 1px 2px rgba(7, 10, 8, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  backdrop-filter: blur(8px);
}

.selected-target.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.selected-target-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.selected-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.selected-identity > img {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(201, 92, 85, 0.35);
  border-radius: 50%;
  object-fit: cover;
}

.selected-identity > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.selected-identity strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-identity small {
  color: var(--danger);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 8px;
}

.selected-target button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  box-shadow: none;
}

.selected-target dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  margin: 10px 0 0;
  font-size: 9px;
}

.selected-target dt {
  color: var(--ink-faint);
}

.selected-target dd {
  margin: 0;
  color: var(--ink-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
}

[hidden] {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  display: flex;
  max-width: min(430px, calc(100vw - 40px));
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(145, 55, 50, 0.28);
  border-radius: 5px;
  background: #fff8f7;
  color: #8d3f3a;
  box-shadow: 0 2px 4px rgba(20, 26, 22, 0.18);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(74, 84, 78, 0.25);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 292px minmax(0, 1fr);
  }

  .source-section,
  .wireless-adb-section,
  .license-section,
  .share-section,
  .calibration-section,
  .display-section,
  .loot-section,
  .targets-section,
  .brand {
    padding-right: 16px;
    padding-left: 16px;
  }

  .map-name-block {
    display: none;
  }

  .map-select-wrap {
    border-right: 0;
  }
}

@media (max-height: 760px) {
  .brand {
    min-height: 64px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .source-section,
  .wireless-adb-section,
  .license-section,
  .share-section,
  .calibration-section,
  .display-section,
  .loot-section,
  .targets-section {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .section-heading {
    margin-bottom: 10px;
  }

  .source-status {
    margin-top: 8px;
  }

  .session-line {
    margin-top: 7px;
    margin-bottom: 8px;
  }
}

@media (max-width: 780px) {
  body.remote-view {
    overflow: auto;
  }

  body.remote-view .app-shell {
    display: flex;
    min-height: 100%;
    height: auto;
    flex-direction: column;
  }

  body.remote-view .sidebar {
    min-height: 0;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }

  body.remote-view .brand {
    min-height: 58px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  body.remote-view .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  body.remote-view .source-section,
  body.remote-view .targets-section,
  body.remote-view .sidebar-footer {
    display: none;
  }

  body.remote-view .map-workspace {
    height: calc(100vh - 58px);
    min-height: 480px;
    padding: 7px;
  }

  body.remote-view .map-stage {
    border-radius: 4px;
  }

  body.remote-view .map-legend,
  body.remote-view .coordinate-readout {
    display: none;
  }
}

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

/* Shared-room additions only; original palette, menus and layout above are retained. */
#radarCanvas { touch-action: none; user-select: none; -webkit-user-select: none; }
.room-entry {
  width: min(340px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 24px; overflow: auto; border: 1px solid var(--line-strong);
  border-radius: 7px 3px 7px 3px; background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow); font: inherit;
}
.room-entry::backdrop { background: rgba(23, 27, 25, .62); }
.room-entry h2 { margin: 0 0 20px; font-size: 17px; }
.room-entry input {
  width: 100%; padding: 11px; border: 1px solid var(--line-strong);
  border-radius: 4px; background: var(--surface); color: var(--ink); font: inherit;
}
.room-entry input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.room-entry input[aria-invalid="true"] { border-color: var(--danger); }
#roomEntryError { min-height: 18px; color: var(--danger); font-size: 12px; }
.room-entry button { width: 100%; margin-top: 8px; }
.room-entry [hidden] { display: none; }
.room-entry-link {
  padding: 0; border: 0; background: transparent; color: var(--accent);
  font: inherit; cursor: pointer; white-space: nowrap;
}
.remote-connection-notice {
  position: absolute; top: 74px; left: 18px; z-index: 2;
  max-width: calc(100% - 244px); padding: 7px 10px;
  border: 1px solid var(--warning); border-radius: 4px;
  background: var(--warning-soft); color: var(--ink-soft);
  font-size: 11px; line-height: 1.5; pointer-events: none; overflow-wrap: anywhere;
}
.remote-connection-notice[hidden] { display: none; }
@media (max-width: 780px) {
  body.remote-view { overflow: hidden; }
  body.remote-view .app-shell { height: 100vh; height: 100dvh; min-height: 0; }
  body.remote-view .sidebar { max-height: 40vh; max-height: 40dvh; overflow-y: auto; }
  body.remote-view .sidebar > * { flex-shrink: 0; }
  body.remote-view .source-section { display: block; }
  body.remote-view .targets-section { display: flex; }
  body.remote-view .sidebar-footer { display: flex; }
  body.remote-view .map-workspace { height: auto; min-height: 140px; flex: 1 1 auto; }
  body.remote-view .selected-target { max-height: calc(100% - 88px); overflow-y: auto; }
  body.remote-view.map-fullscreen .map-workspace { height: 100dvh; }
}
@media (max-width: 420px) {
  body.remote-view .left-toolbar { left: 8px; top: 10px; max-width: calc(100% - 182px); }
  body.remote-view .right-toolbar { right: 8px; top: 10px; }
  body.remote-view .map-button { width: 28px; }
  body.remote-view .map-select-wrap { padding-left: 6px; gap: 4px; }
  body.remote-view .remote-connection-notice { top: 60px; left: 8px; max-width: calc(100% - 16px); }
  body.remote-view .selected-target { right: 8px; }
  body.remote-view #remoteConnectionNotice:not([hidden]) ~ .selected-target { top: 112px; max-height: calc(100% - 122px); }
}
@media (max-height: 500px) and (max-width: 780px) {
  body.remote-view .sidebar { max-height: 32dvh; }
}
