:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0a0a0b;
  color: #f5f5f5;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(64, 68, 75, 0.28), transparent 35rem),
    #0a0a0b;
}

button,
textarea,
select,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.control-panel,
.preview-panel {
  border: 1px solid #292a2e;
  border-radius: 18px;
  background: rgba(20, 21, 23, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.control-panel {
  min-width: 0;
  padding: 28px;
}

.heading {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #9da1aa;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.heading > p:last-child {
  margin-bottom: 0;
  color: #a9abb2;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.field > span {
  display: flex;
  justify-content: space-between;
  color: #d8d9dd;
  font-size: 14px;
  font-weight: 650;
}

textarea,
select {
  width: 100%;
  border: 1px solid #35363c;
  border-radius: 10px;
  outline: none;
  background: #111214;
  color: #f5f5f5;
}

textarea {
  min-height: 116px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

select {
  min-height: 46px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  border-color: #737987;
  box-shadow: 0 0 0 3px rgba(115, 121, 135, 0.16);
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: #f5f5f5;
}

.radius-field {
  justify-items: start;
}

.radius-field > span,
.radius-field input[type="range"] {
  width: min(220px, 100%);
}

.dimension-field {
  min-width: 0;
  justify-items: start;
}

.dimension-field > span,
.dimension-field input[type="range"] {
  width: min(280px, 100%);
}

output {
  color: #9699a1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.history {
  min-width: 0;
  margin-bottom: 22px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 14px;
}

.section-heading span,
.history-empty {
  color: #9da1aa;
  font-size: 12px;
}

.history-empty {
  min-height: 48px;
  margin: 0;
  padding: 14px 12px;
  border: 1px dashed #35363c;
  border-radius: 10px;
}

.history-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.history-item {
  min-width: 0;
  min-height: 48px;
  width: 100%;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  overflow: hidden;
  border: 1px solid #35363c;
  border-radius: 10px;
  background: #111214;
  color: #f5f5f5;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 180ms ease, background 180ms ease;
}

.history-item:hover {
  border-color: #565a64;
  background: #17181b;
}

.history-item:active {
  background: #202125;
}

.history-item:focus-visible {
  outline: 2px solid #f5f5f5;
  outline-offset: 2px;
}

.history-item strong,
.history-item span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-item strong {
  font-size: 13px;
}

.history-item span {
  color: #b4b6bd;
  font-size: 12px;
}

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

.button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 180ms ease, background 180ms ease;
  touch-action: manipulation;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible {
  outline: 2px solid #f5f5f5;
  outline-offset: 2px;
}

.button-primary {
  background: #f5f5f5;
  color: #0a0a0b;
}

.button-secondary {
  border-color: #393a40;
  background: #202125;
  color: #f5f5f5;
}

.preview-panel {
  min-width: 100%;
  width: max-content;
  padding: 22px;
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-heading h2 {
  margin: 0;
  font-size: 16px;
}

.preview-heading span {
  color: #8f929a;
  font-size: 12px;
  font-weight: 650;
}

.canvas-stage {
  min-width: 720px;
  min-height: 360px;
  width: max-content;
  overflow: visible;
  border: 1px solid #28292d;
  border-radius: 14px;
  background:
    linear-gradient(45deg, #17181b 25%, transparent 25%),
    linear-gradient(-45deg, #17181b 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #17181b 75%),
    linear-gradient(-45deg, transparent 75%, #17181b 75%),
    #111214;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.canvas-scroll-content {
  min-width: 718px;
  min-height: 360px;
  width: max-content;
  padding: 28px;
  display: grid;
  place-items: center;
}

#comment-canvas {
  display: block;
  flex: none;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.34));
}

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

@media (max-width: 480px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .control-panel,
  .preview-panel {
    padding: 18px;
    border-radius: 14px;
  }

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

@media (prefers-reduced-motion: reduce) {
  .button,
  .history-item {
    transition: none;
  }

  .button:hover,
  .button:active {
    transform: none;
  }
}
