/* Altyazılı Görüşme. Erişilebilirlik öncelikli, sakin bir uygulama arayüzü.
   Köşe kuralı: paneller 16px, alanlar ve düz düğmeler 12px, görüşme kontrolleri tam yuvarlak. */

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/font/atkinson-hyperlegible-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/vendor/font/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/vendor/font/atkinson-hyperlegible-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/vendor/font/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --scale: 1; /* yazı boyutu düğmeleri bunu değiştirir */

  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ebebe8;
  --line: #d6d6d1;
  --text: #17181b;
  --text-2: #4a4c52;
  --accent: #0b6e66;
  --accent-ink: #ffffff;
  --accent-soft: #d9eeeb;
  --danger: #b42318;
  --danger-ink: #ffffff;
  --focus: #1f5fd6;
  --me: #e8e6df;
  --peer: #dcefec;
  --stage: #101114;
  --caption-bg: rgb(12 13 15 / 0.86);
  --caption-ink: #fbfbf9;
  --shadow: 0 1px 2px rgb(23 24 27 / 0.06), 0 8px 24px rgb(23 24 27 / 0.06);

  --r-panel: 16px;
  --r-field: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --surface: #1c1d21;
    --surface-2: #26282d;
    --line: #34363c;
    --text: #f1f1ee;
    --text-2: #b4b6bc;
    --accent: #3fb8ac;
    --accent-ink: #0c1413;
    --accent-soft: #173733;
    --danger: #f0624f;
    --danger-ink: #1a0b09;
    --focus: #8ab4ff;
    --me: #2a2c31;
    --peer: #183a36;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: calc(17px * var(--scale));
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

.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 {
  position: absolute; left: 12px; top: -48px; z-index: 30;
  background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--r-field);
}
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- Üst çubuk ---- */
.bar {
  height: 60px;
  padding: 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem;
}
.brand i { font-size: 1.6rem; color: var(--accent); }
.bar-tools { display: flex; gap: 6px; }
.icon-btn {
  min-width: 44px; height: 44px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid var(--line); border-radius: var(--r-field);
  background: var(--surface); cursor: pointer;
}
.icon-btn i { font-size: 1.15rem; }
.icon-btn .tiny { font-weight: 700; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-2); }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.screen { flex: 1; }

/* ---- Düğmeler ve alanlar ---- */
.btn {
  min-height: 48px; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--r-field); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 120ms ease, background-color 160ms ease;
}
.btn i { font-size: 1.2rem; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 700; }
.optional { font-weight: 400; color: var(--text-2); }
input[type='text'], textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r-field);
  background: var(--surface); color: var(--text);
}
textarea { resize: none; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--text-2); opacity: 1; }
.hint { color: var(--text-2); font-size: 0.9rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-panel); box-shadow: var(--shadow);
  padding: 24px;
}
.panel-title { font-size: 1.3rem; }

/* ---- Giriş ekranı ---- */
.start {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding: 40px 20px 48px;
  display: grid; gap: 32px; align-content: start;
  grid-template-columns: 1fr;
}
.start-copy { display: grid; gap: 18px; align-content: start; padding-top: 8px; }
.start-copy h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); max-width: 16ch; }
.lead { font-size: 1.15rem; color: var(--text-2); max-width: 46ch; }
.how { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; }
.how li { display: flex; gap: 12px; align-items: flex-start; max-width: 46ch; }
.how i {
  flex: none; font-size: 1.25rem; color: var(--accent);
  width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft);
  display: grid; place-items: center;
}
.how span { padding-top: 7px; }
.join-form { display: grid; gap: 20px; align-content: start; }
.roles { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.roles legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.role { position: relative; display: block; cursor: pointer; }
.role input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.role-body {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-field);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.role-body i { font-size: 1.6rem; color: var(--text-2); margin-top: 2px; }
.role-body strong { display: block; }
.role-body small { display: block; color: var(--text-2); font-size: 0.9rem; }
.role input:checked + .role-body { border-color: var(--accent); background: var(--accent-soft); }
.role input:checked + .role-body i { color: var(--accent); }
.role input:focus-visible + .role-body { outline: 3px solid var(--focus); outline-offset: 2px; }
.join-form .btn.primary { width: 100%; min-height: 54px; font-size: 1.05rem; }

@media (min-width: 900px) {
  .start { grid-template-columns: 1.1fr 0.9fr; gap: 56px; padding-top: 72px; }
}

/* ---- Görüşme ekranı ---- */
.call {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
  flex: none; height: calc(100dvh - 60px); min-height: 0;
}
.stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--stage); }
.videos {
  position: relative; flex: 1;
  min-height: 32dvh; max-height: 42dvh;
  background: var(--stage); overflow: hidden;
}
#remote { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--stage); }
#local {
  position: absolute; right: 12px; top: 12px;
  width: clamp(96px, 22%, 200px); aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 12px; border: 2px solid rgb(255 255 255 / 0.35);
  background: #26282d; transform: scaleX(-1);
}
.waiting {
  position: absolute; inset: 0; padding: 24px;
  display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center;
  color: var(--caption-ink);
}
.waiting h2 { font-size: 1.4rem; }
.waiting p { color: rgb(251 251 249 / 0.78); max-width: 38ch; }
.share { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: min(560px, 100%); margin-top: 6px; }
.share input { flex: 1 1 260px; background: rgb(255 255 255 / 0.08); color: var(--caption-ink); border-color: rgb(255 255 255 / 0.22); }
.share .btn { background: rgb(255 255 255 / 0.12); color: var(--caption-ink); border-color: rgb(255 255 255 / 0.22); }
.share .btn:hover { background: rgb(255 255 255 / 0.2); }
.peer-tag {
  position: absolute; left: 12px; top: 12px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--caption-bg); color: var(--caption-ink); font-size: 0.85rem; font-weight: 700;
}

