/* ==========================================================================
   Lixibu Drop — arayüz stilleri
   Açık/koyu tema, mobil öncelikli, tüm modern tarayıcılarla uyumlu.
   ========================================================================== */

/* ---------- Değişkenler ---------- */
:root {
  --bg:           #f4f6fb;
  --bg-2:         #eef1f8;
  --surface:      #ffffff;
  --surface-2:    #f7f9fd;
  --surface-3:    #eef2f9;
  --border:       #e2e8f2;
  --border-soft:  #edf1f7;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #5f6f86;
  --brand:        #4f46e5;
  --brand-2:      #0369a1;   /* beyaz metinle 6:1 kontrast; #0ea5e9 yalnizca 2.8:1 veriyordu */
  --brand-ink:    #ffffff;
  --brand-soft:   rgba(79, 70, 229, .10);
  --ok:           #047857;   /* beyaz zeminde 5.5:1 (#059669 yalnizca 3.8:1) */
  --ok-soft:      rgba(4, 120, 87, .12);
  --warn:         #b45309;   /* beyaz zeminde 5.1:1 (#d97706 yalnizca 3.2:1) */
  --danger:       #c81e1e;   /* sayfa zemininde 5.3:1 (#dc2626 yalnizca 4.5'in altinda) */
  --danger-soft:  rgba(200, 30, 30, .10);
  --ring:         rgba(79, 70, 229, .35);
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md:    0 4px 12px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg:    0 18px 46px rgba(15, 23, 42, .12), 0 4px 12px rgba(15, 23, 42, .06);
  --radius-sm:    10px;
  --radius:       16px;
  --radius-lg:    22px;
  --maxw:         1080px;
  --header-h:     64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  --bg:           #070b14;
  --bg-2:         #0b1220;
  --surface:      #111827;
  --surface-2:    #161f31;
  --surface-3:    #1d2739;
  --border:       #232f45;
  --border-soft:  #1b2536;
  --text:         #f1f5f9;
  --text-2:       #b6c2d4;
  --text-3:       #8494ac;
  --brand:        #818cf8;
  --brand-2:      #38bdf8;
  --brand-ink:    #0b1020;
  --brand-soft:   rgba(129, 140, 248, .16);
  --ok:           #34d399;
  --ok-soft:      rgba(52, 211, 153, .15);
  --warn:         #fbbf24;
  --danger:       #f87171;
  --danger-soft:  rgba(248, 113, 113, .14);
  --ring:         rgba(129, 140, 248, .45);
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md:    0 6px 18px rgba(0, 0, 0, .45);
  --shadow-lg:    0 24px 60px rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg:           #070b14;
    --bg-2:         #0b1220;
    --surface:      #111827;
    --surface-2:    #161f31;
    --surface-3:    #1d2739;
    --border:       #232f45;
    --border-soft:  #1b2536;
    --text:         #f1f5f9;
    --text-2:       #b6c2d4;
    --text-3:       #8494ac;
    --brand:        #818cf8;
    --brand-2:      #38bdf8;
    --brand-ink:    #0b1020;
    --brand-soft:   rgba(129, 140, 248, .16);
    --ok:           #34d399;
    --ok-soft:      rgba(52, 211, 153, .15);
    --warn:         #fbbf24;
    --danger:       #f87171;
    --danger-soft:  rgba(248, 113, 113, .14);
    --ring:         rgba(129, 140, 248, .45);
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md:    0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg:    0 24px 60px rgba(0, 0, 0, .6);
  }
}

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* hidden niteliği her zaman kazanır. Aşağıdaki kurallarda display tanımlı olduğu için
   tarayıcının varsayılan [hidden] kuralı ezilir; bu satır olmazsa gizli katmanlar
   görünmez biçimde sayfanın üstünde kalır ve tıklamaları engeller. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.22; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
li { list-style: none; }
button, input { font: inherit; color: inherit; }
b, strong { font-weight: 650; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--brand); color: var(--brand-ink);
  padding: 10px 16px; border-radius: var(--radius-sm); text-decoration: none;
}
.skip-link:focus { left: 12px; }

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(760px 420px at 12% -6%, rgba(99, 102, 241, .16), transparent 62%),
    radial-gradient(680px 420px at 92% 4%,  rgba(14, 165, 233, .14), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 42%);
}

