/* Filmstudio: soft cream ground, one colour per kind of thing, big round targets (min 56px) for small fingers. */

@font-face {
	font-family: 'Fredoka';
	src: url('/assets/fonts/Fredoka-Medium.woff2') format('woff2');
	font-weight: 500;
	font-display: swap;
}

@font-face {
	font-family: 'Fredoka';
	src: url('/assets/fonts/Fredoka-Bold.woff2') format('woff2');
	font-weight: 700;
	font-display: swap;
}

:root {
	--bg: #FFF7EA;
	--card: #FFFFFF;
	--ink: #2B2650;
	--ink-soft: #6E6893;
	--line: #EFE6D6;
	--purple: #7C5CFF;
	--purple-soft: #ECE6FF;
	--blue: #3D9BFF;
	--blue-soft: #E1F0FF;
	--green: #22C27A;
	--green-soft: #DDF7EA;
	--orange: #FF8A3D;
	--orange-soft: #FFEBDD;
	--pink: #FF5FA2;
	--pink-soft: #FFE3EF;
	--yellow: #FFBE1A;
	--yellow-soft: #FFF3CF;
	--teal: #14B8A6;
	--teal-soft: #D7F5F1;
	--red: #FF5A5F;
	--red-soft: #FFE1E2;
	--shadow: 0 6px 0 rgba(43, 38, 80, 0.08), 0 10px 24px rgba(43, 38, 80, 0.08);
	--radius: 22px;
	--label-width: 116px;
}

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: transparent;
}

html,
body {
	margin: 0;
	height: 100%;
	background: var(--bg);
	color: var(--ink);
	font-family: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
	font-weight: 500;
	overscroll-behavior: none;
}

body {
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

input,
textarea {
	-webkit-user-select: text;
	user-select: text;
}

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

button {
	cursor: pointer;
	border: 0;
	background: none;
	padding: 0;
	touch-action: manipulation;
}

button:disabled {
	opacity: 0.35;
	cursor: default;
}

svg {
	width: 28px;
	height: 28px;
	flex: none;
}

[hidden] {
	display: none !important;
}

h1,
h2 {
	margin: 0;
	font-weight: 700;
}

.hint {
	color: var(--ink-soft);
	font-size: 17px;
	line-height: 1.35;
	margin: 10px 0 14px;
}

.hint.center {
	text-align: center;
}

/* ------------------------------------------------------------------ buttons */

.big-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 64px;
	padding: 0 26px;
	border-radius: 999px;
	font-size: 21px;
	font-weight: 700;
	background: var(--purple);
	color: #fff;
	box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
	transition: transform 0.08s, box-shadow 0.08s;
	text-decoration: none;
	cursor: pointer;
}

.big-button:active {
	transform: translateY(4px);
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.big-button.go { background: var(--green); }
.big-button.danger { background: var(--red); }
.big-button.magic { background: linear-gradient(135deg, var(--purple), var(--pink)); flex: 1; }
.big-button.soft { background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--line); border: 3px solid var(--line); }
.big-button.wide { width: 100%; margin-top: 18px; }
.big-button.upload { width: 100%; min-height: 84px; font-size: 24px; background: var(--blue); }
.big-button.upload svg { width: 36px; height: 36px; }
.upload-small { width: 100%; margin-top: 16px; }

.round-button {
	display: inline-grid;
	place-items: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--card);
	box-shadow: 0 4px 0 var(--line);
	border: 3px solid var(--line);
	flex: none;
}

