:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #111214;
  color: #f3f4f6;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(58, 74, 91, 0.42), rgba(17, 18, 20, 0) 48%),
    #111214;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #f4c430;
  color: #111214;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.04);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #3f444d;
  border-radius: 8px;
  padding: 0 12px;
  background: #17191d;
  color: #f3f4f6;
  outline: none;
}

input:focus {
  border-color: #f4c430;
  box-shadow: 0 0 0 3px rgba(244, 196, 48, 0.16);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.home-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.home-panel,
.join-card {
  width: min(100%, 520px);
  border: 1px solid #30343b;
  border-radius: 8px;
  padding: 28px;
  background: rgba(24, 26, 30, 0.88);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
}

.home-panel {
  display: grid;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #f4c430;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 4.5rem);
  letter-spacing: 0;
  line-height: 1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.subtle {
  margin-bottom: 0;
  color: #aeb5c2;
}

.meeting-form {
  display: grid;
  gap: 14px;
}

.meeting-form label {
  display: grid;
  gap: 8px;
  color: #cbd0d9;
  font-size: 0.92rem;
}

.meeting-view {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid #2b2f36;
  background: rgba(17, 18, 20, 0.92);
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.secondary {
  border: 1px solid #454a54;
  background: #20242b;
  color: #f3f4f6;
}

.danger {
  background: #e5484d;
  color: #fff;
}

.join-card {
  align-self: center;
  justify-self: center;
  margin: 24px;
}

.call-area {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
}

.video-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-content: start;
  gap: 12px;
}

.video-tile {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  aspect-ratio: 16 / 10;
  border: 1px solid #333842;
  border-radius: 8px;
  background: #050607;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #050607;
}

.video-tile.local video {
  transform: scaleX(-1);
}

.video-tile.local.sharing-screen video {
  object-fit: contain;
  transform: none;
}

.name-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  border: 1px solid #30343b;
  border-radius: 8px;
  padding: 16px;
  background: #181a1e;
}

.participant-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.participant-list li {
  overflow: hidden;
  border-radius: 6px;
  padding: 8px 10px;
  background: #22262d;
  color: #dce1ea;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  border: 1px solid #2f343c;
  border-radius: 8px;
  padding: 10px;
  background: #111214;
}

.chat-message {
  display: grid;
  gap: 2px;
  border-radius: 6px;
  padding: 8px;
  background: #22262d;
}

.chat-message strong {
  color: #f4c430;
  font-size: 0.82rem;
}

.chat-message span {
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid #2b2f36;
  background: rgba(17, 18, 20, 0.95);
}

.control-button {
  border: 1px solid #454a54;
  background: #20242b;
  color: #f3f4f6;
}

.control-button[aria-pressed="true"] {
  background: #f4c430;
  color: #111214;
}

.status-text {
  min-width: 120px;
  color: #aeb5c2;
  font-size: 0.9rem;
}

.whiteboard-panel {
  position: fixed;
  inset: 74px 16px 84px;
  z-index: 20;
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #3a404a;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.whiteboard-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #d6dae2;
  background: #eef2f7;
  color: #111827;
}

.tool-group,
.whiteboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-button,
.compact-field,
.whiteboard-actions button {
  min-height: 38px;
}

.tool-button {
  border: 1px solid #c3cad6;
  background: #fff;
  color: #111827;
}

.tool-button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.compact-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #c3cad6;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: #4b5563;
  font-size: 0.86rem;
  white-space: nowrap;
}

.compact-field input {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.compact-field input[type="color"] {
  width: 32px;
  height: 28px;
}

.range-field input {
  width: 110px;
}

.whiteboard-text-input {
  flex: 1;
  min-width: 180px;
  min-height: 38px;
  border-color: #c3cad6;
  background: #fff;
  color: #111827;
}

.whiteboard-surface {
  position: relative;
  min-height: 0;
  background:
    linear-gradient(#eef2f7 1px, transparent 1px),
    linear-gradient(90deg, #eef2f7 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
}

#whiteboardCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .call-area {
    grid-template-columns: 1fr;
  }

  .side-panel {
    min-height: 360px;
  }

  .whiteboard-panel {
    inset: 118px 10px 92px;
  }

  .whiteboard-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .whiteboard-text-input {
    flex-basis: 100%;
  }
}

@media (max-width: 560px) {
  .home-panel,
  .join-card {
    padding: 20px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-wrap: wrap;
  }

  .control-button {
    flex: 1;
  }
}
