/* ============================================================================
 * Diorama Game — Frontend styles.
 * ========================================================================== */

:root {
	--dior-bg:        #0f172a;
	--dior-bg-2:      #1e293b;
	--dior-bar-bg:    rgba(15, 23, 42, 0.94);
	--dior-bar-border: rgba(255, 255, 255, 0.08);
	--dior-slot-bg:   rgba(255, 255, 255, 0.04);
	--dior-slot-bg-hover: rgba(255, 255, 255, 0.10);
	--dior-text:      #f1f5f9;
	--dior-text-muted:#94a3b8;
	--dior-accent:    #10b981;
	--dior-accent-2:  #38bdf8;
	--dior-warn:      #f97316;
	--dior-shadow:    0 14px 40px rgba(0, 0, 0, 0.35);
	--dior-radius:    14px;
	--dior-bar-height: 124px;
}

/* ============================================================================
 * Container
 * ========================================================================== */
.diorama-game {
	position: relative;
	width: 100%;
	max-width: 1200px;
	margin: 24px auto;
	background: linear-gradient(180deg, var(--dior-bg) 0%, var(--dior-bg-2) 100%);
	color: var(--dior-text);
	border-radius: var(--dior-radius);
	overflow: hidden;
	box-shadow: var(--dior-shadow);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
}

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

/* The canvas takes the full width and reserves a strip at the bottom for the bar. */
.diorama-game__canvas-wrap {
	position: relative;
	width: 100%;
	height: clamp(360px, 60vh, 720px);
}

.diorama-game canvas {
	display: block;
	width: 100% !important;
	height: 100% !important;
	-webkit-tap-highlight-color: transparent;
}

/* ============================================================================
 * Loading overlay
 * ========================================================================== */
.diorama-game__loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: var(--dior-bg);
	color: var(--dior-text);
	z-index: 5;
	transition: opacity 0.4s ease;
}

.diorama-game.is-loaded .diorama-game__loading { opacity: 0; pointer-events: none; }

.diorama-game__spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(255, 255, 255, 0.15);
	border-top-color: var(--dior-accent);
	border-radius: 50%;
	animation: dior-spin 0.85s linear infinite;
}

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

/* ============================================================================
 * HUD (top overlay: title + hint)
 * ========================================================================== */
.diorama-game__hud {
	position: absolute;
	top: 14px;
	left: 16px;
	right: 16px;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	pointer-events: none;
	z-index: 4;
}

/* Right-side cluster: hint + optional mute toggle.
 * `pointer-events: none` is on the parent .diorama-game__hud so the
 * drag/raycast over the canvas keeps working. The button re-enables
 * pointer-events on itself so the user can still click it. */
.diorama-game__hud-right {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	pointer-events: none;
}

/* Mute / unmute button shown to the right of the "Drag the pieces"
 * hint whenever the admin attached a music URL to the diorama.
 * Hidden by default (`hidden` attribute) until game.js confirms the
 * audio element actually loaded, so we never show a broken icon. */
.diorama-game__music-controls {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	pointer-events: none;
	padding: 4px 4px 6px;
	border-radius: 14px;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: background 180ms ease;
}
.diorama-game__music-controls:hover {
	background: rgba(15, 23, 42, 0.75);
}

.diorama-game__music-toggle {
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px !important;
	height: 32px;
	padding: 0 !important;
	border: 1px solid rgba(255, 255, 255, 0.15) !important;
	border-radius: 999px;
	background: rgba(15, 23, 42, 0.6);
	color: var(--dior-text) !important;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: background 180ms ease, border-color 180ms ease, transform 120ms ease;
}
.diorama-game__music-toggle:hover {
	background: rgba(15, 23, 42, 0.85) !important;
	border-color: rgba(255, 255, 255, 0.3) !important;
}
.diorama-game__music-toggle:active {
	transform: scale(0.94);
}
.diorama-game__music-toggle:focus-visible {
	outline: 2px solid var(--dior-accent);
	outline-offset: 2px;
}
/* Stack the two emoji icons on top of each other and toggle which one
 * is visible based on the [aria-pressed] attribute set by game.js. */
.diorama-game__music-icon {
	display: none;
	line-height: 1;
}
.diorama-game__music-toggle[aria-pressed="false"] .diorama-game__music-icon--on,
.diorama-game__music-toggle[aria-pressed="true"]  .diorama-game__music-icon--off {
	display: inline;
}

/* Vertical volume slider. Only rendered when the admin attached a music
 * URL; game.js further hides it whenever the audio is muted (the slider
 * would be useless while the user can't hear anything). */