/* ---------- Üst çubuk ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: var(--header-h);
  padding: 0 clamp(14px, 4vw, 28px);
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 4px 6px; margin-left: -6px; border-radius: 12px;
  text-decoration: none; color: var(--text);
  /* Dar ekranda baslik satiri tasmasin diye marka kisilabilir. */
  min-width: 0; flex: 0 1 auto; overflow: hidden;
}
/* Lixibu logosu: yükseklik sabit, genişlik oranla belirlenir.
   Açık ve koyu tema için iki ayrı dosya; koyu temada koyu mavi katman bir tık açılır. */
.brand-logo {
  display: block;
  height: 26px;
  width: auto;
  flex: none;
}
.brand-logo-dark { display: none; }

html[data-theme="dark"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .brand-logo-light { display: none; }
  html[data-theme="auto"] .brand-logo-dark { display: block; }
}

/* Logodaki "lixibu" küçük harfli olduğu için "Drop" da aynı ağırlıkta ve
   logonun taban çizgisine oturacak biçimde hizalanır. */
.brand-text {
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -.01em;
  color: var(--text);
  line-height: 1;
  padding-bottom: 1px;
}

.header-actions { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; flex: none;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text-2);
  cursor: pointer; transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); }
@supports (border-color: color-mix(in srgb, red 50%, blue)) {
  .icon-btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
}
.icon-btn:active { transform: scale(.94); }

#themeBtn .icon-moon { display: none; }
html[data-theme="dark"] #themeBtn .icon-sun { display: none; }
html[data-theme="dark"] #themeBtn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] #themeBtn .icon-sun { display: none; }
  html[data-theme="auto"] #themeBtn .icon-moon { display: block; }
}

.conn-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
  font-size: .82rem; font-weight: 600; color: var(--text-2); white-space: nowrap;
  min-width: 0; flex: 0 1 auto;
}
.conn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.conn-pill[data-state="connecting"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 38%, var(--border)); }
.conn-pill[data-state="connecting"] .conn-dot { background: var(--warn); animation: pulse 1.15s ease-in-out infinite; }
.conn-pill[data-state="connected"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: var(--ok-soft); }
.conn-pill[data-state="connected"] .conn-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.conn-pill[data-state="lost"] { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: var(--danger-soft); }
.conn-pill[data-state="lost"] .conn-dot { background: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Yerleşim ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 52px) clamp(14px, 4vw, 28px) calc(48px + env(safe-area-inset-bottom));
}

.screen { animation: screenIn .34s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Giriş ekranı ---------- */
.hero { text-align: center; max-width: 660px; margin: 0 auto clamp(26px, 5vw, 42px); }
.hero h1 { font-size: clamp(1.8rem, 5.6vw, 2.9rem); margin-bottom: 14px; }
.grad {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--text-2); font-size: clamp(.98rem, 2.4vw, 1.1rem); }

.start-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: clamp(14px, 2.4vw, 22px);
}

.start-or {
  display: flex; align-items: center; justify-content: center;
  position: relative; color: var(--text-3); font-size: .85rem; font-weight: 600;
}
.start-or::before, .start-or::after {
  content: ""; position: absolute; left: 50%; width: 1px;
  background: linear-gradient(var(--border), transparent);
  transform: translateX(-50%);
}
.start-or::before { top: 0; height: calc(50% - 22px); background: linear-gradient(transparent, var(--border)); }
.start-or::after  { bottom: 0; height: calc(50% - 22px); }
.start-or span {
  background: var(--surface); border: 1px solid var(--border);
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(20px, 3.2vw, 28px);
}

