:root[data-theme="light"] {
	--bg: #f5f7fb;
	--bg-alt: #eef2f9;
	--card: #ffffff;
	--text: #0f1728;
	--muted: #5b6478;
	--accent: #2563eb;
	--danger: #dc2626;
	--warn: #f59e0b;
	--ok: #16a34a;
	--border: #e5e7ef;
	--bg-grad-1: #ffffff;
	--bg-grad-2: #f0f4ff;
	--flash-fill: #fff3d1; /* soft amber fill */
	--flash-shadow: rgba(245, 158, 11, 0.45);
}
:root[data-theme="dark"] {
	--bg: #0f1115;
	--bg-alt: #131722;
	--card: #171b26;
	--text: #e8eef8;
	--muted: #a9b3c7;
	--accent: #7aa2ff;
	--danger: #ff6b6b;
	--warn: #ffd166;
	--ok: #3bd671;
	--border: #23293a;
	--bg-grad-1: #151a27;
	--bg-grad-2: #0e1118;
	--flash-fill: #2a2415; /* dim amber for dark */
	--flash-shadow: rgba(255, 209, 102, 0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
	margin: 0;
	background: radial-gradient(1200px 800px at 30% -10%, var(--bg-grad-1), var(--bg-grad-2)) no-repeat, var(--bg);
	color: var(--text);
	font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
}

@font-face {
	font-family: 'Clockicons';
	src: url('https://db.onlinewebfonts.com/t/84cb021d5f9af287ffff84b61beef6dc.woff') format('woff');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

.app-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid var(--border);
	background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7));
	position: sticky;
	top: 0;
	backdrop-filter: blur(6px);
	z-index: 10;
}
:root[data-theme="dark"] .app-header {
	background: linear-gradient(180deg, rgba(19,23,34,0.8), rgba(19,23,34,0.6));
}
.brand {
	font-weight: 800;
	letter-spacing: 0.2px;
}
.room-info {
	color: var(--muted);
}
.controls { display: flex; gap: 8px; }
.presence {
	color: var(--muted);
	font-size: 12px;
	align-self: center;
	margin-right: 6px;
}
.btn {
	background: var(--accent);
	color: #0c1222;
	border: 1px solid transparent;
	padding: 8px 12px;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
}

main {
	max-width: 1200px;
	margin: 20px auto;
	padding: 0 16px;
}

.checkbox-list { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--card);
}
.checkbox-item input { transform: scale(1.1); }
.checkbox-item .hk {
	margin-left: auto;
	color: var(--muted);
	font-size: 12px;
}
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
}

.groups {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 14px;
	padding: 14px;
	-webkit-user-select: none; /* iOS Safari */
	user-select: none;
	-webkit-touch-callout: none; /* Disable long-press callout on iOS */
	position: relative;
	transition: transform .06s ease, border-color .2s ease, box-shadow .2s ease;
	cursor: pointer;
	touch-action: manipulation; /* allow scrolling and taps without delay */
	box-shadow: 0 2px 8px rgba(15, 23, 40, 0.06);
}
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(15, 23, 40, 0.12); }
.card.disabled {
	background: var(--bg-alt);
	border: 1px dashed var(--border);
	filter: none;
	opacity: 1;
	cursor: not-allowed;
}
/* Increase card/background separation per theme */
html[data-theme="light"] .card {
	box-shadow: 0 0 0 1px rgba(15, 23, 40, 0.08), 0 4px 16px rgba(15, 23, 40, 0.10);
}
html[data-theme="light"] .card:hover {
	box-shadow: 0 0 0 1px rgba(15, 23, 40, 0.12), 0 8px 24px rgba(15, 23, 40, 0.18);
}
html[data-theme="dark"] .card {
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 18px rgba(0, 0, 0, 0.6);
}
html[data-theme="dark"] .card:hover {
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10), 0 12px 28px rgba(0, 0, 0, 0.65);
}
/* Make disabled cards clearly distinct in dark mode */
html[data-theme="dark"] .card.disabled {
	background: #0b0f18;
	border: 1px dashed #2a3347;
	filter: grayscale(35%) brightness(0.9);
}
.card .header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.header-right {
	display: flex;
	align-items: center;
	gap: 6px;
}
.name {
	font-weight: 700;
	font-size: 16px;
}
.name.locked { color: var(--muted); }
.name.locked::after { content: ' 🔒'; font-size: 12px; color: var(--muted); }
.name[contenteditable="true"] {
	outline: none;
	border-bottom: 1px dashed var(--border);
}
.hotkey {
	color: var(--muted);
	font-weight: 600;
	font-size: 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 2px 6px;
}
.card.disabled .hotkey { display: none; }
.badges {
	position: absolute;
	top: 8px;
	right: 10px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	z-index: 2;
}
.badge {
	font-size: 12px;
	border: 1px solid var(--border);
	background: var(--bg-alt);
	border-radius: 999px;
	padding: 2px 6px;
}
.badge-audio {
	color: var(--accent);
}
.badge-audio.muted {
	color: var(--muted);
	text-decoration: line-through;
}
.badge-lock {
	color: var(--muted);
}
.time {
	font-family: 'Clockicons', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
	font-variant-numeric: tabular-nums;
	font-size: 50px;
	font-weight: 800;
	letter-spacing: 1px;
	margin: 4px 0 0;
}
.time-row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	margin: 4px 0 6px;
}
.status-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.status {
	font-size: 12px;
	color: var(--muted);
}
.status.running { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.done { color: var(--danger); }
.meta {
	font-size: 12px;
	color: var(--muted);
}

.group { margin: 10px 0; }
.group-title { margin: 6px 2px 12px; font-size: 18px; font-weight: 800; color: var(--muted); letter-spacing: 0.2px; text-align: center; }
.group-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(3, minmax(220px, 1fr));
}
@media (max-width: 1100px) {
	.group-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 700px) {
	.group-grid { grid-template-columns: 1fr; }
}

.app-footer {
	margin: 16px auto 40px;
	max-width: 1200px;
	padding: 0 16px;
	color: var(--muted);
	font-size: 12px;
}

/* Modal */
.modal.hidden { display: none; }
.modal {
	position: fixed;
	inset: 0;
	z-index: 20;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
}
.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(2px);
}
.modal-dialog {
	position: relative;
	margin: 10px auto;
	max-width: 520px;
	width: calc(100% - 32px);
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 16px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.4);
	/* Ensure dialog fits viewport on short screens and scrolls internally */
	max-height: calc(100vh - 20px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	/* Hide scrollbars (while keeping scroll functional) */
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge legacy */
}
.modal-dialog::-webkit-scrollbar { display: none; } /* WebKit */
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

/* Blink effect on warning */
@keyframes blinkFlash {
	0% {
		background-color: var(--card);
		box-shadow: 0 2px 8px rgba(15, 23, 40, 0.06);
	}
	50% {
		background-color: var(--flash-fill);
		box-shadow: 0 0 0 2px var(--warn), 0 8px 22px var(--flash-shadow);
	}
	100% {
		background-color: var(--card);
		box-shadow: 0 2px 8px rgba(15, 23, 40, 0.06);
	}
}
.card.blink {
	animation: blinkFlash 0.3s ease-in-out 0s 2;
}


