/* Ghost Umbra web app. No external fonts, images or anything else that phones home. */
:root {
  --bg: #0c0d12; --panel: #13151c; --panel-2: #1a1d27; --line: #262a37; --text: #e6e7ee; --muted: #8b90a3;
  --accent: #8f7cff; --accent-2: #6a57e8; --danger: #ff5d6c; --ok: #3ccf91; --warn: #ffb84d;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 13px; }
.danger-text { color: var(--danger); }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { display: grid; place-items: center; min-height: 100%; padding: 24px; }

/* ---------- buttons and fields ---------- */
.btn { border: 1px solid var(--line); background: var(--panel-2); padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.btn:hover { border-color: #3a3f52; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.link { background: none; border: none; color: var(--accent); padding: 4px; }
.btn.icon { padding: 6px 9px; }
input[type=text], input[type=password], input:not([type]), textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.error { color: var(--danger); min-height: 1.2em; font-size: 13px; }

/* ---------- cards / onboarding ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(460px, 100%); }
.card.wide { width: min(640px, 100%); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.brand .logo { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #b6a9ff, #4b3bc4 60%, #191433); box-shadow: 0 0 24px #6a57e855; }
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .3px; }
h2 { font-size: 18px; margin: 0 0 6px; }
.notice { background: #1d1a2e; border: 1px solid #3a3266; border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.notice.warn { background: #2a2214; border-color: #5c4519; }
.notice.danger { background: #2a1418; border-color: #5c1924; }
.secret { font-family: var(--mono); font-size: 18px; letter-spacing: 1px; background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 14px; text-align: center; user-select: all; word-break: break-all; }
.words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: w; }
.words div { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: var(--mono); }
.words div::before { counter-increment: w; content: counter(w) ". "; color: var(--muted); }
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lock screen ---------- */
.lock { text-align: center; }
.lock .logo { margin: 0 auto 14px; width: 56px; height: 56px; }
.lock form { margin-top: 18px; }

/* ---------- main layout ---------- */
.app { display: grid; grid-template-columns: 64px 280px 1fr; height: 100vh; }
.rail { background: #08090d; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 2px solid transparent; font-weight: 600; cursor: pointer; user-select: none; }
.avatar.current { border-color: var(--accent); }
.avatar.add { color: var(--muted); font-size: 22px; }
.rail .spacer { flex: 1; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side header { padding: 14px; border-bottom: 1px solid var(--line); }
.side .list { overflow-y: auto; flex: 1; padding: 6px; }
.side h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 14px 8px 6px; display: flex; justify-content: space-between; align-items: center; }
.item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.item:hover { background: var(--panel-2); }
.item.active { background: #23263a; }
.item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--accent-2); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.server { margin: 4px 0; border-radius: 8px; }
.server > .item { font-weight: 600; }
.server .channels { padding-left: 12px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.main header { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.main header h2 { margin: 0; font-size: 16px; }
.empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 30px; }
.banner { padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.banner.public { background: #2a2214; color: #ffd79a; }
.banner.hold { background: #2a1418; color: #ffb3bb; }

/* ---------- messages ---------- */
.msgs-wrap { flex: 1; position: relative; min-height: 0; }
.msgs { position: absolute; inset: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; background: var(--panel-2); align-self: flex-start; position: relative; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: #2b2550; }
.msg .meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; }
.msg .from { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.msg .fwd { font-size: 11px; color: var(--muted); font-style: italic; }
.msg .actions { position: absolute; top: -12px; right: 6px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.msg:hover .actions { display: flex; }
.msg .actions button { background: none; border: none; cursor: pointer; font-size: 12px; padding: 3px 6px; color: var(--muted); }
.msg .actions button:hover { color: var(--text); }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; }
.composer textarea { resize: none; height: 44px; max-height: 160px; }

/* hold-to-reveal */
.reveal-mode .msg .body { filter: blur(7px); transition: filter .12s; user-select: none; }
.reveal-mode .msg.revealed .body { filter: none; }

/* viewer watermark (background image set from JS) */
.watermark { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: .06; background-repeat: repeat; }
/* anti-camera flicker overlay */
.flicker { position: absolute; inset: 0; pointer-events: none; z-index: 3; width: 100%; height: 100%; image-rendering: pixelated; }

/* ---------- panels, dialogs ---------- */
.panel { padding: 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.section h3 { margin: 0; font-size: 15px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.modal-bg { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; z-index: 60; font-size: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table td, .table th { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; }
.qr { background: #fff; padding: 12px; border-radius: 10px; width: 220px; height: 220px; }
.qr img, .qr svg { width: 100%; height: 100%; }
.post { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.post .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }

@media (max-width: 860px) {
  .app { grid-template-columns: 56px 1fr; }
  .app .main { display: none; }
  .app.chat-open .side { display: none; }
  .app.chat-open .main { display: flex; }
}
