/* LinkAdd mobile app UI. The card itself is styled by card.css. */

:root {
	--a-bg: #f2f3f8;
	--a-surface: #ffffff;
	--a-ink: #141a33;
	--a-muted: #5f6585;
	--a-line: #dfe2ec;
	--a-field: #ffffff;
	--a-accent: #3346d3;
	--a-accent-ink: #ffffff;
	--a-soft: #e8ebfb;
	--a-danger: #c4314b;
	--a-ok: #1d7a4f;
	--a-band: #121735;
	--a-font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--a-bg: #0c1027;
		--a-surface: #161c3b;
		--a-ink: #e9ebff;
		--a-muted: #a1a8d2;
		--a-line: #2a3263;
		--a-field: #10152f;
		--a-accent: #9aabff;
		--a-accent-ink: #10153a;
		--a-soft: #1f2752;
		--a-danger: #ff7d94;
		--a-ok: #6fd6a4;
		--a-band: #070a1c;
		color-scheme: dark;
	}
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.app {
	margin: 0;
	background: var(--a-bg);
	color: var(--a-ink);
	font: 400 16px/1.45 var(--a-font);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
	min-height: 100vh;
	min-height: 100dvh;
}
body.noscroll { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
.ic { width: 22px; height: 22px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }
.loading { padding: 40vh 24px 0; text-align: center; color: var(--a-muted); }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 0 16px;
	border: 0; border-radius: 13px;
	background: var(--a-surface); color: var(--a-ink);
	box-shadow: inset 0 0 0 1px var(--a-line);
	font-weight: 600; font-size: 15px;
	text-decoration: none; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--a-accent); color: var(--a-accent-ink); box-shadow: none; }
