:root {
	--chat-font-size: 16px;
	--bg: #1a1d24;
	--panel: #242a33;
	--panel2: #2c3440;
	--text: #f4f6fb;
	--muted: #c2c7d3;
	--accent: #6aa7ff;
	--danger: #ff5a5f;
	--ok: #2ea043;
	--border: rgba(255,255,255,0.18);
}
html, body {
	height: 100%;
	margin: 0;
	background: radial-gradient(1200px 800px at 20% 0%, rgba(88,166,255,0.15), transparent 60%),
							radial-gradient(900px 700px at 80% 30%, rgba(255,90,95,0.12), transparent 55%),
							var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: var(--chat-font-size);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
	min-height: 100%;
	display: grid;
	place-items: center;
	padding: 20px;
}

.card {
	width: min(760px, 96vw);
	background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
	border: 1px solid var(--border);
	box-shadow: var(--shadow);
	border-radius: var(--radius);
	overflow: hidden;
}

.cardHeader {
	padding: 18px 22px;
	background: rgba(0,0,0,0.18);
	border-bottom: 1px solid var(--border);
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}

.title {
	font-size: 18px;
	font-weight: 650;
	letter-spacing: 0.2px;
}

.subtitle {
	color: var(--muted);
	font-size: 13px;
}

.content {
	padding: 18px 22px 22px 22px;
}

.row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

@media (max-width: 640px) {
	.row { grid-template-columns: 1fr; }
}

label {
	display: block;
	font-size: 12px;
	color: var(--muted);
	margin: 10px 0 6px 0;
}

input, textarea, button {
	width: 100%;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: rgba(0,0,0,0.25);
	color: var(--text);
	padding: 11px 12px;
	outline: none;
	box-sizing: border-box;
	font-family: var(--sans);
}

textarea { min-height: 72px; resize: vertical; }

