﻿:root {
  --bg: #f4efe9;
  --panel: #ffffff;
  --ink: #1c1a17;
  --muted: #6f6a63;
  --accent: #d95f3f;
  --accent-dark: #b84b30;
  --border: #e2d7cc;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fdf7f1, #f0e6dc 45%, #efe3d7 100%);
  min-height: 100vh;
}

.hidden {
  display: none;
}

.panel {
  max-width: 420px;
  margin: 80px auto;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 18px;
}

label {
  display: block;
  margin-top: 16px;
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 6px;
  font-family: inherit;
}

textarea {
  min-height: 80px;
}

button {
  margin-top: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-actions button {
  margin-top: 10px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-top: 0;
  padding: 8px 14px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

.link-button:hover {
  background: var(--accent-dark);
}

.link-button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.link-button.ghost:hover {
  color: var(--accent-dark);
  border-color: var(--accent-dark);
  background: transparent;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 24px;
  padding: 24px 32px 60px;
}

.layout.single {
  grid-template-columns: 1fr;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.column.wide {
  min-width: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.device-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  background: #fffaf4;
}

.device-card.online {
  border-color: #a7d7b6;
  background: #f1fbf4;
}

.device-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(217, 95, 63, 0.25);
}

.device-card.online.selected {
  border-color: var(--accent);
  background: #fff4eb;
}

.device-card h3 {
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer {
  min-height: 360px;
}

.viewer-body {
  position: relative;
  background: #11110f;
  border-radius: 14px;
  overflow: hidden;
  min-height: 260px;
}

.stream-layout {
  position: relative;
  display: grid;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 260px;
  padding: 8px;
  place-items: center;
}

.stream-layout.mode-split {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}

.stream-layout.mode-stack {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.stream-layout.mode-pip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.stream-canvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--stream-aspect, 16 / 9);
  display: block;
  background: #0c0c0b;
  border-radius: 12px;
}

.stream-layout.mode-pip .stream-canvas.screen {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 0;
}

.stream-layout.mode-pip .stream-canvas.camera {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 26%;
  height: auto;
  aspect-ratio: var(--stream-aspect, 4 / 3);
  max-width: 360px;
  max-height: 240px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.stream-layout.mode-pip[data-pip-main="camera"] .stream-canvas.camera {
  position: relative;
  width: 100%;
  height: auto;
  right: auto;
  bottom: auto;
  border-radius: 0;
}

.stream-layout.mode-pip[data-pip-main="camera"] .stream-canvas.screen {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 26%;
  height: auto;
  aspect-ratio: var(--stream-aspect, 16 / 9);
  max-width: 360px;
  max-height: 240px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

#viewerHint {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 3;
  background: rgba(17, 17, 15, 0.7);
  padding: 6px 10px;
  border-radius: 10px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #fffdf9;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: #c43a2f;
  margin-top: 10px;
  font-size: 13px;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }
}
