/* ============================================================
   My Space: black theme. Brass gold is used for the logo and main actions only.
   ============================================================ */
:root {
  --bg: #000;
  --panel: #0e0d0b;
  --panel-2: #171510;
  --line: #28231a;
  --line-2: #3b3322;
  --text: #ece6d8;
  --muted: #9b9381;
  --gold: #d9b46a;
  --gold-hi: #f1dba3;
  --gold-lo: #9c7230;
  --danger: #e2766c;
  --ok: #67c58a;
  --r: 14px;
  --font-ui: "Mulish", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", "Trajan Pro", Georgia, "Times New Roman", serif;
  --font-script: "Great Vibes", "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive;
  --topbar: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--font-ui);
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

/* svg logo text */
.logo-script { font-family: var(--font-script); font-size: 92px; }
.logo-sp { font-family: var(--font-display); font-weight: 700; font-size: 150px; letter-spacing: 6px; }
.logo-mark-text { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 1px; }

/* icons */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-xl { width: 44px; height: 44px; stroke-width: 1.4; }
.sprite symbol { overflow: visible; }


/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: rgba(0,0,0,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font-family: var(--font-display); font-weight: 500; letter-spacing: .12em; font-size: .95rem; }
.nav { display: flex; gap: 4px; }
.nav a {
  position: relative; text-decoration: none; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: .92rem;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--gold-hi); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 1px; background: var(--gold); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--gold); color: #1a1306; font-size: .72rem; font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; padding: 10px 18px;
  font-weight: 700; cursor: pointer; text-decoration: none; transition: filter .15s, background .15s, border-color .15s;
}
.btn-gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo)); color: #1a1306; }
.btn-gold:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold-lo); background: var(--panel-2); }
.btn-danger { background: var(--danger); color: #1a0907; }
.btn.danger { color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .86rem; border-radius: 10px; }
.btn-lg { padding: 14px 40px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--gold-hi); background: var(--panel-2); }
.link-btn { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 4px; font-weight: 600; }
.link-btn:hover { color: var(--gold-hi); text-decoration: underline; }
.link-btn.center { display: block; margin: 12px auto 0; }

/* ---------- views ---------- */
.view { min-height: calc(100dvh - var(--topbar)); }

/* ---------- home ---------- */
.home {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px 20px 56px; overflow: hidden;
}
.aura {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 55% 42% at 50% 38%, rgba(217,180,106,.13), transparent 70%);
}
.logo-big { position: relative; width: min(86vw, 460px); height: auto; aspect-ratio: 420 / 330; overflow: visible; animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; }
.home-title { position: relative; margin-top: 2px; font-family: var(--font-display); font-weight: 500; font-size: clamp(1.1rem, 3.4vw, 1.5rem); letter-spacing: .5em; padding-left: .5em; color: var(--text); }
.home-sub { position: relative; margin: 14px 0 34px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .logo-big { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- cards / forms ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; }
.card h2 { font-size: 1.05rem; margin-bottom: 16px; }
.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: block; margin-bottom: 6px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.field input {
  width: 100%; padding: 11px 13px; background: #060605; border: 1px solid var(--line-2); border-radius: 10px; outline: none;
}
.field input:focus { border-color: var(--gold); }
.field input::placeholder { color: #5f594c; }
.pw { position: relative; display: block; }
.pw input { padding-right: 64px; }
.pw .link-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .84rem; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.form-error { margin: 0 0 14px; color: var(--danger); font-size: .9rem; }
.hint { margin: -6px 0 16px; color: var(--muted); font-size: .82rem; }
.stack { display: grid; gap: 10px; }

.login, .profile { display: grid; place-items: center; padding: 28px 16px 56px; }
.auth-card, .profile-card { width: min(100%, 400px); }
.auth-card h1, .profile-card h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: .12em; font-size: 1.35rem; text-align: center; }
.auth-mark { display: block; width: 56px; height: 56px; margin: 0 auto 14px; }
.auth-card .muted { text-align: center; margin: 8px 0 22px; font-size: .92rem; }
.profile-card { text-align: center; }
.profile-card .avatar-xl { margin: 0 auto 14px; }
.kv { margin: 20px 0 24px; text-align: left; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; background: var(--panel); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---------- avatar + presence ---------- */
.avatar {
  position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #1a1306; background: var(--gold);
}
.avatar svg { stroke: #1a1306; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.7rem; font-family: var(--font-display); }
.avatar.is-note, .avatar.is-lock { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--gold); }
.avatar.is-note svg, .avatar.is-lock svg { stroke: var(--gold); }
.dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #4b463a; border: 2px solid var(--bg); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(103,197,138,.7); }

/* ---------- chat ---------- */
.chat { min-height: 0; }
.chat-shell {
  height: calc(100dvh - var(--topbar)); display: grid; grid-template-columns: 340px 1fr;
  max-width: 1280px; margin: 0 auto; border-inline: 1px solid var(--line);
}

.convlist { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg); }
.convlist-head { padding: 18px 18px 10px; }
.convlist-head h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: .14em; font-size: 1rem; }
.convs { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.conv-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px;
  background: transparent; text-align: left; cursor: pointer;
}
.conv-item:hover { background: var(--panel); }
.conv-item[aria-current="true"] { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--gold); }
.conv-item .t { min-width: 0; }
.conv-item strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .s { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background:
  radial-gradient(ellipse 70% 40% at 50% 0%, rgba(217,180,106,.05), transparent 70%), var(--bg); }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 64px; }
