:root {
  --ink: #000000;
  --muted: #4d4d4d;
  --paper: #f6f5e7;
  --panel: #f6f5e7;
  --panel-deep: #e6e6e6;
  --line: rgba(0, 0, 0, 0.1);
  --line-solid: #000000;
  --rail: #2a2722;
  --wall: #171a1c;
  --wall-mid: #24282a;
  --metal: #c9cbc5;
  --metal-dark: #8e918c;
  --signal: #000000;
  --accent: #fffba4;
  --filter-real: #e6e6e6;
  --filter-internet: #f1faff;
  --filter-pink: #ffeeee;
  --filter-green: #bcf5e7;
  --filter-sand: #e8e0cb;
  --top-bar-h: 52px;
  --brand-bar-h: var(--top-bar-h);
  --shadow: none;
}

* {
  box-sizing: border-box;
  font-family: monospace;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: monospace;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.control-panel {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border-right: 0.5px solid var(--line-solid);
  background: var(--paper);
  box-shadow: none;
}

.brandline {
  display: flex;
  align-items: center;
  height: var(--brand-bar-h);
  min-height: var(--brand-bar-h);
  padding: 0 16px;
  border-bottom: 0.5px solid var(--line);
  background: transparent;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  flex: 0 0 auto;
  object-fit: cover;
}

.brandline p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brandline h1 {
  margin: 0;
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-section {
  padding: 16px;
  border-bottom: 0.5px solid var(--line);
}

.scrolling-controls {
  min-height: 0;
  overflow: auto;
  border-top: 0.5px solid var(--line);
}

.scrolling-controls .panel-section:first-child {
  border-top: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 32px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-heading span {
  flex: 1 1 auto;
  min-width: max-content;
  outline: 0.5px solid var(--line);
  border: 0.5px solid var(--line);
  background: var(--paper);
  padding: 2px 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 27px;
  text-transform: none;
}

.section-heading small {
  outline: 0.5px solid var(--line);
  border: 0.5px solid var(--line);
  background: var(--filter-sand);
  padding: 2px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 27px;
}

.ghost-button,
.small-button,
.random-button {
  min-height: 32px;
  outline: 0.5px solid var(--line);
  border: 0.5px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  line-height: 27px;
  text-transform: none;
  transition:
    box-shadow 120ms ease,
    background 120ms ease;
}

.ghost-button,
.small-button {
  padding: 0 12px;
}

.ghost-button:hover,
.small-button:hover,
.random-button:hover {
  box-shadow: inset 0 0 0 2.5px var(--line-solid);
  background: var(--accent);
}

.random-button {
  min-width: 104px;
  padding: 0 16px;
  border-color: var(--line);
  background: var(--filter-green);
  color: var(--ink);
}

.random-button:hover {
  border-color: var(--line-solid);
  background: var(--filter-green);
}

.can-preview {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  width: 100%;
  min-height: 0;
  border: 0.5px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(230, 230, 230, 0.56)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.045) 0 1px, transparent 1px 18px);
  box-shadow: none;
  overflow: hidden;
}

.can-preview.drag-over,
.layer-drop.drag-over,
.custom-slot.drag-over {
  border-color: var(--line-solid);
  box-shadow: inset 0 0 0 2.5px var(--line-solid);
  background-color: #ffffff;
}

.drop-hint {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.layer-drop {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 0.5px dashed var(--line-solid);
  border-radius: 0;
  color: var(--muted);
  background: #ffffff;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
}

.layers-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  min-height: 54px;
  border: 0.5px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.layer-row.is-selected {
  border-color: var(--line-solid);
  background: var(--accent);
  box-shadow: inset 0 0 0 2.5px var(--line-solid);
}

.layer-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 8px;
}

.layer-thumb {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 0.5px solid var(--line);
  border-radius: 0;
  background: white;
}

.layer-thumb img {
  max-width: 100%;
  max-height: 100%;
}

.layer-name {
  min-width: 0;
}

.layer-name strong,
.slot-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-name span,
.slot-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.row-actions {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  align-self: stretch;
  gap: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 100%;
  min-height: 54px;
  border: 0;
  border-left: 0.5px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.icon-button:hover {
  box-shadow: inset 0 0 0 2.5px var(--line-solid);
  background: var(--accent);
}

.slot-remove:hover {
  box-shadow: inset 0 0 0 2.5px #ffffff;
  background: var(--signal);
}

.layer-inspector {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.control-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 66px 18px;
  align-items: center;
  gap: 8px;
}

.control-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.control-row input[type="range"] {
  width: 100%;
}

.control-row input[type="number"] {
  width: 66px;
  min-height: 28px;
  border: 0.5px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  padding: 0 6px;
  text-align: right;
}

.control-row .unit {
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

.custom-cans {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.custom-slot {
  position: relative;
  display: grid;
  grid-template-rows: 72px auto;
  gap: 7px;
  min-width: 0;
  border: 0.5px dashed var(--line-solid);
  border-radius: 0;
  background: #ffffff;
  padding: 7px;
  cursor: pointer;
}

.custom-slot.has-image {
  border-style: solid;
  border-color: var(--line);
}

.slot-preview {
  display: grid;
  place-items: end center;
  min-width: 0;
  overflow: hidden;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(226, 221, 211, 0.8)),
    repeating-linear-gradient(45deg, rgba(23, 22, 19, 0.08) 0 1px, transparent 1px 8px);
}

.slot-preview img {
  max-width: 90%;
  max-height: 68px;
  object-fit: contain;
}

.slot-copy {
  min-width: 0;
}

.slot-remove {
  position: absolute;
  top: 0;
  right: 0;
  display: none;
  width: 28px;
  height: 28px;
  border: 0.5px solid var(--ink);
  border-radius: 0;
  background: var(--signal);
  color: white;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.custom-slot.has-image .slot-remove {
  display: grid;
  place-items: center;
}

.shelf-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #232625 0%, #141616 100%);
}

.shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  min-height: var(--top-bar-h);
  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.56);
  border-bottom: 2px solid #090a0a;
  color: #f1f2ef;
  background:
    linear-gradient(180deg, #f0efe7 0%, #c6c8c2 22%, #7f8581 54%, #3d4240 100%);
  box-shadow:
    inset 0 8px 10px rgba(255, 255, 255, 0.22),
    0 8px 18px rgba(0, 0, 0, 0.3);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  width: 100%;
  flex-wrap: wrap;
}

.collection-switches {
  display: flex;
  align-items: center;
  gap: 0;
}

.switch-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 32px;
  outline: 0.5px solid rgba(0, 0, 0, 0.1);
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 0;
  background: var(--filter-internet);
  padding: 2px 14px;
  cursor: pointer;
  user-select: none;
}

.collection-switches .switch-chip:nth-child(2) {
  background: var(--filter-internet);
}

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

.switch-chip span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 27px;
  text-transform: none;
}

