:root {
	--bg: #eef2fb;
	--bg-accent: #e4eaf6;
	--surface: #ffffff;
	--surface-strong: #f5f8ff;
	--ink: #0f172a;
	--muted: #56687a;
	--line: rgba(30, 64, 175, 0.11);
	--primary: #2563eb;
	--primary-dark: #1d4ed8;
	--primary-light: #eff4ff;
	--primary-glow: rgba(37, 99, 235, 0.18);
	--success: #059669;
	--danger: #dc2626;
	--shadow: 0 4px 24px rgba(15, 30, 100, 0.08), 0 1px 4px rgba(15, 30, 100, 0.05);
	--shadow-lg: 0 12px 40px rgba(15, 30, 100, 0.12), 0 2px 8px rgba(15, 30, 100, 0.06);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--ink);
	background:
		radial-gradient(ellipse 90% 50% at 65% -10%, rgba(37, 99, 235, 0.1) 0%, transparent 70%),
		radial-gradient(ellipse 60% 40% at -5% 100%, rgba(99, 149, 235, 0.07) 0%, transparent 60%),
		linear-gradient(160deg, var(--bg) 0%, var(--bg-accent) 100%);
	min-height: 100vh;
}

a {
	color: inherit;
	text-decoration: none;
}

.page-shell {
	padding: 24px;
}

/* ── Layout ─────────────────────────────── */

.hero-layout,
.dashboard {
	max-width: 1100px;
	margin: 0 auto;
}

.hero-layout {
	display: grid;
	place-items: center;
	min-height: calc(100vh - 48px);
}

/* ── Cards / Panels ─────────────────────── */

.hero-card,
.panel {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 20px;
	box-shadow: var(--shadow-lg);
}

.hero-card {
	padding: 52px 56px;
	max-width: 460px;
	width: 100%;
}

.panel {
	padding: 28px;
}

/* ── Brand mark ─────────────────────────── */

.brand-mark {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 28px;
}

.brand-icon {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: linear-gradient(135deg, #2563eb 0%, #4f7ef7 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 18px;
	color: #fff;
	letter-spacing: -0.5px;
	box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
	flex-shrink: 0;
}

.brand-icon.small {
	width: 32px;
	height: 32px;
	border-radius: 9px;
	font-size: 15px;
	box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.brand-name {
	font-size: 1.05rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--ink);
}

/* ── Top Bar ────────────────────────────── */

.topbar {
	max-width: 1100px;
	margin: 0 auto 28px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--line);
}

.topbar-brand {
	display: flex;
	align-items: center;
	gap: 14px;
}

.topbar h1 {
	font-size: 1.2rem;
	font-weight: 600;
	margin-bottom: 0;
}

.topbar .eyebrow {
	margin-bottom: 2px;
}

/* ── Tab Navigation ─────────────────────── */

.tab-nav {
	display: inline-flex;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 4px;
	gap: 3px;
	margin-bottom: 24px;
	box-shadow: var(--shadow);
}

.tab-btn {
	padding: 8px 22px;
	border-radius: 9px;
	border: none;
	background: transparent;
	color: var(--muted);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
	white-space: nowrap;
}

.tab-btn:hover {
	background: var(--surface-strong);
	color: var(--ink);
	transform: none;
	box-shadow: none;
}

.tab-btn.active {
	background: var(--primary);
	color: #fff;
	box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.tab-btn.active:hover {
	background: var(--primary-dark);
	color: #fff;
}

/* ── Tab panel layout helpers ───────────── */

.panels-stack {
	display: grid;
	gap: 20px;
}

.panels-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
}

/* ── Profile header (avatar + identity) ─── */

.profile-header {
	display: flex;
	align-items: center;
	gap: 20px;
	padding-bottom: 24px;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--line);
}

.avatar-wrap {
	width: 76px;
	height: 76px;
	border-radius: 50%;
	overflow: hidden;
	flex-shrink: 0;
	border: 2px solid var(--line);
	background: var(--surface-strong);
}

.avatar-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.avatar-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--primary-light);
	color: var(--primary);
}