.round-button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.round-button.listen { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.round-button.listen.is-playing { background: var(--green); color: #fff; }
.round-button.add { background: var(--purple); border-color: var(--purple); color: #fff; box-shadow: 0 4px 0 #5A3FD6; }
.round-button.soft { color: var(--ink-soft); }
.round-button.huge { width: 92px; height: 92px; }
.round-button.huge svg { width: 42px; height: 42px; }
.mic-button { color: var(--pink); border-color: var(--pink-soft); }
.mic-button.is-listening { background: var(--pink); color: #fff; animation: pulse 1s infinite; }

.choice-group {
	display: inline-flex;
	gap: 6px;
	padding: 6px;
	border-radius: 999px;
	background: var(--bg);
	border: 3px solid var(--line);
}

.choice-group.wide-group { display: flex; }
.choice-group.wide-group .choice { flex: 1; }

.choice {
	min-height: 52px;
	min-width: 52px;
	padding: 0 18px;
	border-radius: 999px;
	font-size: 18px;
	font-weight: 700;
	color: var(--ink-soft);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.choice.is-active { background: var(--purple); color: #fff; box-shadow: 0 3px 0 #5A3FD6; }
.choice.icon-choice { padding: 0 10px; }
.choice.size-s { font-size: 15px; }
.choice.size-l { font-size: 22px; }
.choice.style-demo-outline { -webkit-text-stroke: 1px var(--ink); }
.choice.style-demo-box.is-active { background: #fff; color: var(--ink); box-shadow: 0 0 0 3px var(--purple); }

.mini-button {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 48px;
	padding: 0 16px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 17px;
	background: var(--bg);
}

.mini-button.watch { background: var(--green); color: #fff; }
.mini-button.danger { color: var(--red); width: 48px; padding: 0; justify-content: center; }

/* ------------------------------------------------------------------ login */

.login-page {
	display: grid;
	place-items: center;
	padding: 24px;
}

.login-card {
	width: min(440px, 100%);
	background: var(--card);
	border-radius: 32px;
	padding: 40px 32px;
	box-shadow: var(--shadow);
	display: grid;
	gap: 18px;
	text-align: center;
}

.login-logo svg { width: 96px; height: 96px; }
.login-card h1 { font-size: 40px; }
.login-error { color: var(--red); font-size: 18px; margin: 0; }

.big-input {
	width: 100%;
	min-height: 64px;
	padding: 14px 20px;
	border-radius: 20px;
	border: 3px solid var(--line);
	background: var(--bg);
	font-size: 22px;
	outline: none;
	resize: none;
}

.big-input:focus { border-color: var(--purple); background: #fff; }

/* ------------------------------------------------------------------ home */

#home {
	min-height: 100%;
	padding: 28px max(24px, env(safe-area-inset-left)) 40px;
	overflow-y: auto;
	height: 100%;
}

.home-header {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 28px;
}

.home-logo {
	width: 72px;
	height: 72px;
	border-radius: 24px;
	display: grid;
	place-items: center;
	background: var(--purple);
	color: #fff;
	box-shadow: 0 6px 0 #5A3FD6;
}

.home-logo svg { width: 42px; height: 42px; }
.home-header h1 { font-size: 44px; flex: 1; }
.home-logout button { width: 48px; height: 48px; color: var(--ink-soft); opacity: 0.5; }

.home-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 22px;
}

.home-new {
	min-height: 240px;
	border-radius: 28px;
	border: 4px dashed var(--purple);
	background: var(--purple-soft);
	color: var(--purple);
	display: grid;
	place-items: center;
	align-content: center;
	gap: 14px;
	font-size: 26px;
	font-weight: 700;
}

.home-new-icon {
	width: 96px;
	height: 96px;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 6px 0 #5A3FD6;
}

.home-new-icon svg { width: 52px; height: 52px; }

.home-card {
	background: var(--card);
	border-radius: 28px;
	box-shadow: var(--shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.home-card-open {
	display: flex;
	flex-direction: column;
	text-align: left;
}

.home-card-open img,
.home-card-blank {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: var(--blue-soft);
	display: grid;
	place-items: center;
	color: var(--blue);
}

.home-card-blank svg { width: 56px; height: 56px; }
.home-card-name { padding: 14px 18px 4px; font-size: 22px; font-weight: 700; }
.home-card-actions { display: flex; gap: 8px; padding: 10px 14px 14px; justify-content: flex-end; }

/* ------------------------------------------------------------------ editor layout */

#editor {
	height: 100%;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto minmax(0, 1fr) auto auto;
	padding-top: env(safe-area-inset-top);
}

.topbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 18px;
}

.topbar .round-button { width: 52px; height: 52px; }
.topbar-spacer { flex: 1; }

.film-name {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 26px;
	font-weight: 700;
	padding: 6px 14px;
	border-radius: 16px;
	max-width: 34vw;
}

.film-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.film-name svg { width: 22px; height: 22px; color: var(--ink-soft); }

.save-state {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--green);
	font-size: 15px;
}

.save-state svg { width: 18px; height: 18px; }
.save-bad { color: var(--red); }

.big-button.render-button {
	background: linear-gradient(135deg, var(--orange), var(--pink));
	min-height: 58px;
	font-size: 22px;
}

.render-button svg { width: 32px; height: 32px; }

.workspace {
	display: grid;
	grid-template-columns: 96px minmax(300px, 380px) minmax(0, 1fr);
	gap: 14px;
	padding: 0 18px 10px;
	min-height: 0;
}

.tabs {
	display: flex;
	flex-direction: column;
	gap: 5px;
	overflow-y: auto;
	min-height: 0;
	padding-bottom: 4px;
}

.tab {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	min-height: 48px;
	border-radius: 16px;
	background: var(--card);
	font-size: 12.5px;
	font-weight: 700;
	color: var(--ink-soft);
	box-shadow: 0 4px 0 var(--line);
	flex: none;
}

.tab svg { width: 26px; height: 26px; }
.tab-blue svg { color: var(--blue); }
.tab-green svg { color: var(--green); }
.tab-orange svg { color: var(--orange); }
.tab-pink svg { color: var(--pink); }
.tab-yellow svg { color: var(--yellow); }
.tab-purple svg { color: var(--purple); }
.tab-teal svg { color: var(--teal); }
.tab.is-active { color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); }
.tab.is-active svg { color: #fff; }
.tab-blue.is-active { background: var(--blue); }
.tab-green.is-active { background: var(--green); }
.tab-orange.is-active { background: var(--orange); }
.tab-pink.is-active { background: var(--pink); }
.tab-yellow.is-active { background: var(--yellow); }
.tab-purple.is-active { background: var(--purple); }
.tab-teal.is-active { background: var(--teal); }

.panel {
	background: var(--card);
	border-radius: 28px;
	padding: 18px;
	overflow-y: auto;
	min-height: 0;
	box-shadow: var(--shadow);
	-webkit-overflow-scrolling: touch;
}

.panel-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 26px;
}

.panel-title svg { width: 32px; height: 32px; }
.panel-title.small { font-size: 21px; margin-top: 22px; }
.panel-music .panel-title svg { color: var(--green); }
.panel-sfx .panel-title svg { color: var(--orange); }
.panel-voice .panel-title svg { color: var(--pink); }
.panel-text .panel-title svg { color: var(--yellow); }
.panel-transitions .panel-title svg { color: var(--purple); }
.panel-effects .panel-title svg { color: var(--teal); }

.field-label { font-size: 17px; font-weight: 700; color: var(--ink-soft); margin: 16px 0 8px; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.input-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.empty-note { display: grid; place-items: center; gap: 8px; padding: 30px 10px; color: var(--ink-soft); text-align: center; font-size: 18px; }
.empty-note svg { width: 48px; height: 48px; color: var(--blue); }

/* ------------------------------------------------------------------ stage */

.stage-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 0;
	min-width: 0;
	container-type: size;
}

/* As big as the column allows while staying 16:9, with room left for the play button underneath */
.stage {
	position: relative;
	flex: none;
	width: min(100cqw, (100cqh - 84px) * 16 / 9);
	aspect-ratio: 16 / 9;
	background: #1D1B3A;
	border-radius: 24px;
	overflow: hidden;
	box-shadow: var(--shadow);
}

.stage-video,
.stage-flash {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
}

.stage-flash { z-index: 3; pointer-events: none; }

.stage-texts {
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
	font-weight: 700;
}

.stage-text {
	position: absolute;
	left: 4%;
	right: 4%;
	text-align: center;
	line-height: 1.15;
	white-space: pre-wrap;
}

.stage-text.pos-top { top: 8%; }
.stage-text.pos-middle { top: 50%; transform: translateY(-50%); }
.stage-text.pos-bottom { bottom: 8%; }
.stage-text.style-outline { -webkit-text-stroke: var(--stroke) #1D1B3A; paint-order: stroke fill; text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.35); }
.stage-text.style-box { left: 50%; right: auto; width: max-content; max-width: 92%; background: rgba(255, 255, 255, 0.92); padding: var(--pad); }
.stage-text.style-box.pos-middle { transform: translate(-50%, -50%); }
.stage-text.style-box:not(.pos-middle) { transform: translateX(-50%); }

.stage-empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: rgba(255, 255, 255, 0.7);
	font-size: 22px;
	text-align: center;
	padding: 20px;
}

.stage-empty::after { content: 'Je film is nog leeg. Kies links een filmpje!'; }

.stage-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
}

.play-button {
	width: 70px;
	height: 70px;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 6px 0 #5A3FD6;
}

.play-button:active { transform: translateY(4px); box-shadow: 0 2px 0 #5A3FD6; }
.play-button svg { width: 38px; height: 38px; }
.clock { font-size: 22px; font-weight: 700; min-width: 120px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ library */

.tile-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.tile {
	position: relative;
	border-radius: 18px;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	background: var(--blue-soft);
	touch-action: pan-y;
	transition: transform 0.15s;
}

.tile.is-lifted { transform: scale(1.06); box-shadow: 0 10px 24px rgba(43, 38, 80, 0.25); }

.tile-main {
	position: absolute;
	inset: 0;
	width: 100%;
}

.tile-main img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }

.tile-time {
	position: absolute;
	left: 8px;
	bottom: 8px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	border-radius: 999px;
	background: rgba(29, 27, 58, 0.75);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
}

.tile-time svg { width: 16px; height: 16px; }

.tile-add {
	position: absolute;
	right: 8px;
	bottom: 8px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	display: grid;
	place-items: center;
}

.tile-add svg { width: 24px; height: 24px; }

.tile-delete {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: var(--red);
	display: grid;
	place-items: center;
}

.tile-delete svg { width: 20px; height: 20px; }

.tile-busy,
.tile.is-failed {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	align-content: center;
	gap: 8px;
	color: var(--blue);
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	padding: 8px;
}

.tile.is-failed { position: relative; color: var(--red); background: var(--red-soft); }

.spinner {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 5px solid currentColor;
	border-right-color: transparent;
	animation: spin 0.8s linear infinite;
}

.sound-list { display: grid; gap: 10px; }

.sound-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border-radius: 20px;
	background: var(--bg);
	touch-action: pan-y;
	transition: transform 0.15s;
}

.sound-row.is-lifted { transform: scale(1.04); box-shadow: 0 10px 24px rgba(43, 38, 80, 0.2); background: #fff; }
.sound-music { border-left: 8px solid var(--green); }
.sound-sfx { border-left: 8px solid var(--orange); }
.sound-voice { border-left: 8px solid var(--pink); }
.sound-name { flex: 1; min-width: 0; display: grid; }
.sound-name strong { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-name small { color: var(--ink-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row .round-button { width: 54px; height: 54px; }

/* ------------------------------------------------------------------ magic sounds */

.magic-card {
	background: linear-gradient(160deg, var(--purple-soft), var(--pink-soft));
	border-radius: 24px;
	padding: 16px;
}

.ideas { display: flex; flex-wrap: wrap; gap: 8px; }

.idea {
	min-height: 46px;
	padding: 0 16px;
	border-radius: 999px;
	background: #fff;
	font-size: 17px;
	font-weight: 700;
	box-shadow: 0 3px 0 rgba(43, 38, 80, 0.1);
}

.idea.is-active { background: var(--orange); color: #fff; }

.magic-wait,
.render-wait { display: grid; place-items: center; gap: 16px; padding: 20px; }

.magic-wand {
	width: 120px;
	height: 120px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--purple), var(--pink));
	color: #fff;
	display: grid;
	place-items: center;
	animation: wiggle 0.9s ease-in-out infinite;
}

.magic-wand svg { width: 64px; height: 64px; }

.takes {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin: 18px 0;
}

.take {
	border-radius: 24px;
	padding: 16px 12px;
	display: grid;
	justify-items: center;
	gap: 12px;
}

.take-blue { background: var(--blue-soft); }
.take-orange { background: var(--orange-soft); }
.take-green { background: var(--green-soft); }
.take-pink { background: var(--pink-soft); }
.take-number { font-size: 44px; font-weight: 700; line-height: 1; }
.take .big-button { padding: 0 18px; min-height: 56px; font-size: 19px; }

/* ------------------------------------------------------------------ voice */

.recorder { display: grid; justify-items: center; padding: 10px 0; }

.record-big {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	background: var(--red);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: 0 8px 0 #D63E43, 0 0 0 10px var(--red-soft);
}

.record-big svg { width: 70px; height: 70px; }
.record-big.is-recording { animation: pulse 1.2s infinite; }
.record-big.counting { background: var(--yellow); box-shadow: 0 8px 0 #DDA000, 0 0 0 10px var(--yellow-soft); color: var(--ink); }
.countdown { font-size: 84px; font-weight: 700; animation: pop 0.8s ease-out; }

.level {
	width: 80%;
	height: 22px;
	border-radius: 999px;
	background: var(--bg);
	margin-top: 22px;
	overflow: hidden;
	border: 3px solid var(--line);
}

.level-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--yellow), var(--red)); transition: width 0.05s; }
.review-row { display: grid; gap: 10px; width: 100%; }

/* ------------------------------------------------------------------ text */

.text-input { font-size: 24px; font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }

.swatch {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--swatch);
	border: 4px solid #fff;
	box-shadow: 0 0 0 3px var(--line);
}

.swatch.is-active { box-shadow: 0 0 0 5px var(--purple); }

/* ------------------------------------------------------------------ transitions */

.trans-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-top: 16px;
}

.trans-grid.in-modal { grid-template-columns: repeat(4, 1fr); }

.trans-tile {
	display: grid;
	justify-items: center;
	gap: 6px;
	padding: 10px 6px;
	border-radius: 18px;
	background: var(--bg);
	font-size: 16px;
	font-weight: 700;
	border: 3px solid transparent;
}

.trans-tile.is-active { border-color: var(--purple); background: var(--purple-soft); }

.trans-demo {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: 12px;
	overflow: hidden;
	background: #1D1B3A;
}

.trans-demo i {
	position: absolute;
	inset: 0;
	border-radius: 0;
}

.trans-demo .a { background: linear-gradient(135deg, var(--blue), #7FC1FF); }
.trans-demo .b { background: linear-gradient(135deg, var(--orange), var(--yellow)); animation: 2.4s infinite ease-in-out; }

.demo-none .b { animation-name: demo-cut; }
.demo-fade .b, .demo-dissolve .b { animation-name: demo-fade; }
.demo-fadeblack .a, .demo-fadewhite .a { animation: demo-dip-a 2.4s infinite; }
.demo-fadeblack .b, .demo-fadewhite .b { animation-name: demo-dip-b; }
.demo-fadeblack { background: #000; }
.demo-fadewhite { background: #fff; }
.demo-slideleft .b { animation-name: demo-slide; }
.demo-slideup .b { animation-name: demo-up; }
.demo-wipeleft .b { animation-name: demo-wipe; }
.demo-circleopen .b { animation-name: demo-circle; }
.demo-zoomin .a { animation: demo-zoom-a 2.4s infinite ease-in-out; }
.demo-zoomin .b { animation-name: demo-fade; }
.demo-pixelize .b { animation-name: demo-pixel; }
.demo-radial .b { animation-name: demo-radial; }
.demo-dissolve .b { animation-timing-function: steps(6); }

@keyframes demo-cut { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes demo-fade { 0%, 25% { opacity: 0; } 65%, 100% { opacity: 1; } }
@keyframes demo-dip-a { 0%, 25% { opacity: 1; } 45%, 100% { opacity: 0; } }
@keyframes demo-dip-b { 0%, 50% { opacity: 0; } 75%, 100% { opacity: 1; } }
@keyframes demo-slide { 0%, 25% { transform: translateX(100%); } 65%, 100% { transform: translateX(0); } }
@keyframes demo-up { 0%, 25% { transform: translateY(100%); } 65%, 100% { transform: translateY(0); } }
@keyframes demo-wipe { 0%, 25% { clip-path: inset(0 0 0 100%); } 65%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes demo-circle { 0%, 25% { clip-path: circle(0% at 50% 50%); } 65%, 100% { clip-path: circle(75% at 50% 50%); } }
@keyframes demo-zoom-a { 0%, 25% { transform: scale(1); opacity: 1; } 65%, 100% { transform: scale(2); opacity: 0; } }
@keyframes demo-pixel { 0%, 25% { opacity: 0; filter: blur(8px); } 65%, 100% { opacity: 1; filter: blur(0); } }
@keyframes demo-radial { 0%, 25% { clip-path: polygon(50% 50%, 50% 0, 50% 0, 50% 0, 50% 0, 50% 0); } 40% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 50%, 100% 50%, 100% 50%); } 52% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%, 50% 100%, 50% 100%); } 65%, 100% { clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%, 0 100%, 0 0); } }

/* ------------------------------------------------------------------ effects */

.filter-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-top: 14px;
}

.filter-tile {
	display: grid;
	gap: 6px;
	justify-items: center;
	padding: 8px;
	border-radius: 18px;
	background: var(--bg);
	font-size: 15px;
	font-weight: 700;
	border: 3px solid transparent;
}

.filter-tile.is-active { border-color: var(--teal); background: var(--teal-soft); }

.filter-thumb {
	width: 100%;
	aspect-ratio: 16 / 10;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--blue), var(--green) 50%, var(--yellow));
	background-size: cover;
	background-position: center;
}

.filter-thumb.rainbow { animation: rainbow 3s linear infinite; }

/* ------------------------------------------------------------------ toolbar */

.toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 18px 8px;
	overflow-x: auto;
	min-height: 72px;
}

