:root {
  --bg: #f4f7fb;
  --card: #fff;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe3ee;
  --accent: #0f766e;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.7 system-ui, Tahoma, sans-serif;
}
main {
  width: min(860px, 100%);
  margin: auto;
  padding: 24px 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 30px #1720330d;
  min-width: 0;
  overflow: hidden;
}
h1 { margin: 0 0 6px; font-size: 22px; }
.muted { color: var(--muted); }
.tabs { display: flex; gap: 8px; margin: 18px 0; }
.tabs button { flex: 1; margin-top: 0; background: #e8eef5; color: var(--ink); }
.tabs button.active { background: var(--accent); color: #fff; }
label { display: block; color: var(--muted); margin: 18px 0 5px; }
input, button { max-width: 100%; }
input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  direction: ltr;
  text-align: left;
}
button {
  margin-top: 14px;
  padding: 11px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
button:disabled { opacity: .6; }
#error { color: var(--danger); margin-top: 18px; overflow-wrap: anywhere; }
.profile {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-width: 0;
}
.profile > * { min-width: 0; }
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
}
.username { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.stats b { display: block; font-size: 18px; }
.stats span { color: var(--muted); font-size: 13px; }
pre {
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  overflow: auto;
  margin: 12px 0 0;
  max-width: 100%;
}
p, a, h2 { overflow-wrap: anywhere; }
a { color: var(--accent); }
.list { margin-top: 12px; display: grid; gap: 12px; min-width: 0; }
.post, .msg {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
  max-width: 100%;
}
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--line); }
.msg img, .post img { max-width: 100%; height: auto; border-radius: 12px; }
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}
.pager button { margin-top: 0; background: #e8eef5; color: var(--ink); }
.pager span { color: var(--muted); font-size: 14px; }
.panel[hidden] { display: none; }
@media (min-width: 720px) {
  main { padding: 32px 16px; }
  .card { padding: 22px; }
  h1 { font-size: 25px; }
  .tabs button { flex: 0; }
  .profile { grid-template-columns: 110px minmax(0, 1fr); gap: 18px; }
  .avatar { width: 110px; height: 110px; }
  .post { grid-template-columns: 72px minmax(0, 1fr); }
}