/* ── Avatar upload ──────────────────────── */

.avatar-upload {
	position: relative;
	width: 76px;
	height: 76px;
	border-radius: 50%;
	flex-shrink: 0;
	cursor: pointer;
}

.avatar-upload .avatar-wrap {
	width: 100%;
	height: 100%;
}

.avatar-upload-overlay {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.48);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 150ms ease;
	color: #fff;
}

.avatar-upload:hover .avatar-upload-overlay {
	opacity: 1;
}

.avatar-upload.uploading .avatar-upload-overlay {
	opacity: 1;
	background: rgba(37, 99, 235, 0.6);
}

.avatar-upload.uploading {
	cursor: wait;
}

.profile-identity {
	min-width: 0;
}

.profile-name {
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--ink);
	margin: 0 0 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.profile-alias {
	font-size: 0.875rem;
	color: var(--muted);
	margin: 0 0 10px;
}

/* ── Flex / Stack helpers ───────────────── */

.panel-head,
.button-row,
.meta-grid,
.checkbox-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.panel-head {
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 16px;
}

.button-row {
	flex-direction: column;
	gap: 10px;
	margin-top: 4px;
}

.form-actions {
	display: flex;
	padding-top: 4px;
}

.stack {
	display: grid;
	gap: 14px;
}

/* ── Typography ─────────────────────────── */

.eyebrow {
	margin: 0 0 6px;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 0.7rem;
	font-weight: 700;
	color: var(--primary);
}

h1,
h2,
p {
	margin-top: 0;
}

h1 {
	font-size: 1.9rem;
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.2;
	margin-bottom: 10px;
	color: var(--ink);
}

h2 {
	font-size: 1rem;
	font-weight: 600;
	color: var(--ink);
	margin-bottom: 4px;
}

.section-desc {
	font-size: 0.84rem;
	color: var(--muted);
	margin-bottom: 18px;
}

.lede {
	font-size: 0.9875rem;
	line-height: 1.65;
	color: var(--muted);
	margin-bottom: 28px;
}

/* ── Forms ──────────────────────────────── */

label {
	display: grid;
	gap: 5px;
	font-size: 0.84rem;
	font-weight: 500;
	color: var(--ink);
}

input:not([type="checkbox"]):not([type="hidden"]):not([type="submit"]) {
	width: 100%;
	padding: 10px 13px;
	border-radius: 9px;
	border: 1px solid rgba(30, 64, 175, 0.18);
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: 0.9375rem;
	outline: none;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
	color: #aab4c8;
}

input:not([type="checkbox"]):focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="checkbox"] {
	width: 16px;
	height: 16px;
	accent-color: var(--primary);
	cursor: pointer;
}

/* ── Buttons ────────────────────────────── */

button,
.oauth-button,
.ghost-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	padding: 11px 20px;
	border-radius: 9px;
	border: 1px solid transparent;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	cursor: pointer;
	transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
	white-space: nowrap;
}

button:hover,
.oauth-button:hover,
.ghost-button:hover {
	transform: translateY(-1px);
}

