/* Tear & Share web claim page -- mirrors the app's look: grouped iOS-style cards,
   the teal accent (Color.tearAndShareAccent), rounded type, light + dark. */

:root {
	--accent: #059e87;
	--accent-soft: rgba(5, 158, 135, 0.12);
	--bg: #f2f2f7;
	--card: #ffffff;
	--text: #1c1c1e;
	--secondary: #6c6c70;
	--tertiary: #aeaeb2;
	--separator: rgba(60, 60, 67, 0.14);
	--danger: #d8344f;
	--warning: #e08a0b;
	--bar: rgba(249, 249, 249, 0.82);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.06);
	--radius: 18px;
	--spring: cubic-bezier(0.34, 1.3, 0.64, 1);
	--ease: cubic-bezier(0.22, 1, 0.36, 1);
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--accent: #1fc2a8;
		--accent-soft: rgba(31, 194, 168, 0.16);
		--bg: #000000;
		--card: #1c1c1e;
		--text: #f2f2f7;
		--secondary: #98989f;
		--tertiary: #636366;
		--separator: rgba(84, 84, 88, 0.5);
		--bar: rgba(22, 22, 24, 0.8);
		--shadow: none;
	}
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

main {
	max-width: 560px;
	margin: 0 auto;
	padding: max(20px, env(safe-area-inset-top)) 16px calc(170px + env(safe-area-inset-bottom));
}

h1, h2, h3 { margin: 0; font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 13px; font-weight: 600; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.04em; margin: 28px 4px 8px; }

.muted { color: var(--secondary); }
.small { font-size: 14px; }
.num { font-variant-numeric: tabular-nums; }

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- states ------------------------------------------------------------- */

.state { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.state .icon { font-size: 48px; margin-bottom: 12px; }
.state p { max-width: 300px; margin: 8px auto 0; }

.spinner {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid var(--separator); border-top-color: var(--accent);
	animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- header ------------------------------------------------------------- */

.eyebrow { font-size: 15px; color: var(--secondary); margin-bottom: 4px; }
.header { margin: 8px 4px 20px; }
.eyebrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.open-app {
	font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none;
	padding: 5px 10px; border-radius: 999px; background: var(--accent-soft);
}

/* --- cards & rows --------------------------------------------------------- */

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 12px; }

.row {
	display: flex; align-items: center; gap: 12px;
	min-height: 56px; padding: 10px 16px;
	position: relative; width: 100%; text-align: left;
}
.row + .row::before {
	content: ""; position: absolute; top: 0; right: 0; left: 64px;
	border-top: 0.5px solid var(--separator);
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; overflow-wrap: anywhere; }
.row .sub { font-size: 14px; color: var(--secondary); margin-top: 2px; }
.row .amount { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.row.dim { opacity: 0.45; }
/* cursor:pointer is what makes iOS Safari deliver taps on a non-button row. */
.row.tappable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.row.tappable[data-disabled="true"] { cursor: default; }

.accent-text { color: var(--accent); }

/* The claiming card: items on a receipt torn off the roll -- mirrors the app's
   ReceiptPaperCard (header, dashed rules between rows, torn bottom edge, the one
   card shadow). The shadow is a drop-shadow filter so it follows the torn edge. */
.paper {
	background: transparent;
	margin-top: 12px;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.05)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.07));
}
.paper-head, .paper-rows { background: var(--card); }
.paper-head { padding: 16px; border-radius: 20px 20px 0 0; border-bottom: 0.5px solid var(--separator); }
.paper-head .shop { font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; font-weight: 600; font-size: 17px; }
.paper-head .hint { font-size: 12px; color: var(--secondary); margin-top: 2px; }
.paper-rows { overflow: hidden; padding-bottom: 14px; }
/* Dashed, like a ticket perforation, instead of the hairline. */
.paper .row + .row::before { left: 16px; border-top: 1px dashed var(--separator); }
/* Down-pointing teeth: 14px wide, 7px deep (TornReceiptShape's tooth). */
.paper-tear {
	height: 14px;
	margin-top: -7px;
	background:
		linear-gradient(135deg, var(--card) 50%, transparent 0) 0 0 / 14px 14px,
		linear-gradient(225deg, var(--card) 50%, transparent 0) 0 0 / 14px 14px;
	background-repeat: repeat-x;
}
@media (prefers-color-scheme: dark) {
	.paper { filter: none; }
}

.pressable { transition: transform 0.18s var(--ease), background-color 0.2s; }
.pressable:active:not(:disabled) { transform: scale(0.98); background: var(--accent-soft); }

/* --- avatars ------------------------------------------------------------ */

