/* josiah.games admin: shared shell and components for every game's panel.
   Same family as the public site (ink outlines, pastels, Bricolage), tuned
   denser for a work tool. */

:root {
	--bg: #ebe8f2;
	--bg-dot: #d6d1e3;
	--surface: #fff;
	--surface-2: #f6f5fa;
	--ink: #000;
	--muted: #5d5970;
	--line: #000;
	--hairline: #0000001f;

	--yellow: #ffe066;
	--mint: #55efc4;
	--mint-strong: #00b894;
	--peach: #fab1a0;
	--coral: #ff7a59;
	--cyan: #81ecec;
	--pink: #ffb3d1;
	--lilac: #c7b8ff;
	--danger: #ff6b6b;

	--radius: 14px;
	--radius-sm: 8px;
	--border: 2px solid var(--line);
	--shadow: 3px 3px 0 var(--ink);
	--shadow-lg: 6px 6px 0 var(--ink);
	--ease-out: cubic-bezier(0.22, 1, 0.36, 1);
	--ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
	--font: "Bricolage Grotesque", system-ui, sans-serif;

	color-scheme: light;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

::selection {
	background: var(--ink);
	color: #fff;
}

body {
	margin: 0;
	min-height: 100dvh;
	background-color: var(--bg);
	background-image: radial-gradient(var(--bg-dot) 1.1px, transparent 1.3px);
	background-size: 20px 20px;
	color: var(--ink);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
	margin: 0;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.1;
}

p {
	margin: 0;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

[hidden] {
	display: none !important;
}

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

.icon {
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.card {
	border: var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}

.empty {
	padding: 40px 20px;
	color: var(--muted);
	text-align: center;
}

kbd {
	display: inline-block;
	min-width: 1.6em;
	padding: 0 5px;
	border: 1.5px solid currentColor;
	border-bottom-width: 2.5px;
	border-radius: 5px;
	font: 600 12px/1.5 var(--font);
	text-align: center;
	opacity: 0.75;
}

/* ---------- Buttons ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 6px 13px;
	border: var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), background-color 0.15s;
}

.btn:hover {
	background: var(--surface-2);
}

.btn:active {
	transform: translate(1px, 1px);
}

.btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.btn.primary {
	background: var(--mint);
	box-shadow: var(--shadow);
}

.btn.primary:hover {
	transform: translate(-1px, -1px);
	box-shadow: 4px 4px 0 var(--ink);
}

.btn.primary:active {
	transform: translate(3px, 3px);
	box-shadow: 0 0 0 var(--ink);
}

.btn.big {
	padding: 10px 20px;
	font-size: 17px;
}

.btn.ghost {
	border-color: transparent;
	background: transparent;
}

.btn.ghost:hover {
	border-color: var(--ink);
	background: var(--surface);
}

.btn.danger:hover,
.btn.armed {
	background: var(--danger);
	border-color: var(--ink);
}

.btn.small {
	padding: 3px 9px;
	font-size: 14px;
}

.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.icon-btn:hover {
	border-color: var(--ink);
	background: var(--surface);
}

/* ---------- Fields ---------- */

.field {
	display: grid;
	gap: 5px;
}

.field-label {
	font-weight: 700;
	font-size: 14px;
}

.field-hint {
	color: var(--muted);
	font-size: 13px;
}

input[type="text"],
input[type="password"],
input[type="search"],
select,
textarea {
	width: 100%;
	padding: 7px 10px;
	border: var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	outline: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--mint-strong);
	outline-offset: 1px;
}

select {
	appearance: none;
	padding-right: 30px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 16px;
	cursor: pointer;
}

/* Segmented control */
.seg {
	display: inline-flex;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	overflow: hidden;
}

.seg button {
	padding: 4px 13px;
	border: 0;
	background: transparent;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
}

.seg button + button {
	border-left: var(--border);
}

.seg button:hover {
	background: var(--surface-2);
}

.seg button[aria-pressed="true"] {
	background: var(--ink);
	color: #fff;
}

.seg button:focus-visible {
	outline-offset: -5px;
}

/* Switch */
.switch {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
}

.switch input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.switch-track {
	position: relative;
	width: 38px;
	height: 22px;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	transition: background-color 0.15s;
}

.switch-track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--ink);
	transition: transform 0.25s var(--ease-spring);
}

.switch input:checked + .switch-track {
	background: var(--yellow);
}

.switch input:checked + .switch-track::after {
	transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
	outline: 3px solid var(--mint-strong);
	outline-offset: 2px;
}

/* ---------- Toast ---------- */

.toast {
	position: fixed;
	left: 50%;
	bottom: 22px;
	z-index: 100;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 9px 10px 9px 18px;
	border-radius: 50px;
	background: var(--ink);
	color: #fff;
	font-weight: 600;
	transform: translate(-50%, calc(100% + 40px));
	visibility: hidden;
	transition: transform 0.3s var(--ease-spring), visibility 0s 0.3s;
}

.toast.show {
	transform: translate(-50%, 0);
	visibility: visible;
	transition: transform 0.3s var(--ease-spring);
}

