:root {
  color-scheme: dark;
  --bg: #080706;
  --bg-soft: #0d0b0a;
  --panel: rgba(17, 14, 12, 0.84);
  --panel-strong: rgba(23, 19, 16, 0.94);
  --text: #f3e7d2;
  --text-soft: rgba(243, 231, 210, 0.76);
  --text-muted: rgba(243, 231, 210, 0.52);
  --text-faint: rgba(243, 231, 210, 0.34);
  --line: rgba(243, 231, 210, 0.14);
  --line-soft: rgba(243, 231, 210, 0.08);
  --line-strong: rgba(243, 231, 210, 0.24);
  --brand: #ff3e00;
  --brand-soft: rgba(255, 62, 0, 0.18);
  --brand-line: rgba(255, 62, 0, 0.42);
  --accent: #6ee1d8;
  --success: #9fe870;
  --danger: #ff735c;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  --sans: "Geist", "Geist Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  color: var(--text);
  background:
    radial-gradient(circle at 80% -8%, rgba(255, 62, 0, 0.16), transparent 34rem),
    radial-gradient(circle at 18% 18%, rgba(243, 231, 210, 0.055), transparent 28rem),
    linear-gradient(180deg, #0b0908 0%, #050505 100%);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.rail {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  border-right: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(13, 11, 10, 0.96), rgba(8, 7, 6, 0.9)),
    var(--bg);
  backdrop-filter: blur(20px);
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.brand::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 60% 38%, #ff805d 0 14%, transparent 15%),
    var(--brand);
  box-shadow: 0 0 0 1px rgba(255, 62, 0, 0.32), 0 12px 30px rgba(255, 62, 0, 0.2);
}

.rail-nav {
  display: grid;
  gap: 4px;
  margin-top: 34px;
}

.nav-item,
.rail-link,
.back-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.nav-item svg,
.rail-link svg,
.back-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.nav-item.active {
  color: var(--text);
  border-color: var(--brand-line);
  background:
    linear-gradient(90deg, var(--brand-soft), rgba(255, 62, 0, 0.04)),
    rgba(255, 255, 255, 0.025);
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-item[aria-disabled="true"] {
  cursor: default;
}

.rail-bottom {
  display: grid;
  gap: 14px;
  margin-top: auto;
}

.profile {
  display: grid;
  grid-template-columns: 38px 1fr 14px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.avatar,
.owner-chip b,
.owner-stack b {
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text);
  background:
    linear-gradient(140deg, rgba(255, 62, 0, 0.82), rgba(113, 54, 32, 0.88)),
    var(--brand);
  font-weight: 700;
}

.avatar {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(243, 231, 210, 0.24);
  font-size: 13px;
}

.profile strong,
.plan-card strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.profile span,
.plan-card span,
.plan-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.profile svg {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
}

.plan-card {
  padding: 16px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.meter {
  height: 5px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(243, 231, 210, 0.08);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  margin: 0;
  background: var(--brand);
}

.surface {
  min-width: 0;
  padding: 22px 18px 48px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, auto) minmax(420px, 1fr);
  align-items: end;
  gap: 20px;
  padding: 0 2px;
}

.product-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.product-kicker span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(159, 232, 112, 0.1);
}

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

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(42px, 4.2vw, 72px);
  font-weight: 650;
  line-height: 0.9;
}

.title-block p {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.45;
}

.version-pill {
  align-self: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(243, 231, 210, 0.045);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.search-field,
.select-field,
.soft-select {
  height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 231, 210, 0.045);
}

.search-field {
  width: min(460px, 32vw);
  gap: 10px;
  padding: 0 12px;
}

.search-field svg,
.select-field svg,
.soft-select svg {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input,
.select-field select,
.soft-select select {
  width: 100%;
  min-width: 0;
  appearance: none;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-field input::placeholder {
  color: var(--text-faint);
}

.search-field kbd {
  padding: 3px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--mono);
  font-size: 10px;
}

.select-field {
  width: 220px;
  gap: 10px;
  padding: 0 10px 0 12px;
}

.owner-stack {
  display: flex;
  width: 48px;
}

.owner-stack b {
  width: 24px;
  height: 24px;
  margin-left: -7px;
  border: 1px solid var(--bg);
  font-size: 10px;
}

.owner-stack b:first-child {
  margin-left: 0;
}

.create-button,
.primary-button,
.secondary-button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.create-button,
.primary-button {
  color: #fff7ef;
  background: var(--brand);
  box-shadow: 0 16px 42px rgba(255, 62, 0, 0.18);
}

.secondary-button {
  color: var(--text);
  border-color: var(--line);
  background: rgba(243, 231, 210, 0.045);
}

.create-button svg,
.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 20px 0 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--line-soft);
}

.signal-strip div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(243, 231, 210, 0.032);
}

.signal-strip span,
.meta-box span {
  display: block;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.signal-strip strong,
.meta-box strong {
  display: block;
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.subtools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 0 2px;
}

.soft-select {
  height: 38px;
  gap: 8px;
  padding: 0 11px;
  font-size: 12px;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 231, 210, 0.04);
}

.view-toggle button {
  width: 34px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  background: transparent;
}

.view-toggle button.active {
  color: var(--text);
  background: rgba(243, 231, 210, 0.08);
}

.status-region {
  min-height: 0;
}

.notice,
.error-box,
.empty-box {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(243, 231, 210, 0.045);
  font-size: 13px;
  line-height: 1.45;
}

.error-box {
  border-color: rgba(255, 115, 92, 0.38);
  color: #ffd2cb;
  background: rgba(255, 115, 92, 0.08);
}

.gallery-grid {
  width: 100%;
  margin-top: 12px;
  column-count: 6;
  column-gap: 2px;
  line-height: 0;
}

