:root {
	color-scheme: light dark;
	--bg: #ffffff;
	--fg: #0b0d12;
	--muted: #5b6472;
	--accent: #2f6df6;
	--border: #e4e7ec;
	--danger: #b42318;
	--radius: 10px;
	--space: 1rem;
	--font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #0b0d12;
		--fg: #f4f6fa;
		--muted: #9aa4b2;
		--accent: #6f9bff;
		--border: #232833;
		--danger: #ff9a8f;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

.shell {
	max-width: 42rem;
	margin: 0 auto;
	padding: calc(var(--space) * 3) var(--space);
}

h1 {
	margin: 0 0 0.5rem;
	font-size: clamp(1.6rem, 4vw, 2.25rem);
	letter-spacing: -0.02em;
}

.lede {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
}

.hint {
	margin: 0;
	color: var(--muted);
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.55rem 0.9rem;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 500;
	cursor: pointer;
}

.btn:hover {
	filter: brightness(1.05);
}

.btn-secondary {
	background: transparent;
	color: var(--fg);
	border-color: var(--border);
}

.card {
	padding: var(--space);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}

.input,
.select,
.textarea {
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	font: inherit;
}

.field {
	display: grid;
	gap: 0.35rem;
	margin-bottom: var(--space);
}

.field > label {
	font-size: 0.875rem;
	color: var(--muted);
}

.stack {
	display: grid;
	gap: var(--space);
}

.row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

/*
 * 390px-safe. An unclamped minmax track overflows a 390px viewport once the
 * shell padding is subtracted, and nothing in the pipeline ever looked at a
 * phone-width layout, so every generated app inherited the horizontal scroll.
 * min() clamps the track to the container instead.
 */
.grid {
	display: grid;
	gap: var(--space);
	grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
}

.list {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.table {
	width: 100%;
	border-collapse: collapse;
}

.table th,
.table td {
	padding: 0.6rem 0.5rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
}

.table th {
	font-size: 0.8125rem;
	color: var(--muted);
	font-weight: 600;
}

.empty {
	padding: calc(var(--space) * 2);
	text-align: center;
	color: var(--muted);
}

.empty-title {
	margin: 0 0 0.25rem;
	color: var(--fg);
	font-weight: 600;
}

/* Loading. Every fetch has one; without a primitive each app invented its own. */
.loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: calc(var(--space) * 1.5);
	color: var(--muted);
}

.spinner {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: fab-spin 0.7s linear infinite;
}

@keyframes fab-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Placeholder for content whose shape is known before its data arrives. */
.skeleton {
	display: block;
	height: 1rem;
	border-radius: calc(var(--radius) / 2);
	background: linear-gradient(90deg, var(--border), transparent, var(--border));
	background-size: 200% 100%;
	animation: fab-shimmer 1.2s linear infinite;
}

@keyframes fab-shimmer {
	to {
		background-position: -200% 0;
	}
}

/* Error strip: a failure the user can see and retry, never a silent no-op. */
.alert {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--border);
	border-left: 3px solid var(--muted);
	border-radius: var(--radius);
}

.alert-error {
	border-left-color: var(--danger);
	color: var(--danger);
}

.badge {
	display: inline-block;
	padding: 0.1rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: 0.8125rem;
	color: var(--muted);
}

/*
 * The scaffold had exactly one @media rule (prefers-color-scheme) and no width
 * breakpoint at all, so the shell was a 42rem column at every size.
 * Mobile-first stays the default; these only widen it.
 */
@media (min-width: 48rem) {
	.shell {
		max-width: 52rem;
		padding: calc(var(--space) * 3) calc(var(--space) * 1.5);
	}
}