.card-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.card-head h2 { font-size: 1.16rem; margin-bottom: 4px; }
.card-head p { color: var(--text-2); font-size: .92rem; }
.card-icon {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.card-foot { margin-top: 12px; color: var(--text-3); font-size: .82rem; text-align: center; }

.card-create { display: flex; flex-direction: column; }
.card-create .btn { margin-top: auto; }
.card-join form { display: flex; flex-direction: column; }
.card-join .code-input-wrap { margin-top: auto; }

/* Giriş kartındaki kısa kullanım anlatımı */
.mini-steps {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px;
}
.mini-steps li {
  display: flex; align-items: flex-start; gap: 10px;
  color: var(--text-2); font-size: .88rem; line-height: 1.45;
}
.mini-steps li .n {
  flex: none;
  width: 21px; height: 21px; margin-top: 1px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
  font-size: .73rem; font-weight: 700;
}
.mini-steps li b { color: var(--text); font-weight: 650; }

/* Kod girişi */
.code-input-wrap { position: relative; }
.code-input {
  width: 100%;
  padding: 15px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: clamp(.18em, 1.4vw, .34em);
  text-align: center;
  text-transform: uppercase;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.code-input::placeholder { letter-spacing: .28em; color: var(--text-3); font-weight: 500; opacity: .55; }
.code-input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--ring);
}
.code-input.is-invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
  animation: shake .32s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.field-error { margin-top: 9px; color: var(--danger); font-size: .86rem; font-weight: 600; text-align: center; }

/* ---------- Aynı ağdaki cihazlar ---------- */
.nearby {
  margin: 0 auto clamp(20px, 3.5vw, 30px);
  max-width: 760px;
  padding: clamp(14px, 2.4vw, 20px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.nearby[data-phase="pairing"] {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.nearby-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.nearby-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-2);
}
.nearby[data-phase="searching"] .nearby-icon svg { animation: nearbyScan 1.8s ease-in-out infinite; }
@keyframes nearbyScan { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.nearby-headings { flex: 1 1 auto; min-width: 0; }
.nearby-headings h2 {
  margin: 0 0 2px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.nearby-headings p {
  margin: 0;
  font-size: .87rem;
  color: var(--text-2);
}

.nearby-off {
  flex: none;
  /* Başlıktaki simge düğmeleriyle aynı yükseklik: dokunma hedefi rahatça 40px. */
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .16s, border-color .16s, background .16s;
}
.nearby-off:hover { color: var(--text); border-color: var(--brand); }

.nearby-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nearby-list:empty { margin: 0; }

.nearby-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: var(--bg);
}
.nearby-item[data-kind="pairing"] {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.nearby-item[data-kind="invite"] {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.nearby-dev-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
}
.nearby-item[data-kind="pairing"] .nearby-dev-icon,
.nearby-item[data-kind="invite"] .nearby-dev-icon { background: var(--surface); }

.nearby-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
}
.nearby-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nearby-sub {
  font-size: .8rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nearby-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.nearby-state {
  margin: 12px 0 0;
  font-size: .85rem;
  color: var(--text-2);
}
.nearby-state:empty { margin: 0; }

/* Dar ekran: satırlar iki kata düşer, düğmeler tam genişlik olur */
@media (max-width: 520px) {
  .nearby-head { flex-wrap: wrap; }
  .nearby-off { order: 3; margin-left: auto; }
  .nearby-item { flex-wrap: wrap; }
  .nearby-info { flex-basis: calc(100% - 48px); }
  .nearby-actions { flex-basis: 100%; }
  .nearby-actions .btn { flex: 1 1 auto; }
}

/* ---------- Düğmeler ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent; border-radius: 14px;
  font-weight: 650; font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, box-shadow .16s, background .16s, border-color .16s, opacity .16s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .58; cursor: not-allowed; }
.btn-lg { width: 100%; padding: 15px 22px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 8px 13px; font-size: .84rem; border-radius: 11px; }

.btn-primary {
  background: linear-gradient(100deg, var(--brand), var(--brand-2));
  /* Koyu temada degrade parlaktir; beyaz yazı okunmaz. brand-ink tema ile değişir. */
  color: var(--brand-ink);
  box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--brand) 62%, transparent);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 28px -6px color-mix(in srgb, var(--brand) 70%, transparent); }

.btn-secondary { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }

.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

.btn-ok { background: var(--ok); color: var(--brand-ink); border-color: transparent; }
.btn-ok:hover:not(:disabled) { filter: brightness(1.06); }

