:root{
	--bg: #ffffff;
	--bg-elev: #f6f7f9;
	--text: #111827;
	--muted: #6b7280;
	--primary: #2563eb;
	--primary-contrast: #ffffff;
	--card: #ffffff;
	--border: #e5e7eb;
	--shadow: 0 8px 24px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark){
	:root[data-theme="auto"]{
		--bg: #0b1017;
		--bg-elev: #0f1621;
		--text: #e5e7eb;
		--muted: #9ca3af;
		--primary: #60a5fa;
		--primary-contrast: #0b1017;
		--card: #0f1621;
		--border: #1f2937;
		--shadow: 0 8px 24px rgba(0,0,0,0.4);
	}
}

:root[data-theme="dark"]{
	--bg: #0b1017;
	--bg-elev: #0f1621;
	--text: #e5e7eb;
	--muted: #9ca3af;
	--primary: #60a5fa;
	--primary-contrast: #0b1017;
	--card: #0f1621;
	--border: #1f2937;
	--shadow: 0 8px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif; background: var(--bg); color: var(--text); }

#app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--bg);
	backdrop-filter: saturate(180%) blur(6px);
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
}
.topbar .title { margin: 0; font-size: 18px; font-weight: 600; margin-right: auto; }

.content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 12px 12px 98px;
	max-width: 820px;
	width: 100%;
	margin: 0 auto;
}

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; gap: 10px; }
.sublist { list-style: disc; margin: 6px 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.example { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tag { display: inline-block; background: var(--bg-elev); border: 1px solid var(--border); padding: 2px 6px; border-radius: 10px; margin-right: 6px; }

.btn {
	appearance: none;
	border: none;
	border-radius: 12px;
	padding: 10px 14px;
	line-height: 1.2;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.btn.primary { background: var(--primary); color: var(--primary-contrast); }
.btn.subtle { background: var(--bg-elev); color: var(--text); border: 1px solid var(--border); }
.btn.icon { background: transparent; border: 1px solid var(--border); padding: 8px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
a.btn { text-decoration: none; color: inherit; }

.bottombar {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	background: var(--bg);
	border-top: 1px solid var(--border);
	display: flex;
	justify-content: space-around;
	padding: 8px 8px 10px;
	gap: 8px;
}
.bottombar .tab {
	flex: 1;
	text-decoration: none;
	color: var(--text);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px;
	border-radius: 12px;
	border: 1px solid transparent;
}
.bottombar .tab.active { background: var(--bg-elev); border-color: var(--border); }
.bottombar .tab span { font-size: 12px; }

.pin-row { display: flex; gap: 8px; }
.pin-input { flex: 1; font-size: 20px; letter-spacing: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-elev); }
.pin-row .btn { order: 2; }

.gate { display: flex; flex-direction: column; gap: 16px; min-height: 100dvh; align-items: center; justify-content: center; padding: 24px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand .icon { font-size: 44px; }
.brand h1 { margin: 0; font-size: 22px; }
.human-check { margin-top: 8px; }
.foot-note { color: var(--muted); font-size: 12px; margin-top: 8px; text-align: center; }

#hold-verify { position: relative; overflow: hidden; }
#hold-verify .progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--primary); opacity: .2; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-elev); border: 1px solid var(--border); padding: 10px 12px; border-radius: 999px; color: var(--text); text-decoration: none; }
.quick-nav { display: flex; gap: 8px; flex-wrap: wrap; }

.link-item { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.link-item .actions { display: flex; gap: 8px; flex-wrap: wrap; align-self: flex-end; }
.link-item:last-child { border-bottom: none; }

@media (min-width: 720px){
	.content { max-width: 820px; margin: 0 auto; }
	.bottombar { max-width: 820px; margin: 8px auto; border-radius: 14px; box-shadow: var(--shadow); }
	.link-item { flex-direction: row; align-items: center; gap: 12px; }
	.link-item .actions { margin-left: auto; justify-content: flex-end; }
}

/* Smooth, clean "hold to unlock" button styling */
#hold-unlock {
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 3rem;
	font-weight: 600;
	user-select: none;
}
#hold-unlock .progress {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, rgba(0,150,255,0.4), rgba(0,150,255,0.8));
	transition: width 0.03s linear;
	z-index: 0;
	pointer-events: none;
}
#hold-unlock .label {
	position: relative;
	z-index: 1;
	pointer-events: none;
	color: inherit;
	white-space: nowrap;
	text-align: center;
	width: 100%;
}

/* Multi-digit PIN layout */
.pin-boxes {
	display: flex;
	justify-content: center;
	gap: 0.6rem;
	margin-bottom: 1rem;
}
.pin-boxes .pin-digit {
	width: 2.75rem;
	height: 3.25rem;
	text-align: center;
	font-size: 1.5rem;
	font-weight: 500;
	color: var(--text);
	background: var(--card);
	border: 2px solid var(--border);
	border-radius: 0.6rem;
	box-shadow: var(--shadow);
	transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.1s ease;
}
.pin-boxes .pin-digit:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
	outline: none;
	transform: scale(1.05);
}
.pin-boxes .pin-digit::placeholder { color: var(--muted); }

/* Shake animation */
@keyframes shake {
	0% { transform: translateX(0); }
	20% { transform: translateX(-8px); }
	40% { transform: translateX(8px); }
	60% { transform: translateX(-8px); }
	80% { transform: translateX(8px); }
	100% { transform: translateX(0); }
}
.shake { animation: shake 0.4s ease-in-out; }

/* Smooth light/dark adaptation */
:root,
:root[data-theme="auto"],
:root[data-theme="dark"] {
	--pin-box-bg: var(--card);
	--pin-box-border: var(--border);
	--pin-box-shadow: var(--shadow);
}

/* Optional: match input placeholder tone */
.pin-digit::placeholder { color: var(--muted); }

/* ===== MOBILE SCALING ===== */
/* Mobile-specific adjustments for larger buttons */
@media (max-width: 720px) {
    /* General buttons */
    .btn {
        padding: 16px 20px;
        font-size: 1.25rem;
        border-radius: 18px;
    }

    /* Hold-to-unlock button */
    #hold-unlock {
        height: 4.5rem;
        font-size: 1.25rem;
        border-radius: 18px;
    }

    /* PIN boxes larger */
    .pin-boxes .pin-digit {
        width: 3.5rem;
        height: 4rem;
        font-size: 1.85rem;
    }

    /* Bottom navigation tabs larger */
    .bottombar .tab {
        padding: 14px;
    }
    .bottombar .tab span {
        font-size: 15px;
    }

    /* Cards and content spacing slightly larger */
    .content {
        padding: 18px 16px 120px;
        gap: 18px;
    }
    .card {
        padding: 18px;
    }
    .chip {
        padding: 14px 16px;
        font-size: 1.05rem;
    }
}
