:root {
	--bg: #0f1115;
	--panel: #171a21;
	--text: #e6e6e6;
	--muted: #a0a7b4;
	--primary: #4e9cff;
	--primary-pressed: #2f7fe0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
	overflow: hidden;
	overscroll-behavior: none;
}

#app { min-height: 100vh; }
.page { height: 100vh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.page-header { padding: 12px 14px; border-bottom: 1px solid #1f2430; background: var(--panel); }
.chat-list { list-style: none; margin: 0; padding: 10px 12px 16px; overflow: auto; }
.chat-list li { padding: 6px 0; border-bottom: none; cursor: default; }
.chat-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #121622; border: 1px solid #1b1f2a; border-radius: 14px; color: var(--text); cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
.chat-item:hover { border-color: var(--primary); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.chat-item:active { transform: translateY(1px); }
.chat-item .avatar { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #4e9cff, #7a5cff); }
.chat-item .info { min-width: 0; display: grid; gap: 2px; }
.chat-item .title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chevron { margin-left: auto; color: var(--muted); font-size: 18px; transition: color .2s ease, transform .2s ease, background-color .2s ease, box-shadow .2s ease; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; }
.chat-item.unread .chevron { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px rgba(78,156,255,0.18); transform: translateX(0); }
.page-chat { display: grid; grid-template-rows: auto 1fr auto; }
.hidden { display: none; }
.hint { display: none !important; }
.chat-header { padding: 8px 10px; border-bottom: 1px solid #1f2430; display: flex; align-items: center; gap: 8px; }
.back { background: transparent; border: none; color: var(--text); font-size: 18px; padding: 4px 8px; cursor: pointer; }
.chat-title h3 { margin: 0; font-size: 15px; }
.messages { padding: 10px 12px calc(64px + env(safe-area-inset-bottom)); overflow: auto; display: flex; flex-direction: column; gap: 10px; background: #0e1117; overflow-anchor: none; scroll-behavior: smooth; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.message { max-width: 80%; padding: 8px 10px; border-radius: 12px; line-height: 1.35; }
.message.in { background: #131722; align-self: flex-start; }
.message.out { background: #143150; align-self: flex-end; }
.message .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.messages .message img,
.messages .message video {
	max-width: min(85vw, 420px);
	width: 100%;
	height: auto;
	display: block;
	border-radius: 8px;
}
.composer { position: fixed; bottom: 6px; left: 6px; right: 6px; z-index: 1000; display: flex; align-items: center; gap: 8px; padding: 6px 10px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); border: 1px solid #1f2430; background: var(--panel); border-radius: 14px; min-height: calc(46px + env(safe-area-inset-bottom)); box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.attach { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: #0d0f14; border: 1px solid #1f2430; border-radius: 10px; cursor: pointer; }
.paperclip { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #1f2430; border-radius: 50%; background: #0d0f14; }
/* .paperclip:after { } */
.input-wrap { position: relative; flex: 1 1 auto; display: flex; align-items: center; }
.input { width: 100%; min-width: 0; height: 32px; max-height: 120px; resize: none; overflow-y: auto; background: #0d0f14; color: var(--text); border: 1px solid #1f2430; border-radius: 16px; padding: 6px 36px 6px 10px; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.send { width: 32px; height: 32px; background: transparent; border: 1px solid #1f2430; color: var(--text); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto; }
/* Voice button */
.voice { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; background: transparent; border: 1px solid #1f2430; color: var(--text); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .1s ease, background-color .1s ease, border-color .1s ease; }
.voice.recording { transform: translateY(-50%) scale(1.15); background: #2a1a1a; border-color: #6b2323; }
.voice.recording { transform: scale(1.2); background: #2a1a1a; border-color: #6b2323; }
.voice.recording::after { content: ''; position: absolute; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,0,0,0.1); animation: pulse 0.7s infinite ease-in-out; }

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.25; }
  100% { transform: scale(1); opacity: 0.6; }
}
/* .send:after { } */
.btn { appearance: none; border: none; border-radius: 10px; padding: 10px 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--primary); color: #101318; }
.btn.primary:active { background: var(--primary-pressed); }

/* Fullscreen image viewer */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.viewer img { max-width: 96vw; max-height: 96vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.viewer.hidden { display: none; }

/* Mobile layout */
@media (max-width: 768px) { .messages { height: calc(100vh - 140px); } }

.header {
	padding: 20px 16px 8px;
	text-align: center;
}

h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.container { padding: 12px 16px 24px; }

.compose {
	background: var(--panel);
	border-radius: 12px;
	padding: 12px;
	box-shadow: 0 1px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.03);
}

.label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.compose .input {
	width: 100%;
	min-height: 120px;
	resize: vertical;
	background: #0d0f14;
	color: var(--text);
	border: 1px solid #1f2430;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 15px;
}

.actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.btn {
	appearance: none;
	border: none;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.btn.primary { background: var(--primary); color: #101318; }
.btn.primary:active { background: var(--primary-pressed); }

.status { color: var(--muted); font-size: 13px; min-height: 1.4em; }

.footer { margin-top: auto; padding: 12px 16px 20px; text-align: center; color: var(--muted); font-size: 12px; }