/* Yükleniyor durumu */
.spinner {
  display: none;
  width: 17px; height: 17px;
  border: 2.2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading .btn-label { opacity: .55; }
.btn.is-loading .spinner { display: inline-block; }

/* ---------- Özellik satırı ---------- */
.feature-row {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px;
  margin-top: clamp(28px, 5vw, 44px);
}
.feature-row li {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: .86rem; font-weight: 550;
}
.feature-row svg { color: var(--brand); flex: none; }

/* ---------- Oda: bekleme ---------- */
.waiting-panel { max-width: 720px; margin: 0 auto; }
.waiting-head { text-align: center; margin-bottom: 26px; }
.waiting-head h2 { font-size: clamp(1.25rem, 3.6vw, 1.6rem); margin-bottom: 8px; }
.waiting-head p { color: var(--text-2); font-size: .95rem; }

.room-share {
  display: grid; grid-template-columns: 1fr auto; gap: clamp(18px, 3vw, 32px);
  align-items: center;
}

.label {
  display: block; text-transform: uppercase; letter-spacing: .09em;
  font-size: .7rem; font-weight: 700; color: var(--text-3); margin-bottom: 8px;
}
.room-qr .label { margin: 10px 0 0; text-align: center; }

.room-code {
  font-family: var(--mono);
  font-size: clamp(2rem, 9vw, 3.1rem);
  font-weight: 750;
  letter-spacing: clamp(.08em, 1.6vw, .16em);
  line-height: 1.1;
  padding: 14px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  user-select: all; -webkit-user-select: all;
  transition: border-color .16s, background .16s, transform .12s;
  word-break: break-all;
}
.room-code:hover { border-color: var(--brand); background: var(--brand-soft); }
.room-code:active { transform: scale(.99); }

.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.room-qr { text-align: center; }
/* Karekodun okunabilmesi için taranan alan beyaz kalmalı; çerçeve temaya uyar.
   Koyu temada göz yormaması için beyaz alan yalnızca karekodun kendisi kadardır. */
.qr-box {
  width: 176px; height: 176px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.qr-box canvas {
  background: #fff;
  border-radius: 6px;
  padding: 6px;
}
.qr-box canvas { display: block; width: 100%; height: 100%; }

.waiting-status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 26px; padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-2); font-size: .93rem; font-weight: 550;
  text-align: center;
}
.pulse-dots { display: inline-flex; gap: 4px; }
.pulse-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: bounce 1.25s ease-in-out infinite; }
.pulse-dots i:nth-child(2) { animation-delay: .17s; }
.pulse-dots i:nth-child(3) { animation-delay: .34s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---------- Oda: aktarım ---------- */
.transfer-panel { display: flex; flex-direction: column; gap: 16px; }

.peer-bar {
  display: grid; grid-template-columns: 1fr minmax(96px, 1.1fr) 1fr;
  align-items: center; gap: 12px;
  padding: 16px clamp(14px, 3vw, 22px);
}
.peer-side { display: flex; align-items: center; gap: 11px; min-width: 0; }
.peer-other { justify-content: flex-end; }
.peer-info { min-width: 0; display: flex; flex-direction: column; }
.peer-info-right { text-align: right; align-items: flex-end; }
.peer-info strong { font-size: .96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.peer-info span { font-size: .78rem; color: var(--text-3); }

.peer-avatar {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
  font-weight: 700; font-size: .95rem;
}
.peer-me .peer-avatar { background: var(--brand-soft); color: var(--brand); }

.peer-link { position: relative; display: flex; align-items: center; justify-content: center; min-height: 42px; }
.link-line {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, var(--border) 0 6px, transparent 6px 12px);
}
.peer-link[data-state="connected"] .link-line {
  background: linear-gradient(90deg, var(--brand), var(--ok));
  animation: none;
}
.link-badge {
  position: relative;
  padding: 4px 11px; border-radius: 999px;
  /* Arkadaki bağlantı çizgisinin rozetin içinden geçmemesi için zemin her zaman opak olmalı. */
  background: var(--surface); border: 1px solid var(--border);
  font-size: .74rem; font-weight: 700; color: var(--text-3); white-space: nowrap;
}
.peer-link[data-state="connected"] .link-badge {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, var(--border));
  box-shadow: inset 0 0 0 999px var(--ok-soft);
}
.peer-link[data-state="lost"] .link-badge { box-shadow: inset 0 0 0 999px var(--danger-soft); }
.peer-link[data-state="connecting"] .link-badge { color: var(--warn); }
.peer-link[data-state="lost"] .link-line { background: repeating-linear-gradient(90deg, var(--danger) 0 6px, transparent 6px 12px); }
.peer-link[data-state="lost"] .link-badge { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* color-mix desteklemeyen eski tarayıcılar için yedek */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .peer-link[data-state="connected"] .link-badge { border-color: var(--ok); }
  .peer-link[data-state="lost"] .link-badge { border-color: var(--danger); }
  .conn-pill[data-state="connected"] { border-color: var(--ok); }
  .conn-pill[data-state="lost"] { border-color: var(--danger); }
  .conn-pill[data-state="connecting"] { border-color: var(--warn); }
  .drop-zone:hover { border-color: var(--brand); }
  .btn-secondary:hover:not(:disabled) { border-color: var(--brand); }
  .btn-danger { border-color: var(--danger); }
  .icon-btn:hover { border-color: var(--brand); }
  .drop-overlay { background: var(--surface-2); }
  .btn-primary { box-shadow: 0 8px 22px -6px rgba(79, 70, 229, .55); }
}

