:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1b1b1b;
  --muted: #6b6b6b;
  --line: #dcdcd7;
  --accent: #2b59c3;
  --accent-text: #ffffff;
  --accent-soft: #e8eefb;
  --mine: #eef2fb;
  --radius: 6px;
  --header: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --surface: #1f1f1f;
    --text: #e8e8e6;
    --muted: #9a9a96;
    --line: #333331;
    --accent: #6f95ec;
    --accent-text: #0f0f0f;
    --accent-soft: #232c40;
    --mine: #222838;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; margin-top: 1.25rem; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
[hidden] { display: none !important; }

/* header */
.top {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.who { display: flex; gap: 1rem; align-items: center; margin: 0; }
.who form { margin: 0; }
.who a { color: var(--muted); text-decoration: none; }
.who a:hover, .who a.has-unread { color: var(--text); }
.badge {
  display: inline-block;
  min-width: 1.3em;
  padding: 0 .35em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}
.row { display: flex; flex-wrap: wrap; gap: .5rem; }
h2.section { margin-top: 2rem; font-size: 1.2rem; }
.radios { display: grid; gap: .4rem; }
.radio { display: flex; gap: .5rem; align-items: center; font-size: 1rem; }
.radio input { width: auto; margin: 0; }

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.banner-actions { display: flex; gap: .5rem; }
.banner button { padding: .35rem .8rem; }

.members li { display: flex; align-items: baseline; gap: .3rem; }
.member-tools { margin-left: auto; display: flex; gap: .6rem; }
.member-tools .link { color: var(--muted); }
.member-tools .link:hover { color: var(--text); }

.notifications .unread strong::before { content: "● "; color: var(--accent); }
.notifications .room-main span { display: block; }

.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
.block { margin-bottom: 32px; }
.narrow { max-width: 480px; }

/* forms */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
label { display: block; font-size: .9rem; }
label > input, label > select { margin-top: .3rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .9rem; padding: 0; margin-bottom: .3rem; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: .55rem 1rem;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.big { padding: .8rem 1.25rem; font-size: 1.05rem; }
button.ghost { background: transparent; color: var(--muted); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
.stack { display: grid; gap: .9rem; margin: 1.25rem 0; }

.flash {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: .6rem .8rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
}

.auth { max-width: 360px; margin: 8vh auto 0; }
a.button {
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem 1rem;
  background: var(--surface);
  font-weight: 600;
  margin-top: 1.25rem;
}
a.button:hover { border-color: var(--muted); }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.verify-banner {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: .6rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .92rem;
}
.composer.locked { align-items: center; font-size: .92rem; }
.composer.locked button { flex-shrink: 0; }

.share-card { max-width: 420px; margin: 8vh auto 0; }
.share-card h1 { font-size: 1.6rem; margin-bottom: .4rem; }
.share-status { font-weight: 600; margin: 0 0 .25rem; }
.share-status.open { color: var(--accent); }
a.button.primary-link { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.summary-side { display: flex; gap: .75rem; align-items: baseline; flex-shrink: 0; }

.tick { color: var(--accent); font-weight: 700; margin-left: .2rem; font-size: .85em; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* find: altta sabit tuş + alttan açılan panel */
body.has-findbar .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.findbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.findbar button { width: 100%; max-width: 728px; }

.sheet {
  width: 100%;
  max-width: 760px;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto;
}
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet[open] { animation: sheet-up .18s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .75rem; }
.sheet-head h2 { margin: 0; font-size: 1.2rem; outline: none; }
@media (max-width: 520px) {
  .popular .chip:nth-of-type(n+9) { display: none; }
}

.find-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; }
.find-form .wide { grid-column: 1 / -1; }
.find-form p { margin: 0; }
@media (max-width: 520px) {
  .find-form { grid-template-columns: 1fr 1fr; }
}

.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span {
  display: inline-block;
  padding: .4rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.popular { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: -.4rem; }
.chip { padding: .25rem .7rem; border-radius: 999px; font-size: .9rem; }

/* room list */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.list-head h2 { margin: 0; }
.search { max-width: 200px; flex: 1; }
.search input { padding: .4rem .6rem; }
.tabs { display: flex; gap: 1rem; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.tabs a { color: var(--muted); text-decoration: none; padding: .45rem 0; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-bottom-color: var(--text); }

.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li + li { border-top: 1px solid var(--line); }
.room-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem .25rem;
  color: inherit;
  text-decoration: none;
}
.room-row:hover strong { text-decoration: underline; }
.room-row.full { opacity: .55; }
.room-main { min-width: 0; }
.room-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-side { text-align: right; flex-shrink: 0; display: grid; }
.count { font-variant-numeric: tabular-nums; font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }
.tag { font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .4rem; }
.tag.here { color: var(--accent); border-color: var(--accent); }
.empty { padding: 1.5rem 0; }

/* room */
.facts { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.members { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.members li { padding: .15rem 0; }

body.in-room { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.room-page { flex: 1; min-height: 0; width: 100%; max-width: 1100px; margin: 0 auto; }
.room { height: 100%; display: grid; grid-template-columns: 280px 1fr; }
.room-info { border-right: 1px solid var(--line); padding: 20px 16px; overflow-y: auto; }
.room-info summary { list-style: none; cursor: default; }
.room-info summary::-webkit-details-marker { display: none; }
.room-info summary h1 { word-break: break-word; }
.summary-count { display: none; }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: .15rem; overscroll-behavior: contain; }
.msg { max-width: 75ch; padding: .15rem .55rem; border-radius: var(--radius); }
.msg:not(.cont):not(.sys) { margin-top: .55rem; }
.msg .meta { display: flex; gap: .5rem; align-items: baseline; font-size: .85rem; }
.msg .meta time { color: var(--muted); font-size: .8rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { background: var(--mine); }
.msg.sys { color: var(--muted); font-size: .85rem; text-align: center; align-self: center; margin: .5rem 0; }
.notice { margin: 0; padding: .5rem 16px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
.composer {
  display: flex;
  gap: .5rem;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  align-items: flex-end;
}
.composer .counter { align-self: center; font-variant-numeric: tabular-nums; }
.composer textarea { resize: none; max-height: 160px; line-height: 1.4; overflow-y: hidden; }

@media (max-width: 759px) {
  .room { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .room-info { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; max-height: 55dvh; }
  .room-info summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; cursor: pointer; }
  .room-info summary h1 { margin: 0; font-size: 1.05rem; }
  .room-info details[open] summary { margin-bottom: .75rem; }
  .summary-count { display: inline; }
  .messages { padding: 12px; }
  .composer textarea { font-size: 16px; } /* iOS'ta odaklanınca zoom yapmasın */
}
