:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: rgba(13, 18, 20, 0.94);
  --panel-border: rgba(190, 221, 234, 0.12);
  --text: #eef5f8;
  --muted: #9badb6;
  --accent: #8de6ff;
  --accent-2: #f5c26b;
  --danger: #ff6f6f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --dock-edge: 10vw;
  --dock-bottom: 12px;
  --fab-size: 52px;
  --dock-gap: 12px;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.viewport-card, .settings-panel, .tool-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.menu-grid {
  display: grid;
  gap: 12px;
}
label { display: grid; gap: 8px; color: var(--muted); font-size: 0.95rem; }
.toggle-label {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toggle-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.toggle-label.is-disabled {
  opacity: 0.55;
}

select, input, button {
  font: inherit;
}
select, input[type="range"] {
  width: 100%;
}
button {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent), #88f4ff);
  color: #041118;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}
button:hover, button:active { transform: translateY(-1px) scale(1.01); filter: brightness(1.02); }
button.secondary { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid rgba(255,255,255,0.08); }

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.viewport-card {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}

#screen {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border: none;
  border-radius: 0;
  background: #000;
  touch-action: none;
  outline: none;
}

.status-pill, .toast {
  position: absolute;
  backdrop-filter: blur(8px);
}
.status-pill {
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(4, 17, 24, 0.72);
  border: 1px solid rgba(98, 213, 255, 0.24);
}
.bottom-dock {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(5, 6, 7, 0), rgba(5, 6, 7, 0.82) 24%, rgba(5, 6, 7, 0.96));
}

.tool-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.upload-stack {
  display: none;
}

.clipboard-stack {
  display: grid;
  gap: 12px;
}

.clipboard-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.clipboard-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.clipboard-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.clipboard-action {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
}

.clipboard-content {
  display: grid;
  gap: 10px;
  min-height: 100px;
  max-height: 100px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(3, 9, 12, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.clipboard-title {
  font-weight: 600;
}

.clipboard-meta {
  color: var(--accent);
  font-size: 0.82rem;
}

.clipboard-text {
  min-height: 1.4em;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  cursor: text;
}

.clipboard-image {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-panel,
.settings-panel {
  position: relative;
  border-radius: 20px;
  overflow: visible;
}

.settings-status {
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 12px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.settings-status-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
}

.settings-status-value {
  font-size: 0.98rem;
  color: var(--text);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(141, 230, 255, 0.14), transparent 28%),
    rgba(2, 8, 12, 0.88);
  backdrop-filter: blur(16px);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border-radius: 24px;
  background: rgba(10, 15, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.1;
}

.auth-kicker {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
}

.auth-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.auth-label input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.auth-label input:focus {
  border-color: rgba(141, 230, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(141, 230, 255, 0.12);
}

.auth-error {
  margin: 0;
  color: var(--danger);
  min-height: 1.2em;
}

.upload-panel {
  position: fixed;
  right: var(--dock-edge);
  bottom: var(--dock-bottom);
  z-index: 20;
}

.settings-panel {
  position: fixed;
  right: calc(var(--dock-edge) + var(--fab-size) + var(--dock-gap));
  bottom: var(--dock-bottom);
  z-index: 20;
}

.tool-toggle {
  list-style: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(13, 18, 20, 0.94);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.tool-toggle::-webkit-details-marker {
  display: none;
}

.tool-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-panel[open] .tool-toggle,
.settings-panel[open] .settings-toggle {
  background: rgba(18, 31, 35, 0.96);
}

.tool-panel[open] .upload-stack,
.settings-panel[open] .settings-card {
  display: grid;
}

.tool-panel .upload-stack,
.settings-panel .settings-card {
  display: none;
}

.tool-panel[open] .upload-stack {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(460px, calc(100vw - 24px));
  padding: 16px;
  gap: 12px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.settings-panel[open] .menu-grid {
  display: grid;
}

.settings-panel[open] .settings-card {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(360px, calc(100vw - 24px));
  padding: 0 16px 16px;
  gap: 16px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.settings-panel[open] .button-row {
  display: grid;
  grid-auto-flow: column;
}
.toast {
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(30, 10, 10, 0.94);
  border: 1px solid rgba(255, 111, 111, 0.32);
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
}
.hidden { display: none; }

@media (max-width: 900px) {
  .bottom-dock {
    justify-content: flex-end;
  }

  .tool-row {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  :root {
    --dock-edge: 10px;
    --dock-bottom: 10px;
  }

  .bottom-dock {
    padding: 10px;
  }

  .tool-panel[open] .upload-stack,
  .settings-panel[open] .settings-card {
    width: min(360px, calc(100vw - 20px));
  }

  .settings-panel {
    right: calc(var(--dock-edge) + var(--fab-size) + var(--dock-gap));
  }

  .settings-panel[open] .settings-card {
    position: fixed;
    right: 0;
    bottom: calc(var(--dock-bottom) + var(--fab-size) + var(--dock-gap));
  }

  .settings-panel[open] .button-row {
    grid-auto-flow: row;
  }

  .clipboard-header {
    flex-direction: column;
  }

  .clipboard-actions {
    justify-content: flex-start;
  }
}
