:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070a14;
  color: #f2f4ff;
  --bg: #070a14;
  --bg-mid: #0b1022;
  --surface: rgba(17, 24, 42, .86);
  --line: rgba(168, 179, 208, .2);
  --muted: #a8b3d0;
  --accent: #b8c7ff;
  --accent-strong: #86b7ff;
  --danger: #ffb4ab;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 50% 18%, #16213d 0, transparent 34%), linear-gradient(145deg, var(--bg-mid), var(--bg) 60%); }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); position: relative; overflow: hidden; }
.stars { position: fixed; inset: 0; pointer-events: none; opacity: .62; background-image: radial-gradient(circle at 7% 12%, #dce8ff 0 1px, transparent 1.6px), radial-gradient(circle at 19% 67%, #86b7ff 0 .8px, transparent 1.5px), radial-gradient(circle at 31% 23%, #fff 0 .7px, transparent 1.4px), radial-gradient(circle at 44% 78%, #b8c7ff 0 1px, transparent 1.7px), radial-gradient(circle at 58% 14%, #dce8ff 0 .8px, transparent 1.5px), radial-gradient(circle at 73% 54%, #86b7ff 0 .7px, transparent 1.4px), radial-gradient(circle at 88% 20%, #fff 0 1px, transparent 1.6px), radial-gradient(circle at 94% 83%, #b8c7ff 0 .8px, transparent 1.5px), radial-gradient(circle at 12% 91%, #fff 0 .7px, transparent 1.4px), radial-gradient(circle at 52% 44%, #dce8ff 0 .6px, transparent 1.3px), radial-gradient(circle at 82% 91%, #86b7ff 0 .8px, transparent 1.5px), radial-gradient(circle at 25% 8%, #fff 0 .6px, transparent 1.3px), radial-gradient(circle at 38% 51%, #86b7ff 0 .7px, transparent 1.4px), radial-gradient(circle at 66% 31%, #dce8ff 0 .9px, transparent 1.5px), radial-gradient(circle at 79% 72%, #fff 0 .6px, transparent 1.3px), radial-gradient(circle at 3% 44%, #b8c7ff 0 .8px, transparent 1.5px), radial-gradient(circle at 16% 35%, #dce8ff 0 .6px, transparent 1.3px), radial-gradient(circle at 48% 7%, #fff 0 .7px, transparent 1.4px), radial-gradient(circle at 61% 89%, #86b7ff 0 .8px, transparent 1.5px), radial-gradient(circle at 91% 48%, #dce8ff 0 .6px, transparent 1.3px), radial-gradient(circle at 70% 93%, #fff 0 .7px, transparent 1.4px), radial-gradient(circle at 34% 90%, #b8c7ff 0 .8px, transparent 1.5px); background-repeat: no-repeat; animation: star-drift 42s ease-in-out infinite alternate; mask-image: linear-gradient(to bottom, #fff, transparent 82%); }
.meteors { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.meteor, .meteors i { display: block; position: absolute; width: 150px; height: 2px; border-radius: 999px; opacity: 0; background: linear-gradient(90deg, #fff, rgba(184,199,255,.85) 35%, transparent); box-shadow: none; filter: drop-shadow(0 0 6px rgba(134,183,255,.75)); mix-blend-mode: screen; transform: rotate(-36.4deg); animation: meteor-fall 9s linear infinite; will-change: transform, opacity; }
.meteors i:nth-child(1) { top: 10%; left: calc(100% + 120px); animation-name: meteor-first; animation-duration: 4.5s; }
.meteors i:nth-child(2) { top: 39%; left: -18%; width: 110px; background: linear-gradient(90deg, transparent, rgba(184,199,255,.85) 65%, #fff); transform: rotate(36.4deg); animation-name: meteor-fall-right; animation-duration: 5.5s; }
.meteors i:nth-child(3) { top: -8%; left: 52%; width: 125px; animation-duration: 6.5s; }
.site-credit { position: fixed; left: 0; right: 0; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 3; pointer-events: none; text-align: center; color: rgba(168,179,208,.78); font-size: .78rem; letter-spacing: .08em; }
.site-credit span { color: rgba(134,183,255,.65); padding: 0 .35rem; }
@keyframes star-drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(8px,-5px,0) scale(1.015); } }
@keyframes meteor-fall { 0%, 10% { opacity: 0; transform: translate3d(0,0,0) rotate(-36.4deg); } 17% { opacity: .9; transform: translate3d(-58px,43px,0) rotate(-36.4deg); } 70% { opacity: .85; transform: translate3d(-238px,175px,0) rotate(-36.4deg); } 100% { opacity: 0; transform: translate3d(-340px,250px,0) rotate(-36.4deg); } }
@keyframes meteor-first { 0% { opacity: .9; transform: translate3d(-170px,0,0) rotate(-36.4deg); } 70% { opacity: .85; transform: translate3d(-289px,175px,0) rotate(-36.4deg); } 100% { opacity: 0; transform: translate3d(-340px,250px,0) rotate(-36.4deg); } }
@keyframes meteor-fall-right { 0%, 10% { opacity: 0; transform: translate3d(0,0,0) rotate(36.4deg); } 17% { opacity: .9; transform: translate3d(58px,43px,0) rotate(36.4deg); } 70% { opacity: .85; transform: translate3d(238px,175px,0) rotate(36.4deg); } 100% { opacity: 0; transform: translate3d(340px,250px,0) rotate(36.4deg); } }
@media (prefers-reduced-motion: reduce) { .stars, .meteor { animation: none; } .meteor { display: none; } }
.content { width: min(760px, 100%); margin: 0 auto; position: relative; z-index: 1; }
.landing { min-height: calc(100vh - 48px); display: grid; place-items: center; text-align: center; padding-bottom: 12vh; }
.eyebrow { color: var(--accent-strong); letter-spacing: .2em; font-size: .72rem; text-transform: uppercase; }
h1 { margin: .35rem 0 .4rem; font-size: clamp(2.45rem, 10vw, 5.4rem); letter-spacing: -.05em; font-weight: 650; }
h2 { margin: 0; font-size: clamp(1.5rem, 5vw, 2.25rem); letter-spacing: -.03em; }
.subtitle { margin: 0; color: var(--muted); font-size: clamp(1rem, 3vw, 1.2rem); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 2rem; }
.button { min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid var(--line); color: #07101e; background: var(--accent); font-weight: 700; letter-spacing: .04em; }
.button.secondary { color: var(--accent); background: rgba(17, 24, 42, .72); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.back { color: var(--accent); background: transparent; border: 0; padding: 10px 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(18px, 4vw, 28px); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 24px; }
.mode-card { text-align: left; min-height: 130px; padding: 18px; border-radius: 18px; border: 1px solid var(--line); color: inherit; background: rgba(11,16,34,.7); }
.mode-card:hover, .mode-card:focus-visible { border-color: var(--accent-strong); background: rgba(24, 36, 67, .85); }
.mode-card strong { display: block; color: var(--accent); font-size: 1.05rem; }
.mode-card span { display: block; color: var(--muted); margin-top: 8px; line-height: 1.4; font-size: .9rem; }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label, .section-label { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; }
input[type=file] { width: 100%; color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: 14px; background: rgba(7,10,20,.45); }
.hint, .status { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.error { color: var(--danger); }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { padding: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; background: rgba(7,10,20,.35); }
.choice.selected { border-color: var(--accent-strong); color: #fff; background: rgba(134,183,255,.14); }
.preview { width: 100%; max-height: 62vh; object-fit: contain; background: #02040a; border-radius: 16px; margin-top: 4px; }
.result-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .85rem; }
.mask-wrap { position: relative; background: #02040a; border-radius: 16px; overflow: hidden; touch-action: none; cursor: crosshair; }
.mask-wrap canvas { width: 100%; display: block; }
.mask-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.brush-cursor { position: absolute; display: none; border: 2px solid #7ce8c3; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.65), 0 0 14px rgba(124,232,195,.35); }
.brush-controls { display: grid; gap: 8px; margin-top: 14px; }
.brush-controls label { display: flex; justify-content: space-between; color: var(--text); font-size: .9rem; }
.brush-controls output { color: var(--accent); font-variant-numeric: tabular-nums; }
.brush-controls input { width: 100%; accent-color: var(--accent); }
@media (max-width: 560px) { .mode-grid { grid-template-columns: 1fr; } .button { width: 100%; } .actions { display: grid; } }
