* {
  box-sizing: border-box;
}

:root {
  --bg: #0b1020;
  --panel: #131a2e;
  --panel-2: #1a2340;
  --text: #e8eefc;
  --muted: #9fb0d7;
  --accent: #67a3ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(103, 163, 255, 0.16), transparent 28%),
    linear-gradient(180deg, #07101e 0%, #0b1020 100%);
  color: var(--text);
  min-height: 100vh;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 44px);
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 380px 1fr;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(12px);
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 20px;
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="file"],
select,
button,
input[type="range"] {
  width: 100%;
}

input[type="text"],
select,
input[type="file"] {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 12px 14px;
}

input[type="file"]::file-selector-button {
  border: 0;
  background: rgba(103, 163, 255, 0.18);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  margin-right: 12px;
  cursor: pointer;
}

.two-col {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 18px;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #08101d;
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(103, 163, 255, 0.08);
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.preview-panel {
  display: flex;
  flex-direction: column;
}

.preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 520px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px dashed var(--border);
  background:
    linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.03) 75%);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
}

canvas {
  max-width: 100%;
  max-height: 72vh;
  display: none;
  background: transparent;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.stats div {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stats strong {
  font-size: 15px;
}

@media (max-width: 940px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .actions,
  .two-col,
  .stats {
    grid-template-columns: 1fr;
  }

  .preview-wrap {
    min-height: 360px;
  }
}