.diorama-game__music-volume-wrap {
	pointer-events: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 84px;
	cursor: pointer;
}
.diorama-game__music-volume {
	pointer-events: auto;
	-webkit-appearance: slider-vertical; /* legacy WebKit / old Firefox */
	appearance: slider-vertical;
	writing-mode: vertical-lr;          /* modern Chromium / Edge / Firefox */
	direction: rtl;                     /* top = max, bottom = min */
	width: 16px;
	height: 84px;
	margin: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
}
.diorama-game__music-volume:focus-visible {
	outline: 2px solid var(--dior-accent);
	outline-offset: 4px;
}
/* WebKit / Blink track + thumb — WebKit ignores the input's background
 * colour so we have to paint the track on `::-webkit-slider-runnable-track`
 * and the thumb on `::-webkit-slider-thumb`. */
.diorama-game__music-volume::-webkit-slider-runnable-track {
	width: 4px;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 999px;
}
.diorama-game__music-volume::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--dior-accent, #10b981);
	border: 2px solid rgba(255, 255, 255, 0.85);
	margin-left: -5px; /* centre the thumb over the 4px track */
	cursor: pointer;
	transition: transform 120ms ease, box-shadow 120ms ease;
}
.diorama-game__music-volume::-webkit-slider-thumb:hover {
	transform: scale(1.12);
	box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
}
/* Firefox paints its own track + thumb via pseudo-elements. */
.diorama-game__music-volume::-moz-range-track {
	width: 4px;
	background: rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	border: none;
}
.diorama-game__music-volume::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--dior-accent, #10b981);
	border: 2px solid rgba(255, 255, 255, 0.85);
	cursor: pointer;
	transition: transform 120ms ease, box-shadow 120ms ease;
}
.diorama-game__music-volume::-moz-range-thumb:hover {
	transform: scale(1.12);
	box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25);
}

