* {
	box-sizing: border-box;
}
body {
	font-family: -apple-system, BlinkMacSystemFont, sans-serif;
	background: #0c0c0e;
	color: #eee;
	margin: 0 auto;
	padding: 20px;
	max-width: 480px;
	-webkit-tap-highlight-color: transparent;
}
h1 {
	font-size: 20px;
	color: #00ff96;
	margin: 0 0 4px;
}
.sub {
	color: #777;
	font-size: 12px;
	margin: 0 0 18px;
}

/* Connection bar */
.connect-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
	padding: 12px 14px;
	border-radius: 12px;
	background: #17171b;
	border: 1px solid #2a2a2e;
}
.dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #555;
	flex: none;
}
.dot.on {
	background: #00ff96;
	box-shadow: 0 0 8px #00ff96;
}
.dot.err {
	background: #ff4d4d;
	box-shadow: 0 0 8px #ff4d4d;
}
.connect-label {
	flex: 1;
	font-size: 13px;
	color: #aaa;
}
#connectBtn {
	padding: 10px 16px;
	font-size: 14px;
	border: none;
	border-radius: 8px;
	background: #00ff96;
	color: #06110b;
	font-weight: bold;
	cursor: pointer;
}
#connectBtn:disabled {
	background: #2a2a2e;
	color: #666;
}

.disabled-area {
	opacity: 0.35;
	pointer-events: none;
	transition: opacity 0.2s;
}

/* Mode tabs */
.mode-tabs {
	display: flex;
	gap: 0;
	margin-bottom: 18px;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid #2a2a2e;
}
.tab {
	flex: 1;
	padding: 10px 0;
	font-size: 14px;
	border: none;
	background: #1a1a1e;
	color: #888;
	cursor: pointer;
	transition: all 0.2s;
	font-weight: 500;
}
.tab:hover {
	color: #bbb;
}
.tab.active {
	background: #00ff96;
	color: #06110b;
	font-weight: bold;
}

/* Panels */
.panel {
	display: none;
}
.panel.active {
	display: block;
}

/* Preview */
.preview {
	background: #000;
	border: 1px solid #2a2a2e;
	border-radius: 12px;
	height: 84px;
	margin-bottom: 22px;
	display: flex;
	align-items: center;
	overflow: hidden;
	padding: 0 14px;
}
.preview span {
	font-weight: 700;
	font-size: 40px;
	letter-spacing: 2px;
	white-space: nowrap;
	font-family: "Courier New", monospace;
	color: #00ff96;
	text-shadow: 0 0 10px currentColor;
}

/* Controls */
label {
	display: block;
	margin: 16px 0 6px;
	font-size: 13px;
	color: #9a9a9a;
}
input[type="text"] {
	width: 100%;
	padding: 13px;
	font-size: 18px;
	border-radius: 10px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #fff;
}
textarea {
	width: 100%;
	padding: 13px;
	font-size: 15px;
	border-radius: 10px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #fff;
	font-family: "Courier New", monospace;
	resize: vertical;
}
.btn-primary {
	padding: 12px;
	font-size: 14px;
	border: none;
	border-radius: 10px;
	background: #00ff96;
	color: #06110b;
	font-weight: bold;
	cursor: pointer;
	transition: opacity 0.15s;
}
.btn-primary:hover {
	opacity: 0.85;
}
input[type="range"] {
	width: 100%;
	height: 34px;
	accent-color: #00ff96;
}
input[type="color"] {
	width: 52px;
	height: 44px;
	padding: 0;
	border: 1px solid #3a3a3e;
	border-radius: 10px;
	background: #1a1a1e;
	vertical-align: middle;
}
.val {
	color: #00ff96;
	font-weight: bold;
}

/* Swatches */
.swatches {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
.sw {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 2px solid #2a2a2e;
	cursor: pointer;
	transition:
		transform 0.15s,
		border-color 0.15s;
}
.sw:hover {
	transform: scale(1.15);
	border-color: #555;
}

/* Presets */
.presets {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 8px;
}
.chip {
	padding: 8px 12px;
	font-size: 14px;
	border-radius: 20px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #ddd;
	cursor: pointer;
	transition: all 0.15s;
}
.chip:hover {
	border-color: #00ff96;
	color: #00ff96;
}

/* Option buttons */
.option-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: 6px;
}
.option-btn {
	padding: 8px 14px;
	font-size: 13px;
	border-radius: 8px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #aaa;
	cursor: pointer;
	transition: all 0.15s;
}
.option-btn:hover {
	border-color: #00ff96;
	color: #00ff96;
}
.option-btn.active {
	background: rgba(0, 255, 150, 0.1);
	color: #00ff96;
	border-color: #00ff96;
}

