/* WS Photo Card — generator page */
:root {
	--bg: #0b0d12;
	--bg-2: #10131a;
	--panel: #151922;
	--field: #0e1117;
	--line: #262c38;
	--line-2: #323a49;
	--text: #e7eaf0;
	--muted: #8b93a4;
	--ui: #1ea7e6;
	--ui-2: #0d8fcc;
	--radius: 16px;
	--font: "Hind Siliguri", "Noto Sans Bengali", system-ui, sans-serif;
	color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	background: radial-gradient(1200px 600px at 10% -10%, #16202e 0%, transparent 60%), var(--bg);
	color: var(--text);
	font: 15px/1.5 var(--font);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.pc-sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

/* Top bar */
.pc-top {
	position: sticky; top: 0; z-index: 20;
	display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
	padding: 10px 20px;
	background: rgba(11, 13, 18, .82);
	backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--line);
}
.pc-back {
	justify-self: start;
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 14px 7px 10px; border-radius: 999px;
	color: var(--text); text-decoration: none;
	background: var(--panel); border: 1px solid var(--line);
	transition: border-color .15s, background .15s;
}
.pc-back:hover { border-color: var(--line-2); background: #1b2030; }
.pc-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.pc-brand small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.1; }
.pc-brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--ui), #6d5dfc); color: #fff; }

/* Layout */
.pc-app {
	max-width: 1280px; margin: 0 auto;
	padding: 24px 20px 40px;
	display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start;
}
.pc-stage { position: sticky; top: 76px; min-width: 0; }
.pc-canvas-wrap {
	position: relative;
	display: flex; justify-content: center; align-items: center;
	padding: clamp(12px, 3vw, 40px);
	background:
		linear-gradient(45deg, #121620 25%, transparent 25%) 0 0 / 22px 22px,
		linear-gradient(-45deg, #121620 25%, transparent 25%) 0 0 / 22px 22px,
		var(--bg-2);
	border: 1px solid var(--line); border-radius: 22px;
}
#pc-canvas {
	display: block;
	width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 290px);
	border-radius: 6px;
	box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
	touch-action: manipulation;
	user-select: none; -webkit-user-select: none;
}
#pc-canvas.is-move { touch-action: none; outline: 2px dashed var(--ui); outline-offset: 4px; }
.pc-loading {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
	background: rgba(11, 13, 18, .6); border-radius: inherit; color: var(--muted);
	transition: opacity .25s;
}
.pc-loading.is-done { opacity: 0; pointer-events: none; }
.pc-spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ui); animation: pc-spin .8s linear infinite; }
@keyframes pc-spin { to { transform: rotate(360deg); } }

.pc-stage-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 2px 0; }
.pc-hint { margin: 0; flex: 1 1 220px; display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.pc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ui); flex: none; transform: translateY(-1px); }
.pc-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 12px; border-radius: 999px; font-size: 13px;
	background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
.pc-chip:hover { border-color: var(--line-2); }
.pc-chip[aria-pressed="true"] { background: var(--ui); border-color: var(--ui); color: #fff; }
.pc-chip svg { width: 15px; height: 15px; }
.pc-touch-only { display: none; }
@media (hover: none) and (pointer: coarse) {
	.pc-touch-only { display: inline-flex; }
	.pc-mouse-only { display: none; }
}

/* Design picker */
.pc-templates {
	display: flex; gap: 10px; margin-top: 14px; padding: 4px 2px 10px;
	overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin;
}
.pc-tpl {
	flex: none; scroll-snap-align: start;
	display: flex; flex-direction: column; align-items: center; gap: 6px;
	width: 104px; padding: 6px 6px 8px;
	background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
	font-size: 12.5px; color: var(--muted);
	transition: border-color .15s, transform .15s, color .15s;
}
.pc-tpl:hover { transform: translateY(-2px); border-color: var(--line-2); color: var(--text); }
.pc-tpl[aria-checked="true"] { border-color: var(--ui); color: var(--text); box-shadow: 0 0 0 3px rgba(30, 167, 230, .22); }
.pc-tpl canvas { width: 90px; height: auto; border-radius: 8px; background: var(--field); display: block; }
.pc-tpl span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Panel */
.pc-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pc-card {
	background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
	padding: 16px;
	display: flex; flex-direction: column; gap: 14px;
}
details.pc-card { padding: 0; gap: 0; }
details.pc-card > summary {
	list-style: none; cursor: pointer;
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 16px; font-weight: 600; font-size: 14px;
}
details.pc-card > summary::-webkit-details-marker { display: none; }
details.pc-card > summary::after {
	content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
	transform: rotate(45deg) translateY(-2px); transition: transform .2s;
}
details.pc-card[open] > summary::after { transform: rotate(225deg) translate(-2px, 0); }
details.pc-card > :not(summary) { margin: 0 16px 14px; }

.pc-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.pc-field { min-width: 0; }
.pc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pc-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pc-grid3 .pc-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-note { margin: 0; font-size: 12.5px; color: var(--muted); }

textarea, input[type="text"], input[type="date"], select {
	width: 100%; padding: 10px 12px;
	background: var(--field); border: 1px solid var(--line); border-radius: 12px;
	outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; font-size: 16px; line-height: 1.55; font-weight: 600; }
textarea:focus, input[type="text"]:focus, input[type="date"]:focus, select:focus { border-color: var(--ui); box-shadow: 0 0 0 3px rgba(30, 167, 230, .18); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }

/* Range */
.pc-range-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.pc-range-head output { min-width: 34px; text-align: center; padding: 1px 7px; border-radius: 7px; background: var(--field); border: 1px solid var(--line); color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; --p: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(var(--ui), var(--ui)) 0 / var(--p) 100% no-repeat, var(--line-2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ui); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 3px solid var(--ui); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--ui); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(30, 167, 230, .3); }