.primary-button {
	background: var(--primary);
	color: #fff;
	box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.primary-button:hover {
	background: var(--primary-dark);
	box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.oauth-button {
	width: 100%;
	padding: 12px 20px;
}

.oauth-button.google {
	background: #ffffff;
	color: #1f1f1f;
	border-color: rgba(0, 0, 0, 0.12);
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.oauth-button.google:hover {
	background: #f8f8f8;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.oauth-button.apple {
	background: #111111;
	color: #ffffff;
	border-color: transparent;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

.oauth-button.apple:hover {
	background: #222222;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.ghost-button {
	background: #fff;
	border-color: var(--line);
	color: var(--muted);
	box-shadow: var(--shadow);
}

.ghost-button:hover {
	background: var(--primary-light);
	border-color: rgba(37, 99, 235, 0.2);
	color: var(--primary);
}

.danger-button {
	background: transparent;
	border: 1px solid rgba(220, 38, 38, 0.25);
	color: var(--danger);
	padding: 7px 14px;
	font-size: 0.8125rem;
	font-weight: 500;
}

.danger-button:hover {
	background: rgba(220, 38, 38, 0.05);
	border-color: var(--danger);
	transform: none;
}

/* ── Note / Item cards ──────────────────── */

.note-box {
	padding: 14px 16px;
	border-radius: 10px;
	background: var(--primary-light);
	border: 1px solid rgba(37, 99, 235, 0.14);
	font-size: 0.875rem;
	color: #2d4a8a;
	line-height: 1.6;
}

.note-box p {
	margin-bottom: 4px;
}

.note-box p:last-child {
	margin-bottom: 0;
}

.item-card {
	padding: 14px 16px;
	border-radius: 10px;
	background: var(--surface-strong);
	border: 1px solid var(--line);
	display: grid;
	gap: 6px;
}

.item-card strong {
	font-size: 0.9rem;
	word-break: break-all;
}

.item-card .item-meta {
	font-size: 0.8125rem;
	color: var(--muted);
}

/* ── Meta pills ─────────────────────────── */

.meta-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.meta-pill {
	padding: 4px 11px;
	border-radius: 999px;
	background: var(--primary-light);
	border: 1px solid rgba(37, 99, 235, 0.15);
	color: var(--primary-dark);
	font-size: 0.78rem;
	font-weight: 500;
}

/* ── Game launch buttons ────────────────── */

.empty-state {
	padding: 20px;
	border-radius: 14px;
	background: var(--surface-strong);
	border: 1px dashed rgba(37, 99, 235, 0.22);
	color: var(--muted);
}

.empty-state strong {
	display: block;
	color: var(--ink);
	margin-bottom: 4px;
}

.game-link-list {
	display: grid;
	gap: 14px;
}

.game-link-card {
	border: 1px solid var(--line);
	border-radius: 16px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 248, 255, 0.96) 100%);
	box-shadow: var(--shadow);
	padding: 16px 18px;
}

.game-link-card.expanded {
	box-shadow: var(--shadow-lg);
}

.game-link-main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.game-link-ident {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.game-link-icon {
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(29, 78, 216, 0.2) 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
	border: 1px solid rgba(37, 99, 235, 0.16);
}

.game-link-icon-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.game-link-icon-letter {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--primary-dark);
}

.game-link-copy {
	min-width: 0;
}

.game-link-copy strong {
	display: block;
	font-size: 0.98rem;
	margin-bottom: 4px;
	color: var(--ink);
}

.game-link-copy p {
	margin: 0;
	font-size: 0.84rem;
	color: var(--muted);
}

.game-link-actions {
	display: flex;
	flex-wrap: nowrap;
	flex-shrink: 0;
	justify-content: flex-end;
	gap: 8px;
}

.compact-button {
	padding: 8px 12px;
	font-size: 0.82rem;
	white-space: nowrap;
}

.game-link-detail {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid rgba(37, 99, 235, 0.12);
	display: grid;
	gap: 8px;
}

.game-link-detail-text {
	margin: 0;
	font-size: 0.82rem;
	color: var(--muted);
}

.game-key-row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(37, 99, 235, 0.04);
	border: 1px solid rgba(37, 99, 235, 0.15);
	border-radius: 10px;
	padding: 9px 12px;
}

.game-key-masked {
	flex: 1;
	font: 0.82rem/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	color: var(--ink);
	letter-spacing: 0.04em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.copy-key-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--primary-dark);
	background: rgba(37, 99, 235, 0.08);
	border: 1px solid rgba(37, 99, 235, 0.18);
	border-radius: 7px;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s, border-color 0.15s;
}

.copy-key-btn:hover:not(:disabled) {
	background: rgba(37, 99, 235, 0.16);
	border-color: rgba(37, 99, 235, 0.32);
}

.copy-key-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.game-link-detail-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.detail-meta,
.note-subtle {
	font-size: 0.8rem;
	color: var(--muted);
}

.note-inline-action {
	font-weight: 600;
	color: var(--primary-dark);
}

