:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.8);
  --cardSolid: #ffffff;
  --text: rgba(0, 0, 0, 0.88);
  --muted: rgba(0, 0, 0, 0.56);
  --border: rgba(0, 0, 0, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadowSm: 0 6px 18px rgba(0, 0, 0, 0.08);
  --radius: 18px;
  --radiusSm: 14px;
  --accent: #0071e3;
  --accentHover: #0077ed;
  --ring: rgba(0, 113, 227, 0.24);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 42px 18px 72px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 22px;
  padding: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 4.3vw, 54px);
  letter-spacing: -0.8px;
  line-height: 1.04;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.55;
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(0, 0, 0, 0.7);
  font-size: 12px;
  width: fit-content;
}

.heroMeta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metaItem {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 12px 14px;
}

.metaTitle {
  color: var(--muted);
  font-size: 12px;
}

.metaValue {
  margin-top: 4px;
  color: rgba(0, 0, 0, 0.78);
  font-size: 13px;
}

.panel {
  display: grid;
  grid-template-columns: 410px 1fr;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.value {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(0, 0, 0, 0.72);
}

.dropzone {
  position: relative;
  border-radius: 18px;
  border: 1px dashed rgba(0, 0, 0, 0.22);
  background: rgba(255, 255, 255, 0.8);
  padding: 16px 16px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease,
    box-shadow 120ms ease;
  outline: none;
}

.dropzone:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 113, 227, 0.35);
  box-shadow: var(--shadowSm);
}

.dropzone:focus-visible {
  box-shadow: 0 0 0 4px var(--ring);
}

.dropzone.dragover {
  border-color: rgba(0, 113, 227, 0.6);
  background: rgba(0, 113, 227, 0.05);
}

.dropIcon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.01));
  position: relative;
}

.dropIcon::before {
  content: "";
  position: absolute;
  inset: 10px 11px 12px 11px;
  border-radius: 10px;
  border: 1px solid rgba(0, 113, 227, 0.35);
}

.dropTitle {
  font-weight: 600;
  letter-spacing: -0.1px;
}

.dropSubtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.fileInput {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.control {
  padding: 12px;
  border-radius: var(--radiusSm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.control input[type="range"] {
  width: 100%;
}

.select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 38px 10px 12px;
  background-color: rgba(255, 255, 255, 0.9);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%23666' d='M5.3 7.7a1 1 0 0 1 1.4 0L10 11l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: box-shadow 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.select:hover {
  border-color: rgba(0, 0, 0, 0.18);
  background-color: rgba(255, 255, 255, 0.95);
}

.select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radiusSm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(0, 0, 0, 0.82);
  user-select: none;
}

.actions {
  display: flex;
  gap: 10px;
}

button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease,
    box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadowSm);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary {
  border-color: rgba(0, 113, 227, 0.35);
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--accentHover);
}

.secondary {
  background: rgba(255, 255, 255, 0.7);
}

.hint {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.preview {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

.previewHeader {
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.78);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.checkerboard {
  width: 100%;
  height: 100%;
  min-height: 420px;
  padding: 12px;
  background-image:
    linear-gradient(45deg, rgba(0, 0, 0, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.045) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px;
  display: grid;
  place-items: center;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.footer {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 980px) {
  .panel {
    grid-template-columns: 1fr;
  }
  .previews {
    grid-template-columns: 1fr;
  }
  .checkerboard {
    min-height: 360px;
  }
  .heroMeta {
    grid-template-columns: 1fr;
  }
}
