:root {
  --bg: #111111;
  --panel: #181818;
  --panel-2: #202020;
  --line: #2a2a2a;
  --text: #e7decc;
  --muted: #9e978a;
  --muted-2: #6f6a61;
  --ink: #111111;
  --accent: #e7decc;
  --accent-hover: #f3ebdd;
  --danger: #c99982;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(231, 222, 204, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Segoe UI, Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-header,
.app-footer,
.controls-panel,
.preview-panel {
  border: 1px solid var(--line);
  background: rgba(24, 24, 24, 0.96);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.app-header {
  min-height: 112px;
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  letter-spacing: -0.035em;
}

.subtitle,
.preview-header p,
.note,
.muted {
  color: var(--muted);
}

.subtitle {
  margin-bottom: 0;
}

.header-mark {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--accent);
  font-size: 2.2rem;
  font-weight: 900;
  transform: skewX(-8deg);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.controls-panel,
.preview-panel {
  border-radius: var(--radius);
}

.controls-panel {
  height: calc(100vh - 190px);
  min-height: 560px;
  overflow-y: auto;
  padding: 18px;
  scrollbar-color: var(--muted-2) transparent;
}

.control-group {
  padding: 0 0 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(231, 222, 204, 0.08);
}

.control-group:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.control-group h2 {
  margin-bottom: 12px;
  color: var(--muted-2);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #beb6a6;
  font-size: 0.9rem;
  font-weight: 750;
}

input[type="text"] {
  width: 100%;
  margin-bottom: 14px;
  border: 1px solid rgba(231, 222, 204, 0.1);
  border-radius: 12px;
  background: #101010;
  color: var(--text);
  outline: 0;
  padding: 12px 12px;
}

input[type="text"]:focus {
  border-color: rgba(231, 222, 204, 0.55);
  box-shadow: 0 0 0 4px rgba(231, 222, 204, 0.08);
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: #d8d0c0;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
}

.radio-row input {
  accent-color: var(--accent);
}

.color-row {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: start;
}

input[type="color"] {
  width: 54px;
  height: 46px;
  border: 1px solid rgba(231, 222, 204, 0.18);
  border-radius: 12px;
  background: #101010;
  padding: 4px;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-button span,
button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.file-button span:hover,
button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

button.secondary {
  margin-top: 10px;
  border: 1px solid rgba(231, 222, 204, 0.24);
  background: #101010;
  color: var(--text);
}

button.secondary:hover {
  background: #151515;
}

.note,
.muted {
  margin-bottom: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.export-group .note {
  margin-top: 12px;
}

.preview-panel {
  min-height: 560px;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.preview-header h2 {
  margin-bottom: 4px;
  font-size: 1.25rem;
}

.preview-header p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(231, 222, 204, 0.2);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: rgba(16, 16, 16, 0.8);
  font-size: 0.78rem;
  font-weight: 800;
}

.canvas-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04), transparent),
    #151515;
  border: 1px solid rgba(231, 222, 204, 0.08);
  padding: 24px;
}

#previewCanvas {
  width: min(420px, 100%);
  height: auto;
  border-radius: 18px;
  background: #202020;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.35);
}

.app-footer {
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted-2);
  font-size: 0.85rem;
}

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

  .controls-panel {
    height: auto;
    min-height: auto;
    max-height: none;
  }

  .preview-panel {
    min-height: 520px;
  }

  .app-header,
  .app-footer,
  .preview-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
