/* Unicrium Meet — refined dark theme, mobile-first */

:root {
  --bg: #0b0b0d;
  --bg-elevated: #16161a;
  --border: #26262d;
  --border-bright: #3a3a44;
  --text: #ececef;
  --text-muted: #8a8a94;
  --text-dim: #5a5a64;
  --accent: #d4a574;
  --accent-dim: #8a6a4a;
  --danger: #e85a5a;
  --success: #6abf69;

  --serif: 'Instrument Serif', 'EB Garamond', Georgia, serif;
  --sans: 'Inria Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(212, 165, 116, 0.06), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 110%, rgba(212, 165, 116, 0.04), transparent 60%),
    var(--bg);
}

/* dvh = dynamic viewport height (iOS Safari URL bar gizlenince doğru yüksekliği verir) */
.screen {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, var(--safe-top)) max(24px, var(--safe-right)) max(24px, var(--safe-bottom)) max(24px, var(--safe-left));
  overflow-y: auto;
}

.hidden { display: none !important; }

/* ---------- Lobby ---------- */

.lobby-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.brand {
  font-family: var(--serif);
  font-size: clamp(36px, 8vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand span {
  font-style: italic;
  color: var(--accent);
}

.tagline {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 300;
}

.step { margin-top: 28px; }

/* iOS Safari input zoom'unu engelle: 16px+ olmalı */
.btn-primary, .btn-danger, .addr-input {
  font-size: 16px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
  min-height: 52px;
  -webkit-appearance: none;
  appearance: none;
}
.btn-primary:active { transform: scale(0.98); background: var(--accent); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--accent); transform: translateY(-1px); }
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-danger {
  padding: 16px 20px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 10px;
  font-family: var(--sans);
  cursor: pointer;
  min-height: 52px;
  -webkit-appearance: none;
  appearance: none;
}
.btn-danger:active { background: rgba(232, 90, 90, 0.15); }
@media (hover: hover) {
  .btn-danger:hover { background: rgba(232, 90, 90, 0.1); }
}

.hint {
  margin-top: 14px;
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

/* ---------- Address Display ---------- */

.label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  display: block;
}

.addr {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.addr.big { font-size: 14px; padding: 14px 16px; display: block; margin: 16px 0; }

.addr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.addr-row .label { white-space: nowrap; }
.addr-row .addr { flex: 1; font-size: 12px; min-width: 0; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.dot.offline { background: var(--text-dim); }

/* ---------- Peer input ---------- */

.peer-section .label { margin-bottom: 10px; }

.addr-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  min-height: 52px;
}
.addr-input:focus {
  outline: none;
  border-color: var(--accent-dim);
}

.peer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.peer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
  min-height: 44px;
}
.peer-item:active { border-color: var(--accent-dim); background: rgba(212, 165, 116, 0.05); }
@media (hover: hover) {
  .peer-item:hover { border-color: var(--accent-dim); }
}
.peer-item .addr { flex: 1; border: none; padding: 0; background: transparent; font-size: 12px; }

/* ---------- Log ---------- */

.log {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.6;
}
.log .log-error { color: var(--danger); }
.log .log-success { color: var(--success); }

/* ---------- Incoming call ---------- */

.incoming-card {
  text-align: center;
  padding: 48px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 165, 116, 0.3); }
  50% { box-shadow: 0 0 0 20px rgba(212, 165, 116, 0); }
}

.incoming-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.incoming-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.incoming-actions button { flex: 1; }

/* ---------- Call screen ---------- */

#call {
  background: #000;
  padding: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

#remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

#local-wrapper {
  position: absolute;
  top: max(16px, var(--safe-top));
  right: max(16px, var(--safe-right));
  width: 28vw;
  max-width: 140px;
  min-width: 90px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #111;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 10;
  touch-action: none; /* drag için */
  user-select: none;
}
#local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror */
}

.call-status {
  position: absolute;
  top: max(16px, var(--safe-top));
  left: max(16px, var(--safe-left));
  z-index: 10;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 60vw;
}
#status-text {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}
.call-status .addr {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 11px;
  color: var(--text);
}

.controls {
  position: absolute;
  bottom: max(24px, calc(var(--safe-bottom) + 12px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
  padding: 0 12px;
}

.ctrl {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ctrl:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.18); }
@media (hover: hover) {
  .ctrl:hover { background: rgba(255, 255, 255, 0.16); }
}
.ctrl.disabled { background: rgba(255, 255, 255, 0.28); color: var(--text-dim); }
.ctrl.danger { background: var(--danger); border-color: var(--danger); }
.ctrl.danger:active { background: #c44848; }
.ctrl svg { width: 22px; height: 22px; }

/* ---------- Mobile-specific ---------- */

@media (max-width: 600px) {
  .lobby-card {
    padding: 28px 22px;
    border-radius: 12px;
  }
  .ctrl {
    width: 52px;
    height: 52px;
  }
  .ctrl svg { width: 20px; height: 20px; }
  .controls { gap: 8px; }
  .addr.big { font-size: 12px; }
}

/* Çok küçük ekranlar (iPhone SE vb) */
@media (max-width: 380px) {
  .ctrl { width: 48px; height: 48px; }
  .ctrl svg { width: 18px; height: 18px; }
  .lobby-card { padding: 24px 18px; }
  .step { margin-top: 22px; }
}

/* Yatay (landscape) — kontroller yandan */
@media (orientation: landscape) and (max-height: 500px) {
  #local-wrapper {
    width: 18vh;
    max-width: 160px;
  }
  .controls {
    bottom: 16px;
  }
}

/* Copy-address button next to the wallet address (2026-11-23) */
.addr-row #my-addr { cursor: pointer; }
.btn-copy {
  margin-left: 8px; padding: 4px 10px; font-size: 12px; line-height: 1.4;
  border-radius: 6px; border: 1px solid rgba(255,255,255,.18);
  background: transparent; color: inherit; cursor: pointer; white-space: nowrap;
}
.btn-copy:hover { border-color: rgba(255,255,255,.4); }
.btn-copy.copied { border-color: #3fb950; color: #3fb950; }