.toast[data-tone="error"] {
	background: #b3261e;
}

.toast-action {
	padding: 3px 12px;
	border: 2px solid #fff;
	border-radius: 50px;
	background: transparent;
	font-weight: 700;
	cursor: pointer;
}

.toast-action:hover {
	background: #fff;
	color: var(--ink);
}

/* ---------- Sign in ---------- */

.login-wrap {
	display: grid;
	place-items: center;
	min-height: 100dvh;
	padding: 20px;
}

.login {
	display: grid;
	gap: 16px;
	width: min(100%, 360px);
	padding: 26px;
	box-shadow: var(--shadow-lg);
}

.login h1 {
	font-size: 40px;
}

.login-error {
	min-height: 1.4em;
	color: #b3261e;
	font-weight: 600;
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-weight: 800;
	font-size: 18px;
	letter-spacing: -0.02em;
}

.dots {
	display: grid;
	grid-template-columns: 10px 10px;
	gap: 2px;
}

.dots span {
	width: 10px;
	height: 10px;
	border: 2px solid var(--ink);
	border-radius: 50%;
}

.dots span:nth-child(1) { background: var(--pink); }
.dots span:nth-child(2) { background: var(--yellow); }
.dots span:nth-child(3) { background: var(--mint); }
.dots span:nth-child(4) { background: var(--lilac); }

/* ---------- Shell ---------- */

.shell {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	min-height: 100dvh;
}

.side {
	position: sticky;
	top: 0;
	display: flex;
	flex-direction: column;
	gap: 22px;
	height: 100dvh;
	padding: 18px 14px;
	border-right: var(--border);
	background: var(--surface);
}

.side-brand {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 0 6px;
	color: inherit;
	text-decoration: none;
}

.side-tag {
	padding: 0 8px;
	border: var(--border);
	border-radius: 50px;
	background: var(--ink);
	color: #fff;
	font-weight: 700;
	font-size: 12px;
}

.side-nav {
	display: grid;
	gap: 18px;
}

.side-game h2 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 6px 6px;
	font-size: 16px;
}

.game-dot {
	width: 14px;
	height: 14px;
	border: 2px solid var(--ink);
	border-radius: 50%;
	background: var(--game);
}

.side-game ul {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.side-game a {
	display: block;
	padding: 5px 12px;
	border: 2px solid transparent;
	border-radius: 50px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.side-game a:hover {
	border-color: var(--ink);
}

.side-game a[aria-current] {
	border-color: var(--ink);
	background: var(--game);
}

.side-signout {
	margin-top: auto;
	justify-content: flex-start;
}

.stage {
	min-width: 0;
	padding: 24px 28px 60px;
}

.panel-root {
	max-width: 1500px;
}

/* Section header used by panels */
.section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
}

.section-head h1 {
	font-size: 34px;
	margin-right: 4px;
}

.count-pill {
	padding: 1px 10px;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	font-weight: 700;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

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

.search {
	position: relative;
	flex: 0 1 300px;
}

.search .icon {
	position: absolute;
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

.search input {
	padding-left: 34px;
}

.search kbd {
	position: absolute;
	right: 9px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}

.chip-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 11px;
	border: var(--border);
	border-radius: 50px;
	background: var(--surface);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
}

.chip:hover {
	background: var(--surface-2);
}

.chip[aria-pressed="true"] {
	background: var(--ink);
	color: #fff;
}

.chip .n {
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}

/* Checkerboard behind artwork so transparency is visible */
.checker {
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #ececf2 25%, transparent 25%),
		linear-gradient(-45deg, #ececf2 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #ececf2 75%),
		linear-gradient(-45deg, transparent 75%, #ececf2 75%);
	background-size: 16px 16px;
	background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Full-window drop target */
.drop-overlay {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: grid;
	place-items: center;
	padding: 24px;
	background: #ebe8f2e6;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s;
}

.drop-overlay.show {
	opacity: 1;
}

.drop-overlay > div {
	display: grid;
	justify-items: center;
	gap: 10px;
	width: min(100%, 640px);
	padding: 60px 30px;
	border: 3px dashed var(--ink);
	border-radius: 24px;
	background: var(--surface);
	font-weight: 800;
	font-size: 26px;
	text-align: center;
	transform: scale(0.96);
	transition: transform 0.25s var(--ease-spring);
}

.drop-overlay.show > div {
	transform: scale(1);
}

.drop-overlay p {
	color: var(--muted);
	font-weight: 500;
	font-size: 16px;
}

@media (max-width: 860px) {
	.shell {
		grid-template-columns: 1fr;
	}

	.side {
		position: static;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		height: auto;
		border-right: 0;
		border-bottom: var(--border);
	}

	.side-nav {
		display: flex;
		gap: 14px;
	}

	.side-game {
		display: flex;
		align-items: center;
		gap: 6px;
	}

	.side-game h2 {
		display: none;
	}

	.side-game ul {
		display: flex;
	}

	.side-signout {
		margin: 0 0 0 auto;
	}

	.stage {
		padding: 18px 16px 60px;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		transition-duration: 0.001ms !important;
	}
}