.conv-head .back { display: none; }
.conv-title { min-width: 0; flex: 1; display: grid; }
.conv-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-actions { display: flex; gap: 8px; }

.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.day { align-self: center; margin: 12px 0 8px; font-size: .76rem; color: var(--muted); padding: 3px 12px; border: 1px solid var(--line); border-radius: 20px; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble {
  max-width: min(78%, 520px); padding: 8px 12px 6px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line);
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.mine .bubble { background: #2b2316; border-color: #5b4825; color: var(--text); border-bottom-right-radius: 5px; }
.theirs .bubble { border-bottom-left-radius: 5px; }
.bubble .media { display: block; max-width: 100%; border-radius: 10px; margin: 2px 0 6px; max-height: 320px; background: #000; }
.bubble video.media { width: 100%; }
.bubble .secret { display: inline-flex; align-items: center; gap: 6px; letter-spacing: .15em; }
.bubble .secret .icon { width: 15px; height: 15px; }
.meta { display: block; margin-top: 2px; text-align: right; font-size: .7rem; opacity: .6; white-space: nowrap; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 30ch; }

.locked { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); }
.locked .icon { color: var(--gold-lo); }
.locked p { margin: 0; }

.upload-bar { position: relative; margin: 0 14px; padding: 6px 10px; font-size: .82rem; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.upload-bar span { position: relative; z-index: 1; }
.upload-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(217,180,106,.18); transition: width .2s; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.composer textarea {
  flex: 1; resize: none; max-height: 140px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; outline: none; line-height: 1.4;
}
.composer textarea:focus { border-color: var(--gold); }
.send { flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; background: linear-gradient(135deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); color: #1a1306; }
.send:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- admin ---------- */
.admin { padding: 24px 16px 64px; }
.admin-wrap { max-width: 1040px; margin: 0 auto; }
.admin h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: .14em; font-size: 1.4rem; margin-bottom: 18px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.admin-grid .wide { grid-column: 1 / -1; }
.setting + .setting { margin-top: 4px; }
.people, .invites { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.people:empty, .invites:empty { display: none; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); }
.row .t { flex: 1; min-width: 0; }
.row .t strong, .row .t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t span { color: var(--muted); font-size: .84rem; }
.row .avatar { width: 38px; height: 38px; }
.row .acts { display: flex; gap: 6px; }
.row.unseen { box-shadow: inset 2px 0 0 var(--gold); }
.empty-note { margin: 0; color: var(--muted); font-size: .92rem; }

/* ---------- toast + dialog ---------- */
.toasts { position: fixed; z-index: 50; left: 50%; top: calc(var(--topbar) + 14px); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 11px 16px; border-radius: 12px; background: #1b1813; border: 1px solid var(--line-2); box-shadow: 0 8px 28px rgba(0,0,0,.6); font-size: .92rem; animation: pop .22s ease-out both; }
.toast.error { border-color: var(--danger); }
.toast.ok { border-color: var(--gold-lo); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dlg { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--panel); color: var(--text); padding: 22px; width: min(92vw, 380px); }
.dlg::backdrop { background: rgba(0,0,0,.72); }
.dlg h3 { font-size: 1.1rem; margin-bottom: 8px; }
.dlg p { margin: 0 0 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; border-inline: 0; }
  .chat-shell[data-pane="list"] .conv { display: none; }
  .chat-shell[data-pane="conv"] .convlist { display: none; }
  .conv-head .back { display: inline-grid; }
  .conv-actions .btn span { display: none; }
  .conv-actions .btn { padding: 8px 10px; }
  .bubble { max-width: 86%; }
}
@media (max-width: 520px) {
  .brand-name { display: none; }
  .nav a { padding: 8px 9px; }
  .row { flex-wrap: wrap; }
  .row .acts { width: 100%; justify-content: flex-end; }
  .logo-script { font-size: 92px; }
  .card { padding: 20px; }
}
