/* Reset */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

/* Base */
body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: #f5f5f3;
	color: #1a1a18;
	min-height: 100vh;
}

html.dark body {
	background: #1a1a18;
	color: #e8e6df;
}

/* Autosave bar */
.autosave-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	border-radius: 10px;
	padding: 10px 14px;
	border: 0.5px solid rgba(0, 0, 0, 0.1);
	background: #fff;
	font-size: 12px;
}

html.dark .autosave-bar {
	background: #252522;
	border-color: rgba(255, 255, 255, 0.1);
}

.autosave-bar.state-none {
	border-color: rgba(245, 158, 11, 0.35);
	background: rgba(245, 158, 11, 0.05);
}

.autosave-bar.state-active {
	border-color: rgba(34, 197, 94, 0.3);
	background: rgba(34, 197, 94, 0.05);
}

.autosave-bar.state-perm {
	border-color: rgba(245, 158, 11, 0.35);
	background: rgba(245, 158, 11, 0.05);
}

.autosave-bar.state-fallback {
	border-color: rgba(0, 0, 0, 0.1);
}

html.dark .autosave-bar.state-none {
	background: rgba(245, 158, 11, 0.08);
}

html.dark .autosave-bar.state-active {
	background: rgba(34, 197, 94, 0.07);
}

html.dark .autosave-bar.state-perm {
	background: rgba(245, 158, 11, 0.08);
}

.autosave-icon {
	font-size: 15px;
	flex-shrink: 0;
}

.autosave-text {
	flex: 1;
	min-width: 140px;
	color: #555;
	line-height: 1.4;
}

html.dark .autosave-text {
	color: #aaa;
}

.autosave-text strong {
	color: #1a1a18;
	font-weight: 500;
}

html.dark .autosave-text strong {
	color: #e8e6df;
}

/* Autosave action buttons */
.as-btn {
	padding: 6px 14px;
	border-radius: 7px;
	border: 0.5px solid rgba(0, 0, 0, 0.15);
	background: transparent;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	color: #444;
	white-space: nowrap;
	font-family: inherit;
	transition: all 0.15s;
}

.as-btn:hover {
	background: rgba(37, 99, 235, 0.08);
	color: #2563eb;
	border-color: rgba(37, 99, 235, 0.3);
}

.as-btn.primary {
	background: rgba(37, 99, 235, 0.09);
	color: #2563eb;
	border-color: rgba(37, 99, 235, 0.3);
}

.as-btn.primary:hover {
	background: rgba(37, 99, 235, 0.16);
}

.as-btn.amber {
	background: rgba(245, 158, 11, 0.1);
	color: #b45309;
	border-color: rgba(245, 158, 11, 0.35);
}

.as-btn.amber:hover {
	background: rgba(245, 158, 11, 0.18);
}

html.dark .as-btn {
	color: #aaa;
	border-color: rgba(255, 255, 255, 0.15);
}

html.dark .as-btn.primary {
	color: #60a5fa;
	background: rgba(96, 165, 250, 0.12);
	border-color: rgba(96, 165, 250, 0.3);
}

html.dark .as-btn.amber {
	color: #fbbf24;
	background: rgba(251, 191, 36, 0.1);
	border-color: rgba(251, 191, 36, 0.3);
}

/* Flash notification */
.as-flash {
	font-size: 11px;
	color: #16a34a;
	opacity: 0;
	transition: opacity 0.4s;
	white-space: nowrap;
}

.as-flash.show {
	opacity: 1;
}

/* ── Quick navigation bar ───────────────────────────────────────────────────── */

.quick-nav {
	position: sticky;
	top: 0;
	z-index: 50;
	background: #f5f5f3;
	border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
	display: flex;
	justify-content: center;
	gap: 4px;
	padding: 6px 16px;
	margin-bottom: 18px;
}

html.dark .quick-nav {
	background: #1a1a18;
	border-bottom-color: rgba(255, 255, 255, 0.1);
}

.quick-nav-link {
	padding: 5px 16px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	color: #555;
	text-decoration: none;
	transition:
		background 0.12s,
		color 0.12s;
}

.quick-nav-link:hover {
	background: rgba(37, 99, 235, 0.08);
	color: #2563eb;
}

.quick-nav-link.active {
	background: rgba(37, 99, 235, 0.1);
	color: #2563eb;
}

html.dark .quick-nav-link {
	color: #aaa;
}

html.dark .quick-nav-link:hover,
html.dark .quick-nav-link.active {
	background: rgba(37, 99, 235, 0.18);
	color: #60a5fa;
}

/* ── Page footer ────────────────────────────────────────────────────────────── */

footer {
	border-top: 0.5px solid rgba(0, 0, 0, 0.1);
	margin-top: 48px;
	padding: 20px;
	font-size: 11px;
	color: #888;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	text-align: center;
}

html.dark footer {
	border-color: rgba(255, 255, 255, 0.1);
}

footer a {
	color: #2563eb;
	text-decoration: none;
}

html.dark footer a {
	color: #60a5fa;
}

.footer-sep {
	opacity: 0.4;
}

/* ── Pomodoro timer widget ──────────────────────────────────────────────────── */

#pomo-host {
	position: fixed;
	top: 58px;
	right: 16px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#pomo-pill {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px 4px 5px;
	border-radius: 999px;
	border: 1.5px solid rgba(0, 0, 0, 0.1);
	background: #fff;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	color: #1a1a18;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
	transition:
		border-color 0.25s,
		box-shadow 0.2s;
	font-family: inherit;
}

#pomo-pill:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#pomo-host[data-dark='1'] #pomo-pill {
	background: #252522;
	border-color: rgba(255, 255, 255, 0.1);
	color: #e8e6df;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#pomo-pill-time {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.3px;
}