input:focus, textarea:focus {
	border-color: rgba(88,166,255,0.65);
	box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

button {
	cursor: pointer;
	background: linear-gradient(180deg, rgba(88,166,255,0.35), rgba(88,166,255,0.18));
	font-weight: 650;
	letter-spacing: 0.2px;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.actions {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-top: 14px;
	flex-wrap: wrap;
}

.msg {
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: rgba(0,0,0,0.20);
	font-size: 13px;
	line-height: 1.3;
	white-space: pre-wrap;
}
.msg.ok { border-color: rgba(46,160,67,0.5); }
.msg.err { border-color: rgba(255,90,95,0.55); }

.warnBar {
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid rgba(255,90,95,0.50);
	background: rgba(255,90,95,0.10);
	font-size: 12px;
	color: #ffd6d7;
	display: none;
}

/* Chat layout */
.chatGrid {
	min-height: 0;
	display: grid;
	grid-template-rows: auto 1fr auto;
	gap: 12px;
	height: min(76vh, 720px);
}

.buffer {
	border: 1px solid var(--border);
	border-radius: 12px;
	background: rgba(0,0,0,0.22);
	padding: 10px 12px;
	overflow: auto;
	font-family: var(--mono);
	font-size: 12px;
	line-height: 1.35;
	white-space: pre-wrap;
}

.pillRow {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: rgba(0,0,0,0.18);
	font-size: 12px;
	color: var(--muted);
}

.miniBtn {
	width: auto;
	padding: 8px 10px;
	border-radius: 10px;
	font-size: 12px;
	background: rgba(0,0,0,0.25);
}

.splitBtn {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 10px;
	align-items: center;
}

.hint {
	color: var(--muted);
	font-size: 12px;
	margin-top: 8px;
}

.captchaBox {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
	margin-top: 10px;
}

code.inline {
	font-family: var(--mono);
	background: rgba(0,0,0,0.25);
	border: 1px solid var(--border);
	padding: 2px 6px;
	border-radius: 8px;
}


.topRow{
	display: grid;
	grid-template-columns: 260px 1fr 240px;
	gap: 12px;
	height: 100%;
	min-height: 0;
}

.activePane{
	border: 1px solid var(--border);
	border-radius: 12px;
	background: rgba(0,0,0,0.16);
	padding: 10px 12px;
	overflow: auto;
	min-height: 0;
}

.activeTitle{
	font-weight: 700;
	margin-bottom: 8px;
}

.activeList{
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 6px;
}

.activeItem{
	display:flex;
	justify-content: space-between;
	gap: 8px;
	align-items: center;
	padding: 6px 8px;
	border-radius: 10px;
	background: rgba(255,255,255,0.04);
}

.activeItem.you{
	outline: 1px solid rgba(255,255,255,0.18);
}

.badge{
	font-family: var(--mono);
	font-size: 11px;
	opacity: 0.85;
}

.badge.typing{
	font-style: italic;
}

@media (max-width: 980px){
	.topRow{ grid-template-columns: 1fr; }
}


/* Wider card for chat layout */
.chatCard{
	width: min(1120px, 98vw);
}

/* Rooms pane */
.roomsPane{
	border: 1px solid var(--border);
	border-radius: 12px;
	background: rgba(0,0,0,0.16);
	padding: 10px 12px;
	overflow: auto;
	min-height: 0;
}

.roomsHeader{
	display:flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.roomsTitle{
	font-weight: 700;
}

.roomList{
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 6px;
}

.roomItem{
	display:flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 10px;
	background: rgba(255,255,255,0.04);
	cursor: pointer;
	user-select: none;
}

.roomItem:hover{
	background: rgba(255,255,255,0.06);
}

.roomItem.active{
	outline: 1px solid rgba(88,166,255,0.55);
	background: rgba(88,166,255,0.10);
}

.roomName{
	font-weight: 650;
	font-size: 13px;
}

.roomMeta{
	font-family: var(--mono);
	font-size: 11px;
	opacity: 0.85;
}

/* Center pane with topic bar + buffer */
.centerPane{
	display: grid;
	grid-template-rows: auto 1fr;
	gap: 12px;
	min-height: 0;
}

.topicBar{
	border: 1px solid var(--border);
	border-radius: 12px;
	background: rgba(0,0,0,0.16);
	padding: 10px 12px;
	display:flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.topicRoom{
	font-weight: 750;
	letter-spacing: 0.2px;
}

.topicText{
	color: var(--muted);
	font-size: 13px;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 58ch;
}

.topicLeft{
	min-width: 0;
}


/* Unread badges */
.badge{
	display:inline-block;
	min-width: 18px;
	padding: 2px 6px;
	border-radius: 999px;
	font-size: 11px;
	line-height: 1.2;
	text-align:center;
	margin-left: 8px;
	background: rgba(255,255,255,0.12);
	border: 1px solid rgba(255,255,255,0.18);
}

/* DM list */
.dmHeader{ margin-top: 10px; }
.dmList{ list-style:none; padding:0; margin:6px 0 0 0; }
.dmItem{
	display:flex;
	justify-content: space-between;
	align-items:center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 10px;
	cursor:pointer;
}
.dmItem:hover{ background: rgba(255,255,255,0.06); }
.dmItem.active{
	outline: 1px solid rgba(88,166,255,0.55);
	background: rgba(88,166,255,0.10);
}
.dmName{ font-weight:650; font-size:13px; }
/* ==========================================================
	Chat input visibility & accessibility fixes
	========================================================== */

.chat input[type="text"],
.chat input[type="search"],
.chat textarea,
.chat select {
	background-color: #1b1e24;
	color: #f2f2f2;

	border: 1px solid #4a4f5c;
	border-radius: 4px;

	padding: 8px 10px;
	font-size: 14px;
	line-height: 1.4;

	box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
	transition:
		border-color 0.15s ease,
		box-shadow 0.15s ease,
		background-color 0.15s ease;
}

/* Placeholder text */
.chat input::placeholder,
.chat textarea::placeholder {
	color: #9aa0ad;
	opacity: 1; /* Firefox */
}

/* Focus state (very important) */
.chat input:focus,
.chat textarea:focus,
.chat select:focus {
	outline: none;

	border-color: #6aa7ff;
	background-color: #20242c;

	box-shadow:
		0 0 0 1px #6aa7ff,
		0 0 0 3px rgba(106,167,255,0.25);
}

/* Disabled / readonly */
.chat input:disabled,
.chat textarea:disabled,
.chat input[readonly],
.chat textarea[readonly] {
	background-color: #14161b;
	color: #7f8591;
	border-color: #2f3340;
	cursor: not-allowed;
}

/* Send button contrast (often overlooked) */
.chat button {
	background-color: #2a2f3a;
	color: #ffffff;
	border: 1px solid #4a4f5c;
	border-radius: 4px;
	padding: 7px 14px;
	cursor: pointer;
}

.chat button:hover {
	background-color: #353b49;
}

.chat button:active {
	background-color: #3f4656;
}


/* ==========================================================
	Visibility: inputs, selects, textareas (lighter theme)
	========================================================== */

.chat input[type="text"],
.chat input[type="search"],
.chat textarea,
.chat select {
	background-color: #3a4352;
	color: #ffffff;
	border: 1px solid rgba(255,255,255,0.30);
	border-radius: 6px;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.4;
}

.chat input::placeholder,
.chat textarea::placeholder {
	color: rgba(255,255,255,0.70);
	opacity: 1;
}

.chat input:focus,
.chat textarea:focus,
.chat select:focus {
	outline: none;
	border-color: var(--accent);
	background-color: #434e61;
	box-shadow: 0 0 0 3px rgba(106,167,255,0.25);
}

.chat button,
.chat .btn {
	background-color: #3a4352;
	color: #ffffff;
	border: 1px solid rgba(255,255,255,0.30);
}

.chat button:hover,
.chat .btn:hover {
	background-color: #465268;
}

.chat button:active,
.chat .btn:active {
	background-color: #4f5d77;
}


/* Link styled as button */
.linkBtn{ text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }

/* Preferences layout */
.prefsGrid{
	display:grid;
	grid-template-columns: 1fr;
	gap: 14px;
}
@media (min-width: 860px){
	.prefsGrid{ grid-template-columns: 1fr 1fr; }
}
.prefsCard{
	background: rgba(255,255,255,0.03);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 14px;
}
.prefsCard h2{
	margin: 0 0 10px;
	font-size: 16px;
}
.lbl{
	display:block;
	margin: 8px 0 6px;
	color: var(--muted);
	font-size: 13px;
}
.input{
	width: 100%;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid var(--border);
	background: rgba(0,0,0,0.18);
	color: var(--text);
	outline: none;
}
.input:focus{
	border-color: rgba(106,167,255,0.55);
}
.row{ display:flex; gap: 10px; margin-top: 8px; }
.col{ flex:1; }
.preview{
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px solid rgba(255,255,255,0.10);
}
.mono{
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
	opacity: 0.95;
}

/* --------------------------------------------------
	Help modal (persists until closed)
-------------------------------------------------- */
.modal{
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	z-index: 9999;
}
.modalCard{
	width: min(780px, 100%);
	border: 1px solid var(--border);
	border-radius: 18px;
	background: rgba(20,22,26,0.98);
	box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.modalHead{
	display:flex;
	align-items:center;
	justify-content: space-between;
	padding: 12px 12px 10px;
	border-bottom: 1px solid rgba(255,255,255,0.10);
}
.modalBody{
	padding: 12px;
}

/* /list (channel list) */
.listTable{
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
}
.listTable th,
.listTable td{
	border-bottom: 1px solid rgba(255,255,255,0.10);
	padding: 10px 10px;
	text-align: left;
	font-size: 13px;
	vertical-align: top;
}
.listTable th{
	color: var(--muted);
	font-weight: 650;
}
.listRow{
	cursor: pointer;
}
.listRow:hover{
	background: rgba(106,167,255,0.10);
}
.listRoom{
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}
.listTopic{
	color: var(--muted);
	white-space: normal;
}


/* Debug tables (Preferences) */
.tbl { width:100%; border-collapse: collapse; }
.tbl th, .tbl td { border: 1px solid rgba(0,0,0,.12); padding: 8px 10px; text-align:left; font-size: 13px; }
.tbl th { background: rgba(0,0,0,.04); font-weight: 600; }


/* Preferences: Visibility greyed (still editable) */
.visInactive{
	opacity: 0.55;
}
