.tier-board,
.clip-list {
  display: grid;
  gap: 10px;
}

.tier-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.row-label {
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: var(--row-color, var(--surface-soft));
}

.row-label input[type="text"] {
  width: 100%;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
}

.row-label input[type="color"] {
  width: 100%;
  min-height: 34px;
  padding: 2px;
  border: 1px solid rgb(0 0 0 / 0.18);
  border-radius: 6px;
  background: #ffffff;
}

.tier-dropzone,
.bench-dropzone {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
  min-height: 94px;
  padding: 12px;
}

.bench {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tier-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.item-preview {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: var(--surface-soft);
  overflow: hidden;
}

.item-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-initial {
  font-weight: 900;
  color: var(--muted);
}

.item-name {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.item-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 36px 36px minmax(0, 1fr);
  gap: 6px;
}

.item-actions button,
.clip-actions button {
  min-width: 36px;
  padding: 0;
}

.tier-item select {
  min-width: 0;
  padding: 0 8px;
}


  .tier-row {
    grid-template-columns: 1fr;
  }

  .row-label {
    grid-template-columns: minmax(0, 1fr) 60px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }


.tier-builder {
  --item-size: 88px;
  display: grid;
  gap: 18px;
}

.builder-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.title-input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  outline: 0;
}

.title-input:focus {
  border-bottom-color: var(--accent);
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status,
.upload-count,
.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #c6d0dd;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.icon-button:hover,
.primary-button:hover {
  border-color: var(--accent);
}

.text-button {
  gap: 8px;
  padding: 0 13px;
}

.primary-button {
  gap: 8px;
  padding: 0 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.upload-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px;
  border: 1px dashed #c6d0dd;
  border-radius: 8px;
  background: var(--surface);
}

.upload-strip.is-over {
  border-color: var(--accent);
  background: #eaf7f4;
}

.board,
.pool-section {
  display: grid;
  gap: 10px;
}

.rows {
  display: grid;
  gap: 8px;
}

.tier-builder .tier-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.row-tools {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-rows: 1fr 28px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--row-color);
}

.row-drag-handle,
.row-color {
  width: 28px;
  height: 28px;
  border: 0;
}

.row-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.54);
  color: rgba(0, 0, 0, 0.7);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  touch-action: none;
}

.tier-builder .row-label {
  grid-row: span 2;
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(0, 0, 0, 0.78);
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  outline: 0;
}

.tier-builder .row-label:focus {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
}

.tier-builder .row-color {
  grid-column: 1;
  grid-row: 2;
  padding: 0;
  border-radius: 6px;
  background: transparent;
}

.tier-builder .tier-dropzone {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 110px;
  padding: 10px;
  background: #f9fbfd;
}

.pool-section {
  margin-top: 6px;
}

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