/* Colour */
.pc-color { display: block; cursor: pointer; }
.pc-color input[type="color"] {
	width: 100%; height: 42px; padding: 4px; cursor: pointer;
	background: var(--field); border: 1px solid var(--line); border-radius: 12px;
	-webkit-appearance: none; appearance: none;
}
.pc-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.pc-color input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.pc-color input[type="color"]::-moz-color-swatch { border: 0; border-radius: 8px; }

/* Segmented */
.pc-seg { display: flex; padding: 3px; gap: 3px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; }
.pc-seg button { flex: 1; display: grid; place-items: center; min-height: 34px; padding: 4px 6px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; transition: background .15s, color .15s; }
.pc-seg button:hover { color: var(--text); }
.pc-seg button[aria-checked="true"] { background: #232a38; color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.pc-seg--text button[aria-checked="true"] { background: var(--ui); color: #fff; }

/* File pickers */
.pc-file-row { display: flex; gap: 8px; }
.pc-file-row .pc-file { flex: 1; min-width: 0; }
.pc-file {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 8px 8px 8px 14px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--field);
	font-size: 13.5px; color: var(--muted);
}
.pc-file > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-btn-sm { position: relative; flex: none; padding: 6px 14px; border-radius: 9px; background: #232a38; color: var(--text); font-size: 13px; cursor: pointer; transition: background .15s; }
.pc-btn-sm:hover { background: #2c3546; }
.pc-btn-sm:focus-within { outline: 2px solid var(--ui); outline-offset: 2px; }
.pc-icon-btn { flex: none; width: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); color: var(--muted); font-size: 20px; }
.pc-icon-btn:hover { color: #fff; border-color: #a33; background: #2a1517; }
.pc-link { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--ui); font-size: 13px; }

/* Switches */
.pc-switches { display: flex; gap: 18px; flex-wrap: wrap; }
.pc-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.pc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pc-switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; }
.pc-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.pc-switch input:checked + span { background: var(--ui); }
.pc-switch input:checked + span::after { transform: translateX(16px); }
.pc-switch input:focus-visible + span { outline: 2px solid var(--ui); outline-offset: 2px; }

/* Actions */
.pc-actions { position: sticky; bottom: 12px; z-index: 5; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: rgba(21, 25, 34, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .6); }
.pc-primary {
	display: flex; align-items: center; gap: 10px;
	width: 100%; min-height: 54px; padding: 0 18px;
	border: 0; border-radius: 13px;
	background: linear-gradient(135deg, var(--ui), var(--ui-2)); color: #fff;
	font-size: 17px; font-weight: 700;
	box-shadow: 0 10px 24px -12px var(--ui);
	transition: transform .12s, filter .15s;
}
.pc-primary:hover { filter: brightness(1.08); }
.pc-primary:active { transform: scale(.985); }
.pc-primary:disabled { opacity: .6; cursor: progress; }
.pc-primary small { margin-left: auto; font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; opacity: .8; letter-spacing: .04em; }
.pc-actions-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.pc-secondary {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 42px; padding: 0 12px; border-radius: 11px;
	background: #1f2533; border: 1px solid var(--line); font-size: 14px; font-weight: 600;
	transition: background .15s, border-color .15s;
}
.pc-secondary:hover { background: #262e3f; border-color: var(--line-2); }
.pc-secondary svg { width: 16px; height: 16px; }
.pc-secondary--ghost { background: transparent; color: var(--muted); font-weight: 400; }
.pc-credit { margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--muted); }

