.wrv-root {
	--wrv-accent: #1f6f6b;
	--wrv-ink: #1d2327;
	--wrv-muted: #5f6b76;
	--wrv-line: #d9dee3;
	--wrv-bg: #f6f5f1;
	color: var(--wrv-ink);
	font-size: 15px;
	line-height: 1.45;
	box-sizing: border-box;
}
.wrv-root *,
.wrv-root *::before,
.wrv-root *::after { box-sizing: inherit; }
.wrv-root [hidden] { display: none !important; }

/* Welcome */
.wrv-welcome { text-align: center; padding: 28px 16px; background: var(--wrv-bg); border-radius: 16px; }
.wrv-title { margin: 0 0 8px; font-size: 1.7em; text-wrap: balance; }
.wrv-intro { max-width: 40em; margin: 0 auto 18px; color: var(--wrv-muted); }
.wrv-steps { list-style: none; counter-reset: wrv; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 0 0 22px; padding: 0; }
.wrv-steps li { counter-increment: wrv; flex: 1 1 180px; max-width: 240px; background: #fff; border-radius: 12px; padding: 14px 14px 14px 52px; position: relative; text-align: left; }
.wrv-steps li::before { content: counter(wrv); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--wrv-accent); color: #fff; font-weight: 700; display: grid; place-items: center; }
.wrv-status { color: #b32d2e; min-height: 1.4em; margin: 10px 0 0; }
.wrv-note { color: var(--wrv-muted); font-size: 0.85em; margin: 6px 0 0; }

/* Buttons */
.wrv-root .wrv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--wrv-accent); background: #fff; color: var(--wrv-accent); font: inherit; font-weight: 700; font-size: 0.9em; line-height: 1.2; text-decoration: none; cursor: pointer; }
.wrv-root .wrv-btn:hover { filter: brightness(0.96); }
.wrv-root .wrv-btn:focus-visible,
.wrv-root .wrv-tile:focus-visible,
.wrv-root .wrv-chip:focus-visible,
.wrv-root .wrv-handle:focus-visible { outline: 3px solid #f0b849; outline-offset: 2px; }
.wrv-root .wrv-btn:disabled { opacity: 0.45; cursor: default; }
.wrv-root .wrv-btn-primary,
.wrv-root .wrv-tool.is-active { background: var(--wrv-accent); color: #fff; }
.wrv-root .wrv-btn-ghost { border-color: var(--wrv-line); color: var(--wrv-ink); }
.wrv-root .wrv-upload { font-size: 1.05em; min-height: 50px; padding: 12px 28px; }

/* Layout */
.wrv-work { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.wrv-main { min-width: 0; }
.wrv-side { background: var(--wrv-bg); border-radius: 14px; padding: 14px; }

/* Stage */
.wrv-stage { position: relative; width: 100%; background: #111; border-radius: 12px; user-select: none; -webkit-user-select: none; }
.wrv-root .wrv-canvas { display: block; width: 100%; height: 100%; max-width: none; border-radius: 12px; }
.wrv-stage.is-brush .wrv-canvas { touch-action: none; cursor: crosshair; }
.wrv-stage.is-pan .wrv-canvas { touch-action: none; cursor: grab; }
.wrv-stage.is-panning .wrv-canvas { cursor: grabbing; }
.wrv-panhint { flex: 0 0 100%; margin: 0; color: var(--wrv-muted); font-size: 0.87em; }
.wrv-outline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wrv-outline polygon { fill: none; stroke: #fff; stroke-width: 2; stroke-dasharray: 7 5; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)); }
.wrv-root .wrv-handle { position: absolute; width: 30px; height: 30px; margin: 0; padding: 0; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid #fff; background: var(--wrv-accent); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55); cursor: grab; touch-action: none; z-index: 3; min-height: 0; }
.wrv-root .wrv-handle::after { content: ""; position: absolute; inset: -10px; }
.wrv-root .wrv-handle.is-dragging { cursor: grabbing; background: #e8591f; transform: translate(-50%, -50%) scale(1.15); }
.wrv-stage.is-brush .wrv-handles,
.wrv-stage.is-brush .wrv-outline { display: none; }
.wrv-root .wrv-addwall { position: absolute; transform: translate(-50%, -50%); z-index: 3; min-height: 0; margin: 0; padding: 7px 12px; border-radius: 999px; border: 2px solid #fff; background: var(--wrv-accent); color: #fff; font: inherit; font-size: 0.8em; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.55); }
.wrv-root .wrv-removewall { position: absolute; transform: translate(-50%, -50%); z-index: 3; width: 30px; height: 30px; min-height: 0; margin: 0; padding: 0; border-radius: 50%; border: 2px solid #fff; background: rgba(20, 20, 20, 0.72); color: #fff; font: inherit; font-size: 14px; line-height: 1; cursor: pointer; }
.wrv-root .wrv-addwall:focus-visible,
.wrv-root .wrv-removewall:focus-visible { outline: 3px solid #f0b849; outline-offset: 2px; }
.wrv-loupe { display: none; position: absolute; width: 110px; height: 110px; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5); pointer-events: none; z-index: 4; }
.wrv-aichip { position: absolute; left: 10px; top: 10px; z-index: 5; max-width: calc(100% - 20px); padding: 7px 14px; border-radius: 999px; background: rgba(20, 28, 34, 0.86); color: #fff; font-size: 0.82em; font-weight: 700; pointer-events: none; }
.wrv-aichip.is-busy::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: wrv-spin 0.9s linear infinite; }
@keyframes wrv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wrv-aichip.is-busy::before { animation: none; } }
.wrv-airow { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 0.9em; cursor: pointer; }
.wrv-airow input { width: 18px; height: 18px; accent-color: var(--wrv-accent); }
.wrv-ring { display: none; position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7); pointer-events: none; z-index: 2; }

/* Controls */
.wrv-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.wrv-hint { margin: 8px 0 0; color: var(--wrv-muted); font-size: 0.9em; min-height: 2.6em; }
.wrv-brushbox,
.wrv-designbox { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 10px 0 0; padding: 12px 14px; background: var(--wrv-bg); border-radius: 12px; }
.wrv-designbox .wrv-modes { margin: 0; flex: 0 0 100%; }
.wrv-row { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; min-width: 0; }
.wrv-row label { flex: 0 0 auto; font-size: 0.87em; font-weight: 600; }
.wrv-row input[type="range"] { flex: 1 1 auto; min-width: 80px; accent-color: var(--wrv-accent); }
.wrv-dims { display: flex; flex-wrap: wrap; gap: 10px 16px; flex: 0 0 100%; }
.wrv-row-num { flex: 0 1 auto; }
.wrv-dims-note { flex: 0 0 100%; margin: 0; color: var(--wrv-muted); font-size: 0.82em; }
.wrv-root .wrv-row-num input { width: 84px; padding: 6px 8px; border: 1px solid var(--wrv-line); border-radius: 8px; font: inherit; }
.wrv-product { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--wrv-line); border-radius: 12px; }
.wrv-product-info { display: flex; flex-direction: column; min-width: 0; }
.wrv-product-price { color: var(--wrv-muted); }
.wrv-product-btns,
.wrv-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wrv-actions { margin: 12px 0 0; }

/* Library */
.wrv-libtitle { margin: 0 0 10px; font-size: 1.05em; }
.wrv-root .wrv-search { width: 100%; padding: 9px 12px; border: 1px solid var(--wrv-line); border-radius: 10px; font: inherit; margin: 0 0 8px; background: #fff; }
.wrv-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: thin; }
.wrv-root .wrv-chip { flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--wrv-line); background: #fff; color: var(--wrv-ink); font: inherit; font-size: 0.85em; cursor: pointer; min-height: 0; }
.wrv-root .wrv-chip.is-active { background: var(--wrv-accent); border-color: var(--wrv-accent); color: #fff; }
.wrv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 620px; overflow-y: auto; padding: 2px; }
.wrv-root .wrv-tile { display: flex; flex-direction: column; gap: 3px; padding: 4px; margin: 0; border: 2px solid transparent; border-radius: 10px; background: #fff; color: var(--wrv-ink); font: inherit; text-align: left; cursor: pointer; min-height: 0; }
.wrv-root .wrv-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: #e7e7e7; }
.wrv-tile-name { font-size: 0.76em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wrv-tile-price { font-size: 0.76em; color: var(--wrv-muted); }
.wrv-root .wrv-tile.is-active { border-color: var(--wrv-accent); }
.wrv-root .wrv-tile.is-loading { opacity: 0.55; }
.wrv-libstatus { margin: 8px 0 0; color: var(--wrv-muted); font-size: 0.9em; }
.wrv-root .wrv-more { width: 100%; margin-top: 8px; }

@media (max-width: 900px) {
	.wrv-work { grid-template-columns: minmax(0, 1fr); }
	/* Phone: the library sits right under the photo tools. */
	.wrv-work { gap: 0; }
	.wrv-main { display: contents; }
	.wrv-stage { order: 1; }
	.wrv-main > .wrv-tools { order: 2; }
	.wrv-hint { order: 3; }
	.wrv-airow { order: 3; }
	.wrv-brushbox { order: 4; }
	.wrv-side { order: 5; margin-top: 12px; }
	.wrv-designbox { order: 6; }
	.wrv-product { order: 7; }
	.wrv-actions { order: 8; }
	.wrv-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); max-height: 380px; }
}