.item-pool {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tier-builder .tier-item {
  flex: 0 0 var(--item-size);
  width: var(--item-size);
  height: var(--item-size);
  border-radius: 8px;
}

.tier-builder .tier-item {
  position: relative;
  display: block;
  overflow: hidden;
  min-height: 0;
  padding: 0;
  border: 1px solid #c6d0dd;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(22, 30, 46, 0.08);
  touch-action: none;
  user-select: none;
}

.tier-builder .tier-item:focus-visible {
  outline: 3px solid rgba(15, 123, 108, 0.34);
  outline-offset: 2px;
}

.tier-builder .tier-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.delete-item {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(24, 32, 46, 0.82);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.delete-item:hover {
  background: var(--danger);
}

.is-drag-source {
  opacity: 0.32;
}

.drag-ghost {
  --item-size: 90px;
  --item-width: 90px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  opacity: 0.92;
  pointer-events: none;
  box-shadow: 0 9px 21px rgba(22, 30, 46, 0.14);
}

body.is-dragging {
  cursor: grabbing;
}

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

@media (max-width: 760px) {
  .tier-builder {
    --item-size: 76px;
  }

  .builder-top {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .title-input {
    font-size: 25px;
  }

  .action-bar {
    align-items: stretch;
    justify-content: space-between;
  }

  .upload-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .text-button {
    width: 100%;
  }

  .tier-builder .tier-row {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 100px;
  }

  .row-tools {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: 1fr 24px;
    gap: 6px;
    padding: 8px;
  }

  .row-drag-handle,
  .row-color {
    width: 24px;
    height: 24px;
  }

  .tier-builder .row-label {
    font-size: 23px;
  }

  .tier-builder .tier-dropzone {
    min-height: 98px;
    padding: 8px;
  }
}


.tier-builder {
  --item-width: 90px;
  --item-size: 90px;
  display: block;
  width: 100%;
  min-width: 0;
}

.tier-content {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 750px;
  flex-direction: column;
  gap: 16.5px;
  margin: 0 auto;
  padding: 36px 24px 30px;
}

.tier-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tier-title-row {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
}

.tier-page-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
}

.tier-action-button {
  display: inline-flex;
  min-height: 33px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 15px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0.75px 1.5px rgb(22 30 46 / 0.08);
}

.tier-action-button .material-symbols-outlined {
  font-size: 15px;
}

.tier-action-primary {
  border: 1px solid var(--stitch-primary);
  background: var(--stitch-primary);
  color: #ffffff;
}

.tier-action-primary:hover {
  background: #00583c;
}

.tier-action-secondary {
  border: 1px solid var(--stitch-outline);
  background: var(--stitch-surface);
  color: var(--stitch-text);
}

.tier-action-secondary:hover,
.tier-action-secondary:focus-visible {
  background: var(--stitch-surface-low);
}

.tier-action-secondary .material-symbols-outlined {
  font-size: 15px;
}

.title-input {
  width: auto;
  max-width: calc(100% - 30px);
  min-height: 30px;
  padding: 0;
  border: 0;
  border-bottom: 1.5px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--stitch-text);
  font-family: Geist, Inter, sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 30px;
  outline: 0;
}

.title-input:focus {
  border-bottom-color: var(--stitch-primary);
}

.title-edit-button {
  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgb(60 74 66 / 0.8);
}

.title-edit-button:hover {
  background: var(--stitch-surface-high);
  color: var(--stitch-primary);
}

.title-edit-button .material-symbols-outlined {
  font-size: 15px;
}

.board,
.tier-stack,
.rows {
  display: flex;
  flex-direction: column;
}

.board,
.tier-stack {
  gap: 0;
}

.rows {
  gap: 0;
}

.tier-stack.is-over {
  outline: 1.5px dashed var(--stitch-primary-bright);
  outline-offset: 6px;
}

.tier-stack {
  overflow: hidden;
  border: var(--tier-board-border-width, 1px) solid var(--tier-board-border-color, var(--stitch-border));
  border-radius: var(--tier-board-border-radius, 12px);
  background: var(--stitch-surface);
  box-shadow: 0 0.75px 1.5px rgb(22 30 46 / 0.06);
}

.tier-builder .tier-row,
.drag-ghost.tier-row {
  position: relative;
  display: flex;
  min-height: 102px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--tier-row-tile-background, var(--stitch-surface));
  box-shadow: none;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}

.tier-builder .tier-row:first-child,
.drag-ghost.tier-row:first-child {
  border-radius: var(--tier-board-inner-radius, 12px) var(--tier-board-inner-radius, 12px) 0 0;
}

.tier-builder .tier-row:last-child,
.drag-ghost.tier-row:last-child {
  border-radius: 0 0 var(--tier-board-inner-radius, 12px) var(--tier-board-inner-radius, 12px);
}

.tier-builder .tier-row:only-child,
.drag-ghost.tier-row:only-child {
  border-radius: var(--tier-board-inner-radius, 12px);
}

.tier-builder .tier-row + .tier-row::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: 1;
  height: 1px;
  background: var(--tier-board-separator-color, var(--stitch-border));
  content: "";
  pointer-events: none;
}

.tier-builder .tier-row:hover {
  box-shadow: 0 4.5px 12px rgb(22 30 46 / 0.08);
}

.row-tools {
  position: relative;
  display: flex;
  width: 90px;
  flex: 0 0 90px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  background: var(--row-color);
}