/* Toast */
.pc-toast {
	position: fixed; left: 50%; bottom: 24px; z-index: 50;
	transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
	padding: 10px 18px; border-radius: 12px; max-width: calc(100vw - 32px);
	background: #f3f5f8; color: #0b0d12; font-size: 14px; font-weight: 600;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
	transition: opacity .2s, transform .2s;
}
.pc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Share sheet */
.pc-sheet {
	width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
	padding: 0; border: 1px solid var(--line); border-radius: 20px;
	background: var(--panel); color: var(--text);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
}
.pc-sheet[open] { animation: pc-pop .18s ease-out; }
.pc-sheet::backdrop { background: rgba(5, 7, 10, .65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes pc-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.pc-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.pc-sheet-head h2 { margin: 0; font-size: 18px; }
.pc-sheet-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #232a38; font-size: 20px; line-height: 1; }
.pc-sheet-close:hover { background: #2c3546; }
.pc-sheet-main { display: flex; flex-direction: column; gap: 8px; padding: 8px 18px 4px; }
.pc-sheet-big {
	display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; text-align: left;
	border: 1px solid var(--line); border-radius: 14px; background: var(--field);
	transition: border-color .15s, background .15s;
}
.pc-sheet-big:hover { border-color: var(--ui); background: #121a24; }
.pc-sheet-big b { display: block; font-size: 15px; }
.pc-sheet-big small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.pc-sheet-big-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--ui), #6d5dfc); color: #fff; }
#pc-share-native .pc-sheet-big-icon { background: linear-gradient(135deg, #22c55e, #0ea5e9); }
.pc-sheet-sub { margin: 14px 18px 8px; font-size: 13px; color: var(--muted); }
.pc-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 12px 18px; }
.pc-sheet-grid button {
	display: flex; flex-direction: column; align-items: center; gap: 7px;
	padding: 10px 4px; border: 0; border-radius: 14px; background: transparent; font-size: 13px;
	transition: background .15s;
}
.pc-sheet-grid button:hover, .pc-sheet-grid button:focus-visible { background: #1c2230; outline: none; }
.pc-sheet-grid button > span { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--c); color: #fff; box-shadow: 0 8px 18px -10px var(--c); transition: transform .15s; }
.pc-sheet-grid button:hover > span { transform: translateY(-2px); }
.pc-sheet-grid svg { width: 26px; height: 26px; }
.pc-sheet-grid svg path.f { fill: currentColor; stroke: none; }
.pc-sheet-grid button[data-net="x"] > span { border: 1px solid #333; }
.pc-sheet-grid.is-wait button[data-needs-link="1"] { opacity: .45; pointer-events: none; }
.pc-share-status { display: flex; align-items: center; gap: 8px; margin: -2px 18px 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: var(--field); color: var(--muted); }
.pc-share-status[data-state="wait"]::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ui); animation: pc-spin .8s linear infinite; }
.pc-share-status[data-state="ready"] { background: rgba(34, 197, 94, .12); color: #86efac; }
.pc-share-status[data-state="fail"] { background: rgba(239, 68, 68, .12); color: #fca5a5; }

/* Responsive */
@media (max-width: 1024px) {
	.pc-app { grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; }
}
@media (max-width: 860px) {
	.pc-app { grid-template-columns: minmax(0, 1fr); padding: 14px 16px 130px; }
	.pc-stage { position: static; }
	#pc-canvas { width: 100%; min-width: 0; max-height: none; }
	.pc-canvas-wrap { padding: 10px; border-radius: 18px; }
	.pc-actions {
		position: fixed; left: 0; right: 0; bottom: 0;
		border-radius: 18px 18px 0 0; border-width: 1px 0 0;
		padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
		flex-direction: row; align-items: stretch;
	}
	.pc-primary { flex: 1; min-height: 48px; font-size: 15.5px; }
	.pc-primary small { display: none; }
	.pc-actions-row { display: flex; }
	.pc-actions-row .pc-secondary { width: 48px; padding: 0; font-size: 0; gap: 0; }
	.pc-actions-row .pc-secondary svg { width: 19px; height: 19px; }
	.pc-toast { bottom: 90px; }
	/* Bottom sheet on phones. */
	.pc-sheet {
		width: 100%; max-width: none; margin: auto 0 0; max-height: 88vh;
		border-radius: 22px 22px 0 0; border-width: 1px 0 0;
		padding-bottom: env(safe-area-inset-bottom);
	}
	.pc-sheet[open] { animation: pc-up .22s ease-out; }
	.pc-sheet-head::before { content: ""; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-2); }
}
@keyframes pc-up { from { transform: translateY(100%); } }
@media (max-width: 560px) {
	.pc-top { grid-template-columns: auto 1fr; padding: 8px 12px; }
	.pc-top-spacer { display: none; }
	.pc-brand { justify-self: end; font-size: 15px; }
	.pc-brand small { display: none; }
	.pc-back span { display: none; }
	.pc-back { padding: 8px; }
	.pc-grid2 { grid-template-columns: 1fr; }
	.pc-grid2:has(.pc-range), .pc-grid2:has(.pc-color) { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
