* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f5f9; --panel: #ffffff; --fg: #1d1f2b; --muted: #8a8fa3;
  --line: #e7e8ef; --accent: #5b5bd6; --accent-2: #8b5cf6; --hover: #f7f7fb;
  --own: #eef0ff; --shadow: 0 10px 40px rgba(30, 30, 80, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1016; --panel: #171822; --fg: #e8e9f1; --muted: #7c8098;
    --line: #262838; --hover: #1d1f2b; --own: #21234a; --shadow: 0 10px 40px rgba(0,0,0,.4);
  }
}
html, body { height: 100%; }
body { font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; }
input { font: inherit; }

/* ---------- Ana sayfa ---------- */
.home {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px 16px; text-align: center;
  background: radial-gradient(ellipse at top, rgba(91,91,214,.15), transparent 60%);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-size: 44px; font-weight: 800; letter-spacing: -2px; }
.logo i {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 24px; letter-spacing: 0;
}
.home p { color: var(--muted); font-size: 17px; max-width: 420px; }
.join-box {
  display: flex; align-items: center; width: 100%; max-width: 460px; margin-top: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: var(--shadow);
}
.join-box span { padding-left: 12px; color: var(--muted); white-space: nowrap; }
.join-box input { flex: 1; border: 0; padding: 12px 4px; font-size: 16px; background: transparent; color: var(--fg); outline: none; min-width: 0; }
.btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  padding: 11px 20px; border-radius: 10px; font-weight: 600; transition: opacity .15s;
}
.btn:hover { opacity: .9; }
.features { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: 14px; margin-top: 8px; }

/* ---------- Sohbet ---------- */
.chat { height: 100%; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; background: var(--panel); box-shadow: var(--shadow); }
header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
header .room { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
header .room b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header .home-link { font-weight: 800; font-size: 20px; letter-spacing: -1px; color: var(--fg); }
.status { width: 9px; height: 9px; border-radius: 50%; background: #f5a524; flex-shrink: 0; }
.status.on { background: #22c55e; }
.ghost { background: var(--hover); color: var(--fg); padding: 8px 14px; border-radius: 9px; font-size: 14px; border: 1px solid var(--line); }
.ghost:hover { border-color: var(--accent); }

.main { flex: 1; display: flex; min-height: 0; }
#messages { flex: 1; overflow-y: auto; padding: 16px 0; list-style: none; }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; }

.msg { display: flex; gap: 12px; padding: 6px 18px; }
.msg:hover { background: var(--hover); }
.msg.own { background: var(--own); }
.msg.cont { padding-top: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg.cont .meta { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; text-transform: uppercase;
}
.body { min-width: 0; flex: 1; }
.meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.meta b { font-size: 15px; }
.meta time { color: var(--muted); font-size: 12px; }
.text { line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.system { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 18px; }
.system span { background: var(--hover); padding: 4px 12px; border-radius: 20px; border: 1px solid var(--line); }

aside { width: 220px; border-left: 1px solid var(--line); padding: 18px; overflow-y: auto; }
aside h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
aside ul { list-style: none; }
aside li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
aside li .avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
aside li small { color: var(--muted); }

#form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
#input {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; font-size: 15px;
  background: var(--bg); color: var(--fg); outline: none; min-width: 0; transition: border-color .15s;
}
#input:focus { border-color: var(--accent); }

/* Takma ad penceresi */
.overlay { position: fixed; inset: 0; background: rgba(10,10,25,.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 10; }
.overlay[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 18px; padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--shadow); text-align: center; }
.modal h2 { font-size: 22px; margin-bottom: 6px; }
.modal p { color: var(--muted); margin-bottom: 20px; }
.modal input { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; background: var(--bg); color: var(--fg); outline: none; margin-bottom: 12px; font-size: 16px; }
.modal input:focus { border-color: var(--accent); }
.modal .btn { width: 100%; padding: 13px; }

.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-width: 700px) {
  aside { display: none; }
  .chat { box-shadow: none; }
  #copy span { display: none; }
}
