* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, sans-serif;
  background: #111;
  color: #eee;
  height: 100dvh;
  overflow: hidden;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  gap: 1rem;
}
h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.25rem;
}

input {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
  font-size: 1rem;
}
button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  background: #3b82f6;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
button:hover {
  background: #2563eb;
}

.login-form,
.call-form {
  display: flex;
  gap: 0.5rem;
}
.field-error {
  color: #f87171;
  font-size: 0.85rem;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
.app .center {
  flex: 1;
  min-height: 0;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  font-size: 0.85rem;
}
header strong {
  word-break: break-all;
}
header button:not(.icon-button) {
  background: #333;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: 4px;
  color: #aaa;
  vertical-align: middle;
}
.icon-button:hover {
  color: #fff;
  background: color-mix(in srgb, currentColor 15%, transparent);
}

.status {
  text-align: center;
  padding: 0.75rem;
  color: #aaa;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  z-index: 100;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
}
.toast p {
  margin-bottom: 1rem;
}
.toast strong {
  word-break: break-all;
}
.toast-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}
.toast .accept {
  background: #22c55e;
}
.toast .accept:hover {
  background: #16a34a;
}
.toast .decline {
  background: #ef4444;
}
.toast .decline:hover {
  background: #dc2626;
}

.video-call {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.videos {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  overflow: hidden;
}
.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.local-video {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 180px;
  border-radius: 8px;
  border: 2px solid #333;
  object-fit: cover;
  transform: scaleX(-1);
}
.content-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-video {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 180px;
  border-radius: 8px;
  border: 2px solid #333;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 50;
}
.hangup {
  background: #ef4444;
  margin: 1rem auto;
}
.hangup:hover {
  background: #dc2626;
}

/* ── Devtools panel ── */

.devtools-wrapper {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.devtools-resize-handle {
  height: 6px;
  cursor: ns-resize;
  flex-shrink: 0;
  background: transparent;
}
.devtools-resize-handle:hover {
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.devtools-panel {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #ddd;
  background: #fff;
  color: #111;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-size: 12px;
}

.devtools-header {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  height: 32px;
  padding: 0 6px;
  flex-shrink: 0;
}

.devtools-tabs {
  display: flex;
  height: 100%;
  margin-right: 4px;
}
.devtools-tabs button {
  all: unset;
  padding: 0 10px;
  font-size: 11px;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  color: #666;
  border-bottom: 2px solid transparent;
  height: 100%;
}
.devtools-tabs button:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.05);
}
.devtools-tabs button.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

.devtools-close {
  color: #888;
}

.devtools-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.devtools-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.devtools-body-inner {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}
.devtools-body-inner:not(.has-detail) {
  overflow-y: auto;
}
.devtools-body-inner.has-detail > .devtools-timeline {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid #e8e8e8;
  overflow-y: auto;
}

.devtools-empty {
  color: #999;
  text-align: center;
  padding: 24px;
  font-family: system-ui, sans-serif;
}

.devtools-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.devtools-entry {
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 7px 9px;
  background: #fafafa;
  cursor: pointer;
}
.devtools-entry:hover {
  background: #f0f4ff;
  border-color: #c8d8ff;
}
.devtools-entry.active {
  background: #e8f0fe;
  border-color: #4285f4;
}
.devtools-entry.deleted {
  opacity: 0.55;
}

.devtools-entry-deleted {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #c0392b;
  background: #fdecea;
  border-radius: 3px;
  padding: 1px 4px;
}

.devtools-entry-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.devtools-entry-index {
  font-size: 10px;
  font-weight: 700;
  color: #bbb;
  min-width: 14px;
}
.devtools-entry-author {
  font-weight: 600;
  font-size: 11px;
  font-family: system-ui, sans-serif;
}
.devtools-entry-time {
  font-size: 10px;
  color: #aaa;
  margin-left: auto;
}
.devtools-entry-uri {
  font-size: 10px;
  color: #1a73e8;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.devtools-entry-json {
  font-size: 10px;
  color: #555;
  margin: 0;
  white-space: pre;
  line-height: 1.5;
  overflow: hidden;
  max-height: 60px;
}

.devtools-detail {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  min-width: 0;
}
.devtools-detail-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 10px;
  font-family: system-ui, sans-serif;
}
.devtools-doc-json {
  font-size: 12px;
  color: #333;
  margin: 0;
  white-space: pre;
  line-height: 1.5;
}

.sdp-kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  font-size: 11px;
  margin-bottom: 10px;
}
.sdp-kv-grid > span:nth-child(odd) {
  color: #999;
}
.sdp-kv-grid > span:nth-child(even) {
  color: #333;
  word-break: break-all;
}

.sdp-section {
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.sdp-section-title {
  font-weight: 600;
  font-size: 11px;
  font-family: system-ui, sans-serif;
  color: #1a73e8;
  margin-bottom: 6px;
}

.sdp-codecs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.sdp-codec {
  font-size: 10px;
  background: #f0f4ff;
  color: #3355aa;
  border-radius: 4px;
  padding: 2px 6px;
}

.sdp-candidates {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sdp-candidate-row {
  font-size: 10px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Focus ── */

button:focus-visible,
input:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.18);
}