.tool {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	min-width: 70px;
	height: 62px;
	padding: 0 10px;
	border-radius: 18px;
	background: var(--card);
	font-size: 14px;
	font-weight: 700;
	box-shadow: 0 4px 0 var(--line);
	flex: none;
}

.tool:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.tool svg { width: 30px; height: 30px; }
.tool.is-active { background: var(--purple); color: #fff; box-shadow: 0 4px 0 #5A3FD6; }
.tool-cut { background: var(--yellow); box-shadow: 0 4px 0 #DDA000; }
.tool-danger { color: var(--red); }
.tool-group { display: inline-flex; gap: 6px; padding: 0 6px; border-left: 3px solid var(--line); border-right: 3px solid var(--line); }
.toolbar-hint { color: var(--ink-soft); font-size: 17px; padding-left: 8px; white-space: nowrap; }
.toolbar-spacer { flex: 1; }

.volume-dots { display: inline-flex; gap: 4px; align-items: flex-end; height: 40px; }
.volume-dots i { width: 9px; border-radius: 4px; background: var(--line); }
.volume-dots i:nth-child(1) { height: 10px; } .volume-dots i:nth-child(2) { height: 13px; } .volume-dots i:nth-child(3) { height: 16px; }
.volume-dots i:nth-child(4) { height: 19px; } .volume-dots i:nth-child(5) { height: 22px; } .volume-dots i:nth-child(6) { height: 25px; }
.volume-dots i:nth-child(7) { height: 28px; } .volume-dots i:nth-child(8) { height: 31px; } .volume-dots i:nth-child(9) { height: 34px; }
.volume-dots i:nth-child(10) { height: 37px; }
.volume-dots i.on { background: var(--green); }

/* ------------------------------------------------------------------ timeline */

.timeline {
	background: var(--card);
	border-top: 3px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom);
}

.timeline-scroll {
	overflow-x: auto;
	overflow-y: auto;
	max-height: 36vh;
	-webkit-overflow-scrolling: touch;
}

.timeline-inner {
	position: relative;
	min-width: 100%;
	touch-action: pan-x pan-y;
}

.ruler {
	position: relative;
	height: 34px;
	border-bottom: 2px solid var(--line);
	cursor: pointer;
	touch-action: none;
}

.tick {
	position: absolute;
	top: 0;
	height: 100%;
	padding: 6px 0 0 6px;
	border-left: 2px solid var(--line);
	font-size: 14px;
	font-weight: 700;
	color: var(--ink-soft);
}

.lane-label {
	position: sticky;
	left: 0;
	z-index: 6;
	width: var(--label-width);
	height: 100%;
	display: flex;
	align-items: center;
	gap: 8px;
	padding-left: 14px;
	background: var(--card);
	font-size: 15px;
	font-weight: 700;
	border-right: 3px solid var(--line);
}

.ruler-label { position: sticky; }
.lane-label svg { width: 26px; height: 26px; }

.lane {
	position: relative;
	height: calc(var(--rows) * 48px + 8px);
	border-bottom: 2px solid var(--line);
}

.lane-video { height: 84px; }
.lane-color-blue .lane-label svg { color: var(--blue); }
.lane-color-yellow .lane-label svg { color: var(--yellow); }
.lane-color-green .lane-label svg { color: var(--green); }
.lane-color-orange .lane-label svg { color: var(--orange); }
.lane-color-pink .lane-label svg { color: var(--pink); }
.lane-color-orange .lane-label svg { color: var(--orange); }

.lane-empty {
	position: absolute;
	top: 28px;
	color: var(--ink-soft);
	font-size: 17px;
	white-space: nowrap;
}

.block {
	position: absolute;
	top: calc(4px + var(--row, 0) * 48px);
	height: 44px;
	border-radius: 14px;
	overflow: visible;
	display: flex;
	align-items: center;
	touch-action: none;
	cursor: grab;
}

.block-video {
	top: 4px;
	height: 76px;
	background-color: var(--blue);
	background-repeat: no-repeat;
	border: 4px solid var(--blue);
	border-radius: 16px;
	background-clip: padding-box;
}

.block-text { background: var(--yellow); color: var(--ink); }
.block-music { background: var(--green); color: #fff; }
.block-sfx { background: var(--orange); color: #fff; }
.block-voice { background: var(--pink); color: #fff; }

.block-label {
	position: relative;
	padding: 0 12px;
	font-size: 16px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	pointer-events: none;
}

.wave {
	position: absolute;
	inset: 4px 0;
	width: 100%;
	height: calc(100% - 8px);
	pointer-events: none;
}

.wave path { stroke: rgba(255, 255, 255, 0.45); stroke-width: 2.5; stroke-linecap: round; }

.block.is-selected { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--purple); z-index: 4; }
.block-video.is-selected { border-color: var(--purple); }
.block.is-dragged { opacity: 0.35; }

.block-badges {
	position: absolute;
	left: 6px;
	top: 6px;
	display: flex;
	gap: 4px;
	pointer-events: none;
}

.badge {
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 6px;
	border-radius: 999px;
	background: rgba(29, 27, 58, 0.75);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
}

.badge svg { width: 18px; height: 18px; }

.handle {
	position: absolute;
	top: 50%;
	width: 30px;
	height: 64px;
	margin-top: -32px;
	border-radius: 12px;
	background: var(--purple);
	box-shadow: 0 0 0 3px #fff;
	z-index: 5;
	cursor: ew-resize;
}

.handle::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 50%;
	width: 6px;
	height: 26px;
	margin: -13px 0 0 -3px;
	border-left: 2px solid #fff;
	border-right: 2px solid #fff;
}

.handle-left { left: -18px; }
.handle-right { right: -18px; }
.block:not(.block-video) .handle { height: 46px; margin-top: -23px; }

.joint {
	position: absolute;
	top: 19px;
	width: 46px;
	height: 46px;
	margin-left: -23px;
	border-radius: 50%;
	background: #fff;
	color: var(--purple);
	display: grid;
	place-items: center;
	box-shadow: 0 0 0 3px var(--purple-soft), 0 3px 0 rgba(0, 0, 0, 0.1);
	z-index: 5;
}

.joint svg { width: 26px; height: 26px; }
.joint.has-transition { background: var(--purple); color: #fff; }

.insert-marker {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 8px;
	border-radius: 4px;
	background: var(--purple);
	z-index: 6;
}

.playhead {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 4px;
	margin-left: -2px;
	background: var(--red);
	z-index: 7;
	pointer-events: none;
}

.playhead-knob {
	position: absolute;
	top: 2px;
	left: 50%;
	width: 30px;
	height: 34px;
	margin-left: -15px;
	border-radius: 10px 10px 50% 50%;
	background: var(--red);
	pointer-events: auto;
	touch-action: none;
}

.drag-ghost {
	position: fixed;
	left: 0;
	top: 0;
	width: 120px;
	height: 76px;
	border-radius: 16px;
	background: var(--purple) center / cover;
	box-shadow: 0 12px 30px rgba(43, 38, 80, 0.35);
	border: 4px solid #fff;
	z-index: 50;
	pointer-events: none;
	opacity: 0.9;
}

.drag-ghost.is-sound { background-image: none; background-color: var(--green); }

/* ------------------------------------------------------------------ modal + toast */

.modal {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: rgba(43, 38, 80, 0.45);
	display: grid;
	place-items: center;
	padding: 20px;
}

.modal-card {
	width: min(860px, 100%);
	max-height: 100%;
	overflow-y: auto;
	background: var(--card);
	border-radius: 32px;
	padding: 28px;
	box-shadow: 0 20px 60px rgba(43, 38, 80, 0.3);
	animation: pop 0.25s ease-out;
}

.modal-title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	font-size: 30px;
	text-align: center;
}

.modal-title svg { width: 36px; height: 36px; color: var(--purple); }

.modal-row {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	justify-content: center;
	margin-top: 22px;
}

.modal .big-input { margin-top: 20px; }

.finished-video {
	width: 100%;
	border-radius: 20px;
	margin-top: 18px;
	background: #000;
	max-height: 55vh;
}

.progress {
	width: 100%;
	height: 34px;
	border-radius: 999px;
	background: var(--bg);
	border: 3px solid var(--line);
	overflow: hidden;
}

.progress-bar {
	height: 100%;
	width: 0;
	background: repeating-linear-gradient(45deg, var(--orange), var(--orange) 16px, var(--pink) 16px, var(--pink) 32px);
	background-size: 45px 45px;
	animation: stripes 1s linear infinite;
	transition: width 0.6s;
}

.render-rocket {
	width: 120px;
	height: 120px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--orange), var(--pink));
	color: #fff;
	display: grid;
	place-items: center;
	animation: hover 1.2s ease-in-out infinite;
}

