/* 1800.show — mobile-first app shell */

:root {
    --bg: #0a0a0a;
    --surf: #141414;
    --fg: #e4e4e4;
    --dim: #6c6c6c;
    --edge: #262626;
    --accent: #ffffff;   /* monochrome — no glow, no green */
    --warn: #e8e8e8;
    --err: #ff4d4d;       /* red is kept only for real errors */
    --nav-h: 56px;
    --head-h: 48px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: "SF Mono", Menlo, "JetBrains Mono", "Courier New", monospace; font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--fg); }

.accent { color: var(--fg); }

button, input[type="text"], input[type="tel"] {
    background: transparent; color: var(--fg); font: inherit; border: 1px solid var(--edge);
    padding: 8px 12px; border-radius: 4px;
}
button { cursor: pointer; }
button:hover { border-color: var(--fg); color: var(--fg); }
button:disabled { opacity: 0.35; cursor: not-allowed; }
input[type="text"], input[type="tel"] { background: var(--surf); min-width: 0; }
input:focus { outline: none; border-color: var(--fg); }

/* ───────── app shell ───────── */

.app { display: grid; min-height: 100vh; min-height: 100dvh; grid-template-columns: 1fr; grid-template-rows: 1fr auto; }

.app-main { grid-row: 1; min-width: 0; padding-bottom: calc(var(--nav-h) + var(--safe-b)); position: relative; }

.tab-view { display: none; flex-direction: column; min-height: 100%; }
.tab-view.active { display: flex; }
.tab-head {
    position: sticky; top: 0; z-index: 5;
    height: var(--head-h); display: flex; align-items: center; padding: 0 16px;
    background: rgba(10,10,10,0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--edge);
    font-size: 16px; font-weight: 600;
}
.tab-body { flex: 1; padding: 12px 16px 24px; }

.tab-seg { display: flex; gap: 4px; }
.seg-btn {
    background: transparent; border: 1px solid transparent; padding: 4px 10px; font-size: 13px; color: var(--dim); border-radius: 999px;
}
.seg-btn.active { color: var(--fg); border-color: var(--edge); background: var(--surf); }
.seg-btn:hover { color: var(--fg); border-color: var(--fg); }

/* ───────── nav: bottom tab bar (mobile) ───────── */

.nav-side { display: none; }

.nav-bottom {
    grid-row: 2;
    position: sticky; bottom: 0;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--nav-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(10,10,10,0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--edge);
    z-index: 10;
}
.nav-item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: transparent; border: 0; border-radius: 0; color: var(--dim); padding: 4px 0;
    font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
}
.nav-item:hover { color: var(--fg); }
.nav-item.active { color: var(--fg); }
.nav-ico { width: 22px; height: 22px; }
.nav-label { display: block; }

/* ───────── dial view ───────── */