@media (min-width: 64rem) {
	.shell {
		max-width: 64rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spinner,
	.skeleton {
		animation: none;
	}
}

.pw { color-scheme: light; background: #fbf6ee; color: #2b2118; min-height: 100vh; font-family: system-ui, sans-serif; }
.pw-hero { background: #2f5d50; color: #fbf6ee; padding: 2rem 1.25rem 2.5rem; text-align: center; }
.pw-brand { font-weight: 800; font-size: 1.2rem; margin-bottom: 1.5rem; }
.pw-hero h1 { font-size: clamp(2rem, 7vw, 3.2rem); margin: 0 0 .75rem; line-height: 1.1; }
.pw-hero p { font-size: 1.1rem; margin: 0 0 1.5rem; }
.pw-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.pw-btn { display: inline-block; background: #f2a541; color: #2b2118; border: 0; border-radius: 999px; padding: .8rem 1.4rem;
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; }
.pw-btn:disabled { opacity: .6; }
.pw-ghost { background: transparent; color: #fbf6ee; border: 2px solid #fbf6ee; }
.pw-small { padding: .55rem 1.1rem; font-size: .9rem; }
.pw-main { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; display: grid; gap: 2rem; }
.pw-main h2 { margin: 0 0 1rem; }
.pw-packs { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.pw-pack { background: #fff; border-radius: 1rem; padding: 1.25rem; border: 2px solid #eadfcf; position: relative; }
.pw-pack.hot { border-color: #f2a541; }
.pw-pack h3 { margin: 0; }
.pw-pack p { color: #6b5d50; min-height: 2.5em; }
.pw-price { font-size: 2.4rem; font-weight: 800; color: #2f5d50; }
.pw-tag { position: absolute; top: -.7rem; right: 1rem; background: #f2a541; border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 700; }
.pw-card { background: #fff; border-radius: 1rem; padding: 1.5rem 1.25rem; border: 2px solid #eadfcf; scroll-margin-top: 1rem; }
.pw-form { display: grid; gap: .9rem; }
.pw-form label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
.pw-form input, .pw-form select, .pw-form textarea { font: inherit; padding: .7rem; border: 1px solid #d8cbb8; border-radius: .6rem;
  background: #fffdf9; color: inherit; width: 100%; box-sizing: border-box; min-width: 0; }
.pw-two { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.pw-muted { color: #6b5d50; margin: -.5rem 0 0; }
.pw-support { background: #2f5d50; color: #fbf6ee; border: 0; text-align: center; }

.pw-team-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pw-ghost2 { background: transparent; color: inherit; border: 1px solid currentColor; }
.pw-addmember { border: 1px dashed #ccc; border-radius: 12px; padding: 12px; margin: 12px 0; }
.pw-tier h3 { margin: 18px 0 8px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.pw-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.pw-member { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px; border-radius: 12px; background: rgba(0,0,0,0.03); }
.pw-member select { max-width: 100%; font-size: 0.85rem; }
.pw-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.pw-initial { display: grid; place-items: center; background: #f2c94c; font-size: 2rem; font-weight: 700; color: #333; }
.pw-rank { font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; background: #f2c94c; color: #333; }
.pw-mini { font-size: 0.8rem; text-decoration: underline; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
.pw-remove { color: #c0392b; }
.pw-stars { color: #f5b301; margin-right: 4px; letter-spacing: -1px; font-size: 0.75em; }
.pw-rank.pw-r-log { background: #e0f2fe; color: #075985; }
.pw-rank.pw-r-emp { background: #dcfce7; color: #166534; }
.pw-rank.pw-r-stf { background: #f3e8ff; color: #6b21a8; }
.pw-rank.pw-r-top { background: #1f2937; color: #fde68a; }
.pw-member.pw-m-log { border-top: 4px solid #0ea5e9; }
.pw-member.pw-m-emp { border-top: 4px solid #22c55e; }
.pw-member.pw-m-stf { border-top: 4px solid #a855f7; }
.pw-member.pw-m-top { box-shadow: 0 0 0 2px #f5b301; }
.pw-seg { display: flex; gap: 6px; flex-wrap: wrap; }
.pw-seg button { flex: 1; padding: 8px; border-radius: 999px; border: 1px solid #ddd; background: #fff; cursor: pointer; }
.pw-seg button.on { background: #1f2937; color: #fff; }
.pw-prog { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.pw-prog-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; border: 1px solid #eee; border-radius: 12px; }
.pw-prog-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pw-avatar.pw-sm { width: 44px; height: 44px; }
.pw-points { font-size: 1.4rem; font-weight: 800; }
.pw-points small { font-size: 0.7rem; font-weight: 500; }
.pw-give { display: flex; gap: 6px; width: 100%; flex-wrap: wrap; }
.pw-give input { width: 90px; padding: 6px; }

.pw-join-done { background: #eaf7ee; border-radius: 12px; padding: 12px; margin: 8px 0; }
.pw-applicant { gap: 6px; }

:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}