.row-drag-handle,
.row-settings-button,
.row-delete-button {
  position: absolute;
  left: 6px;
  display: inline-flex;
  width: 21px;
  min-width: 21px;
  height: 21px;
  min-height: 21px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4.5px;
  background: transparent;
  color: rgb(25 28 30 / 0.82);
  cursor: pointer;
  opacity: 0.22;
  touch-action: none;
  transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.row-drag-handle {
  top: 6px;
}

.row-settings-button {
  top: auto;
  bottom: 6px;
}

.row-delete-button {
  top: 6px;
  right: 6px;
  left: auto;
  color: rgb(25 28 30 / 0.82);
}

.row-tools:hover .row-drag-handle,
.row-tools:hover .row-settings-button,
.row-tools:hover .row-delete-button,
.row-drag-handle:focus-visible,
.row-settings-button:focus-visible,
.row-delete-button:focus-visible {
  opacity: 0.65;
}

.row-drag-handle:hover,
.row-settings-button:hover,
.row-delete-button:hover {
  background: transparent;
}

.row-delete-button:hover,
.row-delete-button:focus-visible {
  color: var(--stitch-danger);
}

.row-drag-handle .material-symbols-outlined,
.row-settings-button .material-symbols-outlined,
.row-delete-button .material-symbols-outlined {
  font-size: 12px;
}

.tier-builder .row-color,
.drag-ghost .row-color {
  position: absolute;
  inset: 0;
  width: 21px;
  height: 21px;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.tier-builder .row-label,
.drag-ghost .row-label {
  width: 100%;
  min-width: 0;
  padding: 0 21px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgb(25 28 30 / 0.92);
  font-family: Geist, Inter, sans-serif;
  font-size: 21px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
  outline: 0;
}

.tier-builder .row-label:focus {
  border-radius: 6px;
  background: rgb(255 255 255 / 0.36);
}

.tier-builder .tier-dropzone,
.drag-ghost .tier-dropzone {
  display: flex;
  min-width: 0;
  min-height: 100.5px;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-content: center;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 15px;
  background: var(--tier-row-tile-background, var(--stitch-surface));
}

.tier-builder .tier-item,
.tier-builder .upload-tile,
.drag-ghost.tier-item,
.drag-ghost .tier-item,
.drag-ghost .upload-tile {
  flex: 0 0 var(--item-width);
  width: var(--item-width);
  height: var(--item-size);
  border-radius: 6px;
}

.tier-builder .tier-item,
.drag-ghost.tier-item,
.drag-ghost .tier-item {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 0;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--stitch-outline-variant);
  background: var(--stitch-surface);
  box-shadow: 0 0.75px 1.5px rgb(22 30 46 / 0.08);
  cursor: pointer;
  touch-action: none;
  transition: box-shadow 160ms ease;
  user-select: none;
}

.tier-builder .tier-item:hover {
  box-shadow: 0 4.5px 10.5px rgb(22 30 46 / 0.12);
}

.tier-builder .tier-item:focus-visible {
  outline: 2.25px solid rgb(16 185 129 / 0.32);
  outline-offset: 1.5px;
}

.tier-item-media {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  place-items: center;
  overflow: hidden;
  background: var(--stitch-surface-high);
}

.tier-builder .tier-item img,
.drag-ghost.tier-item img,
.drag-ghost .tier-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: transform 180ms ease;
}

.tier-builder .tier-item:hover img {
  transform: scale(1.04);
}

.delete-item {
  position: absolute;
  top: 3.75px;
  right: 3.75px;
  display: inline-flex;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.72);
  color: var(--stitch-danger);
  cursor: pointer;
  opacity: 0;
  transition: opacity 160ms ease, background-color 160ms ease;
}

.delete-item .material-symbols-outlined {
  font-size: 12px;
}

.tier-item:hover .delete-item,
.delete-item:focus-visible {
  opacity: 1;
}

.delete-item:hover {
  background: #ffdad6;
}

.item-initial {
  color: var(--stitch-muted);
  font-family: Geist, Inter, sans-serif;
  font-size: 25.5px;
  font-weight: 700;
}

.tier-builder .upload-tile,
.drag-ghost .upload-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  padding: 0;
  border: 1.5px dashed var(--stitch-outline-variant);
  background: transparent;
  color: var(--stitch-muted);
  cursor: pointer;
  box-shadow: none;
}

.upload-tile .material-symbols-outlined {
  font-size: 16.5px;
  transition: transform 160ms ease;
}

.upload-tile-label {
  font-size: 7.5px;
  font-weight: 600;
  line-height: 9px;
  text-align: center;
}