.dial-hero { max-width: 360px; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding-top: 8px; }
.dial-display {
    min-height: 56px; font-size: 32px; letter-spacing: 2px; text-align: center;
    padding: 12px; border: 1px solid var(--edge); background: var(--surf); border-radius: 6px;
    word-break: break-all; font-variant-numeric: tabular-nums;
}
.dial-hint { text-align: center; color: var(--dim); font-size: 12px; }
.dial-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dial-key {
    aspect-ratio: 1.6 / 1;
    border: 1px solid var(--edge); background: var(--surf); font-size: 22px; border-radius: 6px;
    transition: background 0.08s;
}
.dial-key:active { background: var(--edge); }
.dial-back { font-size: 16px; color: var(--dim); }
.dial-go { font-size: 16px; color: var(--bg); background: var(--accent); border-color: var(--fg); font-weight: 600; }
.dial-go:hover { color: var(--bg); background: #3cffb1; }
.dial-recent { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.dial-recent-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border: 1px solid var(--edge); background: var(--surf); border-radius: 4px;
    font-size: 13px;
}
.dial-recent-item .count { color: var(--dim); font-size: 11px; }

/* ───────── dms view ───────── */

.dm-composer { display: flex; gap: 6px; margin-bottom: 12px; }
.dm-composer input { flex: 1; }
.dm-list { display: flex; flex-direction: column; gap: 6px; }
.dm-list .empty { color: var(--dim); padding: 24px 0; text-align: center; font-size: 13px; }

/* ───────── shows view ───────── */

.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-card {
    border: 1px solid var(--edge); background: var(--surf); padding: 12px; border-radius: 6px;
    display: flex; justify-content: space-between; align-items: center;
}
.feed-card .phone { font-size: 16px; letter-spacing: 1px; }
.feed-card .meta { color: var(--dim); font-size: 11px; }
.feed .empty { color: var(--dim); text-align: center; padding: 24px 0; font-size: 13px; }

/* ───────── room view (kept compact) ───────── */

.container { max-width: 1000px; margin: 0 auto; padding: 16px; padding-bottom: calc(16px + var(--safe-b)); }
.tiles { display: grid; grid-template-columns: 1fr; gap: 8px; }
.tile { border: 1px solid var(--edge); padding: 6px; border-radius: 6px; background: var(--surf); }
.tile.self { border-color: var(--fg); }
.tile-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.ascii-canvas { width: 100%; image-rendering: pixelated; background: #000; display: block; border-radius: 4px; }

.rail { margin-top: 12px; display: flex; flex-direction: column; border: 1px solid var(--edge); padding: 10px; min-height: 220px; border-radius: 6px; background: var(--surf); }
.rail-head { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.rail-log { flex: 1; overflow-y: auto; font-size: 12px; max-height: 200px; }
.rail-log .line { margin-bottom: 4px; white-space: pre-wrap; word-break: break-word; }
.rail-log .sys { color: var(--dim); }
.rail-log .err { color: var(--err); }
.rail-log .ok  { color: var(--fg); }

.chat-msg { border-top: 1px solid var(--edge); padding: 6px 0; margin: 0; position: relative; }
.chat-msg:first-of-type { border-top: 0; }
.chat-head { display: flex; gap: 8px; font-size: 11px; color: var(--dim); margin-bottom: 2px; }
.chat-user { color: var(--fg); }
.chat-quote { border-left: 2px solid var(--edge); padding: 2px 6px; color: var(--dim); font-size: 11px; margin: 2px 0; }
.chat-body { font-size: 13px; }
.chat-acts { display: flex; gap: 4px; margin-top: 4px; align-items: center; opacity: 0; transition: opacity 0.1s; }
.chat-msg:hover .chat-acts { opacity: 1; }
.chat-acts button { padding: 2px 6px; font-size: 11px; background: transparent; border: 1px solid var(--edge); color: var(--dim); border-radius: 4px; }
.chat-acts button:hover { border-color: var(--fg); color: var(--fg); }
.chat-reacts { display: inline-flex; gap: 4px; margin-left: 4px; }
.chat-react { font-size: 11px; padding: 2px 6px; border: 1px solid var(--edge); border-radius: 999px; cursor: pointer; }
.chat-attach { margin-top: 4px; }
.chat-attach img, .chat-attach video { max-width: 100%; border-radius: 4px; display: block; }
.chat-attach audio { width: 100%; }
.attach-html { width: 100%; min-height: 200px; border: 1px solid var(--edge); background: #fff; border-radius: 4px; }
.attach-text { max-height: 240px; overflow: auto; background: #000; padding: 8px; border: 1px solid var(--edge); font-size: 11px; border-radius: 4px; margin: 0; }
.reply-bar { font-size: 11px; color: var(--dim); padding: 4px 8px; background: var(--surf); border: 1px solid var(--edge); border-radius: 4px; margin-top: 4px; display: flex; justify-content: space-between; align-items: center; }
.reply-bar button { font-size: 10px; padding: 2px 6px; border: 1px solid var(--edge); background: transparent; color: var(--dim); border-radius: 4px; }

/* ───────── unified slug page ───────── */
.slug-body { display: grid; grid-template-rows: auto auto auto auto auto 1fr auto; min-height: 100dvh; background: var(--bg); }
.slug-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--edge); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.slug-home { color: var(--dim); font-size: 12px; padding: 2px 6px; border: 1px solid var(--edge); }
.slug-home:hover { color: var(--fg); border-color: var(--fg); }
.slug-name { font-size: 15px; font-weight: 600; }
.slug-badge { font-size: 10px; color: var(--dim); padding: 1px 6px; border: 1px solid var(--edge); text-transform: uppercase; }
.slug-spacer { flex: 1; }
.slug-btn { background: transparent; border: 1px solid var(--edge); color: var(--fg); font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.slug-btn:hover { border-color: var(--fg); }
.slug-bio { padding: 6px 12px; font-size: 12px; color: var(--dim); border-bottom: 1px solid var(--edge); }
.bio-row { display: flex; gap: 10px; align-items: center; }
.bio-avatar { border: 1px solid var(--edge); flex-shrink: 0; }
.bio-col { flex: 1; min-width: 0; }
.bio-name { color: var(--fg); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.on-air { background: var(--fg); color: var(--bg); padding: 1px 6px; font-size: 10px; letter-spacing: 1px; border-radius: 2px; }
.air-next { color: var(--dim); font-size: 10px; letter-spacing: 1px; }
.bio-act, .bio-loc { margin-top: 2px; }
.slug-preview { display: flex; flex-direction: column; border-bottom: 1px solid var(--edge); height: 260px; background: #111; }
.slug-preview-bar { display: flex; gap: 6px; align-items: center; padding: 4px 8px; font-size: 11px; color: var(--dim); border-bottom: 1px solid var(--edge); }
.slug-preview-bar button { margin-left: auto; background: transparent; border: 1px solid var(--edge); color: var(--fg); font: inherit; font-size: 11px; padding: 2px 8px; cursor: pointer; }
.slug-preview iframe { flex: 1; width: 100%; border: 0; background: #fff; }
.slug-queue { padding: 6px 12px; border-bottom: 1px solid var(--edge); display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.qitem { display: flex; gap: 8px; padding: 2px 0; }
.qwho { color: var(--dim); min-width: 90px; }
.qprompt { flex: 1; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qstat { color: var(--dim); text-transform: uppercase; font-size: 10px; }
.status-building .qstat { color: var(--fg); }
.slug-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px; padding: 4px 12px; }
.slug-tiles canvas { width: 100%; height: auto; background: #000; image-rendering: pixelated; }
.slug-tiles .tile { border: 1px solid var(--edge); }
.slug-tiles .tile-head { font-size: 10px; color: var(--dim); padding: 2px 4px; }
.slug-log { padding: 8px 12px; overflow-y: auto; max-width: 760px; width: 100%; margin: 0 auto; font-size: 13px; }
.msg { padding: 3px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; border-top: 1px solid transparent; }
.msg:hover { border-top-color: var(--edge); }
.mwho { color: var(--dim); font-size: 12px; }
.mbot { font-size: 9px; color: var(--dim); border: 1px solid var(--edge); padding: 0 4px; text-transform: uppercase; }
.mbody { word-break: break-word; flex: 1; }
.mbody a { color: var(--fg); text-decoration: underline; }
.mbody a:hover { color: var(--fg); opacity: 0.7; }
.matt { width: 100%; margin-top: 4px; }
.matt img, .matt video { max-width: 100%; }
.matt audio { width: 100%; }
.matt iframe { width: 100%; min-height: 200px; border: 1px solid var(--edge); background: #fff; }
.matt-text { background: #000; color: var(--fg); padding: 6px; max-height: 240px; overflow: auto; font-size: 11px; border: 1px solid var(--edge); white-space: pre-wrap; }
.macts { opacity: 0; display: inline-flex; gap: 2px; }
.msg:hover .macts { opacity: 1; }
.macts button { background: transparent; border: 1px solid var(--edge); color: var(--dim); font-size: 10px; padding: 0 4px; cursor: pointer; }
.macts button:hover { color: var(--fg); border-color: var(--fg); }
.mreacts { display: inline-flex; gap: 4px; }
.mr { font-size: 10px; padding: 1px 6px; border: 1px solid var(--edge); border-radius: 999px; }
.slug-input { display: flex; gap: 4px; padding: 5px 8px; border-top: 1px solid var(--edge); background: var(--bg); position: sticky; bottom: 0; padding-bottom: calc(5px + var(--safe-b)); flex-shrink: 0; align-items: center; }
/* font-size must be >= 16px so iOS Safari doesn't auto-zoom on focus */
.slug-input input { flex: 1 1 0; min-width: 0; padding: 4px 8px; font-size: 16px; border-radius: 3px; height: 32px; }
.slug-input button { flex-shrink: 0; padding: 4px 10px; font-size: 13px; height: 32px; }
input[type="text"], input[type="tel"], input[type="search"] { font-size: 16px; }
[hidden] { display: none !important; }

/* ───────── sidebar presence ───────── */
.slug-main { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.slug-main > .slug-log, .slug-main > .home-grid { flex: 1 1 0; min-width: 0; overflow-y: auto; }
.slug-aside { flex: 0 0 16%; max-width: 180px; min-width: 100px; border-left: 1px solid var(--edge); padding: 6px 4px; font-size: 11px; background: var(--bg); overflow-y: auto; }
.aside-head { color: var(--dim); font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px; padding: 4px 6px 2px; }
.aside-row { display: flex; align-items: center; gap: 4px; padding: 3px 6px; cursor: pointer; color: var(--fg); text-decoration: none; overflow: hidden; }
.aside-row:hover { background: var(--surf); }
.aside-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: var(--dim); }
.aside-dot.live { background: #fff; box-shadow: 0 0 3px #fff; }
.aside-dot.idle { background: var(--dim); opacity: 0.5; }
.aside-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.aside-here { color: var(--fg); font-size: 11px; }
.aside-else { color: var(--dim); font-size: 11px; }
@media (max-width: 480px) { .slug-aside { flex: 0 0 40%; max-width: 150px; min-width: 80px; } }
.line { padding: 2px 0; color: var(--dim); font-size: 12px; }
.line.sys { color: var(--dim); }
.line.err { color: var(--err); }
.line.ok { color: var(--fg); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-card { border: 1px solid var(--edge); padding: 20px; background: var(--bg); max-width: 360px; width: 90%; }
.modal-title { margin-bottom: 12px; font-size: 14px; }
.modal-form { display: flex; gap: 6px; margin-bottom: 8px; }
.modal-form input { flex: 1; }
.modal-msg { color: var(--dim); font-size: 12px; margin-top: 8px; min-height: 1em; }
.reel-card { text-align: center; padding: 32px 24px; max-width: 400px; }
.reel-big { font-size: 52px; letter-spacing: -2px; margin-bottom: 4px; }
.reel-line { font-size: 19px; margin-bottom: 8px; }
.reel-sub { font-size: 13px; color: var(--dim); line-height: 1.5; }
.reel-pre { font-family: "SF Mono", monospace; white-space: pre; font-size: 14px; margin-bottom: 12px; color: var(--fg); }
.reel-dots { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.reel-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--edge); cursor: pointer; }
.reel-dot.on { background: var(--fg); }
.reel-skip { margin-top: 14px; font-size: 11px; color: var(--dim); }
.reel-skip a { color: var(--dim); cursor: pointer; text-decoration: underline; }
.mono { font-family: "SF Mono", Menlo, monospace; background: var(--edge); padding: 1px 6px; border-radius: 3px; }
.slug-preview iframe { flex: 1; width: 100%; border: 0; background: #0a0a0a; color: var(--fg); }

/* ───────── home landing ───────── */
.home { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.home-shell { max-width: 420px; width: 90%; text-align: center; padding: 40px 20px; }
.home-logo { font-size: 40px; letter-spacing: -1px; margin-bottom: 4px; }
.home-tag { color: var(--dim); margin-bottom: 24px; font-size: 13px; }
.home-form { display: flex; gap: 6px; margin-bottom: 20px; }
.home-form input { flex: 1; }
.home-recents { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 24px; }
.home-recents-head { width: 100%; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 4px; }
.home-recent { border: 1px solid var(--edge); padding: 4px 10px; font-size: 12px; color: var(--dim); }
.home-recent:hover { border-color: var(--fg); color: var(--fg); }
.home-footer { color: var(--dim); font-size: 11px; }

/* ───────── home grid ───────── */
html, body { overflow-x: hidden; }
.home-body { display: grid; grid-template-rows: auto 1fr auto auto; min-height: 100dvh; background: var(--bg); max-width: 100vw; }
.home-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--edge); min-width: 0; }
.home-logo-small { font-size: 18px; letter-spacing: -0.5px; }
.home-spacer { flex: 1; min-width: 0; }
.home-tagline { font-size: 11px; color: var(--dim); letter-spacing: 0.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 640px) { .home-tagline { display: none; } }
.home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
    max-width: 100vw;
    width: 100%;
    margin: 0 auto;
}
@media (min-width: 640px)  { .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 760px; padding: 10px; } }
@media (min-width: 1000px) { .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1000px; } }
.tile-card {
    border: 1px solid var(--edge); padding: 8px 10px;
    display: flex; flex-direction: column; gap: 4px;
    background: var(--surf);
    color: var(--fg);
    min-width: 0;
    overflow: hidden;
}
.tile-card:hover { border-color: var(--fg); }
.tile-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.tile-slug { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.tile-kind { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 1.5px; flex-shrink: 0; }
.tile-hint { font-size: 11px; color: var(--dim); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.tile-pulse { margin-top: auto; padding-top: 6px; font-size: 10px; color: var(--dim); display: flex; gap: 6px; align-items: baseline; border-top: 1px dashed var(--edge); min-width: 0; }
.tile-pulse.tile-quiet { color: var(--dim); opacity: 0.5; }
.tile-ago { color: var(--fg); font-size: 10px; flex-shrink: 0; }
.tile-from { color: var(--dim); flex-shrink: 0; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-last { flex: 1; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tile-visits { color: var(--dim); font-size: 10px; border: 1px solid var(--edge); padding: 1px 4px; flex-shrink: 0; margin-left: auto; }
.home-log { padding: 0 10px 10px; max-width: 100vw; margin: 0 auto; width: 100%; }
.rail-input { display: flex; gap: 4px; margin-top: 8px; }
.rail-input input { flex: 1; min-width: 0; }

/* ───────── desktop ≥720 — sidebar nav ───────── */

@media (min-width: 720px) {
    .app {
        grid-template-columns: 220px 1fr;
        grid-template-rows: 1fr;
    }
    .nav-bottom { display: none; }
    .nav-side {
        display: flex; flex-direction: column; grid-row: 1; grid-column: 1;
        border-right: 1px solid var(--edge); padding: 20px 12px; gap: 10px;
        position: sticky; top: 0; height: 100vh; height: 100dvh; background: var(--bg);
    }
    .nav-brand { font-size: 20px; letter-spacing: -0.5px; margin-bottom: 16px; padding-left: 8px; }
    .nav-list { display: flex; flex-direction: column; gap: 4px; }
    .nav-list .nav-item {
        flex-direction: row; gap: 12px; justify-content: flex-start;
        padding: 10px 12px; border-radius: 999px; font-size: 14px; text-transform: none; letter-spacing: 0;
    }
    .nav-list .nav-item.active { background: var(--surf); }
    .nav-list .nav-ico { width: 22px; height: 22px; }
    .nav-account {
        margin-top: auto; display: flex; align-items: center; gap: 12px;
        padding: 10px 12px; border: 1px solid var(--edge); border-radius: 999px; font-size: 13px;
    }
    .nav-account:hover { border-color: var(--fg); color: var(--fg); }
    .nav-ico-wrap { width: 22px; text-align: center; color: var(--fg); font-weight: 700; }
    .app-main { grid-column: 2; padding-bottom: 0; }
    .tab-body { max-width: 640px; }
    .tiles { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

@media (max-width: 719px) {
    .nav-account { display: none; }
}
