.ar-mirror-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  height: calc(100dvh - 118px);
  max-height: calc(100dvh - 118px);
  min-height: 0;
  overflow: hidden;
  background: transparent;
  border-radius: 12px;
  padding: 14px;
  box-sizing: border-box;
}

.ar-mirror-shell:fullscreen,
.ar-mirror-shell:-webkit-full-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border-radius: 0;
  padding: 10px;
  background: #0b1220;
}

.ar-mirror-shell:fullscreen .ar-mirror-stage,
.ar-mirror-shell:-webkit-full-screen .ar-mirror-stage {
  align-self: center;
  height: auto;
  min-height: 0;
}

.ar-mirror-stage {
  position: relative;
  align-self: start;
  justify-self: center;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: transparent;
}

.ar-mirror-frame.is-horizon-pick {
  cursor: crosshair;
}

.ar-horizon-mark {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #38bdf8;
  border-radius: 50%;
  background: rgba(56, 189, 248, .35);
  z-index: 4;
  pointer-events: none;
}

.ar-mirror-frame {
  position: relative;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background: #020617;
}

.ar-mirror-stage video,
.ar-mirror-stage img,
.ar-mirror-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.ar-mirror-stage video {
  opacity: 0;
  pointer-events: none;
}

.ar-mirror-stage canvas {
  background: #020617;
}

.ar-mirror-stage img {
  background: #020617;
}

.ar-mirror-topbar,
.ar-mirror-status {
  position: absolute;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #f8fafc;
}

.ar-mirror-topbar {
  top: 12px;
}

.ar-mirror-topbar--stacked {
  flex-direction: column;
  align-items: stretch;
}

.ar-mirror-topbar--stacked .ar-mirror-camera {
  align-self: flex-end;
  max-width: 100%;
}

.ar-mirror-status {
  bottom: 16px;
  align-items: flex-end;
}

.ar-mirror-eyebrow {
  color: #7dd3fc;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ar-mirror-topbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.ar-mirror-topbar h2 {
  margin: 0;
  font-size: clamp(0.72rem, 1.02vw, 0.98rem);
  font-weight: 650;
  line-height: 1.15;
  white-space: nowrap;
}

.ar-mirror-camera {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 300px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, .78);
  backdrop-filter: blur(8px);
}

.ar-panel-actions .ar-mirror-camera {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
}

.ar-mirror-comment {
  max-width: min(640px, 68%);
  padding: 8px 12px;
  border-left: 4px solid #22c55e;
  border-radius: 8px;
  background: rgba(2, 6, 23, .78);
  font-size: clamp(0.82rem, 1.05vw, 1.05rem);
  font-weight: 650;
  line-height: 1.35;
  white-space: pre-line;
}

.ar-mirror-metrics {
  display: grid;
  gap: 6px;
  min-width: 230px;
  font-size: 0.92rem;
  color: #dbeafe;
  text-align: right;
}

.ar-mirror-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  color: #e5e7eb;
}

.ar-panel-section {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: #1f2937;
  padding: 12px;
}

.ar-panel-title {
  margin-bottom: 10px;
  color: #9ca3af;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ar-mode-list,
.ar-panel-actions {
  display: grid;
  gap: 8px;
}

.ar-mode-btn {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 46px;
  width: 100%;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  text-align: left;
  font-weight: 650;
}

.ar-mode-btn i {
  color: #93c5fd;
  font-size: 1.2rem;
  text-align: center;
}

.ar-mode-btn.active {
  border-color: #38bdf8;
  background: #0f766e;
  color: #fff;
}

.ar-layer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ar-layer-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: #111827;
  font-size: .88rem;
}

.ar-layer-toggle input {
  accent-color: #22c55e;
}

.ar-panel-note {
  margin-top: auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(125, 211, 252, .10);
  color: #bfdbfe;
  font-size: .86rem;
}

@media (max-width: 1100px) {
  .ar-mirror-shell {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .ar-mirror-stage {
    height: auto;
    max-height: min(68dvh, 720px);
  }
  .ar-mirror-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ar-panel-note {
    margin-top: 0;
  }
}

@media (max-width: 780px) {
  .ar-mirror-shell {
    padding: 8px;
  }
  .ar-mirror-stage {
    min-height: 66vh;
  }
  .ar-mirror-topbar,
  .ar-mirror-status {
    left: 10px;
    right: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .ar-mirror-camera,
  .ar-mirror-metrics {
    min-width: 0;
    text-align: left;
  }
  .ar-mirror-panel {
    grid-template-columns: 1fr;
  }
}
