/* =========================================================
   LOTUS 1.4.0 — tema sistemi
   Her tema aşağıdaki değişkenleri doldurur; bileşenler sadece değişken kullanır.
   ========================================================= */

:root, [data-theme] {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-title: var(--font);
  --radius: 10px;
  --bubble-radius: 12px;

  --app-bg: #05070a;
  --app-bg-image: none;
  --text: #eef4fb;
  --muted: #9fb0c2;
  --accent: #5cb3ff;
  --accent-text: #ffffff;
  --online: #4ee08f;
  --danger: #ff6b7d;

  --panel-bg: rgba(20, 24, 30, .72);
  --panel-border: rgba(255, 255, 255, .14);
  --panel-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --panel-blur: 14px;
  --panel-gloss: none;

  --header-bg: rgba(10, 13, 18, .7);
  --header-border: rgba(255, 255, 255, .12);

  --btn-bg: linear-gradient(#3a3f46, #1b1e23);
  --btn-border: rgba(255, 255, 255, .22);
  --btn-text: #eef4fb;
  --btn-shadow: inset 0 1px rgba(255, 255, 255, .25), 0 1px 3px rgba(0, 0, 0, .5);
  --primary-bg: linear-gradient(#4aa3ff, #1f6fd1);
  --primary-border: #7cc0ff;

  --input-bg: rgba(0, 0, 0, .35);
  --input-border: rgba(255, 255, 255, .2);

  --bubble-in-bg: rgba(28, 33, 41, .88);
  --bubble-in-border: rgba(255, 255, 255, .14);
  --bubble-in-text: #eef4fb;
  --bubble-out-bg: linear-gradient(rgba(64, 140, 220, .8), rgba(36, 96, 170, .85));
  --bubble-out-border: rgba(140, 200, 255, .55);
  --bubble-out-text: #ffffff;
  --bubble-meta: rgba(255, 255, 255, .6);
  --bubble-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

/* ---------- So much to tell you<3 ---------- */
[data-theme="pastel"] {
  --font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --bubble-radius: 18px;
  --app-bg: #121c17;
  --app-bg-image: radial-gradient(circle at 20% 0%, rgba(245, 184, 207, .14), transparent 45%), radial-gradient(circle at 90% 100%, rgba(169, 220, 184, .12), transparent 50%);
  --text: #f3faf5;
  --muted: #a9c2b4;
  --accent: #f5b8cf;
  --accent-text: #3a1f2b;
  --online: #a9dcb8;
  --danger: #ff9bb3;
  --panel-bg: rgba(30, 46, 39, .86);
  --panel-border: rgba(169, 220, 184, .28);
  --panel-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --panel-blur: 10px;
  --header-bg: rgba(22, 35, 29, .88);
  --header-border: rgba(169, 220, 184, .2);
  --btn-bg: linear-gradient(#2f4a3e, #233a30);
  --btn-border: rgba(169, 220, 184, .35);
  --btn-text: #e9f6ee;
  --btn-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  --primary-bg: linear-gradient(#f8c7d9, #eea4c0);
  --primary-border: #ffd9e6;
  --input-bg: rgba(10, 20, 15, .5);
  --input-border: rgba(169, 220, 184, .3);
  --bubble-in-bg: rgba(37, 58, 49, .93);
  --bubble-in-border: rgba(169, 220, 184, .45);
  --bubble-in-text: #eef8f1;
  --bubble-out-bg: linear-gradient(135deg, rgba(246, 190, 212, .95), rgba(232, 160, 190, .95));
  --bubble-out-border: #ffdbe8;
  --bubble-out-text: #3a1f2b;
  --bubble-meta: rgba(0, 0, 0, .45);
}
[data-theme="pastel"] .message:not(.mine) .meta { color: rgba(233, 246, 238, .6); }

/* ---------- Win7'ye geri dönüş · Soft White ---------- */
[data-theme="win7-white"] {
  --app-bg: #d6e4f3;
  --app-bg-image: linear-gradient(160deg, #e9f2fb, #c9dbef 60%, #b8cfe8);
  --text: #14243a;
  --muted: #4d627c;
  --accent: #2c7fd6;
  --accent-text: #ffffff;
  --online: #2aa860;
  --danger: #c8283f;
  --panel-bg: rgba(255, 255, 255, .58);
  --panel-border: rgba(255, 255, 255, .9);
  --panel-shadow: 0 0 0 1px rgba(60, 90, 130, .35), 0 10px 30px rgba(30, 60, 100, .25);
  --panel-blur: 16px;
  --panel-gloss: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, .25) 48%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, .18));
  --header-bg: linear-gradient(rgba(255, 255, 255, .78), rgba(220, 234, 248, .62) 50%, rgba(196, 218, 240, .62) 51%, rgba(215, 230, 246, .7));
  --header-border: rgba(70, 105, 150, .45);
  --btn-bg: linear-gradient(#f6f6f6 0%, #ebebeb 45%, #dbdbdb 50%, #cfcfcf 100%);
  --btn-border: #7a7a7a;
  --btn-text: #14243a;
  --btn-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
  --primary-bg: linear-gradient(#e9f5fd 0%, #d4ebfb 45%, #a8d6f6 50%, #8dc9f1 100%);
  --primary-border: #3c7fb1;
  --input-bg: rgba(255, 255, 255, .85);
  --input-border: #8aa7c6;
  --bubble-in-bg: rgba(255, 255, 255, .82);
  --bubble-in-border: rgba(110, 145, 185, .55);
  --bubble-in-text: #14243a;
  --bubble-out-bg: linear-gradient(#e6f3fe, #c6e2fa 50%, #b0d6f7 51%, #c3e0f9);
  --bubble-out-border: #6fa3d6;
  --bubble-out-text: #0f2740;
  --bubble-meta: rgba(20, 36, 58, .55);
  --bubble-shadow: 0 1px 4px rgba(30, 60, 100, .25);
}
[data-theme="win7-white"] .primary { color: #0b2b4a; }

/* ---------- Win7'ye geri dönüş · Piano Black ---------- */
[data-theme="win7-black"] {
  --app-bg: #040507;
  --app-bg-image: radial-gradient(ellipse at 50% -20%, #1c2533, #040507 60%);
  --text: #eef4fb;
  --muted: #93a4b8;
  --accent: #5cb3ff;
  --panel-bg: rgba(14, 18, 24, .55);
  --panel-border: rgba(255, 255, 255, .16);
  --panel-shadow: 0 0 0 1px rgba(0, 0, 0, .8), 0 12px 32px rgba(0, 0, 0, .6);
  --panel-blur: 16px;
  --panel-gloss: linear-gradient(rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 48%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, .03));
  --header-bg: linear-gradient(rgba(60, 66, 76, .72), rgba(24, 27, 32, .72) 50%, rgba(8, 9, 11, .78) 51%, rgba(20, 22, 26, .78));
  --header-border: rgba(255, 255, 255, .14);
  --btn-bg: linear-gradient(#4a5059 0%, #2b2f35 48%, #15181c 52%, #1f2328 100%);
  --btn-border: rgba(0, 0, 0, .9);
  --btn-shadow: inset 0 1px rgba(255, 255, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .06);
  --primary-bg: linear-gradient(#6cbcff 0%, #3a92e6 48%, #1d6fc8 52%, #2a83de 100%);
  --primary-border: #0b3a6b;
  --bubble-in-bg: rgba(22, 26, 33, .82);
  --bubble-out-bg: linear-gradient(rgba(70, 150, 230, .62), rgba(40, 110, 190, .55) 50%, rgba(28, 90, 165, .6) 51%, rgba(40, 110, 190, .6));
  --bubble-out-border: rgba(130, 195, 255, .6);
}

/* ---------- Bu varken biz yoktuk. (Vista, opak) ---------- */
[data-theme="vista"] {
  --radius: 6px;
  --bubble-radius: 8px;
  --app-bg: #08101c;
  --app-bg-image: linear-gradient(#0d1a2c, #060b14);
  --text: #dbe7f6;
  --muted: #8ea4c2;
  --accent: #4fa3ff;
  --panel-bg: linear-gradient(#1c3150, #0f1d31);
  --panel-border: #35598a;
  --panel-shadow: 0 6px 20px rgba(0, 0, 0, .55);
  --panel-blur: 0px;
  --panel-gloss: linear-gradient(rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 46%, rgba(255, 255, 255, 0) 47%);
  --header-bg: linear-gradient(#23406a 0%, #142a48 50%, #0b1a30 51%, #102340 100%);
  --header-border: #3a6297;
  --btn-bg: linear-gradient(#2c4a74 0%, #1b3456 49%, #0f2341 50%, #183152 100%);
  --btn-border: #4a74aa;
  --btn-text: #e3eefb;
  --btn-shadow: inset 0 1px rgba(255, 255, 255, .22);
  --primary-bg: linear-gradient(#5fb0ff 0%, #2f86e0 49%, #1667c2 50%, #2479d4 100%);
  --primary-border: #9fd0ff;
  --input-bg: #0a1424;
  --input-border: #35598a;
  --bubble-in-bg: linear-gradient(#18293f, #111f33);
  --bubble-in-border: #2f5180;
  --bubble-out-bg: linear-gradient(#2a5f99 0%, #1d4a7d 50%, #163c69 51%, #1b4677 100%);
  --bubble-out-border: #5f9ad8;
  --bubble-meta: rgba(210, 228, 250, .6);
}

/* ---------- Cyberpunk'tan araklamışlar. ---------- */
[data-theme="neon"] {
  --font: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-title: "Orbitron", "Rajdhani", "Segoe UI", sans-serif;
  --radius: 2px;
  --bubble-radius: 2px;
  --app-bg: #06050c;
  --app-bg-image: radial-gradient(circle at 0% 0%, rgba(255, 43, 214, .16), transparent 40%), radial-gradient(circle at 100% 100%, rgba(0, 240, 255, .14), transparent 45%);
  --text: #f1eaff;
  --muted: #a493c8;
  --accent: #ff2bd6;
  --accent-text: #0b0614;
  --online: #2bffb0;
  --danger: #ff3864;
  --panel-bg: rgba(14, 10, 26, .86);
  --panel-border: rgba(0, 240, 255, .55);
  --panel-shadow: 0 0 0 1px rgba(255, 43, 214, .25), 0 0 18px rgba(0, 240, 255, .18);
  --panel-blur: 6px;
  --header-bg: rgba(10, 6, 20, .9);
  --header-border: #ff2bd6;
  --btn-bg: linear-gradient(rgba(255, 43, 214, .12), rgba(0, 240, 255, .08));
  --btn-border: #00f0ff;
  --btn-text: #e8fbff;
  --btn-shadow: 0 0 8px rgba(0, 240, 255, .35);
  --primary-bg: linear-gradient(90deg, #ff2bd6, #b026ff);
  --primary-border: #ffb3f1;
  --input-bg: rgba(0, 0, 0, .55);
  --input-border: rgba(255, 43, 214, .55);
  --bubble-in-bg: rgba(8, 18, 28, .9);
  --bubble-in-border: #00f0ff;
  --bubble-in-text: #e8fbff;
  --bubble-out-bg: rgba(40, 6, 40, .9);
  --bubble-out-border: #ff2bd6;
  --bubble-out-text: #ffe8fb;
  --bubble-meta: rgba(232, 251, 255, .55);
  --bubble-shadow: 0 0 10px rgba(255, 43, 214, .18);
}
[data-theme="neon"] .message { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
[data-theme="neon"] .message:not(.mine) { box-shadow: inset 0 0 12px rgba(0, 240, 255, .12); }
[data-theme="neon"] .message.mine { box-shadow: inset 0 0 12px rgba(255, 43, 214, .16); }
[data-theme="neon"] .brand, [data-theme="neon"] .logo-title { text-shadow: 0 0 8px #ff2bd6, 0 0 22px rgba(0, 240, 255, .6); letter-spacing: 4px; text-transform: uppercase; }
[data-theme="neon"] .section-title { color: #00f0ff; text-shadow: 0 0 6px rgba(0, 240, 255, .7); }
[data-theme="neon"] .primary { color: #fff; text-shadow: 0 0 6px rgba(255, 255, 255, .6); }

/* ---------- Terminalden çıkamayanlar. (amber fosfor) ---------- */
[data-theme="amber"] {
  --font: "Cascadia Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;
  --radius: 0px;
  --bubble-radius: 0px;
  --app-bg: #0b0803;
  --app-bg-image: radial-gradient(ellipse at center, #1a1206, #0b0803 70%);
  --text: #ffcc6e;
  --muted: #b3843a;
  --accent: #ffb000;
  --accent-text: #1a1000;
  --online: #ffd780;
  --danger: #ff6a3d;
  --panel-bg: rgba(22, 15, 6, .94);
  --panel-border: #7a5418;
  --panel-shadow: 0 0 14px rgba(255, 176, 0, .12);
  --panel-blur: 0px;
  --panel-gloss: repeating-linear-gradient(rgba(255, 176, 0, .045) 0 1px, transparent 1px 3px);
  --header-bg: #140e05;
  --header-border: #7a5418;
  --btn-bg: #1d1407;
  --btn-border: #a8731f;
  --btn-text: #ffcc6e;
  --btn-shadow: none;
  --primary-bg: #ffb000;
  --primary-border: #ffd780;
  --input-bg: #0b0803;
  --input-border: #7a5418;
  --bubble-in-bg: rgba(20, 14, 5, .94);
  --bubble-in-border: #7a5418;
  --bubble-in-text: #ffcc6e;
  --bubble-out-bg: rgba(58, 40, 10, .95);
  --bubble-out-border: #ffb000;
  --bubble-out-text: #ffe2a8;
  --bubble-meta: rgba(255, 204, 110, .55);
  --bubble-shadow: none;
}
[data-theme="amber"] body { text-shadow: 0 0 4px rgba(255, 176, 0, .35); }
[data-theme="amber"] .primary { color: #1a1000; text-shadow: none; }
[data-theme="amber"] .brand::before { content: "> "; }
[data-theme="amber"] #text::placeholder { color: #8a6328; }

/* =========================================================
   TEMEL
   ========================================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
dialog:not([open]) { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--app-bg);
  background-image: var(--app-bg-image);
  overflow: hidden;
  transition: background-color .3s, color .3s;
}
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

button {
  cursor: pointer;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: calc(var(--radius) * .6);
  box-shadow: var(--btn-shadow);
  padding: 8px 14px;
  transition: transform .08s, filter .15s;
}
button:active { transform: translateY(1px); filter: brightness(.92); }
button:disabled { opacity: .55; }
.primary { background: var(--primary-bg); border-color: var(--primary-border); color: var(--accent-text); font-weight: 600; }
.icon-btn { width: 40px; height: 40px; padding: 0; font-size: 18px; display: inline-grid; place-items: center; flex-shrink: 0; }
.icon-spacer { width: 40px; }
.link-btn { background: none; border: 0; box-shadow: none; color: var(--muted); text-decoration: underline; }
.wide { width: 100%; padding: 12px; }

input:not([type="checkbox"]):not([type="range"]):not([type="file"]), select, textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: calc(var(--radius) * .6);
  padding: 11px 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

.panel {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  -webkit-backdrop-filter: blur(var(--panel-blur));
  backdrop-filter: blur(var(--panel-blur));
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--panel-gloss);
  pointer-events: none;
}
.panel > * { position: relative; }

#app {
  max-width: 680px;
  margin: auto;
  height: 100vh;
  height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.menu-bg { opacity: .5; }
#menuScreen > :not(.menu-bg) { position: relative; z-index: 1; }

.connection-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 60;
  padding: 6px 12px; text-align: center; font-size: 13px; font-weight: 600;
  background: #6b4512f0; color: #ffe6bd;
}

/* =========================================================
   GİRİŞ / KİLİT
   ========================================================= */
.login {
  position: absolute; top: 50%; left: 50%;
  width: min(380px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 34px 26px;
  text-align: center;
}
.logo-title { font-family: var(--font-title); font-size: 34px; letter-spacing: 6px; margin: 6px 0 22px; }
.login form { display: flex; gap: 8px; }
.login-footer { margin-top: 18px; }
.server-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.lock-text { color: var(--muted); margin: -10px 0 20px; }
#lockScreen .link-btn { margin-top: 12px; }

.lotus { width: 84px; height: 62px; margin: 0 auto; position: relative; filter: drop-shadow(0 0 12px var(--accent)); }
.lotus i {
  position: absolute; left: 34px; bottom: 5px; width: 17px; height: 48px;
  background: linear-gradient(#fff, var(--accent)); border-radius: 100% 0 100% 0; transform-origin: 50% 100%;
}
.lotus i:nth-child(1) { transform: rotate(-55deg); }
.lotus i:nth-child(2) { transform: rotate(-28deg); }
.lotus i:nth-child(3) { height: 55px; }
.lotus i:nth-child(4) { transform: scaleX(-1) rotate(-28deg); }
.lotus i:nth-child(5) { transform: scaleX(-1) rotate(-55deg); }
.lotus b { position: absolute; bottom: 3px; left: 24px; width: 38px; height: 5px; background: var(--accent); border-radius: 50%; opacity: .8; }

/* =========================================================
   ÜST ÇUBUKLAR
   ========================================================= */
.app-header, .chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  -webkit-backdrop-filter: blur(var(--panel-blur));
  backdrop-filter: blur(var(--panel-blur));
  flex-shrink: 0;
  z-index: 5;
}
.app-header { justify-content: space-between; }
.brand { font-family: var(--font-title); font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* =========================================================
   AVATAR
   ========================================================= */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--btn-bg) center / cover no-repeat;
  border: 1px solid var(--panel-border);
  font-weight: 700; font-size: 14px;
}
.avatar.large { width: 84px; height: 84px; font-size: 22px; }
.avatar.xl { width: 64px; height: 64px; font-size: 20px; }

/* =========================================================
   ANA MENÜ
   ========================================================= */
.menu-content { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin: 8px 4px 0; }

.me-card, .dm-card { width: 100%; text-align: left; color: var(--text); cursor: pointer; padding: 14px; }
.me-card { display: flex; align-items: center; gap: 12px; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.me-edit { color: var(--muted); font-size: 18px; }

.dm-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.dm-top { display: flex; align-items: center; gap: 14px; }
.dm-avatar-wrap { position: relative; }
.presence-dot {
  position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #6b7280; border: 2px solid var(--app-bg);
}
.presence-dot.online { background: var(--online); box-shadow: 0 0 8px var(--online); }
.dm-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dm-name-row { display: flex; align-items: center; gap: 8px; }
.dm-name-row strong { font-size: 19px; }
.unread-pill { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.dm-presence-text { font-size: 13px; color: var(--muted); }
.dm-presence-text.online { color: var(--online); }
.dm-presence-text.typing { color: var(--accent); }
.dm-mood { font-size: 14px; font-style: italic; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-last { display: flex; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--panel-border); }
.dm-snippet { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 14px; }
.dm-last-time { font-size: 12px; color: var(--muted); }
.dm-unread-badge { align-self: flex-start; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }

.update-banner { margin: 12px 14px 0; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.update-texts { flex: 1; display: flex; flex-direction: column; font-size: 13px; }
.menu-footer { text-align: center; font-size: 12px; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }

/* =========================================================
   AYARLAR
   ========================================================= */
.settings-content { flex: 1; overflow-y: auto; padding: 8px 14px 24px; display: flex; flex-direction: column; gap: 8px; }
.settings-group { padding: 0; overflow: hidden; }
.setting-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: none; border: 0; border-radius: 0; box-shadow: none; text-align: left; color: var(--text);
}
.setting-row + .setting-row { border-top: 1px solid var(--panel-border); }
.setting-label { display: flex; flex-direction: column; gap: 2px; }
.setting-label small { color: var(--muted); font-size: 12px; }
.chev { color: var(--muted); font-size: 20px; }
.setting-row select { width: auto; padding: 6px 10px; }
.danger-text { color: var(--danger); }

.switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0;
  width: 46px; height: 26px; border-radius: 999px; position: relative; cursor: pointer;
  background: var(--input-bg); border: 1px solid var(--input-border); transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); transition: transform .2s, background .2s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(20px); background: #fff; }
.switch:disabled { opacity: .4; }

/* =========================================================
   SOHBET
   ========================================================= */
.chat-screen-layout { height: 100%; }
.identity { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.identity strong { font-size: 16px; }
.status-subtext { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-subtext.online { color: var(--online); }
.status-subtext.typing { color: var(--accent); animation: pulseTyping 1.2s infinite; }
@keyframes pulseTyping { 50% { opacity: .5; } }

.peer-mood-bar {
  padding: 6px 14px; font-size: 13px; font-style: italic; flex-shrink: 0; z-index: 4;
  background: var(--header-bg); border-bottom: 1px solid var(--header-border); color: var(--muted);
}
.peer-mood-bar span::before { content: "“"; } .peer-mood-bar span::after { content: "”"; }

.chat-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.chat-bg { position: absolute; inset: 0; overflow: hidden; background-size: cover; background-position: center bottom; z-index: 0; }
#messages {
  position: relative; z-index: 1; height: 100%;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px; display: flex; flex-direction: column; gap: 6px;
}

.message {
  max-width: 78%;
  padding: 6px 10px 7px;
  border-radius: var(--bubble-radius);
  border: 1px solid var(--bubble-in-border);
  background: var(--bubble-in-bg);
  color: var(--bubble-in-text);
  box-shadow: var(--bubble-shadow);
  align-self: flex-start;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-size: 15px;
}
.message.mine {
  align-self: flex-end;
  border-color: var(--bubble-out-border);
  background: var(--bubble-out-bg);
  color: var(--bubble-out-text);
}
.message > span { white-space: pre-wrap; }
.message .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--bubble-meta); margin-bottom: 2px; }
.meta-status { display: inline-flex; align-items: center; gap: 6px; }
.read-receipt.seen { font-weight: 700; }
.msg-actions, .retry-btn { background: none; border: 0; box-shadow: none; padding: 0 2px; font-size: 11px; color: inherit; opacity: .75; }
.retry-btn { color: var(--danger); opacity: 1; font-weight: 700; }
.message.pending { opacity: .6; }
.message.failed { border-color: var(--danger); }

.message img { display: block; max-width: 100%; max-height: 340px; margin-top: 3px; border-radius: calc(var(--bubble-radius) * .6); object-fit: cover; }
.message.drawing-message { max-width: min(86%, 420px); }
.message-drawing { width: 100%; height: auto; object-fit: contain !important; background: rgba(0, 0, 0, .35); }

/* Reels: önce oynat kartı, dokununca embed */
.message.reel-message { width: min(300px, 82%); }
.reel-card {
  width: 100%; height: 150px; margin-top: 4px; border-radius: calc(var(--bubble-radius) * .6);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, #833ab4, #fd1d1d 60%, #fcb045); border: 0; color: #fff; font-weight: 700;
}
.reel-card .play { width: 52px; height: 52px; border-radius: 50%; background: rgba(0, 0, 0, .35); display: grid; place-items: center; font-size: 22px; }
.reel-embed { position: relative; width: 100%; height: 470px; margin-top: 4px; border-radius: calc(var(--bubble-radius) * .6); overflow: hidden; background: #000; }
.reel-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.reel-open { margin-top: 4px; width: 100%; padding: 6px; font-size: 12px; }

/* Ses */
.audio-msg-player { display: flex; align-items: center; gap: 10px; margin-top: 3px; min-width: 200px; }
.audio-play-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.audio-track-info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.audio-wave-bar { height: 4px; border-radius: 4px; background: rgba(127, 127, 127, .35); overflow: hidden; }
.audio-wave-progress { height: 100%; width: 0; background: currentColor; }
.audio-duration { font-size: 11px; opacity: .7; }

/* Yazma çubuğu */
#composer {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--header-bg); border-top: 1px solid var(--header-border);
  -webkit-backdrop-filter: blur(var(--panel-blur)); backdrop-filter: blur(var(--panel-blur));
  flex-shrink: 0; z-index: 5;
}
#composer #text { flex: 1; }
.upload-indicator { padding: 4px 12px; font-size: 12px; color: var(--accent); background: var(--header-bg); flex-shrink: 0; z-index: 5; }
.recording-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--header-bg); border-top: 1px solid var(--header-border); flex-shrink: 0; z-index: 5; }
.rec-indicator { display: flex; align-items: center; gap: 8px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulseTyping 1s infinite; }
.rec-hint { color: var(--muted); font-size: 13px; }
.rec-buttons { display: flex; gap: 8px; }

/* =========================================================
   DİALOGLAR
   ========================================================= */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 100vw; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.sheet-modal { margin: auto auto 0; width: min(680px, 100vw); }
.sheet-content { padding: 16px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: 85vh; display: flex; flex-direction: column; gap: 10px; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-header h3 { margin: 0; font-family: var(--font-title); }
.sheet-actions { display: flex; gap: 8px; align-items: center; }
.sheet-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-btn { display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; }
.opt-icon { font-size: 22px; }
.opt-text { display: flex; flex-direction: column; }
.opt-text small { color: var(--muted); font-size: 11px; }

.dialog-form { padding: 18px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 12px; }
.dialog-form h3 { margin: 0; font-family: var(--font-title); }
.dialog-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.dialog-form menu { display: flex; justify-content: flex-end; gap: 8px; margin: 4px 0 0; padding: 0; }
.avatar-preview-area { display: flex; align-items: center; gap: 14px; }
.file-btn { display: inline-block; padding: 8px 12px; border: 1px solid var(--btn-border); background: var(--btn-bg); border-radius: calc(var(--radius) * .6); cursor: pointer; font-size: 13px; }

/* Tema seçici */
.theme-sheet { overflow-y: auto; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-option { padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.theme-option.selected, .bg-option.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.theme-swatch { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid rgba(127, 127, 127, .4); }
.theme-swatch i { flex: 1; }
.theme-option span { font-size: 13px; font-weight: 600; line-height: 1.2; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bg-option { padding: 0; overflow: hidden; display: flex; flex-direction: column; border-radius: 8px; }
.bg-option .bg-preview { position: relative; height: 86px; overflow: hidden; }
.bg-option .bg-preview .chat-bg { position: absolute; inset: 0; }
.bg-option span { font-size: 11px; padding: 6px; text-align: center; line-height: 1.2; }

/* GIF */
.gif-sheet { max-height: 80vh; }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow-y: auto; min-height: 120px; }
.gif-cell { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: rgba(0, 0, 0, .3); }
.gif-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.gif-del { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; padding: 0; border-radius: 50%; font-size: 11px; }
.gif-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 24px 8px; font-size: 13px; }

/* Çizim */
.drawing-dialog { margin: auto; }
.drawing-box { width: min(560px, 96vw); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.canvas-wrap { height: 320px; border-radius: 8px; overflow: hidden; background: #0b0f14; border: 1px solid var(--panel-border); touch-action: none; }
#drawingCanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.drawing-tools { display: flex; flex-direction: column; gap: 8px; }
.color-palette { display: flex; gap: 6px; flex-wrap: wrap; }
.color-btn { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.color-btn.active { border-color: var(--text); }
.eraser-btn { background: var(--btn-bg) !important; }
.drawing-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* =========================================================
   SOHBET ARKA PLANLARI
   ========================================================= */
.chat-bg[data-bg="solid-black"] { background: #000; }
.chat-bg[data-bg="solid-pink"] { background: #f4c9d6; }
.chat-bg[data-bg="solid-navy"] { background: #34446a; }
.chat-bg[data-bg="pixel"] { background-color: #2a0f19; background-size: 64px 64px; background-position: 0 0; image-rendering: pixelated; }
.chat-bg[data-bg="forest"] { background-color: #132420; background-size: cover; background-position: center bottom; }

/* Aurora */
.chat-bg[data-bg="aurora"] { background: linear-gradient(#020812, #071a2b 55%, #0b2537); }
.aurora { position: absolute; left: -30%; width: 160%; height: 45%; filter: blur(38px); opacity: .7; border-radius: 50%; mix-blend-mode: screen; animation: auroraDrift 22s ease-in-out infinite alternate; }
.aurora.a1 { top: 4%; background: linear-gradient(90deg, transparent, #2bffb0 30%, #19d6c6 55%, transparent); }
.aurora.a2 { top: 18%; background: linear-gradient(90deg, transparent 10%, #3a8bff 40%, #8a5bff 70%, transparent); animation-duration: 28s; animation-delay: -8s; opacity: .55; }
.aurora.a3 { top: 30%; height: 30%; background: linear-gradient(90deg, transparent 20%, #39f5a0 50%, transparent 85%); animation-duration: 34s; animation-delay: -15s; opacity: .4; }
@keyframes auroraDrift {
  0% { transform: translateX(-6%) skewY(-6deg) scaleY(.9); }
  50% { transform: translateX(4%) skewY(4deg) scaleY(1.15); }
  100% { transform: translateX(8%) skewY(-3deg) scaleY(1); }
}
.aurora-stars, .stars { position: absolute; inset: 0; background-repeat: repeat; }
.aurora-stars, .stars.s1 {
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 35%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 75% 15%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 90%, #fff 50%, transparent 51%);
  background-size: 220px 220px;
  opacity: .55;
}

/* Gece gökyüzü + yıldız kayması yağmuru */
.chat-bg[data-bg="night"] { background: radial-gradient(ellipse at 70% 0%, #1b2552, #0b1029 45%, #05060f); }
.stars.s2 {
  background-image:
    radial-gradient(1.5px 1.5px at 20% 40%, #dfe8ff 50%, transparent 51%),
    radial-gradient(1px 1px at 65% 25%, #dfe8ff 50%, transparent 51%),
    radial-gradient(2px 2px at 85% 80%, #fff6d6 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 60%, #dfe8ff 50%, transparent 51%);
  background-size: 160px 160px;
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .9; } }
.shooting-star {
  position: absolute; width: 110px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, .95), rgba(180, 200, 255, .4) 40%, transparent);
  transform: rotate(-35deg);
  transform-origin: left center;
  animation: shoot 4s linear infinite;
  filter: drop-shadow(0 0 4px rgba(200, 220, 255, .8));
}
@keyframes shoot {
  0% { opacity: 0; transform: rotate(-35deg) translateX(0) scaleX(.3); }
  6% { opacity: 1; }
  30% { opacity: 0; transform: rotate(-35deg) translateX(-260px) scaleX(1); }
  100% { opacity: 0; transform: rotate(-35deg) translateX(-260px) scaleX(1); }
}

/* Orman ateş böcekleri */
.firefly { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff3b8; box-shadow: 0 0 8px 3px rgba(255, 236, 160, .55); opacity: 0; animation: firefly 8s ease-in-out infinite; }
@keyframes firefly {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  30% { opacity: .9; }
  50% { transform: translate(14px, -18px); opacity: .5; }
  70% { opacity: .9; transform: translate(-8px, -30px); }
}

/* Vista kurdeleleri */
.chat-bg[data-bg="ribbons"] { background: radial-gradient(ellipse at 30% 110%, #0d3b7a, #061427 55%, #030812); }
.ribbon { position: absolute; left: -40%; width: 180%; height: 140px; border-radius: 50%; filter: blur(10px); opacity: .55; animation: ribbonDrift 26s ease-in-out infinite alternate; }
.ribbon.r1 { top: 55%; background: linear-gradient(90deg, transparent, rgba(120, 200, 255, .55) 40%, rgba(255, 255, 255, .5) 52%, rgba(60, 140, 255, .4) 65%, transparent); transform: rotate(-12deg); }
.ribbon.r2 { top: 63%; height: 90px; background: linear-gradient(90deg, transparent 10%, rgba(80, 255, 200, .35) 45%, rgba(200, 255, 240, .45) 55%, transparent 85%); transform: rotate(-8deg); animation-duration: 32s; animation-delay: -10s; }
.ribbon.r3 { top: 45%; height: 60px; background: linear-gradient(90deg, transparent 20%, rgba(255, 255, 255, .35) 50%, transparent 80%); transform: rotate(-16deg); animation-duration: 38s; animation-delay: -18s; opacity: .4; }
.ribbon-glow { position: absolute; left: 10%; top: 50%; width: 60%; height: 30%; background: radial-gradient(ellipse, rgba(150, 210, 255, .25), transparent 70%); }
@keyframes ribbonDrift { from { translate: -5% 0; } to { translate: 6% -4%; } }

@media (prefers-reduced-motion: reduce) {
  .aurora, .ribbon, .shooting-star, .firefly, .stars.s2 { animation: none !important; }
  .shooting-star { display: none; }
}

@media (max-width: 420px) {
  .sheet-options { grid-template-columns: 1fr; }
  .canvas-wrap { height: 260px; }
}