.tier-builder .upload-tile:hover,
.tier-builder .upload-tile:focus-visible {
  border-color: var(--stitch-primary);
  background: var(--stitch-surface-low);
  color: var(--stitch-primary);
}

.upload-tile:hover .material-symbols-outlined {
  transform: scale(1.08);
}

.add-row-button {
  display: inline-flex;
  width: 100%;
  height: 42px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 9px 0 18px;
  border: 1.5px dashed var(--stitch-outline-variant);
  border-radius: 9px;
  background: transparent;
  color: var(--stitch-muted);
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
}

.tier-page-actions .add-row-button {
  width: auto;
  height: 33px;
  min-height: 33px;
  margin: 0;
  padding: 0 14px;
  white-space: nowrap;
}

.add-row-button:hover,
.add-row-button:focus-visible {
  border-color: var(--stitch-primary);
  background: var(--stitch-surface-low);
  color: var(--stitch-primary);
}

.add-row-button .material-symbols-outlined {
  font-size: 15px;
  transition: transform 160ms ease;
}

.add-row-button:hover .material-symbols-outlined {
  transform: scale(1.08);
}

.add-row-button:disabled,
.add-row-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

.add-row-button:disabled:hover,
.add-row-button[aria-disabled="true"]:hover,
.add-row-button:disabled:focus-visible,
.add-row-button[aria-disabled="true"]:focus-visible {
  border-color: var(--stitch-outline-variant);
  background: transparent;
  color: var(--stitch-muted);
}

.add-row-button:disabled:hover .material-symbols-outlined,
.add-row-button[aria-disabled="true"]:hover .material-symbols-outlined {
  transform: none;
}

.tier-builder.has-pool-items .add-row-button {
  margin-bottom: 0;
}

.tier-builder .pool-section {
  display: none;
  gap: 9px;
  margin-top: 3px;
}

.tier-builder.has-pool-items .pool-section {
  display: grid;
}

.tier-builder .pool-section .section-heading h2 {
  color: var(--stitch-text);
  font-family: Geist, Inter, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
}

.tier-builder .section-heading {
  gap: 9px;
}

.tier-builder .save-status,
.tier-builder .upload-count,
.tier-builder .section-heading span {
  font-size: 9.75px;
}

.tier-builder .item-pool {
  display: flex;
  min-height: 102px;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--stitch-border);
  border-radius: 12px;
  background: var(--stitch-surface);
  box-shadow: 0 0.75px 1.5px rgb(22 30 46 / 0.06);
}

.row-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(3px);
}

.row-settings-modal[hidden] {
  display: none;
}

body.has-row-settings-modal {
  overflow: hidden;
}

.row-settings-panel {
  --row-settings-active-color: #fc7c78;
  display: flex;
  width: min(100%, 700px);
  max-height: calc(100vh - 48px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 8px;
  background: var(--stitch-surface);
  box-shadow: 0 20px 25px -5px rgb(25 28 30 / 0.18), 0 8px 10px -6px rgb(25 28 30 / 0.18);
}

.row-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--stitch-outline-variant);
  background: var(--stitch-bg);
}

.row-settings-header h2 {
  color: var(--stitch-text);
  font-family: Geist, Inter, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.row-settings-icon-button {
  display: inline-flex;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--stitch-muted);
  transition: background 160ms ease, color 160ms ease;
}

.row-settings-icon-button:hover,
.row-settings-icon-button:focus-visible {
  background: var(--stitch-surface-high);
  color: var(--stitch-text);
}

.row-settings-icon-button .material-symbols-outlined {
  font-size: 20px;
}

.row-settings-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  background: var(--stitch-surface);
}

.row-settings-column {
  display: grid;
  align-content: start;
  gap: 20px;
}

.row-settings-primary-column {
  padding-right: 24px;
  border-right: 1px solid var(--stitch-outline-variant);
}

.row-settings-field {
  display: grid;
  gap: 6px;
}

.row-settings-field-label {
  color: var(--stitch-muted);
  font-family: Geist, Inter, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 16px;
}