/* Canlı altyazı: televizyon altyazısı gibi koyu zemin üzerinde açık yazı */
.live {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 12px 14px; display: flex; justify-content: center; pointer-events: none;
}
.live p {
  max-width: min(92%, 52ch);
  background: var(--caption-bg); color: var(--caption-ink);
  padding: 8px 14px; border-radius: 10px;
  font-size: calc(1.45rem * var(--scale)); font-weight: 700; line-height: 1.35;
  text-align: center;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.live p:empty { display: none; }
.live .interim { opacity: 0.8; }

.controls {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 12px; background: var(--stage);
}
.ctl {
  min-height: 48px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1px solid rgb(255 255 255 / 0.18);
  background: rgb(255 255 255 / 0.1); color: var(--caption-ink);
  font-weight: 700; font-size: 0.92rem; cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease;
}
.ctl i { font-size: 1.25rem; }
.ctl:hover { background: rgb(255 255 255 / 0.18); }
.ctl:active { transform: scale(0.97); }
.ctl[aria-pressed='true'] { background: var(--caption-ink); color: #17181b; border-color: var(--caption-ink); }
.ctl.off { background: rgb(240 98 79 / 0.22); border-color: rgb(240 98 79 / 0.5); }
.ctl.end { background: #c8321f; border-color: #c8321f; color: #fff; }
.ctl.end:hover { background: #a92a1a; }
.ctl[disabled] { opacity: 0.45; cursor: not-allowed; }
.status { color: rgb(251 251 249 / 0.78); text-align: center; font-size: 0.9rem; padding: 0 12px 10px; min-height: 1.4em; }

.conversation {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--surface); border-top: 1px solid var(--line);
}
.conv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line);
}
.conv-head h2 { font-size: 1.05rem; }
.log {
  list-style: none; margin: 0; padding: 14px 16px;
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  min-height: 72px;
}
.log-empty { padding: 0 16px 14px; color: var(--text-2); }
.entry { display: grid; gap: 2px; max-width: 92%; }
.entry .who { font-size: 0.8rem; font-weight: 700; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.entry .who i { font-size: 0.95rem; }
.entry .bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: calc(1.1rem * var(--scale)); line-height: 1.4; overflow-wrap: anywhere;
}
.entry.peer { align-self: flex-start; }
.entry.peer .bubble { background: var(--peer); border-top-left-radius: 4px; }
.entry.me { align-self: flex-end; justify-items: end; }
.entry.me .bubble { background: var(--me); border-top-right-radius: 4px; }
.entry.interim .bubble { opacity: 0.72; font-style: italic; }
.entry.system { align-self: center; max-width: 100%; }
.entry.system .bubble { background: transparent; color: var(--text-2); font-size: 0.9rem; padding: 2px 8px; text-align: center; }

.phrases {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 2px;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.phrase {
  flex: none; scroll-snap-align: start;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 0.9rem; cursor: pointer; white-space: nowrap;
}
.phrase:hover { border-color: var(--accent); }
.compose {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
}
.compose textarea { flex: 1; min-height: 52px; max-height: 140px; font-size: calc(1.05rem * var(--scale)); }
.compose .btn { min-height: 52px; }

@media (max-width: 520px) {
  .ctl span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ctl { padding: 0 14px; min-width: 52px; justify-content: center; }
  .send-label { display: none; }
}

@media (min-width: 1000px) {
  .call { grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr); }
  .videos { min-height: 0; max-height: none; }
  .conversation { border-top: 0; border-left: 1px solid var(--line); }
}

/* Görüşme sonu */
.ended { display: grid; place-items: center; padding: 40px 20px; }
.ended .panel { max-width: 520px; display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Yeni mesaj geldiğinde kenarda kısa bir görsel işaret (sesli uyarının yerine) */
.flash .videos { box-shadow: inset 0 0 0 4px var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .videos { transition: box-shadow 220ms ease; }
}

.toast {
  position: fixed; left: 50%; top: 72px; transform: translate(-50%, -12px);
  max-width: min(92vw, 480px);
  background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-weight: 700;
  opacity: 0; pointer-events: none; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity 200ms ease, transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
