:root {
	--bg1: #0f1020;

	--bg2: #1b1130;

	--glow: #ffdc7b;

	--ink: #ede8ff;

	--accent: #f6b14a;

	--accent-2: #c769f2;

	--muted: #c9c3dd;
	--good: #8ee59c;
	--bad: #ff8b7a;

	--mandala-size: clamp(240px, 55vw, 420px);

	--ring: 10px;

	--dot: 8px;

	--orbit: calc(var(--mandala-size) / 2 - var(--ring) - var(--dot) / 2);
	--safe-top: env(safe-area-inset-top, 0px);
	--safe-right: env(safe-area-inset-right, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--safe-left: env(safe-area-inset-left, 0px);
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	-webkit-user-select: none;

	-ms-user-select: none;

	user-select: none;
	-webkit-touch-callout: none;
	padding: calc(var(--safe-top)) calc(var(--safe-right)) calc(var(--safe-bottom)) calc(var(--safe-left));
}

input,
textarea,
select,
[contenteditable],
.allow-select {
	-webkit-user-select: text;
	-ms-user-select: text;
	user-select: text;
	-webkit-touch-callout: default;
}

body {
	margin: 0;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
	color: var(--ink);
	background: radial-gradient(1200px 800px at 80% -10%, rgba(246, 177, 74, 0.18), transparent 60%), radial-gradient(1000px 700px at 20% 120%, rgba(199, 105, 242, 0.18), transparent 60%),
		linear-gradient(180deg, var(--bg1), var(--bg2));
	display: flex;
	align-items: flex-start;
	justify-content: center;
	min-height: 100dvh;
	overflow: scroll;
}

.wrap {
	width: min(920px, 96vw);
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	padding: 5px;
}

header {
	text-align: center;
}

.title {
	font-size: clamp(1.6rem, 3.5vw, 2.4rem);
	font-weight: 800;
	letter-spacing: 0.4px;
	margin: 4px 0 6px;
	text-shadow: 0 0 24px rgba(255, 220, 123, 0.35);
}

.sub {
	color: var(--muted);
	font-size: 0.98rem;
	margin-bottom: 16px;
}

/* tap area */
#tapArea,
#tapArea * {
	-webkit-user-select: none;
	-ms-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

#tapArea,
.btn {
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

#count {
	-webkit-user-select: none;
	user-select: none;
	pointer-events: none;
}

/* Mandala ring */
.mandala {
	position: relative;
	display: grid;
	place-items: center;
	margin: 6px auto 2px;
	width: var(--mandala-size);
	aspect-ratio: 1/1;
	border-radius: 50%;
	background: radial-gradient(circle at 50% 40%, rgba(255, 220, 123, 0.14), rgba(255, 220, 123, 0) 60%), radial-gradient(circle at 50% 60%, rgba(199, 105, 242, 0.14), rgba(199, 105, 242, 0) 62%);
	box-shadow: inset 0 0 80px rgba(255, 220, 123, 0.08), 0 0 0 2px rgba(255, 255, 255, 0.06), 0 10px 60px rgba(0, 0, 0, 0.45);
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: transform 0.08s ease;
	overflow: hidden;
}

.mandala:active {
	transform: scale(0.995);
}

.count {
	font-variant-numeric: tabular-nums;
	font-size: clamp(2.4rem, 8vw, 4rem);
	font-weight: 900;
	text-shadow: 0 0 20px rgba(255, 220, 123, 0.35);
}

/* Bead ring (presentation only) */
.beads {
	position: absolute;
	inset: var(--ring);
	border-radius: 50%;
	pointer-events: none;
}

.beads i {
	position: absolute;
	left: 50%;
	top: 50%;
	width: var(--dot);
	height: var(--dot);
	margin: calc(var(--dot) / -2);
	border-radius: 50%;
	background: radial-gradient(circle at 30% 30%, #fff7, #0000 70%), radial-gradient(circle at 65% 70%, rgba(246, 177, 74, 0.85), rgba(246, 177, 74, 0.1));
	box-shadow: 0 0 8px rgba(246, 177, 74, 0.45);
	opacity: 0.52;
	filter: saturate(0.9);
}

.beads i.on {
	opacity: 1;
}

.panel {
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr;
	margin-top: 8px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	padding: 14px;
	backdrop-filter: blur(6px);
}

.row {
	display: grid;
	gap: 10px;
	align-items: center;
	margin-bottom: 10px;
}

.row[aria-label="Quick actions"] {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row[aria-label="Quick actions"] .btn:nth-child(3) {
	grid-column: 1 / -1;
}

.row[aria-label="Manual entry"],
.row[aria-label="Mantra name"] {
	grid-template-columns: 1fr;
}

.row[aria-label="Reset"] .btn {
	width: 100%;
}

.row input[type="number"],
.row input[type="text"] {
	width: 100%;
	min-width: 0;
	height: 44px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--ink);
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 12px;
	padding: 12px 14px;
}

input::placeholder {
	color: #cfc9eeaa;
}

.btn {
	appearance: none;
	border: none;
	cursor: pointer;
	width: 100%;
	min-height: 44px;
	padding: 12px 16px;
	border-radius: 12px;
	background: linear-gradient(180deg, rgba(246, 177, 74, 0.9), rgba(246, 177, 74, 0.75));
	color: #2e1300;
	font-size: 0.98rem;
	font-weight: 800;
	letter-spacing: 0.25px;
	box-shadow: 0 6px 18px rgba(246, 177, 74, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.45);
	transition: transform 0.08s ease, box-shadow 0.2s ease;
}

.btn:hover {
	box-shadow: 0 10px 24px rgba(246, 177, 74, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.btn:active {
	transform: translateY(1px) scale(0.99);
}

.btn.secondary {
	background: linear-gradient(180deg, rgba(199, 105, 242, 0.85), rgba(199, 105, 242, 0.7));
	color: #1b0a26;
	box-shadow: 0 6px 18px rgba(199, 105, 242, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.btn.ghost {
	background: rgba(255, 255, 255, 0.06);
	color: var(--ink);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.btn.bad {
	background: linear-gradient(180deg, rgba(255, 139, 122, 0.9), rgba(255, 139, 122, 0.75));
	color: #2a0a06;
	box-shadow: 0 6px 18px rgba(255, 139, 122, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.btn:focus-visible {
	outline: 2px solid rgba(246, 177, 74, 0.9);
	outline-offset: 2px;
}

@media (min-width: 420px) {
	.row[aria-label="Manual entry"],
	.row[aria-label="Mantra name"] {
		grid-template-columns: 1fr auto;
	}

	.row[aria-label="Manual entry"] .btn,
	.row[aria-label="Mantra name"] .btn {
		width: auto;
		min-width: 120px;
		justify-self: end;
	}
}

@media (min-width: 520px) {
	.row[aria-label="Quick actions"] {
		grid-template-columns: repeat(3, 1fr);
	}

	.row[aria-label="Quick actions"] .btn:nth-child(3) {
		grid-column: auto;
	}
}

@media (min-width: 1024px) {
	.btn {
		min-height: 48px;
		font-size: 1rem;
	}
}

/* ---- Tabs (minimal, won't affect your existing UI) ---- */
.tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 12px;
	padding: 6px;
}

.tab {
	appearance: none;
	border: none;
	cursor: pointer;
	padding: 10px 12px;
	border-radius: 10px;
	font-weight: 800;
	background: transparent;
	color: var(--ink);
}

.tab.is-active {
	background: linear-gradient(180deg, rgba(246, 177, 74, 0.9), rgba(246, 177, 74, 0.75));
	color: #2e1300;
	box-shadow: 0 6px 18px rgba(246, 177, 74, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.tabpanel[hidden] {
	display: none;
}

.hide {
	display: none;
}

footer {
	text-align: center;
	margin-top: 12px; /* a bit more breathing room */
	color: var(--muted);
	font-size: 0.85rem;
}

.footer-links {
	display: inline-flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 6px;
}

footer a {
	color: var(--glow);
	text-decoration: none;
}
footer a:hover {
	text-decoration: underline;
}

.footer-note {
	opacity: 0.9;
}
/* Compact floating "Install" pill on phones */

#installAppBtn.install-fab {
	position: fixed;
	right: calc(12px + var(--safe-area-inset-right, 0px));
	bottom: calc(12px + var(--safe-area-inset-bottom, 0px));
	z-index: 1000;

	width: auto;
	min-width: 0;
	padding: 10px 14px;
	font-size: 0.9rem;
	line-height: 1;
	border-radius: 999px;

	background: rgba(255, 255, 255, 0.08);
	color: var(--ink);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
	backdrop-filter: blur(8px);
}

#a2hsClose {
	margin-top: 15px;
}