.row-settings-field-limit {
  margin-left: 6px;
  color: var(--stitch-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.row-settings-field input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 4px;
  background: transparent;
  color: var(--stitch-text);
  font-size: 14px;
  transition: border-color 160ms ease, background 160ms ease;
}

.row-settings-field input:focus {
  border-color: var(--stitch-primary);
  outline: 0;
  background: transparent;
}

.row-settings-number-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.row-settings-properties {
  display: grid;
  gap: 12px;
}

.row-settings-property-option {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 4px;
  background: var(--stitch-surface);
  color: var(--stitch-text);
  font-size: 14px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.row-settings-property-option:hover,
.row-settings-property-option:focus-visible {
  border-color: var(--stitch-primary);
  outline: 0;
}

.row-settings-property-option.is-active,
.row-settings-property-option[aria-pressed="true"] {
  border-color: var(--stitch-primary);
  background: rgb(0 108 73 / 0.06);
  box-shadow: inset 0 0 0 1px var(--stitch-primary);
  color: var(--stitch-primary);
  font-weight: 600;
}

.row-settings-property-swatch,
.row-settings-active-swatch {
  --row-settings-swatch-fill: var(--row-settings-property-color, var(--stitch-surface));

  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--stitch-outline-variant);
  background-color: #ffffff;
  background-image: linear-gradient(var(--row-settings-swatch-fill), var(--row-settings-swatch-fill)),
    linear-gradient(45deg, rgb(25 28 30 / 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(25 28 30 / 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgb(25 28 30 / 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgb(25 28 30 / 0.12) 75%);
  background-position: 0 0, 0 0, 0 4px, 4px -4px, -4px 0;
  background-size: auto, 8px 8px, 8px 8px, 8px 8px, 8px 8px;
  box-shadow: inset 0 1px 2px rgb(25 28 30 / 0.08);
}

.row-settings-property-swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
}

.row-settings-active-swatch {
  --row-settings-swatch-fill: var(--row-settings-active-color);

  width: 40px;
  height: 40px;
  border-radius: 4px;
}

.row-settings-color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.row-settings-hidden-colors {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.row-settings-color-editor {
  gap: 18px;
}

.row-settings-color-plane {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 4px;
  background: linear-gradient(to top, #000000, transparent),
    linear-gradient(to right, #ffffff, var(--row-settings-active-hue-color, #ff0000));
  cursor: pointer;
  touch-action: none;
}

.row-settings-color-plane:focus-within {
  border-color: var(--stitch-primary);
  outline: 2px solid rgb(0 108 73 / 0.18);
  outline-offset: 2px;
}

.row-settings-native-color {
  appearance: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  opacity: 0;
  cursor: pointer;
}

.row-settings-color-target {
  position: absolute;
  top: var(--row-settings-value-position, 0%);
  left: var(--row-settings-saturation-position, 100%);
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgb(25 28 30 / 0.16);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.row-settings-color-sliders {
  display: grid;
  gap: 14px;
}

.row-settings-hue-slider,
.row-settings-alpha-slider {
  position: relative;
  height: 16px;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgb(25 28 30 / 0.18);
  cursor: pointer;
  touch-action: none;
}

.row-settings-hue-slider:focus-visible,
.row-settings-alpha-slider:focus-visible {
  outline: 2px solid rgb(0 108 73 / 0.22);
  outline-offset: 3px;
}

.row-settings-hue-slider {
  background: linear-gradient(
    to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
}

.row-settings-alpha-slider {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, var(--stitch-surface-high) 25%, transparent 25%),
    linear-gradient(-45deg, var(--stitch-surface-high) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--stitch-surface-high) 75%),
    linear-gradient(-45deg, transparent 75%, var(--stitch-surface-high) 75%);
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: 10px 10px;
  overflow: hidden;
}

.row-settings-alpha-slider::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to right, transparent, var(--row-settings-active-solid-color, var(--row-settings-active-color)));
  content: "";
}

.row-settings-hue-slider span,
.row-settings-alpha-slider span {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(25 28 30 / 0.18);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.row-settings-hue-slider span {
  left: var(--row-settings-hue-position, 0%);
}

.row-settings-alpha-slider span {
  left: var(--row-settings-alpha-position, 100%);
}

.row-settings-hex-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-settings-hex-field {
  display: flex;
  min-width: 0;
  min-height: 40px;
  flex: 1 1 auto;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 4px;
  background: var(--stitch-surface-high);
  color: var(--stitch-muted);
}

.row-settings-hex-field:focus-within {
  border-color: var(--stitch-primary);
  background: var(--stitch-surface-low);
}

.row-settings-hex-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--stitch-text);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.row-settings-hex-field input:focus {
  outline: 0;
}

.row-settings-copy-button {
  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--stitch-muted);
}

.row-settings-copy-button:hover,
.row-settings-copy-button:focus-visible {
  background: var(--stitch-surface);
  color: var(--stitch-primary);
  outline: 0;
}

.row-settings-copy-button .material-symbols-outlined {
  font-size: 16px;
}

.row-settings-preset-area {
  min-height: 24px;
}

.row-settings-color-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, 24px);
  gap: 8px;
  min-height: 24px;
}

.row-settings-color-swatches[hidden] {
  display: none;
}

.row-settings-color-swatch {
  --row-settings-swatch-fill: var(--row-settings-swatch-color, var(--stitch-surface));

  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 4px;
  background-color: #ffffff;
  background-image: linear-gradient(var(--row-settings-swatch-fill), var(--row-settings-swatch-fill)),
    linear-gradient(45deg, rgb(25 28 30 / 0.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(25 28 30 / 0.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgb(25 28 30 / 0.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgb(25 28 30 / 0.12) 75%);
  background-position: 0 0, 0 0, 0 4px, 4px -4px, -4px 0;
  background-size: auto, 8px 8px, 8px 8px, 8px 8px, 8px 8px;
  box-shadow: 0 1px 3px rgb(25 28 30 / 0.12);
  cursor: pointer;
}

.row-settings-color-swatch:hover,
.row-settings-color-swatch:focus-visible {
  border-color: var(--stitch-outline);
  outline: 0;
}

.row-settings-color-swatch.is-active,
.row-settings-color-swatch[aria-pressed="true"] {
  border-color: transparent;
  outline: 2px solid var(--stitch-primary);
  outline-offset: 2px;
}

.row-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--stitch-outline-variant);
  background: var(--stitch-surface-low);
}

.row-settings-actions button {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

.row-settings-secondary-button {
  border: 0;
  background: transparent;
  color: var(--stitch-muted);
}

.row-settings-secondary-button:hover,
.row-settings-secondary-button:focus-visible {
  background: var(--stitch-surface-high);
  color: var(--stitch-text);
  outline: 0;
}

.row-settings-primary-button {
  border: 1px solid var(--stitch-primary);
  background: var(--stitch-primary);
  color: #ffffff;
}

.row-settings-primary-button:hover,
.row-settings-primary-button:focus-visible {
  border-color: var(--stitch-primary-bright);
  background: var(--stitch-primary-bright);
  color: var(--stitch-text);
  outline: 0;
}

.tier-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(17 24 39 / 0.58);
}

.tier-crop-modal[hidden] {
  display: none;
}

body.has-tier-crop-modal {
  overflow: hidden;
}

.tier-crop-panel {
  display: grid;
  width: min(100%, 315px);
  gap: 12px;
  padding: 13.5px;
  border: 1px solid var(--stitch-outline-variant);
  border-radius: 6px;
  background: var(--stitch-surface);
  box-shadow: 0 18px 52.5px rgb(22 30 46 / 0.24);
}

.tier-crop-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.tier-crop-header h2 {
  color: var(--stitch-text);
  font-family: Geist, Inter, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 19.5px;
}

.tier-crop-header p {
  max-width: 100%;
  margin: 1.5px 0 0;
  overflow: hidden;
  color: var(--stitch-muted);
  font-size: 9.75px;
  line-height: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tier-crop-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: #111827;
  cursor: grab;
  touch-action: none;
}

.tier-crop-viewport:active {
  cursor: grabbing;
}

.tier-crop-viewport::after {
  position: absolute;
  inset: 0;
  border: 0.75px solid rgb(255 255 255 / 0.66);
  content: "";
  pointer-events: none;
}

.tier-crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  transform-origin: top left;
  user-select: none;
  pointer-events: none;
}

.tier-crop-zoom {
  display: grid;
  gap: 6px;
  color: var(--stitch-muted);
  font-size: 9.75px;
  font-weight: 600;
}

.tier-crop-zoom input {
  width: 100%;
  accent-color: var(--stitch-primary);
}

.tier-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7.5px;
}