/* Timezone row */
.tz-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 6px;
}
.tz-row button {
	width: 36px;
	height: 36px;
	font-size: 18px;
	border: 1px solid #3a3a3e;
	border-radius: 8px;
	background: #1a1a1e;
	color: #00ff96;
	cursor: pointer;
	font-weight: bold;
	transition: all 0.15s;
}
.tz-row button:hover {
	background: #00ff961a;
	border-color: #00ff96;
}
.tz-label {
	font-size: 15px;
	color: #ccc;
	min-width: 100px;
	text-align: center;
}

/* Alarm list */
.alarm-list {
	margin: 10px 0;
	max-height: 220px;
	overflow-y: auto;
}
.alarm-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	margin-bottom: 6px;
	background: #1a1a1e;
	border-radius: 8px;
	border: 1px solid #2a2a2e;
}
.alarm-item .time {
	font-family: "Courier New", monospace;
	font-size: 16px;
	color: #00ff96;
	min-width: 52px;
}
.alarm-item .msg {
	flex: 1;
	font-size: 14px;
	color: #ccc;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.alarm-item .toggle,
.alarm-item .del {
	background: none;
	border: none;
	color: #888;
	cursor: pointer;
	font-size: 16px;
	padding: 4px;
	transition: color 0.15s;
}
.alarm-item .toggle:hover {
	color: #00ff96;
}
.alarm-item .del:hover {
	color: #ff4d4d;
}
.alarm-item.off {
	opacity: 0.45;
}
.alarm-item.off .time {
	color: #555;
}

.alarm-add {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	align-items: center;
}
.alarm-add input[type="time"] {
	padding: 8px 10px;
	font-size: 14px;
	border-radius: 8px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #fff;
}
.alarm-add input[type="text"] {
	flex: 1;
	padding: 8px 10px;
	font-size: 14px;
	border-radius: 8px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #fff;
}
.alarm-add button {
	padding: 8px 14px;
	font-size: 14px;
	border: none;
	border-radius: 8px;
	background: #00ff96;
	color: #06110b;
	font-weight: bold;
	cursor: pointer;
	transition: opacity 0.15s;
}
.alarm-add button:hover {
	opacity: 0.85;
}
.alarm-empty {
	color: #555;
	font-size: 13px;
	padding: 8px 0;
}

/* Rows */
.row {
	display: flex;
	gap: 10px;
	margin-top: 24px;
}
button.clear {
	flex: 1;
	padding: 14px;
	font-size: 16px;
	border: none;
	border-radius: 10px;
	font-weight: bold;
	cursor: pointer;
	background: #3a2626;
	color: #ff9c9c;
	transition: opacity 0.15s;
}
button.clear:hover {
	opacity: 0.85;
}
fieldset {
	margin: 0;
	padding: 0;
	border: none;
	min-inline-size: auto;
}
legend {
	display: block;
	margin: 16px 0 6px;
	font-size: 13px;
	color: #9a9a9a;
	padding: 0;
}

.note {
	margin-top: 22px;
	font-size: 12px;
	color: #666;
	line-height: 1.6;
}
.note b {
	color: #999;
}

/* Bitmap editor */
.bmp-tabs {
	display: flex;
	gap: 4px;
	margin-top: 10px;
	flex-wrap: wrap;
}
.bmp-tab {
	padding: 6px 10px;
	font-size: 12px;
	border-radius: 6px;
	border: 1px solid #3a3a3e;
	background: #1a1a1e;
	color: #aaa;
	cursor: pointer;
}
.bmp-tab.active {
	background: rgba(0, 255, 150, 0.15);
	color: #00ff96;
	border-color: #00ff96;
}
.bmp-tab.add {
	color: #00ff96;
}
.bmp-grid {
	display: grid;
	grid-template-columns: repeat(32, 1fr);
	gap: 1px;
	background: #2a2a2e;
	padding: 2px;
	border-radius: 6px;
	margin-top: 10px;
	user-select: none;
	touch-action: none;
	aspect-ratio: 32 / 8;
}
.bmp-cell {
	background: #000;
	cursor: pointer;
	border-radius: 1px;
}
.bmp-palette {
	display: flex;
	gap: 6px;
	margin-top: 10px;
	flex-wrap: wrap;
	align-items: center;
}
.bmp-pal {
	position: relative;
	width: 34px;
	height: 34px;
	border-radius: 6px;
	border: 2px solid #2a2a2e;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.bmp-pal.active {
	border-color: #00ff96;
	box-shadow: 0 0 6px #00ff96;
}
.bmp-pal input[type="color"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
	padding: 0;
	border: none;
}
.bmp-pal .off {
	color: #666;
	font-size: 20px;
}
.bmp-actions {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}
.bmp-actions button {
	flex: 1;
	padding: 10px;
	font-size: 13px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
}
.bmp-actions .send {
	background: #00ff96;
	color: #06110b;
	font-weight: bold;
}
.bmp-actions .clear {
	background: #2a2a2e;
	color: #aaa;
}
.bmp-actions .del {
	background: #3a2626;
	color: #ff9c9c;
}
