:root {
  --bg: #ececea;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #999;
  --line: #ccc;
  --line-faint: rgba(0, 0, 0, 0.08);
  --accent: #FF3C00;
  --sidebar-w: 200px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.mono {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 10px;
  letter-spacing: 0;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--sidebar-w);
  height: 100vh;
}

.sidebar {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.sidebar-left {
  border-right: 1px solid var(--line-faint);
}

.sidebar-right {
  border-left: 1px solid var(--line-faint);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-meta {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.control-row label,
.section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.08em;
}

.control-row .value {
  text-align: right;
  color: var(--text-muted);
}

.control-select {
  width: 100%;
  padding: 6px 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.control-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}

.control-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

.control-row input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}

.action-btn {
  width: 100%;
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 20px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.generate-btn {
  margin-top: 6px;
  background: var(--text);
  color: var(--surface);
  border: none;
}

.generate-btn:hover {
  opacity: 0.85;
}

.export-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text);
}

.export-btn:hover {
  opacity: 0.85;
}

.shortcut-hint {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin-top: 4px;
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.preview-frame {
  position: relative;
  display: inline-flex;
  max-width: min(900px, 90vw);
  max-height: calc(100vh - 64px);
}

.preview-box {
  width: min(900px, 90vw, calc((100vh - 64px) * var(--aspect-w, 16) / var(--aspect-h, 9)));
  max-height: calc(100vh - 64px);
  aspect-ratio: 16 / 9;
  background: var(--surface);
  overflow: hidden;
  transition: width 0.3s ease, aspect-ratio 0.3s ease;
}

.preview-svg {
  width: 100%;
  height: 100%;
}

.preview-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.crop-mark {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--text);
  border-style: solid;
  pointer-events: none;
}

.crop-mark.tl { top: -8px; left: -8px; border-width: 2px 0 0 2px; }
.crop-mark.tr { top: -8px; right: -8px; border-width: 2px 2px 0 0; }
.crop-mark.bl { bottom: -8px; left: -8px; border-width: 0 0 2px 2px; }
.crop-mark.br { bottom: -8px; right: -8px; border-width: 0 2px 2px 0; }

.section-label {
  display: block;
  margin-bottom: 12px;
}

.output-block {
  margin-bottom: 28px;
}

.output-specs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.output-specs div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.output-specs dt {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.output-specs dd {
  color: var(--text);
}

.ratio-block {
  margin-bottom: 28px;
}

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

.ratio-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s;
}

.ratio-btn:hover {
  opacity: 0.75;
}

.ratio-btn.active {
  opacity: 1;
}

.ratio-shape {
  display: block;
  width: calc(28px * var(--w) / max(var(--w), var(--h)));
  height: calc(28px * var(--h) / max(var(--w), var(--h)));
  border: 1.5px solid var(--text);
  transition: background 0.15s;
}

.ratio-btn.active .ratio-shape {
  background: var(--text);
}

.format-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.format-select {
  width: 100%;
  padding: 6px 0;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 10px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  outline: none;
}

@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar-left { border-right: none; border-bottom: 1px solid var(--line-faint); }
  .sidebar-right { border-left: none; border-top: 1px solid var(--line-faint); }
  .stage { min-height: 50vh; }
  .preview-frame { height: auto; min-height: 280px; }
}