.switch-chip:has(input:checked) {
  border-color: var(--line-solid);
  outline-color: var(--line-solid);
  background: var(--accent);
  box-shadow: inset 0 0 0 2.5px var(--line-solid);
}

.switch-chip:has(input:checked) span {
  font-weight: 600;
}

.range-field {
  display: grid;
  grid-template-columns: auto 96px 28px;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  outline: 0.5px solid rgba(0, 0, 0, 0.1);
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 0;
  background: var(--paper);
  padding: 2px 10px;
}

.range-field span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 27px;
  text-transform: none;
}

.range-field output {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  text-align: right;
}

.range-field input[type="range"] {
  width: 96px;
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  height: 18px;
  margin: 0;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 0;
  background: var(--line-solid);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 6px;
  height: 18px;
  margin-top: -8px;
  border: 0;
  border-radius: 0;
  background: var(--line-solid);
  cursor: ew-resize;
}

input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 0;
  background: var(--line-solid);
}

input[type="range"]::-moz-range-thumb {
  width: 6px;
  height: 18px;
  border: 0;
  border-radius: 0;
  background: var(--line-solid);
  cursor: ew-resize;
}

.shelf-stage {
  --rows: 6;
  --can-h: 78px;
  --rail-h: 18px;
  --row-pad-bottom: 15px;
  display: grid;
  position: relative;
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.shelf-stage.drag-over::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 10;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 0 0 999px rgba(255, 255, 255, 0.03),
    0 0 34px rgba(255, 255, 255, 0.16);
  pointer-events: none;
  animation: shelfDropPulse 900ms ease-in-out infinite alternate;
}

