:root {
  color-scheme: light;
  --ink: #101214;
  --muted: #64707c;
  --line: #d9e0e7;
  --surface: #f6f8fa;
  --panel: rgba(255, 255, 255, 0.92);
  --accent: #0f766e;
  --accent-strong: #105f59;
  --warm: #d97706;
  --shadow: 0 18px 52px rgba(16, 18, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 9%, rgba(217, 119, 6, 0.13), transparent 23rem),
    radial-gradient(circle at 8% 90%, rgba(15, 118, 110, 0.13), transparent 24rem),
    linear-gradient(180deg, #ffffff 0%, var(--surface) 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.35;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  color: inherit;
}

.workshop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1440px, calc(100% - 32px));
  height: 58px;
  margin: 0 auto;
}

.workshop-brand,
.workshop-links {
  display: flex;
  align-items: center;
}

.workshop-brand {
  gap: 0.65rem;
  font-weight: 820;
}

.workshop-links {
  gap: 1rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.workshop-links a:hover {
  color: var(--accent);
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  object-fit: cover;
}

.workshop-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  gap: 14px;
  width: min(1440px, calc(100% - 32px));
  height: calc(100svh - 74px);
  margin: 0 auto 16px;
}

.preview-area,
.controls-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  min-height: 74px;
  padding: 1rem;
}

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

.eyebrow {
  margin-bottom: 0.45rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.48rem, 2.2vw, 2.25rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.1;
}

.toolbar-controls,
.toolbar-actions {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.toolbar-controls {
  align-items: flex-start;
  gap: 0.9rem;
}

.color-menu {
  position: relative;
  display: grid;
  gap: 0.35rem;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.color-menu-button {
  display: inline-grid;
  width: 68px;
  height: 42px;
  box-sizing: border-box;
  place-items: center;
  border: 1px solid rgba(96, 112, 124, 0.24);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  padding: 4px;
  box-shadow:
    0 8px 18px rgba(16, 18, 20, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.color-split {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--current-bg) 0 50%, var(--current-fg) 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(16, 18, 20, 0.12);
}

.color-popover {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.55rem);
  left: 0;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 52px rgba(16, 18, 20, 0.16);
  padding: 0.9rem;
}

.color-popover[hidden] {
  display: none;
}

.pattern-select-field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.pattern-select-field span {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-select-field select {
  appearance: none;
  -webkit-appearance: none;
  width: 108px;
  height: 42px;
  box-sizing: border-box;
  border: 1px solid rgba(96, 112, 124, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--accent-strong) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--accent-strong) 50%, transparent 50%) calc(100% - 13px) 50% / 6px 6px no-repeat,
    linear-gradient(180deg, #ffffff, #edf2f7);
  color: var(--accent-strong);
  padding: 0 1.45rem 0 0.65rem;
  font-weight: 850;
}

.tool-button,
.quiet-button,
.shape-button,
.pager-button,
.swatch-button,
.upload-icon-button {
  border: 1px solid rgba(96, 112, 124, 0.24);
  cursor: pointer;
}

.tool-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #edf2f7);
  color: var(--accent-strong);
  box-shadow:
    0 8px 18px rgba(16, 18, 20, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.tool-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.pattern-preview {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #f6f8fa;
}

.pattern-preview svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.controls-panel {
  display: grid;
  grid-auto-rows: max-content;
  gap: 1px;
  overflow: auto;
  background: rgba(217, 224, 231, 0.85);
}

.control-section {
  display: grid;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.93);
  padding: 1rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 780;
}

.search-field,
.color-control,
.range-section label:not(.toggle-control) {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
}

.search-field input {
  min-height: 42px;
  padding: 0 0.75rem;
}

.selected-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: start;
  gap: 0.65rem;
}

.upload-icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #ffffff;
  color: #151719;
  box-shadow: inset 0 0 0 1px rgba(16, 18, 20, 0.03);
}

.upload-icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.upload-icon-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.selected-strip {
  display: flex;
  flex-wrap: wrap;
  min-height: 42px;
  gap: 0.45rem;
  overflow: visible;
}

.selected-mark,
.shape-button {
  display: inline-grid;
  place-items: center;
}

.selected-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--current-bg);
  color: var(--current-fg);
}

button.selected-mark {
  cursor: pointer;
  padding: 0;
}

.selected-mark svg,
.shape-button svg {
  width: 28px;
  height: 28px;
  overflow: visible;
  fill: currentColor;
}

.empty-note,
.loading-note {
  align-self: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.15rem;
}

.shape-button {
  aspect-ratio: 1;
  border-radius: 12px;
  background: #151719;
  color: #ffffff;
}

.shape-button[aria-pressed="true"] {
  border-color: rgba(15, 118, 110, 0.8);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.icon-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.icon-pager span {
  min-width: 7.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
  text-align: center;
}

.pager-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent-strong);
}

.pager-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.pager-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.quiet-button {
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 820;
}

.color-control input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  padding: 3px;
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 0.45rem;
}

.swatch-button {
  min-height: 34px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg) 0 50%, var(--fg) 50% 100%);
}

.swatch-button[aria-current="true"] {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.72);
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.toggle-control input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.range-section input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

button:hover,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
}

select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 2px;
}

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

  .workshop-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .pattern-preview {
    min-height: 58svh;
  }

  .controls-panel {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .workshop-header {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    align-content: center;
    padding: 0.65rem 0;
  }

  .workshop-links {
    width: 100%;
    justify-content: space-between;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .tool-button {
    flex: 1;
  }

  .shape-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

}