/* ── Key value display ──────────────────── */

.key-value {
	font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
	font-size: 0.8rem;
	padding: 10px 12px;
	margin: 10px 0;
	background: rgba(37, 99, 235, 0.06);
	border: 1px solid rgba(37, 99, 235, 0.18);
	border-radius: 8px;
	word-break: break-all;
	user-select: all;
	color: var(--ink);
	line-height: 1.5;
}

/* ── Open in app button ─────────────────── */

.open-in-app-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 9px 18px;
	border-radius: 9px;
	background: var(--primary);
	color: #fff;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
	transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.open-in-app-btn:hover {
	background: var(--primary-dark);
	box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
	transform: translateY(-1px);
}

/* ── Action row ─────────────────────────── */

.action-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-top: 4px;
}

/* ── Flash notification ─────────────────── */

.flash {
	position: fixed;
	right: 24px;
	bottom: 24px;
	max-width: 360px;
	padding: 14px 18px;
	border-radius: 12px;
	color: #fff;
	background: var(--success);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
	font-size: 0.9rem;
	font-weight: 500;
	z-index: 1000;
}

.flash.error {
	background: var(--danger);
}

.hidden {
	display: none !important;
}

/* ── Responsive ─────────────────────────── */

@media (max-width: 720px) {
	.page-shell {
		padding: 16px;
	}

	.hero-card {
		padding: 32px 24px;
		border-radius: 18px;
	}

	.panel {
		padding: 20px;
		border-radius: 16px;
	}

	h1 {
		font-size: 1.6rem;
	}

	.topbar {
		flex-direction: row;
		align-items: center;
	}

	.panel-head {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.tab-nav {
		display: flex;
		width: 100%;
	}

	.tab-btn {
		flex: 1;
		padding: 8px 12px;
		font-size: 0.8125rem;
	}

	.profile-header {
		gap: 16px;
	}

	.avatar-wrap {
		width: 60px;
		height: 60px;
	}

	.game-link-main {
		flex-direction: column;
		align-items: stretch;
	}

	.game-link-actions {
		justify-content: stretch;
	}

	.game-link-actions > * {
		flex: 1 1 100%;
	}
}

.topbar-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.toolbar-row {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.toolbar-row input[type="search"] {
	flex: 1 1 320px;
}

.list-summary {
	font-size: 0.84rem;
	color: var(--muted);
	margin-bottom: 12px;
}

.table-wrap {
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.92);
}

.data-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 900px;
}

.data-table th,
.data-table td {
	padding: 12px 14px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid rgba(30, 64, 175, 0.09);
	font-size: 0.84rem;
}

.data-table th {
	font-size: 0.76rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--muted);
	background: rgba(239, 244, 255, 0.8);
	position: sticky;
	top: 0;
}

.data-table tbody tr:hover {
	background: rgba(37, 99, 235, 0.03);
}

.table-title {
	font-weight: 600;
	color: var(--ink);
}

.table-subtitle {
	font-size: 0.78rem;
	color: var(--muted);
}

.table-empty {
	text-align: center;
	color: var(--muted);
	padding: 28px 14px;
}

.table-mono {
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
	font-size: 0.78rem;
}

.pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 14px;
}

.pager-label {
	font-size: 0.84rem;
	color: var(--muted);
}

.filter-group {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.status-pill {
	display: inline-flex;
	align-items: center;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(37, 99, 235, 0.09);
	border: 1px solid rgba(37, 99, 235, 0.16);
	color: var(--primary-dark);
	font-size: 0.76rem;
	font-weight: 600;
	text-transform: lowercase;
}

button:disabled,
.ghost-button:disabled,
.primary-button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

@media (max-width: 720px) {
	.topbar-actions {
		width: 100%;
		justify-content: space-between;
	}

	.toolbar-row {
		align-items: stretch;
	}

	.toolbar-row input[type="search"],
	.toolbar-row button,
	.pager button {
		flex: 1 1 100%;
	}

	.pager {
		flex-direction: column;
		align-items: stretch;
	}
}
