:root {
  --bg: #0f1115;
  --bg2: #151821;
  --panel: #1a1e29;
  --panel2: #212636;
  --line: #2a3042;
  --text: #e6e8ef;
  --muted: #9aa3b8;
  --faint: #6b7489;
  --accent: #84e1bc;
  --accent2: #7aa2f7;
  --warn: #f7768e;
  --hl: #3b2f1a;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; background: var(--panel2); padding: .1em .4em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
section { max-width: 1120px; margin: 0 auto; padding: 72px 20px 0; }
.eyebrow { font: 600 .8rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: rgba(15,17,21,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font: 700 1.2rem var(--mono); color: var(--text); }
.brand .prompt { color: var(--accent); }
.cursor { animation: blink 1.1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.top nav { display: flex; gap: 18px; align-items: center; font-size: .95rem; }
.top nav a { color: var(--muted); }
.top nav a.cta { color: var(--bg); background: var(--accent); padding: 6px 14px; border-radius: 999px; font-weight: 600; }
.top nav a:hover { color: var(--text); text-decoration: none; }
.top nav a.cta:hover { color: var(--bg); filter: brightness(1.08); }

/* hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding-top: 80px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); letter-spacing: -.02em; }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); color: var(--text);
  background: var(--panel); font: 600 .95rem var(--sans); cursor: pointer; overflow-wrap: anywhere; }
.btn:hover { text-decoration: none; border-color: var(--faint); }
.btn.primary { background: var(--accent); color: #0b1a14; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }

.terminal { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7), 0 0 0 1px rgba(132,225,188,.05); font: .9rem/1.65 var(--mono); }
.term-bar { display: flex; gap: 7px; align-items: center; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a4055; }
.term-bar span:first-child { background: #f7768e; } .term-bar span:nth-child(2) { background: #e0af68; } .term-bar span:nth-child(3) { background: #9ece6a; }
.term-bar em { margin-left: 10px; color: var(--muted); font-style: normal; }
.term-body { padding: 16px 18px; }
.term-body p { margin: 0 0 8px; overflow-wrap: anywhere; }
.term-body time { color: var(--faint); }
.n1 { color: #e0af68; } .n2 { color: var(--accent); } .n3 { color: #bb9af7; }
.blink { animation: blink 1s steps(1) infinite; color: var(--muted); }

/* features */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid article { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.grid h3 { font-size: 1.05rem; color: var(--accent); font-family: var(--mono); }
.grid p { margin: 0; color: var(--muted); }

/* commands */
.commands > p { color: var(--muted); }
.commands dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 28px; margin: 22px 0; }
.commands dl div { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.commands dt { font-family: var(--mono); color: var(--accent2); min-width: 9.5em; }
.commands dd { margin: 0; color: var(--muted); }
.where { color: var(--muted); }

/* owner */
.owner-card { display: flex; gap: 28px; align-items: flex-start; background: linear-gradient(135deg, var(--panel), var(--bg2));
  border: 1px solid var(--line); border-radius: 18px; padding: 34px; }
.avatar { flex: none; width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center;
  font: 700 1.8rem var(--mono); color: #0b1a14; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.owner-card h2 { font-family: var(--mono); }
.owner-card p { color: var(--muted); max-width: 46em; }
.conn { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 4px; }
.conn div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.conn span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.conn code { background: none; padding: 0; color: var(--text); }

/* chat section */
.chat-section .sub { color: var(--muted); margin-top: -6px; }
.lounge { position: relative; height: min(78vh, 720px); min-height: 460px; margin-top: 22px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.connect { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, rgba(132,225,188,.08), transparent 60%), var(--bg2); }
.connect[hidden] { display: none; }
.connect-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.connect-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.connect-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: 1rem var(--mono); color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.connect-card input:focus { border-color: var(--accent); }
.connect-card details { margin: -4px 0 14px; color: var(--muted); font-size: .85rem; }
.connect-card summary { cursor: pointer; margin-bottom: 10px; }
.connect-card .btn { width: 100%; }
.cf-error { color: var(--warn); font-size: .85rem; margin: -4px 0 14px; overflow-wrap: anywhere; }
.cf-error[hidden] { display: none; }
.fine { font-size: .78rem; color: var(--faint); margin: 12px 0 0; }

.client { display: grid; grid-template-columns: 210px 1fr 180px; height: 100%; }
.client[hidden] { display: none; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.net-name { padding: 14px 16px; font: 700 .85rem var(--mono); letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.status.on { background: #9ece6a; }
.buffers { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; }
.buffers li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font: .92rem var(--mono); white-space: nowrap; overflow: hidden; }
.buffers li span:first-child { overflow: hidden; text-overflow: ellipsis; }
.buffers li:hover { background: var(--panel2); color: var(--text); }
.buffers li.active { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.buffers li.lobby { font-weight: 700; }
.buffers li.unread { color: var(--text); }
.badge { font: 600 .7rem var(--sans); background: var(--line); color: var(--text); border-radius: 999px; padding: 1px 7px; }
.badge.hl { background: var(--warn); color: #1a0b0f; }
.side-foot { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.link { background: none; border: 0; color: var(--muted); font: .82rem var(--sans); cursor: pointer; padding: 4px; }
.link:hover { color: var(--accent); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.bar .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar strong { font-family: var(--mono); margin-right: 10px; }
.bar #buf-topic { color: var(--muted); font-size: .88rem; }
.icon { background: none; border: 0; color: var(--muted); font-size: 1.05rem; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.icon:hover { background: var(--panel2); color: var(--text); }
#btn-menu { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 10px 0; font: .9rem/1.5 var(--mono); }
.msg { display: grid; grid-template-columns: 4.2em 9.5em 1fr; gap: 0 10px; padding: 2px 14px; }
.msg:hover { background: rgba(255,255,255,.02); }
.msg time { color: var(--faint); font-size: .8rem; padding-top: .15em; }
.msg .from { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; cursor: pointer; }
.msg .text { overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.event .from, .msg.event .text { color: var(--faint); font-weight: 400; }
.msg.event .from { cursor: default; }
.msg.notice .text { color: var(--accent2); }
.msg.action .text { font-style: italic; }
.msg.error .text { color: var(--warn); }
.msg.highlight { background: var(--hl); box-shadow: inset 3px 0 0 #e0af68; }
.msg.self .from { opacity: .85; }
.date-sep { text-align: center; color: var(--faint); font-size: .75rem; margin: 10px 0; }

.input { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg2); }
.input .me { font: 600 .85rem var(--mono); color: var(--muted); white-space: nowrap; max-width: 10em; overflow: hidden; text-overflow: ellipsis; }
.input input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  color: var(--text); font: .95rem var(--mono); outline: none; }
.input input:focus { border-color: var(--accent); }
.send { background: var(--accent); color: #0b1a14; border: 0; border-radius: 8px; width: 40px; height: 38px; cursor: pointer; font-size: 1rem; }

.users { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; font: .88rem var(--mono); }
.users-head { padding: 14px 14px 8px; color: var(--faint); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.users ul { list-style: none; margin: 0; padding: 0 8px 12px; }
.users li { padding: 3px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.users li:hover { background: var(--panel2); }
.users li .mode { color: var(--faint); display: inline-block; width: 1ch; margin-right: 4px; }
.client.no-users .users { display: none; }
.client.no-users { grid-template-columns: 210px 1fr; }

/* IRC formatting */
.b { font-weight: 700; } .i { font-style: italic; } .u { text-decoration: underline; } .s { text-decoration: line-through; } .m { font-family: var(--mono); }

footer { max-width: 1120px; margin: 80px auto 0; padding: 28px 20px 40px; border-top: 1px solid var(--line); color: var(--faint); font-size: .88rem; }

/* responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .commands dl { grid-template-columns: 1fr; }
  .client, .client.no-users { grid-template-columns: 1fr; }
  #btn-menu { display: inline-block; }
  .sidebar, .users { position: absolute; top: 0; bottom: 0; z-index: 5; width: 230px; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.4); }
  .users { right: 0; left: auto; transform: translateX(105%); }
  .client.show-side .sidebar { transform: none; }
  .client.show-users .users { transform: none; display: block; }
  .client.no-users .users { display: block; }
  .msg { grid-template-columns: 3.4em 1fr; }
  .msg .from { text-align: left; grid-column: 2; }
  .msg .text { grid-column: 1 / -1; padding-left: calc(3.4em + 10px); }
  .msg time { grid-row: 1; }
}
@media (max-width: 560px) {
  section { padding-top: 56px; padding-left: 16px; padding-right: 16px; }
  .grid { grid-template-columns: 1fr; }
  .top nav a:not(.cta) { display: none; }
  .owner-card { flex-direction: column; padding: 24px; }
  .lounge { height: 82vh; }
  .input .me { display: none; }
}
