/* Telegram Web gorunumu. Olculer ve renkler Telegram Web (K) ile ayni tutuldu. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: #707579;
  --accent: #3390ec;
  --accent-text: #ffffff;
  --divider: #dadce0;
  --section-gap: #f4f4f5;
  --hover: rgba(112, 117, 121, 0.08);
  --bubble: #ffffff;
  --bubble-shadow: 0 1px 2px rgba(16, 35, 47, 0.15);
  --meta: #a2acb4;
  --link: #3390ec;
  --code: #e17076;
  --code-bg: rgba(0, 0, 0, 0.05);
  --service-bg: rgba(87, 125, 75, 0.45);
  --wall-1: #dbddbb;
  --wall-2: #6ba587;
  --wall-3: #d5d88d;
  --wall-4: #88b884;
  --wall-base: #9fc396;
  --pattern: rgba(0, 0, 0, 0.1);
  --pattern-opacity: 1;
  /* isim renkleri: kirmizi, turuncu, mor, yesil, camgobegi, mavi, pembe */
  --n0: #cc5049; --n1: #d67722; --n2: #955cdb; --n3: #40a920;
  --n4: #309eba; --n5: #368ad1; --n6: #c7508b;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181818;
    --surface: #212121;
    --text: #ffffff;
    --muted: #aaaaaa;
    --accent: #8774e1;
    --divider: #0f0f0f;
    --section-gap: #181818;
    --hover: rgba(255, 255, 255, 0.06);
    --bubble: #212121;
    --bubble-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --meta: #8f8f8f;
    --link: #8774e1;
    --code: #ff8a80;
    --code-bg: rgba(255, 255, 255, 0.07);
    --service-bg: rgba(0, 0, 0, 0.35);
    --wall-base: #0f0f0f;
    --pattern: linear-gradient(135deg, #6ba587, #d5d88d, #88b884, #6ba587);
    --pattern-opacity: 0.45;
    --n0: #ff8e86; --n1: #eda86c; --n2: #b18fff; --n3: #88d367;
    --n4: #4fd1d8; --n5: #78c1ff; --n6: #ff7cab;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #181818; --surface: #212121; --text: #ffffff; --muted: #aaaaaa;
  --accent: #8774e1; --divider: #0f0f0f; --section-gap: #181818; --hover: rgba(255, 255, 255, 0.06);
  --bubble: #212121; --bubble-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --meta: #8f8f8f;
  --link: #8774e1; --code: #ff8a80; --code-bg: rgba(255, 255, 255, 0.07); --service-bg: rgba(0, 0, 0, 0.35);
  --wall-base: #0f0f0f; --pattern: linear-gradient(135deg, #6ba587, #d5d88d, #88b884, #6ba587);
  --pattern-opacity: 0.45;
  --n0: #ff8e86; --n1: #eda86c; --n2: #b18fff; --n3: #88d367;
  --n4: #4fd1d8; --n5: #78c1ff; --n6: #ff7cab;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.3125 Roboto, -apple-system, BlinkMacSystemFont, "Apple Color Emoji", "Segoe UI", Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; height: 100vh; }
@supports (height: 100dvh) { .app { height: 100dvh; } }

/* ------------------------------------------------------------------ sohbet */
.chat {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--wall-base);
}
/* Telegram'in 4 renkli yumusak gecisli duvar kagidi */
.chat::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 10% 15%, var(--wall-1) 0, transparent 60%),
    radial-gradient(ellipse at 90% 10%, var(--wall-3) 0, transparent 55%),
    radial-gradient(ellipse at 85% 90%, var(--wall-2) 0, transparent 60%),
    radial-gradient(ellipse at 15% 95%, var(--wall-4) 0, transparent 60%);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat::before { display: none; } }
:root[data-theme="dark"] .chat::before { display: none; }
/* uzerine desen */
.chat::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--pattern);
  opacity: var(--pattern-opacity);
  -webkit-mask: url("pattern.svg") 0 0 / 300px 300px repeat;
  mask: url("pattern.svg") 0 0 / 300px 300px repeat;
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 8px 0 16px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--divider);
  flex-shrink: 0;
}
.topbar-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; height: 100%; }
.topbar-text { display: flex; flex-direction: column; min-width: 0; }
.topbar-title { margin: 0; font-weight: 500; font-size: 16px; line-height: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 14px; line-height: 18px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; transition: background 0.15s; }
.icon-btn:hover { background: var(--hover); }

.pinned {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding: 6px 16px 6px 18px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--divider);
  text-align: left;
  flex-shrink: 0;
}
.pinned:hover { background: color-mix(in srgb, var(--surface) 94%, var(--muted)); }
.pinned-bar { width: 2px; border-radius: 1px; background: var(--accent); }
.pinned-text { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow: hidden; font-size: 14px; line-height: 18px; }
.pinned-label { color: var(--accent); font-weight: 500; }
.pinned-body { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* avatar: Telegram'in 7 gecisli rengi */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(var(--c-top, #72d5fd), var(--c-bot, #2a9ef1));
  user-select: none;
  text-decoration: none !important;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 34px; height: 34px; font-size: 14px; }