.tier-crop-actions button {
  min-height: 27px;
  padding: 0 9px;
  border-radius: 4.5px;
  font-size: 12px;
}

@media (min-width: 761px) {
  body.tier-route {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }

  body.tier-route .topbar,
  body.tier-route .site-footer {
    flex: 0 0 auto;
  }

  body.tier-route .tier-page {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    justify-content: center;
    overflow: hidden;
  }

  body.tier-route .tier-builder {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    justify-content: center;
    overflow: hidden;
  }

  body.tier-route .tier-content {
    /* Keep the natural height measurable before JS applies the fit transform. */
    align-self: flex-start;
    flex: 0 0 auto;
    transform: scale(var(--tier-fit-scale, 1));
    transform-origin: top center;
    will-change: transform;
  }
}

@media (max-width: 760px) {
  .tier-content {
    gap: 12px;
    padding: 18px 12px 24px;
  }

  .tier-page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .tier-title-row {
    width: 100%;
    flex: 0 1 auto;
  }

  .tier-page-actions {
    width: 100%;
    gap: 9px;
  }

  .tier-action-button {
    min-height: 30px;
    padding: 0 12px;
  }

  .tier-page-actions .add-row-button {
    flex: 0 0 auto;
    height: 30px;
    min-height: 30px;
    padding: 0 10px;
  }

  .tier-action-primary {
    flex: 1 1 auto;
    min-width: 0;
  }

  .tier-action-secondary {
    flex: 0 0 auto;
  }

  .title-input {
    max-width: calc(100% - 30px);
    font-size: 18px;
    line-height: 24px;
  }

  .rows {
    gap: 0;
  }

  .tier-builder .tier-row,
  .drag-ghost.tier-row {
    min-height: 0;
    flex-direction: column;
    border-radius: 0;
    background: var(--tier-row-tile-background, var(--stitch-surface));
  }

  .tier-builder .tier-row:first-child,
  .drag-ghost.tier-row:first-child {
    border-radius: var(--tier-board-inner-radius, 12px) var(--tier-board-inner-radius, 12px) 0 0;
  }

  .tier-builder .tier-row:last-child,
  .drag-ghost.tier-row:last-child {
    border-radius: 0 0 var(--tier-board-inner-radius, 12px) var(--tier-board-inner-radius, 12px);
  }

  .tier-builder .tier-row:only-child,
  .drag-ghost.tier-row:only-child {
    border-radius: var(--tier-board-inner-radius, 12px);
  }

  .row-tools {
    width: 100%;
    height: 36px;
    min-height: 36px;
    flex: 0 0 36px;
    flex-direction: row;
    gap: 4.5px;
    justify-content: space-between;
    padding: 0 12px;
  }

  .row-drag-handle,
  .row-settings-button,
  .row-delete-button {
    position: static;
    inset: auto;
    flex: 0 0 21px;
    opacity: 0.62;
  }

  .row-tools:hover .row-drag-handle,
  .row-tools:hover .row-settings-button,
  .row-tools:hover .row-delete-button,
  .row-drag-handle:focus-visible,
  .row-settings-button:focus-visible,
  .row-delete-button:focus-visible {
    opacity: 0.72;
  }

  .tier-builder .row-label,
  .drag-ghost .row-label {
    width: auto;
    height: 36px;
    min-height: 36px;
    flex: 1 1 auto;
    padding: 0 6px;
    font-size: 21px;
    line-height: 24px;
  }

  .tier-builder .tier-dropzone,
  .drag-ghost .tier-dropzone {
    width: 100%;
    min-height: 114px;
    justify-content: center;
    align-content: center;
    align-items: center;
    gap: 9px;
    padding: 12px;
  }

  .tier-builder .item-pool {
    justify-content: center;
    align-content: center;
    gap: 9px;
    padding: 12px;
  }

  .row-settings-modal {
    align-items: stretch;
    padding: 12px;
  }

  .row-settings-panel {
    max-height: calc(100vh - 24px);
  }

  .row-settings-header,
  .row-settings-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .row-settings-body {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }

  .row-settings-primary-column {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--stitch-outline-variant);
  }

  .row-settings-number-grid {
    grid-template-columns: 1fr;
  }
}