.space-card {
  position: relative;
  width: 100%;
  display: inline-block;
  margin: 0 0 2px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #17120f;
  box-shadow: none;
  break-inside: avoid;
  cursor: pointer;
}

.cover-frame {
  position: relative;
  aspect-ratio: var(--ratio, 1.18);
  overflow: hidden;
}

.space-card.feature { --ratio: 1.62; }
.space-card.wide { --ratio: 1.72; }
.space-card.standard { --ratio: 1.2; }
.space-card.compact { --ratio: 1.45; }
.space-card.square { --ratio: 1; }
.space-card.portrait { --ratio: 0.78; }
.space-card.tall { --ratio: 0.64; }

.cover-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0) 34%, rgba(5, 5, 5, 0.28) 70%, rgba(5, 5, 5, 0.78) 100%),
    linear-gradient(90deg, rgba(5, 5, 5, 0.34), transparent 58%);
  pointer-events: none;
}

.cover-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.92) contrast(0.98);
  transform: scale(1.01);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), filter 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.space-card:hover .cover-frame img,
.space-card:focus-visible .cover-frame img {
  filter: saturate(1.02) contrast(1.03);
  transform: scale(1.04);
}

.icon-action {
  position: absolute;
  z-index: 3;
  bottom: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(243, 231, 210, 0.2);
  border-radius: 7px;
  color: var(--text);
  background: rgba(8, 7, 6, 0.48);
  backdrop-filter: blur(14px);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
}

.icon-action svg {
  width: 17px;
  height: 17px;
}

.detail-action {
  right: 46px;
}

.open-action {
  right: 8px;
}

.card-copy {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 72px;
  bottom: 9px;
  color: var(--text);
}

.card-copy h2 {
  margin: 0;
  font-size: clamp(14px, 1vw, 20px);
  font-weight: 650;
  line-height: 1.05;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.62);
}

.owner-chip {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(243, 231, 210, 0.14);
  border-radius: 8px;
  background: rgba(8, 7, 6, 0.38);
  backdrop-filter: blur(14px);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
}

.owner-chip b {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid rgba(243, 231, 210, 0.28);
  font-size: 9px;
}

.space-card:hover .icon-action,
.space-card:focus-within .icon-action {
  opacity: 1;
}

.icon-action:hover {
  background: rgba(255, 62, 0, 0.72);
}

.detail-root {
  max-width: 1240px;
  margin: 0 auto;
}

.detail-surface {
  padding-top: 30px;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(340px, 0.92fr);
  gap: 22px;
  align-items: stretch;
}

.detail-cover {
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.96) contrast(1);
}

.detail-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(34px);
}

.detail-panel h1 {
  margin-top: 12px;
  font-size: clamp(38px, 4.2vw, 64px);
}

.eyebrow {
  color: var(--brand);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-summary {
  margin: 22px 0 0;
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.58;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 26px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--line-soft);
}

.meta-box {
  min-width: 0;
  padding: 14px;
  background: rgba(243, 231, 210, 0.035);
}

.meta-box strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-section {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(243, 231, 210, 0.025);
}

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

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-list a,
.related-list span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(243, 231, 210, 0.04);
  font-size: 12px;
}

@media (max-width: 1420px) {
  .gallery-grid {
    column-count: 5;
  }

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

  .tools {
    justify-content: flex-start;
  }

  .search-field {
    width: min(520px, 46vw);
  }
}

@media (max-width: 1080px) {
  body {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .rail {
    padding: 20px 12px;
  }

  .brand span,
  .nav-item span,
  .rail-link span,
  .back-link span,
  .profile div,
  .profile svg,
  .plan-card {
    display: none;
  }

  .brand::before {
    width: 28px;
    height: 28px;
  }

  .nav-item,
  .rail-link,
  .back-link {
    justify-content: center;
    padding: 0;
  }

  .profile {
    display: flex;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .gallery-grid {
    column-count: 4;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-cover {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  body {
    display: block;
  }

  .rail {
    position: sticky;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .brand span {
    display: inline;
    font-size: 20px;
  }

  .brand::before {
    width: 22px;
    height: 22px;
  }

  .rail-nav {
    display: flex;
    gap: 4px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .rail-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    min-width: 42px;
  }

  .nav-item.active {
    box-shadow: inset 0 -2px 0 var(--brand);
  }

  .rail-bottom {
    display: none;
  }

  .surface {
    padding: 14px 4px 36px;
  }

  .topbar {
    padding: 0 8px;
    gap: 14px;
  }

  .product-kicker {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 44px;
  }

  .title-block p {
    font-size: 13px;
  }

  .title-row {
    align-items: flex-end;
  }

  .version-pill {
    margin-bottom: 2px;
  }

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

  .search-field,
  .select-field {
    width: 100%;
  }

  .create-button {
    display: none;
  }

  .signal-strip {
    grid-template-columns: 1fr 1fr 1fr;
    margin: 14px 8px 8px;
  }

  .signal-strip div {
    padding: 10px 8px;
  }

  .signal-strip span {
    font-size: 9px;
  }

  .signal-strip strong {
    font-size: 11px;
  }

  .subtools {
    justify-content: flex-start;
    padding: 0 8px;
    overflow-x: auto;
  }

  .gallery-grid {
    margin-top: 8px;
    column-count: 2;
    column-gap: 2px;
  }

  .space-card {
    margin-bottom: 2px;
  }

  .icon-action {
    display: none;
  }

  .card-copy {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .card-copy h2 {
    font-size: 14px;
  }

  .owner-chip {
    display: none;
  }

  .detail-surface {
    padding: 12px 8px 36px;
  }

  .detail-cover {
    min-height: 420px;
  }

  .detail-panel {
    padding: 20px;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }
}