#pomo-panel {
	background: #fff;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	border-radius: 14px;
	padding: 18px 16px 14px;
	min-width: 182px;
	text-align: center;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	position: relative;
}

#pomo-host[data-dark='1'] #pomo-panel {
	background: #252522;
	border-color: rgba(255, 255, 255, 0.1);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#pomo-close {
	position: absolute;
	top: 8px;
	right: 10px;
	background: none;
	border: none;
	font-size: 18px;
	line-height: 1;
	padding: 0 2px;
	cursor: pointer;
	color: #aaa;
	font-family: inherit;
}

#pomo-close:hover {
	color: #555;
}

#pomo-host[data-dark='1'] #pomo-close:hover {
	color: #e8e6df;
}

#pomo-phase {
	font-size: 12px;
	font-weight: 500;
	color: #888;
	margin-bottom: 6px;
	letter-spacing: 0.3px;
}

#pomo-host[data-dark='1'] #pomo-phase {
	color: #7a7872;
}

#pomo-time {
	font-size: 34px;
	font-weight: 600;
	letter-spacing: -1px;
	line-height: 1;
	margin-bottom: 10px;
	font-variant-numeric: tabular-nums;
}

#pomo-dots {
	display: flex;
	gap: 7px;
	justify-content: center;
	margin-bottom: 14px;
}

.pomo-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.1);
	transition: background 0.3s;
}

#pomo-host[data-dark='1'] .pomo-dot {
	background: rgba(255, 255, 255, 0.12);
}

#pomo-btns {
	display: flex;
	gap: 5px;
}

#pomo-btns button {
	padding: 6px 10px;
	border-radius: 8px;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	background: transparent;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	color: #444;
	font-family: inherit;
	transition:
		background 0.15s,
		color 0.15s;
}

#pomo-btns button:hover {
	background: rgba(37, 99, 235, 0.08);
	color: #2563eb;
	border-color: rgba(37, 99, 235, 0.3);
}

#pomo-host[data-dark='1'] #pomo-btns button {
	color: #aaa;
	border-color: rgba(255, 255, 255, 0.12);
}

#pomo-host[data-dark='1'] #pomo-btns button:hover {
	background: rgba(96, 165, 250, 0.1);
	color: #60a5fa;
	border-color: rgba(96, 165, 250, 0.3);
}

#pomo-start {
	flex: 1;
}

#pomo-settings-toggle {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 4px 8px;
	border-radius: 6px;
	border: 0.5px solid rgba(0, 0, 0, 0.1);
	background: transparent;
	cursor: pointer;
	font-size: 11px;
	color: #888;
	font-family: inherit;
	text-align: center;
	transition:
		background 0.15s,
		color 0.15s;
}

#pomo-settings-toggle:hover {
	background: rgba(0, 0, 0, 0.05);
	color: #555;
}

#pomo-host[data-dark='1'] #pomo-settings-toggle {
	border-color: rgba(255, 255, 255, 0.1);
	color: #666;
}

#pomo-host[data-dark='1'] #pomo-settings-toggle:hover {
	background: rgba(255, 255, 255, 0.05);
	color: #999;
}

#pomo-settings {
	margin-top: 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.pomo-set-row {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: #666;
	cursor: default;
}

.pomo-set-row span:first-child {
	flex: 1;
}

.pomo-set-row input {
	width: 38px;
	padding: 2px 4px;
	border-radius: 4px;
	border: 0.5px solid rgba(0, 0, 0, 0.2);
	background: transparent;
	font-size: 11px;
	font-family: inherit;
	color: inherit;
	text-align: center;
}

#pomo-host[data-dark='1'] .pomo-set-row {
	color: #999;
}

#pomo-host[data-dark='1'] .pomo-set-row input {
	border-color: rgba(255, 255, 255, 0.15);
	color: #ccc;
}

/* ── Keyboard shortcut help overlay ─────────────────────────────────────────── */

#kbd-help {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.48);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}

#kbd-help-box {
	background: #fff;
	border-radius: 14px;
	padding: 22px 24px 18px;
	min-width: 280px;
	max-width: 360px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

html.dark #kbd-help-box {
	background: #252522;
}

#kbd-help-box h3 {
	margin: 0 0 14px;
	font-size: 14px;
	font-weight: 600;
	color: #1a1a18;
}

html.dark #kbd-help-box h3 {
	color: #e8e6df;
}

.kbd-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
	font-size: 13px;
	color: #555;
}

html.dark .kbd-row {
	color: #aaa;
}

.kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 22px;
	padding: 0 6px;
	border-radius: 5px;
	border: 1px solid rgba(0, 0, 0, 0.18);
	background: #f5f5f3;
	font-size: 11px;
	font-weight: 600;
	color: #333;
	flex-shrink: 0;
	font-family: inherit;
	white-space: nowrap;
}

html.dark .kbd {
	background: #1a1a18;
	border-color: rgba(255, 255, 255, 0.2);
	color: #e8e6df;
}

#kbd-help-close {
	margin-top: 14px;
	width: 100%;
	padding: 8px;
	border-radius: 8px;
	border: 0.5px solid rgba(0, 0, 0, 0.12);
	background: transparent;
	cursor: pointer;
	font-size: 13px;
	color: #555;
	font-family: inherit;
}

html.dark #kbd-help-close {
	color: #aaa;
	border-color: rgba(255, 255, 255, 0.12);
}

#kbd-help-close:hover {
	background: rgba(0, 0, 0, 0.04);
}

html.dark #kbd-help-close:hover {
	background: rgba(255, 255, 255, 0.05);
}
