.editor-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 480px;
  min-height: 100vh;
}

.editor-shell.is-library-collapsed {
  grid-template-columns: 320px minmax(0, 1fr) 480px;
}

.editor-sidebar {
  height: 100vh;
  min-height: 0;
  padding: 20px;
  background: rgba(7, 14, 20, 0.92);
  border-right: 1px solid var(--panel-border);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.editor-sidebar h1 {
  margin-top: 0;
}

.editor-library-panel {
  display: flex;
  flex-direction: column;
  grid-column: 3;
  grid-row: 1;
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  width: auto;
  height: 100vh;
  min-width: 0;
  background: rgba(7, 14, 20, 0.92);
  border-left: 1px solid var(--panel-border);
  overflow: hidden;
  z-index: auto;
  box-shadow: none;
}

.editor-library-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 66px;
  padding: 0 14px 0 20px;
  border-bottom: 1px solid var(--panel-border);
}

.editor-library-panel__title {
  margin: 0;
  font-size: 1rem;
  white-space: nowrap;
}

.editor-library-panel__toggle {
  display: none;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.editor-library-panel__toggle:hover {
  background: rgba(255, 255, 255, 0.13);
}

.editor-library-panel__toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.editor-library-panel__toggle-label {
  display: none;
}

.editor-library-panel__content {
  flex: 0 1 auto;
  min-height: 0;
  height: calc(100vh - 66px);
  max-height: calc(100vh - 66px);
  padding: 18px 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.editor-library-panel {
  display: flex;
}

.editor-library-panel > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 0 20px;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
  list-style: none;
  border-bottom: 1px solid var(--panel-border);
}

.editor-library-panel > summary::-webkit-details-marker {
  display: none;
}

.editor-library-panel > summary::after {
  content: none;
}

.editor-library-panel__icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.editor-library-panel__summary-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-library-panel__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.editor-library-panel__actions button {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 9px;
  font-size: 1.2rem;
  line-height: 1;
}

.editor-library-panel__summary-chevron {
  margin-left: auto;
  font-size: 1.7rem;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 0.16s ease;
}

.editor-library-panel:not([open]) {
  height: 100vh;
}

.editor-library-panel:not([open]) > summary {
  border-bottom: 0;
}

.editor-library-panel:not([open]) .editor-library-panel__summary-chevron {
  transform: none;
}

.editor-shell:has(.editor-library-panel:not([open])) {
  grid-template-columns: 320px minmax(0, 1fr) 66px;
}

.editor-shell:has(.editor-library-panel:not([open])) .editor-library-panel > summary {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 0;
}

.editor-shell:has(.editor-library-panel:not([open])) .editor-library-panel__summary-title {
  display: block;
  overflow: visible;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.editor-shell:has(.editor-library-panel:not([open])) .editor-library-panel__actions {
  display: none;
}

.editor-shell:has(.editor-library-panel:not([open])) .editor-library-panel__summary-chevron {
  margin-left: 0;
  font-size: 1.45rem;
}

.editor-shell.is-library-collapsed .editor-library-panel__header {
  justify-content: space-between;
  min-height: 66px;
  padding: 0 14px 0 20px;
  border-bottom: 1px solid var(--panel-border);
}

.editor-shell.is-library-collapsed .editor-library-panel {
  width: auto;
}

.editor-shell.is-library-collapsed .editor-library-panel__title,
.editor-shell.is-library-collapsed .editor-library-panel__content {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.editor-shell.is-library-collapsed .editor-library-panel__toggle svg {
  transform: rotate(180deg);
}

.editor-shell.is-library-collapsed .editor-library-panel__toggle {
  display: none;
}

.editor-shell.is-library-collapsed .editor-library-panel__toggle-label {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.editor-group {
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.editor-group summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 850;
  margin: -2px 0 10px;
}

.editor-group:not([open]) summary {
  margin-bottom: 0;
}

.editor-group > .field:last-child,
.editor-group > .button-grid:last-child,
.editor-group > .hint:last-child,
.editor-group > .status:last-child {
  margin-bottom: 0;
}

.editor-group summary::marker {
  color: #ffbd4a;
}

.field--inline {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.field textarea,
.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.field select option {
  color: #101820;
}

.field textarea {
  min-height: 180px;
  resize: vertical;
}

.button-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.button-grid--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.asset-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.asset-preset-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  min-height: 86px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.045);
}

.asset-preset-card.is-active {
  border-color: rgba(255, 189, 74, 0.8);
  background: rgba(255, 189, 74, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 189, 74, 0.16);
}

.asset-preset-preview {
  position: relative;
  height: 36px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(30, 40, 50, 0.75), rgba(12, 18, 25, 0.72));
}

.asset-preset-preview::before,
.asset-preset-preview::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 999px;
}

.asset-preset-preview--barrier-red-white::before {
  height: 14px;
  background: repeating-linear-gradient(90deg, #e63946 0 18px, #f4f4f4 18px 36px);
}

.asset-preset-preview--barrier-concrete::before {
  height: 16px;
  background: repeating-linear-gradient(90deg, #9aa0a6 0 28px, #737a82 28px 31px);
}

.asset-preset-preview--barrier-tire::before {
  height: 18px;
  background: repeating-radial-gradient(circle at 10px 50%, #10151b 0 4px, #2b2f36 5px 9px, transparent 10px 18px);
  background-size: 23px 18px;
}

.asset-preset-preview--barrier-cones::before {
  height: 22px;
  background: repeating-linear-gradient(90deg, transparent 0 10px, #ff8c1a 10px 17px, transparent 17px 25px);
  clip-path: polygon(0 100%, 5% 0, 10% 100%, 20% 100%, 25% 0, 30% 100%, 40% 100%, 45% 0, 50% 100%, 60% 100%, 65% 0, 70% 100%, 80% 100%, 85% 0, 90% 100%, 100% 100%);
}

.asset-preset-preview--curb-red-white::before,
.asset-preset-preview--curb-yellow-black::before {
  height: 18px;
  transform: translateY(-50%) skewX(-18deg);
  border-radius: 5px;
}

.asset-preset-preview--curb-red-white::before {
  background: repeating-linear-gradient(90deg, #e63946 0 15px, #f4f4f4 15px 30px);
}

.asset-preset-preview--curb-yellow-black::before {
  background: repeating-linear-gradient(90deg, #f6c945 0 15px, #141820 15px 30px);
}

.asset-preset-label {
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
}

.editor-subgroup {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.editor-subgroup__title,
.scenery-preset-category__title {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(233, 244, 255, 0.74);
}

.asset-editor-link {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
}

.scenery-preset-catalog {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow: auto;
  padding-right: 3px;
}

.scenery-preset-category {
  display: grid;
  gap: 7px;
}

.scenery-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.scenery-preset-card {
  display: grid;
  gap: 5px;
  padding: 6px;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}

.scenery-preset-card.is-active {
  border-color: rgba(84, 215, 255, 0.88);
  background: rgba(84, 215, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(84, 215, 255, 0.18);
}

.scenery-preset-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.5;
  object-fit: contain;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(25, 37, 48, 0.92), rgba(9, 14, 20, 0.94));
}

.scenery-preset-card span {
  overflow: hidden;
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-list {
  display: grid;
  gap: 8px;
}

.draft-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.draft-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.library-row.is-favorite {
  border-color: rgba(255, 213, 74, 0.48);
  background: rgba(255, 213, 74, 0.08);
}

.library-row.is-real {
  box-shadow: inset 3px 0 0 rgba(74, 163, 255, 0.8);
}

.library-row.is-rx {
  outline: 1px solid rgba(255, 91, 191, 0.28);
}

.library-thumb {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
}

.library-meta {
  min-width: 0;
}

.library-name {
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-metadata-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 6px 0;
}

.library-metadata-editor input {
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(6, 10, 15, 0.64);
  color: var(--text);
  font: inherit;
}

.library-url {
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  color: #9ed4ff;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-time {
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-history {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 0.82rem;
}

.library-history[hidden] {
  display: none;
}

.library-history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.library-history-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-favorite-button {
  min-width: 36px;
  padding-inline: 0;
  color: #ffd54a;
  font-size: 1.05rem;
  line-height: 1;
}

.library-favorite-button[aria-pressed="true"] {
  border-color: rgba(255, 213, 74, 0.58);
  background: rgba(255, 213, 74, 0.16);
}

.library-real-button {
  min-width: 54px;
  padding-inline: 8px;
  color: #9ed4ff;
  font-size: 0.82rem;
  font-weight: 800;
}

.library-real-button[aria-pressed="true"] {
  border-color: rgba(74, 163, 255, 0.62);
  background: rgba(74, 163, 255, 0.16);
}

.library-rx-button {
  min-width: 46px;
  padding-inline: 8px;
  color: #ff9fe0;
  font-size: 0.82rem;
  font-weight: 800;
}

.library-rx-button[aria-pressed="true"] {
  border-color: rgba(255, 91, 191, 0.62);
  background: rgba(255, 91, 191, 0.16);
}

.hint,
.status {
  color: var(--muted);
}

.status {
  margin-top: 0;
}

.editor-stage {
  position: relative;
  min-width: 0;
  margin-right: 0;
}

.editor-shell.is-library-collapsed .editor-stage {
  margin-right: 0;
}

.editor-stage-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.editor-stage-toolbar button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 10px 14px;
  color: #fff;
  background: rgba(7, 14, 20, 0.82);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.editor-stage-toolbar button[aria-pressed="true"] {
  border-color: rgba(255, 189, 74, 0.85);
  background: rgba(255, 189, 74, 0.24);
}

#editor-canvas,
#editor-race-canvas {
  width: 100%;
  height: 100vh;
  display: block;
  background: #87a8c7;
}

#editor-canvas.is-hidden,
#editor-race-canvas.is-hidden {
  display: none;
}

#tile-canvas {
  width: 100%;
  height: 100vh;
  display: block;
  background: #87a8c7;
}

.tile-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 16px;
}

.tile-examples button {
  min-width: 0;
  padding: 8px 6px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tile-picker-button {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  text-align: left;
}

.tile-picker-button code {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.tile-picker-button span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.tile-stat {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.tile-stat strong,
.tile-stat span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-stat strong {
  color: var(--text);
  font-size: 1rem;
}

.tile-stat span {
  color: var(--muted);
  font-size: 0.78rem;
}

.back-link {
  display: inline-block;
  margin-top: 8px;
}

.editor-lock {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.editor-lock-card {
  max-width: 420px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(7, 14, 20, 0.92);
  text-align: center;
}

.tile-editor-page {
  min-height: 100vh;
  overflow: hidden;
  background: #101113;
}

.tile-editor-page .tile-editor-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 64px;
  background: rgba(12, 12, 13, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tile-editor-topbar nav,
.tile-editor-top-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.tile-editor-topbar a,
.tile-editor-topbar button {
  border: 0;
  padding: 8px 0;
  color: rgba(241, 245, 249, 0.72);
  background: transparent;
  font-weight: 650;
}

.tile-editor-topbar a.is-active,
.tile-editor-topbar a:hover,
.tile-editor-topbar button:hover {
  color: #ffffff;
}

.tile-editor-page .tile-editor-shell {
  display: block;
  min-height: 100vh;
  padding-top: 48px;
}

.tile-editor-page .editor-stage {
  position: fixed;
  inset: 48px 0 0 0;
  overflow: hidden;
}

.tile-editor-page #tile-canvas {
  height: calc(100vh - 48px);
  background: #3f4145;
  cursor: grab;
  touch-action: none;
}

.tile-editor-page #tile-canvas.is-panning {
  cursor: grabbing;
}

.tile-editor-page #tile-canvas.is-pan-ready {
  cursor: grab;
}

.tile-editor-page #tile-canvas.is-placing-stand {
  cursor: crosshair;
}

.tile-editor-page .editor-sidebar {
  position: fixed;
  top: 64px;
  left: 64px;
  z-index: 30;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(12, 14, 18, 0.93);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(14px);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.tile-editor-shell.is-panel-closed .editor-sidebar {
  pointer-events: none;
  opacity: 0;
  transform: translateX(-24px) scale(0.98);
}

.tile-stage-actions {
  position: fixed;
  top: 64px;
  z-index: 12;
  display: flex;
  gap: 8px;
}

.tile-stage-actions--left {
  left: 80px;
}

.tile-stage-actions--right {
  right: 66px;
}

.tile-stage-actions button,
.tile-drive-preview {
  min-width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  color: #f8fafc;
  background: rgba(12, 12, 13, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.tile-stage-actions button:hover,
.tile-drive-preview:hover {
  background: rgba(255, 255, 255, 0.13);
}

.tile-stage-actions button[aria-pressed="true"] {
  color: #18202a;
  background: #ffd166;
}

.tile-navigation-panel {
  padding: 12px;
  border: 1px solid rgba(72, 199, 255, 0.28);
  border-radius: 14px;
  background: rgba(72, 199, 255, 0.06);
}

.tile-navigation-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.tile-navigation-actions button {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 0.8rem;
}

.tile-navigation-panel small {
  display: block;
  margin-top: 9px;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.76rem;
  line-height: 1.35;
}

.tile-navigation-panel kbd {
  padding: 1px 4px;
  border-radius: 4px;
  color: #dff5ff;
  background: rgba(255, 255, 255, 0.13);
  font: inherit;
}

.tile-boundary-note strong {
  display: block;
  margin-top: 5px;
  color: #ffd166;
  font-size: 0.86rem;
  font-weight: 700;
}

.tile-dimensions {
  position: fixed;
  top: 78px;
  left: 50%;
  z-index: 12;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  color: #f8fafc;
  background: rgba(15, 15, 16, 0.36);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.tile-drive-preview {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 12;
  width: auto;
  padding: 0 22px;
  transform: translateX(-50%);
  border-radius: 999px;
  color: rgba(248, 250, 252, 0.78);
}

.tile-editor-page .tile-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.tile-mode-tabs button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(241, 245, 249, 0.78);
}

.tile-mode-tabs button.is-active {
  border-color: rgba(72, 199, 255, 0.8);
  background: rgba(72, 199, 255, 0.18);
  color: #ffffff;
}

.tile-bridge-panel {
  padding: 12px;
  border: 1px solid rgba(255, 214, 102, 0.24);
  border-radius: 14px;
  background: rgba(255, 214, 102, 0.06);
}

.tile-bridge-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tile-bridge-controls label {
  display: grid;
  gap: 4px;
  font-size: 0.76rem;
  color: rgba(226, 232, 240, 0.72);
}

.tile-bridge-controls select,
.tile-bridge-controls input {
  width: 100%;
}

.bridge-list {
  display: grid;
  gap: 6px;
  min-height: 24px;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.82rem;
}

.bridge-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.bridge-row button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
}

.tile-editor-page .tile-picker-button {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

.tile-editor-page .tile-picker-button code {
  width: 34px;
  height: 34px;
}

@media (max-width: 760px) {
  .tile-editor-page .tile-editor-topbar {
    padding: 0 14px;
  }

  .tile-editor-topbar nav {
    gap: 12px;
  }

  .tile-editor-topbar a {
    font-size: 0.82rem;
  }

  .tile-editor-page .editor-sidebar {
    top: 56px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 72px);
  }

  .tile-stage-actions--left {
    left: 12px;
  }

  .tile-stage-actions--right {
    right: 12px;
  }
}

@media (max-width: 980px) {
  .editor-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, auto) 1fr auto;
  }

  .editor-shell.is-library-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, auto) 1fr 52px;
  }

  .editor-stage,
  .editor-shell.is-library-collapsed .editor-stage {
    margin-right: 0;
  }

  .editor-sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    max-height: 42vh;
  }

  .editor-library-panel {
    grid-column: auto;
    grid-row: auto;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    max-height: 65vh;
    border-left: none;
    border-top: 1px solid var(--panel-border);
  }

  .editor-library-panel:not([open]) {
    height: 66px;
  }

  .editor-shell.is-library-collapsed .editor-library-panel {
    min-height: 52px;
    width: auto;
  }

  .editor-shell.is-library-collapsed .editor-library-panel__header {
    min-height: 52px;
  }

  .editor-shell.is-library-collapsed .editor-library-panel__toggle {
    grid-template-columns: auto auto;
    grid-template-rows: 1fr;
    height: 52px;
  }

  .editor-shell.is-library-collapsed .editor-library-panel__toggle-label {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .button-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #editor-canvas,
  #editor-race-canvas {
    height: 58vh;
  }

  #tile-canvas {
    height: 58vh;
  }
}

@media (max-width: 640px) {
  .editor-sidebar {
    padding: 16px;
  }

  .button-grid {
    grid-template-columns: 1fr;
  }

  .draft-row {
    grid-template-columns: 1fr 1fr;
  }

  .draft-name {
    grid-column: 1 / -1;
  }

  #editor-canvas,
  #editor-race-canvas {
    height: 52vh;
  }

  #tile-canvas {
    height: 52vh;
  }
}