.avatar-md { width: 42px; height: 42px; font-size: 16px; }
.ac0 { --c-top: #ff885e; --c-bot: #ff516a; }
.ac1 { --c-top: #ffcd6a; --c-bot: #ffa85c; }
.ac2 { --c-top: #82b1ff; --c-bot: #665fff; }
.ac3 { --c-top: #a0de7e; --c-bot: #54cb68; }
.ac4 { --c-top: #53edd6; --c-bot: #28c9b7; }
.ac5 { --c-top: #72d5fd; --c-bot: #2a9ef1; }
.ac6 { --c-top: #e0a2f3; --c-bot: #d669ed; }
.nc0 { color: var(--n0); } .nc1 { color: var(--n1); } .nc2 { color: var(--n2); }
.nc3 { color: var(--n3); } .nc4 { color: var(--n4); } .nc5 { color: var(--n5); } .nc6 { color: var(--n6); }
.bc0 { --bar: var(--n0); } .bc1 { --bar: var(--n1); } .bc2 { --bar: var(--n2); }
.bc3 { --bar: var(--n3); } .bc4 { --bar: var(--n4); } .bc5 { --bar: var(--n5); } .bc6 { --bar: var(--n6); }

.scroller {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.messages {
  max-width: 728px;
  margin: 0 auto;
  padding: 8px 16px 8px;
  display: flex;
  flex-direction: column;
}
.day { display: flex; flex-direction: column; }

.date-sep {
  position: sticky;
  top: 6px;
  z-index: 2;
  align-self: center;
  margin: 6px 0;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--service-bg);
  color: #fff;
  font-size: 15px;
  line-height: 26px;
  font-weight: 500;
}
.service {
  align-self: center;
  margin: 6px 0;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--service-bg);
  color: #fff;
  font-size: 15px;
  line-height: 26px;
  font-weight: 500;
  text-align: center;
  max-width: 85%;
}

/* ayni kisinin ardisik mesajlari: avatar sola, kaydirirken altta yapisik */
.sgroup { display: flex; align-items: stretch; gap: 8px; margin-top: 6px; }
.sgroup-av { width: 34px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.sgroup-av .avatar { position: sticky; bottom: 6px; }
.sgroup-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.row { display: flex; align-items: flex-end; margin-top: 4px; }
.row:first-child { margin-top: 0; }
.row.flash .bubble { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 70%, transparent); } 100% { box-shadow: var(--bubble-shadow); } }

.bubble {
  position: relative;
  max-width: min(480px, 100%);
  min-width: 56px;
  background: var(--bubble);
  border-radius: 12px;
  box-shadow: var(--bubble-shadow);
  padding: 5px 8px 6px 9px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
/* Telegram'da ardisik balonlarin gruba bakan koseleri kucuktur */
.row:not(.first) .bubble { border-top-left-radius: 6px; }
.row:not(.last) .bubble { border-bottom-left-radius: 6px; }
.row.last .bubble { border-bottom-left-radius: 0; }
.row.last .bubble::before {
  content: "";
  position: absolute;
  left: -8.4px;
  bottom: 0;
  width: 9px;
  height: 17px;
  background: var(--bubble);
  clip-path: path("M9 0 V17 H1.2 C0.2 17 -0.2 15.9 0.6 15.2 C4.2 12.2 8.8 8 9 0 Z");
}
.bubble.media-only { padding: 0; overflow: hidden; }
.bubble.media-only::before { display: none; }
.row.last .bubble.media-only { border-bottom-left-radius: 6px; }
.bubble.sticker-bubble { background: none; box-shadow: none; padding: 0; }
.bubble.sticker-bubble::before { display: none; }

.sender {
  display: block;
  max-width: 100%;
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.sender:hover { text-decoration: underline; }
.row:not(.first) .sender { display: none; }
.media-only > .sender, .media-only > .fwd { padding: 5px 9px 4px; margin: 0; }
.fwd { font-size: 14px; color: var(--accent); margin-bottom: 4px; line-height: 18px; }
.fwd b { font-weight: 500; }

.reply {
  display: flex;
  gap: 6px;
  width: 100%;
  margin: 2px 0 5px;
  padding: 2px 8px 3px 9px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--bar, var(--accent)) 10%, transparent);
  border-left: 3px solid var(--bar, var(--accent));
  text-align: left;
  font-size: 14px;
  line-height: 18px;
  min-width: 0;
  transition: background 0.15s;
}
.reply:hover { background: color-mix(in srgb, var(--bar, var(--accent)) 18%, transparent); }
.media-only > .reply { margin: 6px 6px 4px; width: calc(100% - 12px); }
.reply-text { display: flex; flex-direction: column; min-width: 0; }
.reply-name { font-weight: 500; color: var(--bar, var(--accent)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-body { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }

.text { white-space: pre-wrap; line-height: 1.3125; }
.media-only .text { padding: 6px 9px 0; }
.text code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.9375em; color: var(--code); }
.text pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.875em; background: var(--code-bg); padding: 6px 8px; border-radius: 6px; margin: 4px 0; white-space: pre-wrap; border-left: 3px solid var(--accent); }
.text blockquote { margin: 3px 0; padding: 2px 8px 2px 10px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 4px; }
.text .hashtag { color: var(--link); }
.spoiler { background: color-mix(in srgb, var(--muted) 70%, transparent); color: transparent; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.spoiler.revealed { background: none; color: inherit; }

.meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 6px -2px -5px 10px;
  font-size: 12px;
  line-height: 18px;
  color: var(--meta);
  white-space: nowrap;
  position: relative;
  top: 2px;
  user-select: none;
}
.meta svg { width: 15px; height: 15px; stroke-width: 1.8; }
.meta.overlay {
  position: absolute;
  right: 6px;
  bottom: 6px;
  top: auto;
  margin: 0;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  float: none;
}
.clear { clear: both; }

/* medya */
.media { position: relative; display: block; background: var(--code-bg); cursor: pointer; overflow: hidden; }
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.bubble:not(.media-only) .media { margin: 4px -8px 0 -9px; border-radius: 0; }
.bubble:not(.media-only) .media:first-child { margin-top: -5px; border-radius: 12px 12px 0 0; }
.media.spoiler-media img, .media.spoiler-media video { filter: blur(28px); transform: scale(1.1); }
.media .play {
  position: absolute; top: 50%; left: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.45); color: #fff; display: flex; align-items: center; justify-content: center;
}
.media .play svg { fill: currentColor; stroke: none; width: 26px; height: 26px; margin-left: 3px; }
.media .badge-tl {
  position: absolute; left: 6px; top: 6px; padding: 0 6px; border-radius: 10px; line-height: 18px;
  background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 12px;
}
.album { display: grid; gap: 2px; }
.album .media { margin: 0 !important; border-radius: 0 !important; aspect-ratio: 1; }
.album.n2 { grid-template-columns: 1fr 1fr; }
.album.n3 { grid-template-columns: 1fr 1fr; }
.album.n3 .media:first-child { grid-column: 1 / 3; aspect-ratio: 2; }
.album.n4 { grid-template-columns: 1fr 1fr; }
.album.nmany { grid-template-columns: 1fr 1fr 1fr; }
.round { width: 220px; height: 220px; border-radius: 50%; overflow: hidden; cursor: pointer; position: relative; }
.round video { width: 100%; height: 100%; object-fit: cover; }
.sticker { width: 180px; height: 180px; object-fit: contain; display: block; }

.file { display: flex; align-items: center; gap: 12px; padding: 3px 0; min-width: 220px; }
.file:hover { text-decoration: none; }
.file-icon {
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.file-info { display: flex; flex-direction: column; min-width: 0; }
.file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.file-size { font-size: 14px; color: var(--muted); }
audio { display: block; width: 260px; max-width: 100%; height: 40px; margin: 2px 0; }

.webpage {
  display: block;
  margin-top: 6px;
  padding: 3px 8px 6px 10px;
  border-left: 3px solid var(--bar, var(--accent));
  border-radius: 4px;
  background: color-mix(in srgb, var(--bar, var(--accent)) 10%, transparent);
  font-size: 14px;
  line-height: 18px;
  color: var(--text);
}
.webpage:hover { text-decoration: none; }
.webpage-site { color: var(--bar, var(--accent)); font-weight: 500; }
.webpage-title { font-weight: 500; }
.webpage-desc { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.webpage img { display: block; width: 100%; max-height: 260px; object-fit: cover; border-radius: 6px; margin-top: 6px; }

.poll { min-width: 240px; }
.poll-q { font-weight: 500; margin-bottom: 2px; }
.poll-kind { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.poll-opt { margin: 8px 0; font-size: 15px; }
.poll-opt-row { display: flex; gap: 8px; }
.poll-pct { font-weight: 500; width: 40px; text-align: right; flex-shrink: 0; font-size: 14px; }
.poll-bar { height: 4px; border-radius: 2px; background: var(--accent); margin: 4px 0 0 48px; min-width: 4px; }
.poll-total { font-size: 14px; color: var(--muted); margin-top: 6px; }
.dice { font-size: 64px; line-height: 1; }

/* en alta in */
.to-bottom {
  position: absolute;
  z-index: 3;
  right: 20px;
  bottom: 82px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.to-bottom .badge {
  position: absolute; top: -6px; right: -2px; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 14px; font-weight: 500; line-height: 24px; text-align: center;
}

.joinbar {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
}
.join-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 696px;
  height: 54px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  font-size: 16px;
  text-transform: uppercase;
  box-shadow: 0 1px 2px rgba(16, 35, 47, 0.15);
  transition: background 0.15s;
}
.join-btn:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.join-btn-solid { background: var(--accent); color: var(--accent-text); box-shadow: none; height: 48px; border-radius: 10px; }
.join-btn-solid:hover { background: color-mix(in srgb, #000 8%, var(--accent)); }

.loader { display: flex; justify-content: center; padding: 12px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.scroller .spinner { border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ grup bilgisi */
.info {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--divider);
}
.info-head { display: flex; align-items: center; gap: 22px; height: 56px; padding: 0 16px 0 12px; flex-shrink: 0; }
.info-head-title { font-size: 20px; font-weight: 500; }
.info-scroll { flex: 1; overflow-y: auto; }

/* Telegram Web'deki gibi tam genislikte kare profil fotografi */
.profile {
  position: relative;
  aspect-ratio: 1;
  max-height: 420px;
  width: 100%;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(var(--c-top, #72d5fd), var(--c-bot, #2a9ef1));
}
.profile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-initials { position: absolute; inset: 0 0 20%; display: flex; align-items: center; justify-content: center; font-size: 120px; font-weight: 500; }
.profile::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  pointer-events: none;
}
.profile-text { position: absolute; z-index: 1; left: 24px; right: 24px; bottom: 16px; }
.profile-title { margin: 0; font-size: 20px; line-height: 26px; font-weight: 500; overflow-wrap: anywhere; }
.profile-sub { margin: 0; font-size: 14px; opacity: 0.8; }

.info-rows { padding: 8px 8px; }
.info-row { display: flex; gap: 30px; padding: 10px 14px; border-radius: 10px; align-items: flex-start; width: 100%; text-align: left; }
button.info-row:hover { background: var(--hover); }
.info-row > svg { color: var(--muted); flex-shrink: 0; margin-top: 4px; }
.info-row-text { display: flex; flex-direction: column; min-width: 0; }
.info-row-main { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.3125; }
.info-row-label { font-size: 14px; color: var(--muted); margin-top: 2px; }
.info-join { padding: 0 22px 18px; }
.info-media { border-top: 12px solid var(--section-gap); }
.tabs { display: flex; padding: 0 12px; box-shadow: inset 0 -1px 0 var(--divider); }
.tab { position: relative; padding: 14px 12px 12px; font-weight: 500; color: var(--muted); }
.tab-active { color: var(--accent); }
.tab-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; padding: 1px 0; }
.media-grid .cell { position: relative; aspect-ratio: 1; background: var(--code-bg); cursor: pointer; overflow: hidden; }
.media-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid .dur { position: absolute; left: 4px; bottom: 4px; font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.35); padding: 0 5px; border-radius: 8px; }
.empty { text-align: center; color: var(--muted); padding: 24px; margin: 0; }

/* ------------------------------------------------------------------ medya goruntuleyici */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.viewer-stage { max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; padding: 56px 16px; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100vh - 112px); display: block; }
.viewer .icon-btn { color: #fff; position: absolute; z-index: 2; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.viewer-close { top: 8px; right: 8px; }
.viewer-nav { top: 50%; margin-top: -20px; }
.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }
.viewer-msg { color: #fff; text-align: center; }
.viewer-msg a { color: #8ab4f8; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60;
  background: rgba(0, 0, 0, 0.75); color: #fff; padding: 8px 16px; border-radius: 10px; font-size: 14px;
}

/* ------------------------------------------------------------------ mobil */
@media (max-width: 900px) {
  .info { position: fixed; inset: 0; width: auto; z-index: 20; border-left: 0; }
  .profile { max-height: none; }
}
@media (max-width: 600px) {
  .messages { padding: 6px 8px 8px; }
  .topbar { padding-left: 8px; }
  .joinbar { padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
  .to-bottom { right: 12px; }
  .round { width: 180px; height: 180px; }
  .sticker { width: 140px; height: 140px; }
}

/* ======================================================================
   Platform gorunumleri. Sunucu <html data-platform="ios|android|web">
   olarak secer: ziyaretci kendi telefonundaki Telegram'i gorur.
   ====================================================================== */

html:not([data-platform="ios"]) .only-ios { display: none !important; }
html:not([data-platform="android"]) .only-android { display: none !important; }
html:not([data-platform="web"]) .only-web { display: none !important; }
html[data-platform="ios"] .not-ios { display: none !important; }
html[data-platform="web"] .back-btn { display: none; }
.back-btn { display: inline-flex; align-items: center; flex-shrink: 0; color: inherit; text-decoration: none !important; }
.back-btn:not([href]) { pointer-events: none; }
.info-section-title { display: none; }
.profile-photo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.profile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-photo .profile-initials { position: static; }

/* ------------------------------------------------------------------ iOS */
:root[data-platform="ios"] {
  --bg: #efeff4;
  --surface: #ffffff;
  --nav: rgba(247, 247, 247, 0.94);
  --hairline: rgba(60, 60, 67, 0.29);
  --text: #000000;
  --muted: #8e8e93;
  --accent: #007aff;
  --link: #007aff;
  --divider: rgba(60, 60, 67, 0.29);
  --hover: rgba(0, 0, 0, 0.04);
  --bubble: #ffffff;
  --bubble-shadow: none;
  --meta: #a0a8b0;
  --code: #ff3b30;
  --n0: #fc5c51; --n1: #fa790f; --n2: #895dd5; --n3: #0fb297;
  --n4: #00c1a6; --n5: #3d72ed; --n6: #d54fae;
}
@media (prefers-color-scheme: dark) {
  :root[data-platform="ios"]:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1d;
    --nav: rgba(29, 29, 29, 0.94);
    --hairline: rgba(84, 84, 88, 0.65);
    --text: #ffffff;
    --muted: #98989e;
    --accent: #3e88f7;
    --link: #3e88f7;
    --divider: rgba(84, 84, 88, 0.65);
    --hover: rgba(255, 255, 255, 0.05);
    --bubble: #262628;
    --meta: #8e8e93;
    --code: #ff6961;
    --wall-base: #000000;
    --service-bg: rgba(72, 72, 74, 0.65);
    --n0: #ff7b7b; --n1: #ffa357; --n2: #b88bff; --n3: #4fd18b;
    --n4: #47d6d0; --n5: #6aaeff; --n6: #ff79c4;
  }
}

[data-platform="ios"] body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.2px;
}
[data-platform="ios"] .topbar {
  height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 4px;
  background: var(--nav);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--hairline);
}
[data-platform="ios"] .back-btn { gap: 4px; padding: 0 6px; height: 44px; color: var(--accent); font-size: 17px; z-index: 1; }
[data-platform="ios"] .back-btn svg { width: 12px; height: 21px; stroke-width: 2.6; }
[data-platform="ios"] .topbar-main { justify-content: flex-end; }
[data-platform="ios"] .topbar-text {
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 44px;
  transform: translateX(-50%);
  max-width: calc(100% - 210px);
  align-items: center;
  justify-content: center;
  text-align: center;
}
[data-platform="ios"] .topbar-title { font-size: 17px; line-height: 21px; font-weight: 600; max-width: 100%; }
[data-platform="ios"] .topbar-sub { font-size: 13px; line-height: 16px; color: var(--muted); max-width: 100%; }
[data-platform="ios"] .topbar .avatar-md { width: 37px; height: 37px; font-size: 15px; }
[data-platform="ios"] .more-btn { display: none; }
[data-platform="ios"] .pinned {
  background: var(--nav);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 0.5px 0 var(--hairline);
  padding: 6px 12px 6px 16px;
}
[data-platform="ios"] .pinned-label { font-size: 14px; font-weight: 600; }
[data-platform="ios"] .pinned-body { font-size: 14px; }

[data-platform="ios"] .messages { padding: 6px 8px 8px 6px; }
[data-platform="ios"] .sgroup { gap: 5px; margin-top: 8px; }
[data-platform="ios"] .sgroup-av { width: 37px; }
[data-platform="ios"] .avatar-sm { width: 37px; height: 37px; font-size: 15px; }
[data-platform="ios"] .row { margin-top: 2px; }
[data-platform="ios"] .row:first-child { margin-top: 0; }
[data-platform="ios"] .bubble { border-radius: 18px; padding: 6px 11px 7px 12px; }
[data-platform="ios"] .row:not(.first) .bubble { border-top-left-radius: 8px; }
[data-platform="ios"] .row:not(.last) .bubble { border-bottom-left-radius: 8px; }
[data-platform="ios"] .row.last .bubble { border-bottom-left-radius: 0; }
[data-platform="ios"] .row.last .bubble.media-only { border-bottom-left-radius: 8px; }
[data-platform="ios"] .row.last .bubble::before {
  left: -6px;
  width: 12px;
  height: 18px;
  clip-path: path("M12 0 V18 H3 C1 18 -0.6 17.2 0.4 16.4 C4 13.6 6.6 10 6.6 4 V0 Z");
}
[data-platform="ios"] .bubble:not(.media-only) .media { margin: 4px -11px 0 -12px; }
[data-platform="ios"] .bubble:not(.media-only) .media:first-child { margin-top: -6px; border-radius: 18px 18px 0 0; }
[data-platform="ios"] .sender { font-size: 15px; line-height: 19px; font-weight: 600; letter-spacing: -0.1px; }
[data-platform="ios"] .text { line-height: 22px; }
[data-platform="ios"] .meta { font-size: 12px; margin: 7px -3px -6px 10px; }
[data-platform="ios"] .reply { font-size: 15px; line-height: 19px; border-radius: 6px; }
[data-platform="ios"] .webpage { font-size: 15px; line-height: 19px; border-radius: 6px; }
[data-platform="ios"] .date-sep,
[data-platform="ios"] .service {
  font-size: 13px;
  line-height: 22px;
  font-weight: 600;
  border-radius: 11px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
[data-platform="ios"] .date-sep { top: 6px; }
[data-platform="ios"] .joinbar {
  padding: 0 0 env(safe-area-inset-bottom);
  background: var(--nav);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 -0.5px 0 var(--hairline);
}
[data-platform="ios"] .join-btn {
  max-width: none;
  height: 50px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-size: 17px;
  font-weight: 400;
  text-transform: none;
}
[data-platform="ios"] .join-btn:hover { background: none; opacity: 0.6; }
[data-platform="ios"] .to-bottom {
  width: 38px;
  height: 38px;
  bottom: calc(62px + env(safe-area-inset-bottom));
  right: 10px;
  background: var(--nav);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 0 0 0.5px var(--hairline);
}
[data-platform="ios"] .to-bottom svg { width: 22px; height: 22px; }

/* iOS grup bilgisi: gruplanmis liste */
[data-platform="ios"] .info { background: var(--bg); border-left-color: var(--hairline); }
[data-platform="ios"] .info-head {
  height: calc(44px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0 4px;
  background: var(--bg);
}
[data-platform="ios"] .info-head-title { display: none; }
[data-platform="ios"] .close-btn { width: auto; height: 44px; border-radius: 0; gap: 4px; padding: 0 6px; color: var(--accent); font-size: 17px; }
[data-platform="ios"] .close-btn:hover { background: none; opacity: 0.6; }
[data-platform="ios"] .close-btn svg { width: 12px; height: 21px; stroke-width: 2.6; }
[data-platform="ios"] .profile {
  aspect-ratio: auto;
  max-height: none;
  background: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px 22px;
}
[data-platform="ios"] .profile::after { display: none; }
[data-platform="ios"] .profile-photo {
  position: relative;
  inset: auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(var(--c-top), var(--c-bot));
  color: #fff;
}
[data-platform="ios"] .profile-initials { font-size: 40px; font-weight: 600; }
[data-platform="ios"] .profile-text { position: static; margin-top: 12px; text-align: center; }
[data-platform="ios"] .profile-title { font-size: 24px; line-height: 29px; font-weight: 600; }
[data-platform="ios"] .profile-sub { font-size: 15px; opacity: 1; color: var(--muted); margin-top: 2px; }
[data-platform="ios"] .info-rows { margin: 0 16px; padding: 0; background: var(--surface); border-radius: 12px; overflow: hidden; }
[data-platform="ios"] .info-row { gap: 0; padding: 10px 16px 11px; border-radius: 0; position: relative; }
[data-platform="ios"] .info-row + .info-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--hairline); }
[data-platform="ios"] .info-row > svg { display: none; }
[data-platform="ios"] .info-row-label { order: -1; margin: 0 0 2px; font-size: 14px; color: var(--text); }
[data-platform="ios"] .info-row-main { font-size: 17px; line-height: 22px; }
[data-platform="ios"] .info-row.is-link .info-row-main { color: var(--accent); }
[data-platform="ios"] .info-join { padding: 16px 16px 0; }
[data-platform="ios"] .join-btn.join-btn-solid,
[data-platform="android"] .join-btn.join-btn-solid { background: var(--accent); color: #fff; }
[data-platform="ios"] .join-btn.join-btn-solid:hover,
[data-platform="android"] .join-btn.join-btn-solid:hover { background: var(--accent); opacity: 0.85; }
[data-platform="ios"] .join-btn-solid { height: 50px; border-radius: 12px; font-size: 17px; font-weight: 600; text-transform: none; }
[data-platform="ios"] .info-media { border-top: 0; margin: 20px 16px 16px; background: var(--surface); border-radius: 12px; overflow: hidden; }
[data-platform="ios"] .tabs { justify-content: center; box-shadow: none; padding: 8px; }
[data-platform="ios"] .tab { padding: 6px 14px; border-radius: 8px; font-size: 15px; font-weight: 600; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--text); }
[data-platform="ios"] .tab-active::after { display: none; }

/* ------------------------------------------------------------------ Android */
:root[data-platform="android"] {
  --bg: #f0f0f0;
  --surface: #ffffff;
  --nav: #517da2;
  --nav-text: #ffffff;
  --nav-sub: #d7e8f7;
  --text: #222222;
  --muted: #8a8a8a;
  --accent: #3a95d5;
  --link: #2678b6;
  --join: #3a8ccf;
  --divider: #e5e5e5;
  --section-gap: #f0f0f0;
  --hover: rgba(0, 0, 0, 0.05);
  --bubble: #ffffff;
  --bubble-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  --meta: #a1aab3;
}
@media (prefers-color-scheme: dark) {
  :root[data-platform="android"]:not([data-theme="light"]) {
    --bg: #0e1621;
    --surface: #17212b;
    --nav: #212d3b;
    --nav-text: #ffffff;
    --nav-sub: #7f91a4;
    --text: #f5f5f5;
    --muted: #7f91a4;
    --accent: #64b5ef;
    --link: #6ab3f3;
    --join: #64b5ef;
    --divider: #101921;
    --section-gap: #0e1621;
    --hover: rgba(255, 255, 255, 0.05);
    --bubble: #182533;
    --bubble-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
    --meta: #6d7f8f;
    --wall-base: #0e1621;
    --service-bg: rgba(30, 44, 58, 0.9);
  }
}

[data-platform="android"] body { font-family: Roboto, "Segoe UI", sans-serif; }
[data-platform="android"] .topbar {
  height: 56px;
  padding: 0 4px 0 0;
  gap: 0;
  background: var(--nav);
  color: var(--nav-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-platform="android"] .back-btn { width: 54px; height: 56px; justify-content: center; }
[data-platform="android"] .back-btn svg { width: 24px; height: 24px; }
[data-platform="android"] .topbar-main { gap: 12px; }
[data-platform="android"] .topbar-title { font-size: 18px; line-height: 22px; font-weight: 500; color: var(--nav-text); }
[data-platform="android"] .topbar-sub { font-size: 14px; line-height: 18px; color: var(--nav-sub); }
[data-platform="android"] .topbar .avatar-md { width: 42px; height: 42px; }
[data-platform="android"] .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
[data-platform="android"] .more-btn { color: var(--nav-text); width: 48px; height: 48px; }
[data-platform="android"] .pinned { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); padding: 7px 16px 7px 18px; }

[data-platform="android"] .messages { padding: 6px 8px 8px 6px; }
[data-platform="android"] .sgroup { gap: 6px; }
[data-platform="android"] .sgroup-av { width: 42px; }
[data-platform="android"] .avatar-sm { width: 42px; height: 42px; font-size: 16px; }
[data-platform="android"] .bubble { border-radius: 16px; padding: 6px 9px 7px 10px; }
[data-platform="android"] .row:not(.first) .bubble { border-top-left-radius: 6px; }
[data-platform="android"] .row:not(.last) .bubble { border-bottom-left-radius: 6px; }
[data-platform="android"] .bubble:not(.media-only) .media:first-child { border-radius: 16px 16px 0 0; }
[data-platform="android"] .sender { font-size: 14px; line-height: 19px; font-weight: 500; }
[data-platform="android"] .date-sep,
[data-platform="android"] .service { font-size: 14px; line-height: 25px; border-radius: 13px; padding: 0 10px; }
[data-platform="android"] .joinbar {
  padding: 0 0 env(safe-area-inset-bottom);
  background: var(--surface);
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.12);
}
[data-platform="android"] .join-btn {
  max-width: none;
  height: 48px;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--join);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.3px;
}
[data-platform="android"] .join-btn:hover { background: var(--hover); }
[data-platform="android"] .to-bottom {
  width: 42px;
  height: 42px;
  bottom: 62px;
  right: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Android grup bilgisi: renkli baslik bandi */
[data-platform="android"] .info { background: var(--section-gap); border-left-color: var(--divider); }
[data-platform="android"] .info-head { height: 56px; padding: 0 4px; background: var(--nav); color: var(--nav-text); }
[data-platform="android"] .info-head-title { display: none; }
[data-platform="android"] .close-btn { width: 48px; height: 48px; color: var(--nav-text); }
[data-platform="android"] .profile {
  aspect-ratio: auto;
  max-height: none;
  background: var(--nav);
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 22px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-platform="android"] .profile::after { display: none; }
[data-platform="android"] .profile-photo {
  position: relative;
  inset: auto;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(var(--c-top), var(--c-bot));
}
[data-platform="android"] .profile-initials { font-size: 24px; }
[data-platform="android"] .profile-text { position: static; min-width: 0; }
[data-platform="android"] .profile-title { font-size: 20px; line-height: 26px; }
[data-platform="android"] .profile-sub { font-size: 14px; opacity: 1; color: var(--nav-sub); }
[data-platform="android"] .info-rows { background: var(--surface); padding: 0 0 8px; }
[data-platform="android"] .info-section-title { display: block; padding: 16px 21px 4px; color: var(--accent); font-size: 15px; font-weight: 500; }
[data-platform="android"] .info-row { gap: 0; padding: 10px 21px; border-radius: 0; }
[data-platform="android"] .info-row > svg { display: none; }
[data-platform="android"] .info-row-main { font-size: 16px; line-height: 21px; color: var(--text); }
[data-platform="android"] .info-row-label { font-size: 13px; margin-top: 3px; }
[data-platform="android"] .info-join { background: var(--surface); padding: 4px 21px 18px; }
[data-platform="android"] .join-btn-solid { height: 44px; border-radius: 6px; font-size: 15px; letter-spacing: 0.3px; }
[data-platform="android"] .info-media { border-top: 8px solid var(--section-gap); background: var(--surface); }
[data-platform="android"] .tabs { padding: 0 8px; }
[data-platform="android"] .tab { font-size: 15px; }

@media (max-width: 600px) {
  [data-platform="ios"] .messages,
  [data-platform="android"] .messages { padding-left: 4px; padding-right: 6px; }
}

/* saat = mesajin kalici linki; Telegram'daki gibi duz gorunur */
.meta-link { color: inherit; text-decoration: none !important; }

/* ======================================================================
   18+ onay penceresi. Platforma gore: Telegram Web popup, iOS uyari
   penceresi, Android diyalog kutusu.
   ====================================================================== */
html.age-gate .app { filter: blur(14px); pointer-events: none; user-select: none; }
html.age-gate body { overflow: hidden; }

.age {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.35);
  animation: age-fade 0.2s ease;
}
@keyframes age-fade { from { opacity: 0; } to { opacity: 1; } }
.age-dialog {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  animation: age-pop 0.2s ease;
}
@keyframes age-pop { from { transform: scale(0.94); } to { transform: scale(1); } }
.age-body { padding: 20px 22px 8px; }
.age-title { margin: 0 0 8px; font-size: 20px; line-height: 26px; font-weight: 500; }
.age-text { margin: 0; font-size: 16px; line-height: 21px; }
.age-actions { display: flex; justify-content: flex-end; gap: 4px; padding: 8px 10px 10px; }
.age-btn {
  padding: 0 12px;
  height: 38px;
  border-radius: 8px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  transition: background 0.15s;
}
.age-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.age-exit { color: #e53935; }
.age-exit:hover { background: rgba(229, 57, 53, 0.1); }

/* iOS: ortada dar, buzlu cam uyari; butonlar alt alta, ince cizgilerle */
/* Ustundeki opaklik animasyonu backdrop-filter'i bozar (Chrome): iOS'ta animasyon yok. */
[data-platform="ios"] .age { background: rgba(0, 0, 0, 0.4); animation: none; }
[data-platform="ios"] .age-dialog { animation: none; }
[data-platform="ios"] .age-dialog {
  max-width: 270px;
  border-radius: 14px;
  background: rgba(242, 242, 242, 0.85);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: none;
  text-align: center;
  overflow: hidden;
}
@media (prefers-color-scheme: dark) {
  [data-platform="ios"]:not([data-theme="light"]) .age-dialog { background: rgba(37, 37, 37, 0.85); }
}
[data-platform="ios"] .age-body { padding: 19px 16px 18px; }
[data-platform="ios"] .age-title { margin: 0 0 3px; font-size: 17px; line-height: 22px; font-weight: 600; }
[data-platform="ios"] .age-text { font-size: 13px; line-height: 17px; }
[data-platform="ios"] .age-actions { flex-direction: column-reverse; gap: 0; padding: 0; }
[data-platform="ios"] .age-btn {
  height: 44px;
  border-radius: 0;
  font-size: 17px;
  font-weight: 400;
  text-transform: none;
  box-shadow: inset 0 0.5px 0 var(--hairline);
}
[data-platform="ios"] .age-btn:hover { background: rgba(0, 0, 0, 0.06); }
[data-platform="ios"] .age-ok { font-weight: 600; }
[data-platform="ios"] .age-exit { color: #ff3b30; }

/* Android: Telegram diyalogu, sag altta buyuk harfli metin butonlari */
[data-platform="android"] .age { background: rgba(0, 0, 0, 0.5); }
[data-platform="android"] .age-dialog { max-width: 330px; border-radius: 12px; }
[data-platform="android"] .age-body { padding: 22px 24px 6px; }
[data-platform="android"] .age-title { font-size: 20px; margin-bottom: 12px; }
[data-platform="android"] .age-text { font-size: 16px; line-height: 22px; color: var(--text); }
[data-platform="android"] .age-actions { padding: 12px 12px 10px; }
[data-platform="android"] .age-btn { height: 36px; border-radius: 4px; font-size: 14px; letter-spacing: 0.3px; }
[data-platform="android"] .age-exit { color: #cc2929; }
.age-dialog:focus { outline: none; }
.age-btn:focus { outline: none; }
.age-btn:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
