:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --accent: #0f8bff;
  --accent-dark: #0868c7;
  --shadow: 0 18px 48px rgba(22, 34, 51, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover {
  border-color: #aeb9c8;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.preview-panel,
.controls {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.brand-mark {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.brand-mark img {
  display: block;
  width: min(178px, 48vw);
  height: auto;
}

.brand-row span,
.control-section p {
  color: var(--muted);
  font-size: 13px;
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle button {
  border: 0;
  border-radius: 0;
  min-height: 34px;
  padding: 0 10px;
}

.view-toggle .is-active {
  background: var(--ink);
  color: #fff;
}

.preview-stage {
  position: relative;
  min-height: 540px;
  background:
    radial-gradient(circle at 50% 82%, rgba(23, 32, 42, 0.09), transparent 27%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  overflow: hidden;
}

#kit2d,
.three-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#kit2d {
  display: block;
}

.three-stage {
  display: none;
}

.preview-stage.is-3d #kit2d {
  display: none;
}

.preview-stage.is-3d .three-stage {
  display: block;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: auto;
  max-height: calc(100vh - 36px);
}

.control-section {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.control-section:last-child {
  border-bottom: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input[type="text"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 4px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-control input {
  width: 100%;
  min-height: 40px;
  border: 1px dashed #aeb9c8;
  border-radius: 6px;
  padding: 8px;
}

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

  .controls {
    max-height: none;
  }

  .preview-stage {
    min-height: 480px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
    gap: 10px;
  }

  .brand-row {
    align-items: stretch;
    flex-direction: column;
  }

  .preview-stage {
    min-height: 430px;
  }

  .color-grid {
    grid-template-columns: 1fr;
  }
}