/* Sürükle-bırak alanı */
.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  background: var(--surface);
  padding: clamp(26px, 6vw, 46px) 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .14s;
  overflow: hidden;
}
.drop-zone:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); background: var(--surface-2); }
.drop-zone.is-dragover { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.008); }
.drop-zone.is-disabled { opacity: .55; cursor: not-allowed; }

.drop-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon {
  width: 64px; height: 64px; border-radius: 20px; margin-bottom: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
  transition: transform .18s;
}
.drop-zone:hover .drop-icon { transform: translateY(-2px); }
.drop-title { font-weight: 700; font-size: clamp(1rem, 3vw, 1.18rem); }
.drop-sub { color: var(--text-2); font-size: .9rem; }
.link-like { color: var(--brand); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }

.drop-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  color: var(--brand); font-weight: 700; font-size: 1.05rem;
  opacity: 0; pointer-events: none; transition: opacity .16s;
}
.drop-zone.is-dragover .drop-overlay { opacity: 1; }

/* Araç çubuğu */
.transfer-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 4px;
}
.toolbar-summary { color: var(--text-3); font-size: .85rem; font-weight: 600; }

/* Aktarım listesi */
.transfer-list { display: flex; flex-direction: column; gap: 10px; }

.transfer-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  animation: itemIn .28s cubic-bezier(.22, .9, .3, 1) both;
}
@keyframes itemIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ti-icon {
  flex: none; width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
}
.transfer-item[data-dir="in"]  .ti-icon { background: var(--brand-soft); color: var(--brand); }
.transfer-item[data-state="done"] .ti-icon { background: var(--ok-soft); color: var(--ok); }
.transfer-item[data-state="error"] .ti-icon,
.transfer-item[data-state="cancelled"] .ti-icon { background: var(--danger-soft); color: var(--danger); }

.ti-body { min-width: 0; }
.ti-name {
  font-weight: 600; font-size: .94rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ti-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin-top: 3px; color: var(--text-3); font-size: .79rem;
  font-variant-numeric: tabular-nums;
}
.ti-meta .sep { opacity: .5; }
.ti-state { font-weight: 650; }
.transfer-item[data-state="done"]  .ti-state { color: var(--ok); }
.transfer-item[data-state="error"] .ti-state,
.transfer-item[data-state="cancelled"] .ti-state { color: var(--danger); }

.ti-bar {
  position: relative; height: 5px; margin-top: 8px;
  background: var(--surface-3); border-radius: 999px; overflow: hidden;
}
.ti-bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width .18s linear;
}
.transfer-item[data-state="done"] .ti-bar { display: none; }
.transfer-item[data-state="error"] .ti-bar-fill,
.transfer-item[data-state="cancelled"] .ti-bar-fill { background: var(--danger); }

.ti-actions { display: flex; align-items: center; gap: 7px; }
.ti-actions .btn { white-space: nowrap; }

/* Gizli indirme bağlantısı stil uyumu */
a.btn { text-decoration: none; }

.empty-note {
  text-align: center; color: var(--text-3); font-size: .86rem;
  padding: 6px 10px;
}

.room-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.room-chip { color: var(--text-3); font-size: .84rem; }
.room-chip b { font-family: var(--mono); color: var(--text-2); letter-spacing: .08em; }