.render-rocket svg { width: 64px; height: 64px; }
.render-percent { font-size: 26px; font-weight: 700; color: var(--ink); }

.toast {
	position: fixed;
	left: 50%;
	bottom: 30px;
	transform: translateX(-50%);
	z-index: 60;
	padding: 16px 28px;
	border-radius: 999px;
	font-size: 21px;
	font-weight: 700;
	color: #fff;
	background: var(--green);
	box-shadow: 0 10px 30px rgba(43, 38, 80, 0.3);
	max-width: 90vw;
	text-align: center;
}

.toast-bad { background: var(--orange); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes pop { 0% { transform: scale(0.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes wiggle { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes stripes { to { background-position: 45px 0; } }
@keyframes rainbow { to { filter: hue-rotate(360deg) saturate(1.4); } }

/* ------------------------------------------------------------------ smaller and upright screens */

@media (max-width: 1100px) {
	.workspace { grid-template-columns: 84px minmax(280px, 330px) minmax(0, 1fr); gap: 10px; padding: 0 12px 10px; }
	.render-button span { display: none; }
	.render-button { padding: 0 18px; }
	.takes { grid-template-columns: repeat(2, 1fr); }
	.trans-grid.in-modal { grid-template-columns: repeat(3, 1fr); }
}

@media (orientation: portrait) {
	.workspace {
		grid-template-columns: 84px minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
	}
	.stage-wrap { grid-column: 1 / -1; grid-row: 1; container-type: normal; }
	.stage { width: min(100%, 30vh * 16 / 9); }
	.tabs { grid-row: 2; }
	.panel { grid-row: 2; }
	.timeline-scroll { max-height: 30vh; }
}

.login-code { text-align: center; letter-spacing: 0.5em; font-size: 30px; }

/* ------------------------------------------------------------------ music folders */

.folder-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}

.folder {
	display: grid;
	justify-items: start;
	gap: 2px;
	padding: 14px;
	border-radius: 20px;
	text-align: left;
	color: var(--ink);
	box-shadow: 0 4px 0 rgba(43, 38, 80, 0.08);
}

.folder strong { font-size: 19px; }
.folder small { color: var(--ink-soft); font-size: 14px; }

.folder-icon {
	width: 52px;
	height: 52px;
	border-radius: 16px;
	display: grid;
	place-items: center;
	color: #fff;
	margin-bottom: 6px;
}

.folder-icon svg { width: 30px; height: 30px; }

.folder-green { background: var(--green-soft); } .folder-green .folder-icon { background: var(--green); }
.folder-yellow { background: var(--yellow-soft); } .folder-yellow .folder-icon { background: var(--yellow); }
.folder-red { background: var(--red-soft); } .folder-red .folder-icon { background: var(--red); }
.folder-blue { background: var(--blue-soft); } .folder-blue .folder-icon { background: var(--blue); }
.folder-purple { background: var(--purple-soft); } .folder-purple .folder-icon { background: var(--purple); }
.folder-pink { background: var(--pink-soft); } .folder-pink .folder-icon { background: var(--pink); }
.folder-teal { background: var(--teal-soft); } .folder-teal .folder-icon { background: var(--teal); }
.folder-orange { background: var(--orange-soft); } .folder-orange .folder-icon { background: var(--orange); }

.folder-back {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: 60px;
	padding: 0 16px;
	border-radius: 18px;
	font-size: 21px;
	font-weight: 700;
	margin-bottom: 12px;
}

.folder-back svg { width: 30px; height: 30px; }

.picker-body { margin-top: 18px; max-height: 58vh; overflow-y: auto; }
.picker-body .folder-grid { grid-template-columns: repeat(4, 1fr); }
.picker-grid { grid-template-columns: repeat(4, 1fr); margin-top: 18px; max-height: 58vh; overflow-y: auto; }

/* ------------------------------------------------------------------ lane plus buttons */

.lane-label { padding-right: 6px; }
.lane-label span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.lane-add {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	display: grid;
	place-items: center;
	flex: none;
	box-shadow: 0 3px 0 #5A3FD6;
}

.lane-add svg { width: 22px; height: 22px; color: #fff !important; }
:root { --label-width: 168px; }

/* ------------------------------------------------------------------ sound maker popup */

.big-button.tall { width: 100%; min-height: 80px; font-size: 24px; margin-top: 8px; }
.big-button.tall svg { width: 34px; height: 34px; }

.step {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	margin-top: 18px;
	padding: 14px;
	border-radius: 22px;
	background: var(--bg);
}

.step-number {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: var(--purple);
	color: #fff;
	display: grid;
	place-items: center;
	font-size: 24px;
	font-weight: 700;
	flex: none;
}

.step-body { flex: 1; min-width: 0; }
.step-title { display: block; font-size: 21px; margin: 8px 0 12px; }
.step .big-button.tall { margin-top: 0; }

/* ------------------------------------------------------------------ help */

.help-button { color: var(--purple); border-color: var(--purple-soft); }
.help-button svg { width: 32px; height: 32px; }
body.help-mode .help-button { background: var(--purple); color: #fff; animation: pulse 1s infinite; }
body.help-mode #editor button,
body.help-mode #editor .block,
body.help-mode #editor label { outline: 3px dashed rgba(124, 92, 255, 0.55); outline-offset: 2px; cursor: help; }

.help-banner {
	position: fixed;
	left: 50%;
	top: 86px;
	transform: translateX(-50%);
	z-index: 45;
	padding: 14px 26px;
	border-radius: 999px;
	background: var(--purple);
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	box-shadow: 0 10px 30px rgba(43, 38, 80, 0.3);
	max-width: 92vw;
}

.help-card { display: grid; justify-items: center; text-align: center; }

.help-icon {
	width: 96px;
	height: 96px;
	border-radius: 50%;
	background: var(--purple-soft);
	color: var(--purple);
	display: grid;
	place-items: center;
	margin-bottom: 12px;
}

.help-icon svg { width: 52px; height: 52px; }
.help-text { font-size: 23px; line-height: 1.45; max-width: 620px; margin: 14px 0 0; }

@media (max-width: 1100px) {
	.picker-body .folder-grid, .picker-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ------------------------------------------------------------------ install */

.install-button { min-height: 60px; font-size: 20px; }

.ios-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 14px;
	margin-left: 4px;
	border-radius: 12px;
	background: #fff;
	color: var(--blue);
	box-shadow: 0 0 0 2px var(--blue-soft);
	vertical-align: middle;
}

.ios-chip svg { width: 24px; height: 24px; }
