:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #6aa9ff;
  --accent-ink: #0b1220;
  --ok: #4ade80;
  --warn: #fbbf24;
  --rec: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* ---------------------------------------------------------------------------
   KRİTİK: `hidden` özniteliği her zaman kazanmalı.

   Tarayıcı `[hidden]` için `display: none` uygular, ama bu kural UA
   stil sayfasından gelir ve AŞAĞIDAKİ `.center { display: grid }` gibi
   herhangi bir yazar kuralı onu ezer. O durumda `el.hidden = true` yazmak
   hiçbir işe yaramaz: giriş ekranı panelin üstünde durmaya devam eder ve
   "giriş çalışmıyor" gibi görünür. Oysa giriş çalışmıştır.
   --------------------------------------------------------------------------- */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.view { min-height: 100dvh; }
.center { display: grid; place-items: center; padding: 16px; }

main { padding: 0 16px 48px; max-width: 760px; margin: 0 auto; }

.brand { font-size: 22px; letter-spacing: -0.3px; margin: 0 0 2px; }
.brand.small { font-size: 15px; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px); z-index: 5;
}

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
  margin: 28px 0 10px; display: flex; align-items: center; gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card.narrow { width: min(380px, 100%); display: grid; gap: 12px; }

label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

input {
  width: 100%; padding: 11px 12px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; /* iOS'ta odakta zoom olmasin */
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  appearance: none; cursor: pointer;
  padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 14px; font-weight: 500;
}
.btn:hover { border-color: #3a414f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 650; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--rec); }
.btn.tiny { padding: 6px 10px; font-size: 12.5px; }
.btn.rec-on { background: var(--rec); color: #1a0b0b; border-color: transparent; font-weight: 650; }

.error { color: var(--rec); font-size: 13px; margin: 0; }

/* Giris kartinin altindaki yasal baglantilar */
.legal { text-align: center; margin: 2px 0 0; font-size: 12.5px; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover { color: var(--text); text-decoration: underline; }

/* --- cihaz kartlari --- */
.devices { display: grid; gap: 12px; }

.device {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  display: grid; gap: 12px;
}
.device-head { display: flex; align-items: center; gap: 10px; }
.device-name { font-weight: 600; }
.device-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(74,222,128,.16); }
.dot.off { background: #4b5563; }
.dot.rec { background: var(--rec); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.live { color: var(--accent); border-color: rgba(106,169,255,.4); }
.badge.rec { color: var(--rec); border-color: rgba(248,113,113,.4); }

/* --- eslestirme --- */
.pairing { margin-top: 12px; display: grid; gap: 10px; justify-items: start; }
.pairing h3 { margin: 0; font-size: 15px; }
.paircode {
  font-size: 30px; font-weight: 700; letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); border: 1px dashed var(--accent);
  border-radius: 12px; padding: 14px 18px; width: 100%; text-align: center;
}
.paircode small { display: block; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-top: 6px; }

/* --- canli --- */
.live { display: grid; gap: 10px; }
.live-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#meter { width: 100%; height: 48px; background: var(--surface-2); border-radius: 8px; display: block; }

/* --- kayitlar --- */
.recordings { display: grid; gap: 10px; }
.rec-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px;
}
.rec-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rec-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-item audio { width: 100%; height: 36px; }
.rec-actions { display: flex; gap: 8px; }

.empty { color: var(--muted); font-size: 13.5px; padding: 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 20px; margin: 0; padding: 10px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13.5px; z-index: 50;
  max-width: calc(100vw - 32px);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
