:root {
  --bg: #000;
  --panel: #0e0e10;
  --panel2: #17171a;
  --line: #26262b;
  --text: #f4f4f5;
  --muted: #9a9aa3;
  --accent: #e5252a;
  --green: #3ecf6b;
  --nav-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.m-boot { margin: auto; text-align: center; color: var(--muted); }
.m-boot img { border-radius: 22px; }

/* üst çubuk, ana alan, alt menü */
.m-top { flex: none; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.m-top-logo { width: 26px; height: 26px; border-radius: 7px; }
.m-top-title { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px; }
.m-nav { flex: none; display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); border-top: 1px solid var(--line); background: var(--panel); }
.m-nav-item { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; color: var(--muted); font-size: 11px; }
.m-nav-item.on { color: var(--text); }
.m-nav-item.on .m-nav-ico { color: var(--accent); }
.m-nav-ico svg { display: block; }
.m-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.m-badge.inline { position: static; }

/* ortak */
.m-muted { color: var(--muted); }
.small { font-size: 13px; }
.m-pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.m-pill.ok { background: rgba(62,207,107,.15); color: var(--green); }
.m-btn { min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 600; }
.m-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-btn.block { display: block; width: 100%; }
.m-btn:disabled { opacity: .6; }
.m-input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; }
.m-err { color: #ff6b6b; min-height: 20px; font-size: 14px; }
.m-list { display: flex; flex-direction: column; gap: 10px; }
.m-grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-section { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.m-mini { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 6px 4px; }
.m-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); text-align: left; cursor: pointer; }
.m-row-ico { width: 36px; text-align: center; color: var(--muted); font-weight: 700; font-size: 20px; }

/* giriş */
.m-login { margin: auto; width: 100%; max-width: 360px; padding: 24px; }
.m-login form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; }
.m-login h1 { margin: 0 0 6px; }
.m-login input { min-height: 50px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-size: 16px; }
.m-login-logo { align-self: center; border-radius: 22px; }

/* odalar */
.m-room { display: block; width: 100%; text-align: left; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; }
.m-room.here { border-color: var(--accent); }
.m-room.locked { opacity: .55; }
.m-room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.m-room-name { font-weight: 700; font-size: 17px; }
.m-room-users { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.m-room-user { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* oda içi */
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-tile { position: relative; border-radius: 14px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.m-tile.video { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.m-video { position: absolute; inset: 0; display: grid; place-items: center; background: #050506; }
.m-video video { width: 100%; height: 100%; object-fit: contain; }
.m-video video.mirror { transform: scaleX(-1); }
.m-tile-name { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 16px); padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.65); font-size: 13px; }
.m-live { background: var(--accent); border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.m-tile-btn { position: absolute; right: 8px; top: 8px; padding: 6px 10px; border-radius: 999px; border: 0; background: rgba(0,0,0,.65); font-size: 12px; }
.m-watchers { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 999px; background: rgba(0,0,0,.65); font-size: 12px; }
.m-watchers .avatar { margin-left: -6px; border: 2px solid #000; }
.m-watchers .avatar:first-child { margin-left: 0; }
.m-tile.full { position: fixed; inset: 0; z-index: 50; border-radius: 0; aspect-ratio: auto; border: 0; background: #000; }
.m-person { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; padding: 12px 8px; text-align: center; }
.m-person.speaking { border-color: var(--green); box-shadow: 0 0 0 2px var(--green) inset; }
.m-person-name { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-person-state { font-size: 12px; color: var(--muted); min-height: 16px; }
.avatar { border-radius: 50%; overflow: hidden; display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* kontroller */
.m-controls { flex: none; display: flex; gap: 6px; justify-content: space-around; padding: 8px 8px 10px; background: var(--panel); border-top: 1px solid var(--line); }
.m-ctrl { flex: 1; max-width: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border-radius: 12px; background: var(--panel2); border: 0; font-size: 11px; color: var(--text); cursor: pointer; }
.m-ctrl.off { background: #3a1214; color: #ff8a8d; }
.m-ctrl.on { background: #14301d; color: var(--green); }
.m-ctrl.hangup { background: var(--accent); }
.m-ctrl svg { display: block; fill: none; stroke: currentColor; }

/* ses paneli */
.m-sb { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.m-sb-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; padding: 8px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.m-sb-btn.special { border-color: var(--accent); }
.m-sb-emoji { font-size: 26px; }
.m-sb-name { font-size: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.sb-badge { position: absolute; left: 50%; top: 8px; translate: -50% 0; z-index: 5; max-width: 90%; padding: 4px 12px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* sohbet */
.m-main:has(.m-chat) { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.m-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.m-chat-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.m-back { background: none; border: 0; font-size: 28px; line-height: 1; padding: 0 8px 4px; cursor: pointer; }
.m-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.m-msg { align-self: flex-start; max-width: 82%; padding: 7px 11px; border-radius: 14px; background: var(--panel2); }
.m-msg.mine { align-self: flex-end; background: #3a1214; }
.m-msg-who { font-size: 12px; font-weight: 700; color: var(--accent); }
.m-msg-body { white-space: pre-wrap; word-break: break-word; }
.m-msg-time { font-size: 11px; color: var(--muted); text-align: right; }
.m-compose { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.m-compose-in { resize: none; max-height: 120px; }
.m-send { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
svg { stroke: currentColor; }

/* ben */
.m-me { display: flex; align-items: center; gap: 14px; padding: 8px 0 12px; }
.m-opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.m-opt .m-input { width: auto; min-height: 38px; }

/* pencere (modal) ve bildirim: masaüstü sınıfları telefona uyarlanır */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-height: 85dvh; overflow: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 14px 16px calc(16px + var(--safe-b)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.icon-btn { background: none; border: 0; color: var(--text); padding: 8px; cursor: pointer; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 600; }
.btn.danger { background: var(--accent); border-color: var(--accent); }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 76px); translate: -50% 0; z-index: 200; max-width: 90%; padding: 10px 16px; border-radius: 12px; background: #222228; color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
#toast.error { background: #5b1519; }
#toast:not(.show) { display: none; }

/* ses paneli GIF efekti */
.fx-layer { position: fixed; inset: 0; z-index: 250; pointer-events: none; display: grid; place-items: center; }
.fx-item { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: fx-pop .25s ease-out; transition: opacity .3s, scale .3s; }
.fx-item img { width: min(80vw, 360px); height: auto; max-height: 45vh; object-fit: contain; border-radius: 12px; filter: drop-shadow(0 12px 32px rgba(0,0,0,.55)); }
.fx-label { background: rgba(0,0,0,.7); color: #fff; font-weight: 700; font-size: 15px; padding: 5px 12px; border-radius: 999px; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-item.out { opacity: 0; scale: .92; }
@keyframes fx-pop { from { opacity: 0; scale: .6; } 70% { scale: 1.05; } to { opacity: 1; scale: 1; } }