.shelf-stage.drag-over::after {
  content: "DROP IN";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 11;
  transform: translate(-50%, -50%);
  border: 0.5px solid rgba(255, 255, 255, 0.82);
  border-radius: 0;
  background: rgba(16, 18, 18, 0.86);
  color: #fffdf3;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  padding: 12px 18px;
  pointer-events: none;
}

.shelf-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 0;
  padding: 0 0 var(--row-pad-bottom);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.45)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.12), transparent 38%),
    linear-gradient(180deg, var(--wall-mid), var(--wall) 74%);
}

.shelf-row::before {
  content: "";
  position: absolute;
  inset: 0 0 var(--rail-h);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent 12%, transparent 88%, rgba(0, 0, 0, 0.32)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 32px);
  opacity: 0.95;
}

.shelf-row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--rail-h);
  background:
    linear-gradient(180deg, #f4f1e8 0%, #bfc0ba 18%, #858984 46%, #3b3f3d 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  border-bottom: 2px solid #090a0a;
  box-shadow:
    inset 0 8px 10px rgba(255, 255, 255, 0.22),
    0 -7px 18px rgba(0, 0, 0, 0.34);
}

.price-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(3px, calc(var(--rail-h) * 0.14));
  z-index: 4;
  display: flex;
  justify-content: space-around;
  height: 10px;
  pointer-events: none;
}

.price-strip span {
  display: block;
  width: clamp(38px, 8%, 82px);
  border-radius: 0;
  background: #fffdf2;
  opacity: 0.82;
}

.price-strip span:nth-child(3n + 2) {
  background: linear-gradient(90deg, #fffdf2 0 52%, #f0ce3f 52% 100%);
}

.price-strip span:nth-child(4n) {
  background: #fff8df;
  opacity: 0.7;
}

.shelf-items {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(3px, 0.45vw, 8px);
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.brand-group {
  display: flex;
  align-items: flex-end;
  gap: clamp(1px, 0.16vw, 3px);
  min-width: 0;
  flex: 0 0 auto;
  filter: drop-shadow(4px 9px 5px rgba(0, 0, 0, 0.34));
}

.shelf-can,
.shelf-own {
  height: var(--can-h);
  flex: 0 0 auto;
}

.shelf-can {
  display: block;
  width: auto;
  max-width: calc(var(--can-h) * 0.72);
  object-fit: contain;
}

.shelf-can.is-overflow-hidden,
.brand-group.is-overflow-hidden,
.shelf-own.is-overflow-hidden {
  display: none;
}

.brand-group.is-overflow-hidden .shelf-can,
.brand-group.is-overflow-hidden .shelf-own {
  display: none;
}

.can-composite {
  position: relative;
  width: auto;
  aspect-ratio: 407 / 1039;
  isolation: isolate;
}

.can-composite.preview-can {
  height: min(410px, 92%);
  filter: drop-shadow(16px 28px 26px rgba(32, 25, 17, 0.24));
}

.can-composite.shelf-own {
  height: var(--can-h);
}

.can-base,
.can-light,
.can-design-texture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.can-base,
.can-light,
.can-design-texture {
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.can-base {
  z-index: 1;
}

.can-design-texture {
  z-index: 2;
}

.can-light {
  z-index: 3;
  opacity: 0.38;
  mix-blend-mode: multiply;
}

.can-composite.is-editable {
  cursor: grab;
}

.can-composite.is-editable:active {
  cursor: grabbing;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 340px minmax(0, 1fr);
  }

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

  .toolbar-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 46dvh) minmax(0, 1fr);
  }

  .control-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .can-preview {
    aspect-ratio: 4 / 4.6;
  }

  .custom-cans {
    grid-template-columns: repeat(5, minmax(60px, 1fr));
  }

  .shelf-toolbar {
    padding: 8px;
  }

  .range-field {
    grid-template-columns: auto 78px 28px;
  }

  .range-field input[type="range"] {
    width: 78px;
  }
}

@keyframes shelfDropPulse {
  from {
    opacity: 0.72;
  }

  to {
    opacity: 1;
  }
}