.diorama-game__hud-title {
	font-weight: 600;
	font-size: 16px;
	background: rgba(15, 23, 42, 0.6);
	padding: 6px 12px;
	border-radius: 999px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	max-width: 60%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.diorama-game__hud-hint {
	font-size: 12px;
	color: var(--dior-text-muted);
	background: rgba(15, 23, 42, 0.6);
	padding: 6px 12px;
	border-radius: 999px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* ============================================================================
 * Bottom inventory bar
 *
 * The bar is positioned ABSOLUTELY over the bottom of the canvas so the
 * shared-canvas scissor test (in game.js → `_render()`) can paint the
 * mini piece previews *inside* each slot. The bar and the slots must be
 * transparent (or semi-transparent) so the 3D content painted on the
 * canvas behind them is visible to the player.
 * ========================================================================== */
.diorama-game__bar {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: var(--dior-bar-height);
	/* Subtle gradient so the bar reads as a distinct region without
	 * hiding the canvas content behind it. The 3D piece previews are
	 * painted onto the shared canvas underneath each slot, so the
	 * gradient is intentionally translucent — opacity was lowered from
	 * 0.85→0.45 so a slot can actually read its piece instead of a
	 * black square. */
	background: linear-gradient( to top, rgba(11, 18, 32, 0.45) 0%, rgba(11, 18, 32, 0.18) 60%, rgba(11, 18, 32, 0) 100% );
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	z-index: 3;
}

.diorama-game__slot {
	flex: 0 0 auto;
	width: 96px;
	height: 96px;
	/* Transparent so the 3D piece painted on the canvas (via the scissor
	 * test) shows through. The border + hover styles keep the slot
	 * visually distinct. */
	background: transparent;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	position: relative;
	touch-action: none;
	overflow: hidden;
	/* Long-form transitions so the placement + slide animations can run
	 * without competing with the quick hover transitions. */
	transition:
		transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		opacity   320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		width     320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		min-width 320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		padding   320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		margin    320ms cubic-bezier(0.22, 0.61, 0.36, 1),
		border-color 180ms ease,
		background 180ms ease,
		box-shadow 180ms ease;
}

/* The slot whose piece has just been placed: fades out + collapses so the
 * slots to its right can slide over it. */
.diorama-game__slot.is-fading-out {
	opacity: 0;
	transform: scale(0.6);
	width: 0 !important;
	min-width: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: -10px; /* offset the flex gap so neighbours close it cleanly */
	border-color: transparent;
	pointer-events: none;
}

/* Slots that sit to the right of a freshly-placed slot: slide left by
 * the width of the collapsed slot so the bar stays visually contiguous. */
.diorama-game__slot.is-sliding-left {
	transform: translateX(var(--dior-slide-distance, 0px));
	pointer-events: none;
}

.diorama-game__slot:hover {
	/* Subtle highlight so the user knows the slot is interactive.
	 * Kept low-opacity so the 3D piece painted on the canvas behind it
	 * stays clearly visible. */
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.3);
	transform: translateY(-2px);
}

.diorama-game__slot.is-dragging { cursor: grabbing; opacity: 0.55; }

.diorama-game__slot canvas {
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.diorama-game__slot-label {
	position: absolute;
	bottom: 4px;
	left: 4px;
	right: 4px;
	text-align: center;
	font-size: 10.5px;
	color: rgba(255, 255, 255, 0.65);
	background: rgba(0, 0, 0, 0.35);
	border-radius: 6px;
	padding: 2px 4px;
	pointer-events: none;
}

/* The order of appearance is hinted with a small dot. */
.diorama-game__slot-order {
	position: absolute;
	top: 4px;
	right: 6px;
	font-size: 10px;
	color: rgba(255, 255, 255, 0.55);
	pointer-events: none;
}

/* When a piece is being dragged, hide its slot. */
.diorama-game__slot.is-empty {
	opacity: 0.25;
	pointer-events: none;
}

/* Prerequisite not yet placed → de-emphasise, disable pointer. */
.diorama-game__slot.is-locked {
	cursor: not-allowed;
	opacity: 0.4;
	filter: grayscale(0.7);
}
.diorama-game__slot.is-locked:hover {
	background: var(--dior-slot-bg);
	transform: none;
}

/* ============================================================================
 * Floating drag image (so the original DOM element can stay put while
 * we render a small 3D-flavoured tooltip under the cursor).
 * ========================================================================== */
.diorama-game__drag-shadow {
	position: fixed;
	width: 110px;
	height: 110px;
	pointer-events: none;
	border-radius: 12px;
	/* Use `background-color` (not the `background` shorthand) so we
	 * don't clobber the `background-image` that `_spawnDragShadow`
	 * sets inline when a piece preview is available. */
	background-color: rgba(16, 185, 129, 0.18);
	border: 2px solid var(--dior-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	transform: translate(-50%, -50%) scale(0.92);
	transition: transform 0.12s ease;
	box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.diorama-game__drag-shadow::after {
	content: "✋";
	font-size: 26px;
	color: #fff;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.diorama-game__drag-shadow.is-invalid { background-color: rgba(239, 68, 68, 0.15); border-color: #ef4444; }
.diorama-game__drag-shadow.is-valid   { background-color: rgba(16, 185, 129, 0.25); border-color: var(--dior-accent); }

/* When a piece preview is available, show it instead of the ✋ emoji.
 * The PNG is pre-rendered by `_renderPiecePreview` in game.js and set
 * as `background-image` on the element. The preview occupies most of
 * the box (with a small padding ring so the validity tint stays
 * visible around the silhouette). */
.diorama-game__drag-shadow.has-preview {
	background-size: 84% 84%;
	background-repeat: no-repeat;
	background-position: center;
}
.diorama-game__drag-shadow.has-preview::after {
	content: none;
}
/* Validity tinting when a preview is showing: the image covers most of
 * the box, so we use a subtler hue (border + faint backdrop colour).
 * The `is-valid` / `is-invalid` rules above win for elements without
 * the `has-preview` class. */
.diorama-game__drag-shadow.has-preview.is-valid {
	background-color: rgba(16, 185, 129, 0.08);
	border-color: var(--dior-accent);
}
.diorama-game__drag-shadow.has-preview.is-invalid {
	background-color: rgba(239, 68, 68, 0.10);
	border-color: #ef4444;
}

/* ============================================================================
 * Win modal
 * ========================================================================== */
.diorama-game__win {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.65);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 6;
	animation: dior-fade 0.35s ease both;
}

@keyframes dior-fade { from { opacity: 0; } to { opacity: 1; } }

.diorama-game__win[hidden] { display: none; }

.diorama-game__win-panel {
	background: rgb(255 255 255 / 96%);
	border: 2px solid #000000;
	border-radius: 18px;
	padding: 28px 30px;
	text-align: center;
	max-width: 90%;
	width: 380px;
	box-shadow: var(--dior-shadow);
	/* Scale-in animation when JS adds the `is-animating` class.
	 * Slight overshoot (1.06×) before settling gives the modal a
	 * satisfying "pop" feel, mirroring the per-piece pulse. */
	transform: scale(0.7);
	opacity: 0;
}
.diorama-game__win.is-animating .diorama-game__win-panel {
	animation: dior-win-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes dior-win-pop {
	0%   { transform: scale(0.7)  translateY(20px); opacity: 0; }
	60%  { transform: scale(1.06) translateY(-4px); opacity: 1; }
	100% { transform: scale(1)    translateY(0);    opacity: 1; }
}
/* Title shake so the modal feels "alive" right after the celebration. */
.diorama-game__win.is-animating .diorama-game__win-title {
	animation: dior-win-shake 600ms ease-out 120ms both;
}
@keyframes dior-win-shake {
	0%   { transform: translateX(0)    rotate(0); }
	20%  { transform: translateX(-6px) rotate(-2deg); }
	40%  { transform: translateX(5px)  rotate(2deg); }
	60%  { transform: translateX(-3px) rotate(-1deg); }
	80%  { transform: translateX(2px)  rotate(1deg); }
	100% { transform: translateX(0)    rotate(0); }
}

/* DOM confetti particles spawned on top of the win modal by
 * `_spawnWinConfetti()`. The JS sets `left`/`top` (anchors) + per-
 * frame `transform` (translation + rotation) + `opacity` (fade).
 * `will-change: transform, opacity` puts the particles on their
 * own compositor layer so the rest of the modal stays jank-free
 * even with 60 simultaneous animations. */
.diorama-game__win-confetti {
	position: absolute;
	display: block;
	width: 8px;
	height: 14px;
	border-radius: 2px;
	pointer-events: none;
	will-change: transform, opacity;
	z-index: 1;
}

.diorama-game__win-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 18px;
	color: #000000;
}

.diorama-game__win-actions {
	display: flex;
	gap: 12px;
	flex-direction: column;
}

.diorama-game__btn {
	width: 100%;
    font-family: var(--e-global-typography-accent-font-family), Sans-serif !important;
    font-weight: var(--e-global-typography-accent-font-weight);
    text-transform: var(--e-global-typography-accent-text-transform);
    font-weight: 500;
    color: #000000 !important;
    background-color: var(--e-global-color-accent) !important;
    border-style: solid;
    border-width: 2px 2px 2px 2px;
    border-color: #000000 !important;
    border-radius: 3px 3px 3px 3px;
    padding: 12px 16px 12px 16px;
    box-shadow: .9px -1px 0 0 #000, 1.5px -2px 0 0 #000, 2.5px -3px 0 0 #000, 3.5px -4px 0 0 #000, 4.5px -5px 0 0 #000, 5.5px -6px 0 0 #000, 6.5px -7px 0 0 #000, 7.5px -8px 0 0 #000, 8.5px -9px 0 0 #000, 9.5px -10px 0 0 #000;
    transition: all .3s;
}

.diorama-game__btn:hover,
.diorama-game__btn:active { 
	background: #000000 !important;
    border-color: #000 !important;
    color: #ffffff !important;
    box-shadow: none;
 }

.diorama-game__btn--another { background: rgba(255, 255, 255, 0.08); color: #fff; }
.diorama-game__btn--another:hover { background: rgba(255, 255, 255, 0.16); box-shadow: none; }

/* ============================================================================
 * Free-camera mode (post-completion)
 *
 * Once the diorama is finished the player can dismiss the win modal to
 * frame their own photo. The toggle button is rendered as part of the
 * .diorama-game__win so it lives over the modal backdrop; once clicked
 * the modal + backdrop fade out and the free-camera HUD (separate from
 * the modal) fades in with two buttons: "Take photo" and "Back".
 * ========================================================================== */

/* Toggle shown inside the win modal: bottom-right corner so it doesn't
 * collide with the centred win panel. Only visible while the modal is
 * displayed (the modal itself becomes `hidden` after the player enters
 * free-camera mode). */
.diorama-game__btn--free-camera {
	position: absolute;
    right: 18px;
    bottom: 18px;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.85) !important;
    border-radius: 999px !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 7;
    animation: dior-free-camera-in 320ms ease both;
}
.diorama-game__btn--free-camera:hover {
	background: #000000 !important;
	border-color: var(--dior-accent) !important;
	transform: translateY(-2px) !important;
}
.diorama-game__btn--free-camera:active {
	transform: translateY(0) scale(0.96);
}
.diorama-game__btn--free-camera:focus-visible {
	outline: 2px solid var(--dior-accent);
	outline-offset: 3px;
}
.diorama-game__btn--free-camera-icon {
	font-size: 16px;
	line-height: 1;
}
@keyframes dior-free-camera-in {
	from { opacity: 0; transform: translateY(8px) scale(0.92); }
	to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

/* The HUD shown when the player is in free-camera mode. Lives outside
 * the win modal so its visibility isn't tied to the modal's hidden
 * attribute. Positioned bottom-right of the wrapper so it overlays the
 * 3D scene without occluding the diorama itself. */
.diorama-game__free-camera-hud {
	position: absolute;
	right: 18px;
	bottom: 18px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	z-index: 6;
	pointer-events: none; /* container is decorative; children re-enable it */
	animation: dior-free-camera-in 320ms ease both;
}
.diorama-game__free-camera-hud[hidden] { display: none; }

/* Shared styling for the snap + back buttons. They share the look of
 * .diorama-game__btn but we override the global "stretched-shadow"
 * effect with a flatter pill style so they read clearly as overlay
 * controls on top of the 3D scene. */
.diorama-game__btn--snap,
.diorama-game__btn--back {
	pointer-events: auto;
	width: auto;
	min-width: 160px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
	font-size: 13px;
	font-weight: 600;
	color: #ffffff !important;
	background: rgba(15, 23, 42, 0.85) !important;
	border: 2px solid rgba(255, 255, 255, 0.85) !important;
	border-radius: 999px !important;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45) !important;
	padding: 10px 18px !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}
.diorama-game__btn--snap:hover,
.diorama-game__btn--back:hover {
	background: var(--dior-accent) !important;
	border-color: #ffffff !important;
	transform: translateY(-2px);
}
.diorama-game__btn--snap:active,
.diorama-game__btn--back:active {
	transform: translateY(0) scale(0.96);
}
.diorama-game__btn--snap:focus-visible,
.diorama-game__btn--back:focus-visible {
	outline: 2px solid var(--dior-accent);
	outline-offset: 3px;
}

/* "Take photo" gets an accent-coloured border so it reads as the
 * primary action; "Back" stays neutral so it doesn't compete. */
.diorama-game__btn--snap {
	border-color: var(--dior-accent) !important;
}

/* Toast that flashes briefly after a photo is saved. Sits just above
 * the buttons so the player sees the confirmation without it covering
 * the diorama. */
.diorama-game__free-camera-toast {
	pointer-events: none;
	background: rgba(16, 185, 129, 0.95);
	color: #ffffff;
	font-size: 12.5px;
	font-weight: 600;
	padding: 8px 14px;
	border-radius: 999px;
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
	animation: dior-toast-in 220ms ease both;
}
.diorama-game__free-camera-toast[hidden] { display: none; }
@keyframes dior-toast-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0);   }
}

/* Mobile: shrink the floating buttons so they don't crowd the bar. */
@media (max-width: 640px) {
	.diorama-game__btn--free-camera,
	.diorama-game__btn--snap,
	.diorama-game__btn--back {
		font-size: 12px;
		padding: 8px 14px !important;
		min-width: 0;
	}
	.diorama-game__btn--free-camera-label { display: none; }
	.diorama-game__free-camera-hud,
	.diorama-game__btn--free-camera {
		right: 12px;
		bottom: 12px;
	}
}

/* Reduced motion: drop the pop-in keyframes so the buttons fade
 * without scaling, matching the rest of the prefers-reduced-motion
 * rules above. */
@media (prefers-reduced-motion: reduce) {
	.diorama-game__btn--free-camera,
	.diorama-game__free-camera-hud,
	.diorama-game__free-camera-toast {
		animation: none;
	}
}

/* ============================================================================
 * Inline error (no diorama, no WebGL, …)
 * ========================================================================== */
.diorama-game__error {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 28px;
	text-align: center;
	background: var(--dior-bg);
	color: var(--dior-text);
	z-index: 7;
}

.diorama-game--empty .diorama-game__error { position: static; min-height: 120px; }

.diorama-game__error-hint {
	margin: 0 auto;
	max-width: 520px;
	padding: 0 28px 24px;
	text-align: center;
	font-size: 12.5px;
	color: var(--dior-text-dim, #94a3b8);
	line-height: 1.5;
}

/* ============================================================================
 * Responsive
 * ========================================================================== */
@media (max-width: 640px) {
	:root { --dior-bar-height: 108px; }
	.diorama-game__slot { width: 82px; height: 82px; }
	.diorama-game__hud-title { max-width: 50%; font-size: 14px; }
	.diorama-game__hud-hint  { font-size: 11px; }
	.diorama-game__music-toggle    { width: 28px; height: 28px; font-size: 14px; }
	.diorama-game__music-volume-wrap { width: 28px; height: 64px; }
	.diorama-game__music-volume    { height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
	.diorama-game__spinner { animation-duration: 4s; }
	.diorama-game__win      { animation: none; }
	.diorama-game__win.is-animating .diorama-game__win-panel,
	.diorama-game__win.is-animating .diorama-game__win-title {
		animation: none;
		transform: none;
		opacity: 1;
	}
	.diorama-game__win-confetti { display: none; }
}
