/* OpenIM — dark amber theme. No frameworks, no external assets. */
:root {
  --bg: #141110;
  --surface: #1c1815;
  --surface-2: #262019;
  --border: #322a21;
  --text: #e9e2d8;
  --muted: #a3968a;
  --accent: #ee8332;
  --accent-hi: #ffa14f;
  --accent-dim: rgba(238, 131, 50, .12);
  --on-accent: #1d1206;
  --green: #57ab5a;
  --blue: #6cb6ff;
  --red: #e5534b;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg) radial-gradient(ellipse at 50% -10%, #221a12 0%, var(--bg) 55%);
  color: var(--text);
  font: 16px/1.65 var(--sans);
}

a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .9em;
  color: var(--accent-hi);
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  word-break: break-all;
}

/* ================= top bar ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.brand {
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
}
.brand:hover { text-decoration: none; }
.brand .cursor {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: .95rem;
}
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 6px; }
.nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav a.btn, .nav a.btn:hover { color: var(--on-accent); background: var(--accent); }
.nav a.btn:hover { background: var(--accent-hi); }
.nav a.btn-host, .nav a.btn-host:hover { color: #fff; background: #3d8bfd; }
.nav a.btn-host:hover { background: #5ca3ff; }

/* ================= layout ================= */
main { flex: 1; width: 100%; }
.page { max-width: 720px; margin: 0 auto; padding: 28px 20px 72px; }
.home { max-width: 1000px; margin: 0 auto; padding: 36px 20px 72px; }

/* ================= typography ================= */
h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 18px; letter-spacing: -.5px; }
.page h1 { font-size: 1.55rem; }

h2 {
  font-family: var(--mono);
  font-size: 1.15rem;
  margin: 52px 0 18px;
}
h2::before { content: "## "; color: var(--accent); }

h3 { font-size: 1.05rem; margin: 0 0 8px; }

ul { padding-left: 1.3em; }
li { margin-bottom: 6px; }
li::marker { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.lead { font-size: 1.1rem; color: var(--muted); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ================= hero ================= */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 28px 0 12px;
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 20px; }

/* chat preview card */
.chat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 60px rgba(238, 131, 50, .05);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 11px 16px;
}
.chat-peer { font-family: var(--mono); font-size: .85rem; }
.chat-enc {
  font-size: .72rem;
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.chat-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px 20px;
}
.msg {
  margin: 0;
  max-width: 80%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.45;
  opacity: 0;
  animation: msg-in .4s ease forwards;
}
.msg.them {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.me {
  background: var(--accent);
  color: var(--on-accent);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-body .msg:nth-child(1) { animation-delay: .3s; }
.chat-body .msg:nth-child(2) { animation-delay: 1s; }
.chat-body .msg:nth-child(3) { animation-delay: 1.7s; }
.chat-body .msg:nth-child(4) { animation-delay: 2.4s; }
.chat-body .msg:nth-child(5) { animation-delay: 3.1s; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.typing {
  display: inline-flex;
  gap: 4px;
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 13px 14px;
}
.msg.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s ease-in-out infinite;
}
.msg.typing span:nth-child(2) { animation-delay: .2s; }
.msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* ================= components ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 16px;
}
.card > :last-child { margin-bottom: 0; }

/* numbered steps */
.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0;
  margin: 0;
}
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin: 0;
}
.steps li::before {
  content: "0" counter(step);
  display: block;
  font-family: var(--mono);
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.steps p, .steps ul { font-size: .95rem; color: var(--muted); }
.steps ul { padding-left: 1.2em; margin: 8px 0 0; }
.steps a { color: var(--accent-hi); }

/* feature row */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }
.features .card { margin: 0; padding: 18px 20px; }
.features h3 { font-size: .95rem; }
.features p { font-size: .9rem; color: var(--muted); margin: 0; }

.alert {
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px 16px;
  margin: 22px 0;
  font-size: .95rem;
}
.alert-info    { border-left-color: var(--blue); }
.alert-success { border-left-color: var(--green); }
.alert-warn    { border-left-color: var(--accent); }
.alert-danger  { border-left-color: var(--red); }
.alert h3 { margin-bottom: 6px; }
.alert > :last-child { margin-bottom: 0; }

.btn {
  display: inline-block;
  font: 600 .95rem var(--sans);
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 20px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-hi); border-color: var(--accent-hi); text-decoration: none; }
.btn-outline { background: transparent; color: var(--accent-hi); }
.btn-outline:hover { background: var(--accent-dim); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); font-weight: 500; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }
.btn-sm { font-size: .85rem; padding: 5px 14px; }
.btn-lg { font-size: 1rem; padding: 12px 26px; border-radius: 9px; }
.btn-host { background: #3d8bfd; border-color: #3d8bfd; color: #fff; }
.btn-host:hover { background: #5ca3ff; border-color: #5ca3ff; }
.btn-block { display: block; width: 100%; text-align: center; padding: 12px; }

/* online users pill */
.online {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--accent-hi);
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
}
.online .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

/* ================= tables ================= */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
thead th {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
tbody th { color: var(--muted); font-weight: 500; white-space: nowrap; vertical-align: top; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
td { word-break: break-word; }

/* ================= forms ================= */
.field { margin-bottom: 22px; }
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }

input[type=text], input[type=password], input[type=email] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--text);
  font: inherit;
  caret-color: var(--accent);
}
input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.hint { display: block; font-size: .82rem; color: var(--muted); margin-top: 6px; }

.jid-group { display: flex; }
.jid-group input { flex: 1; border-radius: 8px 0 0 8px; }
.jid-suffix {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--accent-hi);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 0 13px;
}

.captcha-img {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
}

/* ================= donate ================= */
.addr {
  font-family: var(--mono);
  font-size: .84rem;
  word-break: break-all;
  color: var(--accent-hi);
  background: #0e0b08;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px 13px;
  margin-bottom: 14px;
}
.qr { display: none; text-align: center; margin-top: 14px; }
.qr.open { display: block; }
.qr img { background: #fff; padding: 10px; border-radius: 8px; max-width: 220px; }

/* ================= footer ================= */
footer { margin-top: 40px; border-top: 1px solid var(--border); background: var(--surface); }
.foot-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px;
  text-align: center;
  font-size: .875rem;
  color: var(--muted);
}
.foot-inner p { margin: 10px 0 0; }
.foot-inner img { vertical-align: middle; max-width: 100%; }

.statusline {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 9px 20px;
  border-top: 1px dashed var(--border);
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
}
.statusline .ok { color: var(--green); }

@media (prefers-reduced-motion: reduce) {
  .brand .cursor, .online .dot, .msg.typing span { animation: none; }
  .msg { animation: none; opacity: 1; }
}