.avatar {
	width: 36px; height: 36px; border-radius: 50%; flex: none;
	display: grid; place-items: center;
	color: #fff; font-weight: 600; font-size: 15px;
	font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif;
}
.avatars { display: flex; margin-top: 6px; }
.avatars .avatar { width: 22px; height: 22px; font-size: 11px; border: 2px solid var(--card); margin-right: -6px; }
.avatars .avatar.me { box-shadow: 0 0 0 2px var(--accent); }

/* --- the claim circle (SelectionCircleIcon) --------------------------------- */

.check {
	width: 28px; height: 28px; border-radius: 50%; flex: none;
	border: 2px solid var(--tertiary);
	display: grid; place-items: center;
	transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.35s var(--spring);
}
.check svg { width: 16px; height: 16px; opacity: 0; transform: scale(0.4); transition: opacity 0.15s, transform 0.35s var(--spring); }
.check.on { background: var(--accent); border-color: var(--accent); }
.check.on svg { opacity: 1; transform: scale(1); }
.row:active .check { transform: scale(0.9); }

/* --- quantity stepper ------------------------------------------------------- */

.stepper { display: flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 999px; padding: 3px; flex: none; }
.stepper button {
	width: 32px; height: 32px; border-radius: 50%;
	display: grid; place-items: center; font-size: 20px; font-weight: 500; color: var(--accent);
	transition: transform 0.15s var(--ease), background-color 0.2s;
}
.stepper button:active:not(:disabled) { transform: scale(0.88); background: var(--accent-soft); }
.stepper button:disabled { color: var(--tertiary); }
.stepper .count { min-width: 24px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* An item other people have fully claimed (the app's lock + dimmed row). */
.row.exhausted .title, .row.exhausted .amount { opacity: 0.5; }
.lock {
	width: 28px; height: 28px; border-radius: 50%; flex: none;
	display: grid; place-items: center; color: var(--tertiary);
}
.lock svg { width: 16px; height: 16px; }
.lock.filed { background: rgba(224, 138, 11, 0.16); color: var(--warning); font-weight: 700; }
.warn-text { color: var(--warning) !important; }

.flag {
	font-size: 13px; color: var(--secondary); padding: 6px 8px; margin: -6px -8px -6px 0; border-radius: 8px;
}
.flag.on { color: var(--warning); font-weight: 600; }

.pill {
	display: inline-flex; align-items: center; gap: 4px;
	font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
	background: var(--accent-soft); color: var(--accent);
}
.pill.warn { background: rgba(224, 138, 11, 0.14); color: var(--warning); }
.pill.grey { background: var(--bg); color: var(--secondary); }

/* --- hero total ----------------------------------------------------------- */

.hero { padding: 20px; text-align: center; }
.hero .label { font-size: 15px; color: var(--secondary); }
.hero .big {
	font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif;
	font-size: 46px; font-weight: 700; letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums; margin: 2px 0 6px;
}
.hero .who { font-size: 14px; color: var(--secondary); }
.hero .who button { color: var(--accent); font-weight: 500; }

/* --- "your name was freed up" notice --- */

.notice { margin: 4px 0 8px; box-shadow: inset 0 0 0 1.5px rgba(224, 138, 11, 0.45), var(--shadow); }
.notice-icon {
	width: 28px; height: 28px; border-radius: 50%; flex: none;
	display: grid; place-items: center; font-weight: 700;
	background: rgba(224, 138, 11, 0.16); color: var(--warning);
}

/* --- join ----------------------------------------------------------------- */

.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.name-btn {
	display: flex; align-items: center; gap: 10px;
	background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
	padding: 12px; font-weight: 500; text-align: left;
	transition: transform 0.18s var(--ease), opacity 0.2s;
}
.name-btn:active:not(:disabled) { transform: scale(0.96); }
.name-btn:disabled { opacity: 0.45; }
.name-btn .sub { font-size: 12px; color: var(--secondary); font-weight: 400; }

.field { display: flex; gap: 8px; margin-top: 12px; }
.field input {
	flex: 1; min-width: 0; font: inherit; color: var(--text);
	background: var(--card); border: 0; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow);
}

.cta {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; min-height: 52px; border-radius: 16px; padding: 0 16px; text-align: center;
	background: var(--accent); color: #fff; font-weight: 600; font-size: 17px;
	transition: transform 0.18s var(--ease), opacity 0.2s;
}
.cta:active:not(:disabled) { transform: scale(0.97); }
.cta:disabled { opacity: 0.4; }
.cta.secondary { background: var(--card); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cta.compact { width: auto; padding: 0 20px; min-height: 48px; }

/* Pay links (#15): the providers' own look (their artwork, colours, pill
   shape) -- recognisably Monzo's and PayPal's, never restyled as ours. */
.pay-links { display: flex; flex-direction: column; gap: 10px; }
.pay-btn {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 50px; border-radius: 999px; padding: 0 20px; text-decoration: none;
	font-weight: 600; font-size: 17px; transition: transform 0.18s var(--ease), filter 0.2s;
}
.pay-btn:active { transform: scale(0.97); filter: brightness(0.95); }
.pay-btn .pay-with { margin-right: 2px; }
.pay-btn .pay-mark { height: 22px; width: auto; }
.pay-btn.paypal { background: #60cdff; color: #000; }
.pay-btn.paypal .pay-wordmark { height: 20px; width: auto; margin-top: 4px; }
.pay-btn.monzo { background: #112231; color: #fff; }
.pay-btn.monzo .pay-mark { height: 19px; }
.pay-btn.monzo .pay-wordmark { height: 16px; width: auto; }
@media (prefers-color-scheme: dark) {
	.pay-btn.monzo { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
}

.note { font-size: 13px; color: var(--secondary); margin: 12px 4px 0; line-height: 1.45; }
.error { color: var(--danger); font-size: 14px; margin: 10px 4px 0; min-height: 1em; }

/* --- pinned pay bar (the app's .background(.bar)) ----------------------------- */

.bar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	background: var(--bar);
	-webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
	border-top: 0.5px solid var(--separator);
}
.bar-inner { max-width: 528px; margin: 0 auto; display: flex; gap: 10px; }

/* --- pay sheet ----------------------------------------------------------- */

.scrim {
	position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.35);
	opacity: 0; transition: opacity 0.25s var(--ease);
}
.scrim.open { opacity: 1; }
.sheet {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
	max-width: 560px; margin: 0 auto;
	background: var(--bg); border-radius: 22px 22px 0 0;
	padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
	transform: translateY(100%); transition: transform 0.42s var(--ease);
	max-height: 90vh; overflow-y: auto;
}
.sheet.open { transform: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--tertiary); margin: 0 auto 14px; }
.copy-row + .copy-row::before { left: 16px; }
.copy-row { min-height: 48px; }
.copy-row .value { font-variant-numeric: tabular-nums; color: var(--secondary); text-align: right; overflow-wrap: anywhere; }
.copy-row .value.done { color: var(--green, #34c759); font-weight: 600; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 4px 8px; }
.section-head h2 { margin: 0; }
.copy-btn { color: var(--accent); font-size: 13px; font-weight: 600; padding: 4px 0; }
.copy-btn.done { color: var(--green, #34c759); }

/* --- toast ---------------------------------------------------------------- */

.toast {
	position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 30;
	transform: translate(-50%, 20px); opacity: 0;
	background: rgba(28, 28, 30, 0.92); color: #fff; font-size: 15px;
	padding: 10px 16px; border-radius: 999px; max-width: calc(100% - 32px);
	transition: opacity 0.2s, transform 0.35s var(--spring);
	pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* --- entrance -------------------------------------------------------------- */

.enter { animation: rise 0.5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.celebrate { animation: pop 0.6s var(--spring); }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
	.pressable:active, .cta:active, .name-btn:active, .pay-btn:active { transform: none !important; }
}

/* --- "All done" screen --------------------------------------------------- */

.done-hero { text-align: center; margin: 4px 8px 20px; }
.done-check {
	width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px;
	background: #34c759; display: grid; place-items: center;
}
.done-check svg { width: 34px; height: 34px; }
.done-title { font-size: 22px; margin-bottom: 6px; }
.done-hero p { margin: 0 auto; max-width: 340px; font-size: 15px; line-height: 1.45; }
.breakdown { border-top: 0.5px solid var(--separator); margin-top: 12px; padding-top: 10px; text-align: left; }
.breakdown .line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; }
.breakdown .line span:last-child { color: var(--secondary); white-space: nowrap; }
.text-btn { color: var(--accent); font-weight: 600; font-size: 15px; padding: 6px; align-self: center; }

/* --- "claim by" countdown ---------------------------------------------------- */

.deadline {
	margin: 12px 0 0; padding: 10px 14px; border-radius: 14px; font-size: 14px; text-align: center;
	background: rgba(224, 138, 11, 0.12); color: var(--warning);
}
.deadline strong { font-variant-numeric: tabular-nums; }
.deadline.late { background: rgba(224, 138, 11, 0.2); color: var(--warning); }
.done-hero + .deadline { margin: 0 0 12px; }

/* "More ways to pay" (#15): the host's other methods, one tap away. */
.more-pay {
	display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 16px;
	padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
	color: var(--accent); font-weight: 600; font-size: 16px; text-align: left;
}
.more-pay .more-pay-detail { flex: 1; text-align: right; color: var(--secondary); font-weight: 400; font-size: 15px; }
.more-pay .chevron { color: var(--tertiary); font-size: 20px; transition: transform 0.25s var(--ease); }
.more-pay .chevron.open { transform: rotate(90deg); }