.btn.big { width: 100%; min-height: 56px; font-size: 17px; }
.btn.small { min-height: 40px; font-size: 14px; padding: 0 14px; }
.btn.dashed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--a-line); border: 0; outline-offset: 2px; background-image: none; }
.btn.danger { color: var(--a-danger); }
.btn.danger-solid { background: var(--a-danger); color: #fff; box-shadow: none; }
.linkbtn { background: none; border: 0; color: var(--a-accent); font-weight: 600; padding: 10px 4px; cursor: pointer; }
.iconbtn {
	width: 38px; height: 38px; display: grid; place-items: center;
	border: 0; border-radius: 10px; background: transparent; color: var(--a-muted); cursor: pointer;
}
.iconbtn .ic { width: 20px; height: 20px; }
.iconbtn:disabled { opacity: .3; cursor: default; }
.iconbtn.on { color: #e0a100; }
.iconbtn.danger:hover { color: var(--a-danger); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

:focus-visible { outline: 3px solid var(--a-accent); outline-offset: 2px; }

/* ---------- Fields ---------- */
.f { display: block; margin: 0 0 12px; }
.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--a-muted); margin: 0 0 5px 2px; }
.f input, .f textarea, .lk input, .slug input {
	width: 100%;
	min-height: 50px;
	padding: 12px 14px;
	border: 0; border-radius: 12px;
	background: var(--a-field);
	box-shadow: inset 0 0 0 1px var(--a-line);
	font-size: 16px; /* stops iOS zooming in */
	outline: none;
	-webkit-appearance: none; appearance: none;
}
.f textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.f input:focus, .f textarea:focus, .lk input:focus, .slug input:focus { box-shadow: inset 0 0 0 2px var(--a-accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.group { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.group legend { padding: 0; margin: 0 0 10px 2px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.note { color: var(--a-muted); font-size: 14px; margin: 6px 2px 12px; }
.lead { color: var(--a-muted); margin: 0 2px 16px; }
.form-err { color: var(--a-danger); font-size: 14px; min-height: 0; margin: 0 2px 12px; }
.form-err:empty { display: none; }
.form-ok { color: var(--a-ok); font-size: 14px; margin: 0 2px 12px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--a-band); }
.auth__hero { padding: calc(36px + env(safe-area-inset-top)) 24px 28px; color: #eef0ff; max-width: 480px; width: 100%; margin: 0 auto; }
.auth__deck { width: 72%; max-width: 300px; margin: 18px 0 30px 6px; transform: rotate(-5deg); transform-origin: 50% 50%; animation: la-deal .8s cubic-bezier(.2, .9, .25, 1.05) both; }
@keyframes la-deal { from { transform: translateY(18px) rotate(-14deg); opacity: 0; } to { transform: rotate(-5deg); opacity: 1; } }
.auth h1 { margin: 0; font-size: 40px; line-height: 1; letter-spacing: -.035em; font-weight: 750; font-variation-settings: "opsz" 96; }
.auth__hero p { margin: 10px 0 0; color: #b3bae4; font-size: 17px; max-width: 30ch; }
.auth__panel {
	flex: 1;
	background: var(--a-bg);
	border-radius: 24px 24px 0 0;
	padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
}
.auth__panel > * { max-width: 440px; margin-left: auto; margin-right: auto; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--a-soft); border-radius: 13px; padding: 4px; margin-bottom: 20px; }
.seg button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; color: var(--a-muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--a-surface); color: var(--a-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.auth-form .btn.big { margin-top: 6px; }
.auth-form .linkbtn { display: block; margin: 10px auto 0; }
.auth-note { color: var(--a-muted); margin: 0 2px 14px; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top {
	position: sticky; top: 0; z-index: 3;
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
	background: var(--a-bg);
}
.view--card ~ .top, .shell:has(.view--card) .top { background: var(--a-band); color: #eef0ff; }
.top h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.pill { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; color: var(--a-muted); }
.pill:empty { display: none; }
.pill--saved { color: var(--a-ok); }
.pill--error { color: #fff; background: var(--a-danger); }
.pill--offline { color: #fff; background: #8a6a00; }
.shell:has(.view--card) .pill { color: #b3bae4; }

.view { max-width: 520px; margin: 0 auto; }
.pad { padding: 8px 16px 24px; }

.tabs {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
	display: grid; grid-template-columns: repeat(4, 1fr);
	background: var(--a-surface);
	box-shadow: 0 -1px 0 var(--a-line);
	padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
	display: flex; flex-direction: column; align-items: center; gap: 2px;
	min-height: 54px; border: 0; border-radius: 12px; background: transparent;
	color: var(--a-muted); font-size: 12px; font-weight: 600; cursor: pointer;
}
.tabs button[aria-current="page"] { color: var(--a-accent); }
.tabs button[aria-current="page"] .ic { stroke-width: 2.2; }

/* ---------- Card tab ---------- */
.hero { background: var(--a-band); padding: 6px 20px 30px; border-radius: 0 0 28px 28px; margin-bottom: 18px; }
.hero__card { max-width: 400px; margin: 0 auto; }
.nudge {
	display: block; width: 100%; text-align: left; cursor: pointer;
	border: 0; border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
	background: var(--a-soft); color: var(--a-ink);
}
.nudge b { display: block; font-size: 15px; }
.nudge span { display: block; font-size: 14px; color: var(--a-muted); }
.view--card .btn.primary.big { margin-bottom: 10px; }
.urlrow {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	margin-top: 14px; padding: 14px 16px;
	border-radius: 14px; background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line);
	color: var(--a-ink); text-decoration: none;
}
.urlrow span { min-width: 0; }
.urlrow small { display: block; color: var(--a-muted); font-size: 13px; }
.urlrow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urlrow .ic { color: var(--a-muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.stats div { padding: 14px 16px; border-radius: 14px; background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line); }
.stats b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--a-muted); font-size: 13px; }

/* ---------- QR full screen ---------- */
.qrfull {
	position: fixed; inset: 0; z-index: 20;
	background: #ffffff; color: #121735;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
	text-align: center;
	animation: qr-in .22s ease-out both;
	color-scheme: light;
}
@keyframes qr-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.qrfull__close {
	position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px;
	width: 48px; height: 48px; border: 0; border-radius: 50%; background: #eef0f6; color: #121735;
	display: grid; place-items: center; cursor: pointer;
}
.qrfull__box { width: min(78vw, 46vh, 340px); }
.qrfull__box svg { display: block; width: 100%; height: auto; }
.qrfull h2 { margin: 18px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.qrfull__url { margin: 4px 0 0; color: #5f6585; font-size: 15px; word-break: break-all; }
.qrfull__hint { margin: 14px auto 0; color: #5f6585; font-size: 14px; max-width: 30ch; }
.qrfull__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 360px; margin-top: 22px; }
.qrfull .btn { background: #eef0f6; color: #121735; box-shadow: none; }

/* ---------- Details ---------- */
.photo { display: flex; align-items: center; gap: 16px; margin: 4px 0 22px; }
.photo__img {
	width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex: none;
	display: grid; place-items: center;
	background: var(--accent); color: var(--accent-ink);
	font-size: 28px; font-weight: 700;
}
.photo__img img { width: 100%; height: 100%; object-fit: cover; }
.photo__btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Links ---------- */
.links { display: grid; gap: 10px; margin-bottom: 12px; }
.lk { background: var(--a-surface); border-radius: 16px; padding: 10px 12px 12px; box-shadow: inset 0 0 0 1px var(--a-line); }
.lk__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lk__head b { flex: 1; font-weight: 650; }
.lk__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--a-soft); }
.lk__ico .ic { width: 19px; height: 19px; }
.lk__tools { display: flex; gap: 0; margin-right: -6px; }
.lk input { min-height: 46px; }
.lk .lk__label { margin-top: 8px; min-height: 40px; font-size: 15px; padding: 8px 14px; }
.empty { text-align: center; padding: 26px 16px; border-radius: 16px; background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line); }
.empty b { display: block; font-size: 17px; }
.empty span { color: var(--a-muted); font-size: 14px; }

/* ---------- Sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 15; background: rgba(6, 9, 26, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet__in {
	width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
	background: var(--a-bg); border-radius: 22px 22px 0 0;
	padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
	animation: sheet-up .22s ease-out both;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0 0 14px 4px; font-size: 20px; letter-spacing: -.015em; }
.sheet .btn.big { margin-top: 10px; }
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.types button {
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	padding: 14px 6px; border: 0; border-radius: 14px;
	background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line);
	font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ---------- Style ---------- */
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.theme .bc { box-shadow: inset 0 0 0 1px var(--card-edge), 0 6px 14px -8px rgba(0, 0, 0, .4); pointer-events: none; }
.theme > span { display: block; margin: 6px 2px 0; font-size: 14px; font-weight: 600; color: var(--a-muted); }
.theme.on .bc { outline: 3px solid var(--a-accent); outline-offset: 3px; }
.theme.on > span { color: var(--a-ink); }
.slug { display: flex; align-items: center; border-radius: 12px; background: var(--a-field); box-shadow: inset 0 0 0 1px var(--a-line); padding-left: 14px; }
.slug span { color: var(--a-muted); white-space: nowrap; font-size: 15px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.slug input { box-shadow: none; padding-left: 2px; background: transparent; }
.slug:focus-within { box-shadow: inset 0 0 0 2px var(--a-accent); }
.slug__msg { font-size: 14px; color: var(--a-muted); margin: 6px 2px 10px; }
.slug__msg.ok { color: var(--a-ok); }
.slug__msg.bad { color: var(--a-danger); }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--a-accent); flex: none; }
.version { text-align: center; color: var(--a-muted); font-size: 12px; margin-top: 24px; }

/* ---------- Toast ---------- */
.toast {
	position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 30;
	transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
	max-width: calc(100vw - 32px);
	background: #121735; color: #fff; padding: 10px 16px; border-radius: 999px;
	font-size: 14px; font-weight: 500;
	transition: .2s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--a-danger); }

@media (prefers-reduced-motion: reduce) {
	.auth__deck, .qrfull, .sheet__in { animation: none; }
	.toast { transition: none; }
}

/* ---------- Invite, strength, directory, tips (0.2) ---------- */
select { font: inherit; color: inherit; }
.f select {
	width: 100%; min-height: 50px; padding: 12px 40px 12px 14px;
	border: 0; border-radius: 12px; background: var(--a-field);
	box-shadow: inset 0 0 0 1px var(--a-line); font-size: 16px;
	-webkit-appearance: none; appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--a-muted) 50%), linear-gradient(135deg, var(--a-muted) 50%, transparent 50%);
	background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px;
	background-size: 5px 5px; background-repeat: no-repeat;
}
.f select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--a-accent); }
.switch.consent { margin: 4px 2px 14px; font-size: 14px; color: var(--a-muted); }

.invite { margin-top: 18px; padding: 16px; border-radius: 16px; background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line); }
.invite__head { display: flex; align-items: center; gap: 10px; }
.invite__head .ic { color: var(--a-accent); }
.invite__head b { flex: 1; font-size: 17px; }
.invite__n { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; display: grid; place-items: center; background: var(--a-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.invite p { margin: 8px 0 12px; color: var(--a-muted); font-size: 14px; }

.strength { margin: -6px 0 22px; padding: 14px 16px; border-radius: 16px; background: var(--a-soft); }
.strength__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.strength__top b { font-size: 15px; }
.strength__top span { font-size: 14px; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.strength__bar { margin: 8px 0 10px; height: 8px; border-radius: 999px; background: var(--a-surface); overflow: hidden; }
.strength__bar i { display: block; height: 100%; border-radius: inherit; background: var(--a-accent); transition: width .3s ease; }
.strength ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--a-ink); }
.strength li { margin: 4px 0; }
.strength p { margin: 0; font-size: 14px; color: var(--a-muted); }

.dirfields { margin-top: 12px; }
.dirfields[hidden] { display: none; }
#dir-status a { color: var(--a-accent); font-weight: 600; }

.tips { margin: 6px 0 18px; border-radius: 16px; background: var(--a-surface); box-shadow: inset 0 0 0 1px var(--a-line); }
.tips summary { display: flex; align-items: center; gap: 10px; padding: 16px; font-weight: 650; cursor: pointer; list-style: none; }
.tips summary::-webkit-details-marker { display: none; }
.tips summary::after { content: "+"; margin-left: auto; font-size: 20px; color: var(--a-muted); }
.tips[open] summary::after { content: "–"; }
.tips summary .ic { color: var(--a-accent); }
.tips ul { margin: 0; padding: 0 16px 16px 34px; display: grid; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--a-muted); }
.tips li b { color: var(--a-ink); }
@media (prefers-reduced-motion: reduce) { .strength__bar i { transition: none; } }

/* ---------- Private link (0.5) ---------- */
.privurl { margin: 0 0 8px; padding: 12px 14px; border-radius: 12px; background: var(--a-field); box-shadow: inset 0 0 0 1px var(--a-line); }
.privurl small { display: block; color: var(--a-muted); font-size: 13px; }
.privurl b { display: block; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }
.switch input:disabled + span { color: var(--a-muted); }

/* ---------- Several cards (0.7.0) ---------- */
.cardsbar { background: var(--a-bg); padding: 0 0 10px; }
.cardsbar[hidden] { display: none; }
.cardsbar__in {
	max-width: 520px; margin: 0 auto;
	display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cardsbar__in::-webkit-scrollbar { display: none; }
.cardchip {
	flex: none; display: inline-flex; align-items: center; gap: 6px;
	min-height: 40px; padding: 0 16px;
	border: 0; border-radius: 999px;
	background: var(--a-surface); color: var(--a-ink);
	box-shadow: inset 0 0 0 1px var(--a-line);
	font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.cardchip.on { background: var(--a-accent); color: var(--a-accent-ink); box-shadow: none; }
.cardchip--add { background: transparent; color: var(--a-accent); box-shadow: inset 0 0 0 1.5px var(--a-line); }
.cardchip__lock { display: inline-flex; opacity: .8; }
.cardchip__lock .ic { width: 15px; height: 15px; }
.shell:has(.view--card) .cardsbar { background: var(--a-band); }
.shell:has(.view--card) .cardchip { background: rgba(255, 255, 255, .1); color: #eef0ff; box-shadow: none; }
.shell:has(.view--card) .cardchip.on { background: #ffffff; color: #121735; }
.shell:has(.view--card) .cardchip--add { background: transparent; color: #c5ccff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .28); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip {
	display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
	border: 0; border-radius: 999px;
	background: var(--a-surface); color: var(--a-ink);
	box-shadow: inset 0 0 0 1px var(--a-line);
	font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--a-accent); color: var(--a-accent-ink); box-shadow: none; }
.chip.dim { color: var(--a-muted); }

/* "Show on" under each link */
.lk__on { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.lk__onlabel { font-size: 13px; font-weight: 600; color: var(--a-muted); margin-right: 2px; }
.lk__on .chip { min-height: 34px; padding: 0 12px; font-size: 13px; background: var(--a-bg); }
.lk__on .chip.on { background: var(--a-accent); }
.lk__hidden { font-size: 13px; color: var(--a-danger); font-weight: 600; }

/* The QR button is the main thing on the card tab. */
.btn.qrbtn { min-height: 66px; font-size: 19px; font-weight: 700; gap: 12px; box-shadow: 0 12px 26px -14px var(--a-accent); }
.btn.qrbtn .ic { width: 28px; height: 28px; }
a.btn { text-decoration: none; }

/* 0.7.1: links that the card being edited does not show, and the new-card links choice */
.lk--off .lk__url, .lk--off .lk__label, .lk--off .lk__ico, .lk--off .lk__head > b { opacity: .5; }
.lk__offtag { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 999px; background: var(--a-soft); color: var(--a-muted); font-size: 12px; font-weight: 600; }
.newcard__links { margin: 2px 2px 14px; }
.newcard__links small { display: block; color: var(--a-muted); font-size: 13px; margin-top: 2px; }
.sheet .btn.big.danger { box-shadow: inset 0 0 0 1.5px var(--a-danger); }
