* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #14181d;
  color: #e8eaed;
}

header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid #2a2f36;
}

#logo {
  height: 44px;
  width: auto;
}

h1 {
  font-size: 1.1rem;
  margin: 0;
}

.status {
  font-size: 0.85rem;
  color: #9aa0a6;
}

.status.connected {
  color: #4caf7d;
}

.status.error {
  color: #e57373;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.videos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.video-tile {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

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

.video-tile .label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.5rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.controls {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

#settings-btn {
  background: none;
  color: #9aa0a6;
  border: 1px solid #2a2f36;
  border-radius: 6px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
}

#settings-btn:hover {
  color: #e8eaed;
  border-color: #3a3f46;
}

#settings-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  z-index: 10;
  background: #1a1f26;
  border: 1px solid #2a2f36;
  border-radius: 10px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  min-width: 280px;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

#settings-close-btn {
  background: none;
  border: none;
  color: #9aa0a6;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
}

#settings-close-btn:hover {
  color: #e8eaed;
}

.devices {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.devices label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #9aa0a6;
}

.devices select {
  background: #1f242b;
  color: #e8eaed;
  border: 1px solid #2a2f36;
  border-radius: 6px;
  padding: 0.4rem;
  width: 100%;
}

#speaker-test-btn {
  background: none;
  color: #8ab4f8;
  border: 1px solid #2a2f36;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

#speaker-test-btn:disabled {
  color: #7a7f86;
  cursor: default;
}

.recording {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#record-btn {
  background: #c62828;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}

#record-btn:disabled {
  background: #3a3f46;
  color: #7a7f86;
  cursor: not-allowed;
}

#record-btn.is-recording {
  background: #8e0000;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  50% { opacity: 0.7; }
}

#record-timer {
  font-variant-numeric: tabular-nums;
  color: #9aa0a6;
}

#landing,
#join-gate {
  text-align: center;
  padding: 4rem 1rem;
}

#landing p {
  color: #9aa0a6;
}

#join-gate label {
  display: block;
  color: #9aa0a6;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

#landing-error {
  color: #e57373;
}

#name-input,
#password-input {
  background: #1f242b;
  color: #e8eaed;
  border: 1px solid #2a2f36;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  width: 240px;
  margin-right: 0.5rem;
}

#start-session-btn,
#copy-link-btn,
#download-guest-btn,
#join-btn {
  background: #2d6cdf;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}

#copy-link-btn,
#download-guest-btn {
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
}

#download-guest-btn:disabled {
  background: #3a3f46;
  color: #7a7f86;
  cursor: default;
}

#recording-badge {
  color: #ff5252;
  font-weight: 600;
  animation: pulse 1.5s infinite;
}

#upload-status,
#peer-upload-status {
  font-size: 0.85rem;
  color: #9aa0a6;
  white-space: nowrap;
}

#upload-status.ok,
#peer-upload-status.ok {
  color: #4caf7d;
}

#upload-status.warn,
#peer-upload-status.warn {
  color: #e5a663;
}

#download-link {
  color: #8ab4f8;
}

.hint {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: #9aa0a6;
}

.hint code {
  background: #1f242b;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  user-select: all;
}