/* ---------- Kip penceresi ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 22, .58); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; z-index: 1;
  width: min(560px, 100%); max-height: min(84vh, 720px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: clamp(22px, 4vw, 32px);
  animation: modalIn .26s cubic-bezier(.22, .9, .3, 1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-card h2 { font-size: 1.35rem; margin-bottom: 16px; padding-right: 34px; }
.modal-card h3 { font-size: .99rem; margin: 20px 0 6px; }
.modal-card p { color: var(--text-2); font-size: .92rem; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.steps li {
  counter-increment: step;
  position: relative; padding-left: 40px;
  color: var(--text-2); font-size: .93rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 27px; height: 27px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: .84rem;
}
.steps li strong { color: var(--text); }

/* ---------- Bildirimler ---------- */
.toasts {
  position: fixed; z-index: 80;
  left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 9px; align-items: center;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 15px;
  border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .9rem; font-weight: 550; color: var(--text);
  animation: toastIn .26s cubic-bezier(.22, .9, .3, 1) both;
}
.toast.is-out { animation: toastOut .22s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast-icon { flex: none; display: inline-flex; }
.toast[data-kind="success"] .toast-icon { color: var(--ok); }
.toast[data-kind="error"]   .toast-icon { color: var(--danger); }
.toast[data-kind="info"]    .toast-icon { color: var(--brand); }
.toast[data-kind="warn"]    .toast-icon { color: var(--warn); }

.noscript {
  margin: 20px auto; max-width: 620px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  text-align: center; font-weight: 600;
}

/* ---------- Duyarlı yerleşim ---------- */
@media (max-width: 860px) {
  .start-grid { grid-template-columns: 1fr; }
  .start-or { min-height: 40px; }
  .start-or::before, .start-or::after {
    left: 0; right: 0; width: auto; height: 1px; top: 50%; transform: none;
  }
  .start-or::before { left: 0; width: calc(50% - 30px); background: var(--border); }
  .start-or::after  { left: auto; right: 0; width: calc(50% - 30px); bottom: auto; top: 50%; height: 1px; background: var(--border); }
}

@media (max-width: 680px) {
  .room-share { grid-template-columns: 1fr; justify-items: center; }
  .room-code-block { width: 100%; }
  .room-code-block .label { text-align: center; }
  .share-buttons { justify-content: center; }
  .qr-box { width: 164px; height: 164px; }
}

@media (max-width: 560px) {
  .peer-bar { grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 13px; }
  .peer-info strong { font-size: .87rem; }
  .peer-info span { font-size: .72rem; }
  .peer-avatar { width: 38px; height: 38px; font-size: .86rem; }
  .link-badge { font-size: .68rem; padding: 3px 8px; }

  .transfer-item { grid-template-columns: auto minmax(0, 1fr); gap: 10px 11px; padding: 12px; }
  .ti-actions { grid-column: 1 / -1; justify-content: stretch; }
  .ti-actions .btn { flex: 1; }

  .feature-row { gap: 9px 16px; }
  .feature-row li { font-size: .8rem; }

  .share-buttons .btn { flex: 1 1 auto; min-width: 140px; }
}

@media (max-width: 380px) {
  .share-buttons .btn { min-width: 100%; }
  .room-code { font-size: 1.85rem; letter-spacing: .06em; }
  .brand-logo { height: 22px; }
  .brand-text { font-size: 1rem; }
  .brand { gap: 7px; }
  /* Cok dar ekranda baglanti rozeti yalniz renkli nokta olarak kalir;
     durum metni ekran okuyucu icin #srStatus uzerinden verilmeye devam eder. */
  .conn-pill { padding: 0 9px; gap: 0; }
  .conn-pill .conn-text { display: none; }
  .header-actions { gap: 6px; }
}

/* Yatay mobil */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { margin-bottom: 20px; }
  .drop-zone { padding: 20px; }
  .drop-icon { width: 48px; height: 48px; margin-bottom: 2px; }
}

/* Büyük ekran */
@media (min-width: 1240px) {
  :root { --maxw: 1120px; }
}

/* ---------- Erişilebilirlik ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  .card, .transfer-item, .icon-btn { border-width: 2px; }
  .drop-zone { border-width: 3px; }
}

/* Yazdırma */
@media print {
  .site-header, .toasts, .modal, .drop-zone, .room-footer, .feature-row { display: none !important; }
  body { background: #fff; color: #000; }
}
