* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px;
  font-family: Arial, sans-serif;
  color: white;
  background:
    radial-gradient(circle at 20% 0%, rgba(70, 194, 255, 0.1), transparent 28%),
    #101720;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

html {
  min-height: 100%;
  background: #101720;
}

.site-header {
  margin: 0 0 24px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid #2b3b4d;
  border-radius: 999px;
  color: #dbefff;
  text-decoration: none;
  background: rgba(24, 36, 49, 0.78);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.active {
  border-color: #46c2ff;
  color: white;
  background: rgba(70, 194, 255, 0.16);
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: 22px;
}

h3,
.page-intro {
  max-width: 760px;
  margin: 0;
  color: #b7c7d8;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 400;
}

a {
  color: #79d6ff;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.card {
  position: relative;
  display: block;
  overflow: hidden;
  background: #182431;
  border: 1px solid #2b3b4d;
  border-radius: 10px;
  color: white;
  text-decoration: none;
  min-height: 180px;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0b1018;
}

.card span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 28px 12px 12px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
}

.card:hover,
.card:focus-visible {
  border-color: #46c2ff;
}

.theme-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.theme-card img {
  flex: 0 0 auto;
  aspect-ratio: 16 / 10;
}

.theme-card span {
  position: static;
  min-height: 58px;
  padding: 10px 12px 12px;
  background: #0b1018;
  font-size: 17px;
}

.theme-preview {
  --theme-accent: #46c2ff;
  --theme-panel: #182431;
  --theme-bg: #101720;
  --theme-pop: #79d6ff;
  position: relative;
  display: grid;
  grid-template-columns: 24% 1fr;
  gap: 8%;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: clamp(12px, 7%, 44px);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, color-mix(in srgb, var(--theme-accent), transparent 55%), transparent 34%),
    linear-gradient(135deg, var(--theme-panel), var(--theme-bg));
}

.theme-preview.large {
  aspect-ratio: 16 / 9;
  padding: clamp(22px, 7%, 70px);
}

.theme-preview:before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--theme-pop), transparent 90%)),
    linear-gradient(transparent 72%, rgba(0, 0, 0, 0.28));
}

.preview-rail,
.preview-stage {
  position: relative;
  z-index: 1;
}

.preview-rail {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 12%;
  min-height: 0;
  padding: clamp(8px, 18%, 28px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.preview-rail i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.preview-rail i:first-child {
  background: var(--theme-accent);
}

.preview-stage {
  display: grid;
  grid-template-rows: 18% 1fr 20%;
  gap: 8%;
  min-width: 0;
  min-height: 0;
}

.preview-top,
.preview-footer,
.preview-grid i {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}

.preview-top {
  width: 72%;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7%;
}

.preview-grid i {
  display: block;
}

.preview-grid i:first-child {
  background: color-mix(in srgb, var(--theme-accent), transparent 42%);
}

.preview-footer {
  width: 88%;
}

.card span strong,
.card span small {
  display: block;
}

.card span strong {
  line-height: 1.15;
}

.card span small {
  margin-top: 4px;
  color: #b7c7d8;
  font-size: 13px;
  font-weight: 700;
}

.theme-view {
  width: 100%;
}

.theme-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  gap: 26px;
  align-items: start;
  width: 100%;
}

.theme-preview-frame,
.theme-gallery,
.theme-info {
  border: 1px solid #2b3b4d;
  border-radius: 10px;
  background: rgba(24, 36, 49, 0.78);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.theme-preview-frame {
  overflow: hidden;
}

.theme-gallery {
  overflow: hidden;
}

.theme-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0b1018;
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid #2b3b4d;
}

.gallery-controls span {
  color: #b7c7d8;
  font-size: 14px;
  font-weight: 700;
}

.gallery-btn {
  min-width: 74px;
  min-height: 38px;
  border: 1px solid #2b3b4d;
  border-radius: 8px;
  color: #f7fbff;
  background: #101720;
  font-weight: 700;
  cursor: pointer;
}

.gallery-btn:hover,
.gallery-btn:focus-visible {
  border-color: #46c2ff;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 14px 16px;
}

.gallery-dots button {
  width: 34px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #2b3b4d;
  cursor: pointer;
}

.gallery-dots button.active {
  background: #46c2ff;
}

.theme-info {
  min-width: 0;
  padding: 24px;
}

.theme-info h1 {
  margin-bottom: 16px;
}

.theme-status {
  display: inline-flex;
  margin: 0 0 16px;
  padding: 6px 10px;
  border: 1px solid #46c2ff;
  border-radius: 999px;
  color: #dbefff;
  background: rgba(70, 194, 255, 0.12);
  font-size: 13px;
  font-weight: 700;
}

.theme-description {
  margin: 0;
  color: #b7c7d8;
  font-size: 18px;
  line-height: 1.55;
}

.detail-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0;
}

.detail-swatch {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--swatch);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.download-button,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.download-button {
  border: 1px solid #46c2ff;
  color: #061019;
  background: #46c2ff;
}

.download-button:hover,
.download-button:focus-visible {
  background: #79d6ff;
}

.download-button.disabled {
  border-color: #2b3b4d;
  color: #b7c7d8;
  background: #182431;
  cursor: not-allowed;
}

.secondary-link {
  border: 1px solid #2b3b4d;
  color: #dbefff;
  background: rgba(16, 23, 32, 0.8);
}

.theme-maker-page {
  height: 100vh;
  overflow: hidden;
}

.theme-maker-page .site-header {
  margin-bottom: 18px;
}

.maker-workspace {
  --maker-accent: #46c2ff;
  --maker-panel: #182431;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.86fr);
  gap: 18px;
  align-items: stretch;
  height: calc(100vh - 206px);
  min-height: 0;
}

.maker-preview-shell,
.maker-controls {
  min-width: 0;
  min-height: 0;
}

.maker-preview-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid #2b3b4d;
  border-radius: 10px;
  background: rgba(24, 36, 49, 0.78);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.maker-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 14px 16px;
  border-bottom: 1px solid #2b3b4d;
}

.maker-preview-head h2 {
  margin: 0;
}

.maker-preview-head span {
  color: #b7c7d8;
  font-size: 13px;
  font-weight: 800;
}

.bsl-preview-viewport {
  --preview-scale: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #101720;
}

.bsl-preview-frame {
  display: block;
  width: 1280px;
  height: 720px;
  border: 0;
  background: #101720;
  transform: scale(var(--preview-scale));
  transform-origin: top left;
}

.maker-controls {
  display: grid;
  gap: 18px;
  align-content: start;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: #2b3b4d transparent;
}

.maker-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid #2b3b4d;
  border-radius: 10px;
  background: rgba(24, 36, 49, 0.78);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.2);
}

.maker-panel h2 {
  margin-bottom: 16px;
}

.maker-field,
.color-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #dbefff;
  font-weight: 700;
}

.maker-field input,
.maker-field textarea,
.maker-code-panel textarea {
  width: 100%;
  border: 1px solid #2b3b4d;
  border-radius: 8px;
  color: #f7fbff;
  background: rgba(11, 16, 24, 0.86);
  font: inherit;
}

.maker-field input {
  min-height: 42px;
  padding: 10px 12px;
}

.maker-field textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

.maker-field input:focus,
.maker-field textarea:focus,
.maker-code-panel textarea:focus,
.color-field input:focus {
  outline: 3px solid color-mix(in srgb, var(--maker-accent), transparent 72%);
  border-color: var(--maker-accent);
}

.color-fields {
  display: grid;
  gap: 12px;
}

.color-field {
  grid-template-columns: minmax(92px, 1fr) 52px minmax(76px, auto);
  align-items: center;
  margin-top: 0;
}

.color-field input {
  width: 52px;
  height: 38px;
  padding: 4px;
  border: 1px solid #2b3b4d;
  border-radius: 8px;
  background: #0b1018;
}

.color-field output {
  color: #b7c7d8;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.maker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.maker-actions button {
  cursor: pointer;
}

.maker-sample {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #2b3b4d;
  border-radius: 10px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--maker-accent), transparent 76%), transparent 32%),
    rgba(11, 16, 24, 0.72);
}

.maker-sample strong,
.maker-sample span {
  display: block;
}

.maker-sample strong {
  font-size: 22px;
  line-height: 1.15;
}

.maker-sample span {
  max-width: 720px;
  margin-top: 6px;
  color: #b7c7d8;
  line-height: 1.45;
}

.maker-sample button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--maker-accent);
  border-radius: 8px;
  font-weight: 800;
}

.maker-code-panel textarea {
  min-height: 460px;
  padding: 14px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .theme-detail {
    grid-template-columns: 1fr;
  }

  .theme-maker-page {
    height: auto;
    overflow: visible;
  }

  .maker-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .maker-preview-shell {
    min-height: 0;
  }

  .maker-controls {
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  body {
    padding: 20px;
  }

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

  .theme-info {
    padding: 20px;
  }

  .download-button,
  .secondary-link {
    width: 100%;
  }

  .maker-panel {
    padding: 16px;
  }

  .color-field {
    grid-template-columns: 1fr 48px;
  }

  .color-field output {
    grid-column: 1 / -1;
  }

  .maker-sample {
    align-items: stretch;
    flex-direction: column;
  }

  .maker-sample button,
  .maker-actions button {
    width: 100%;
  }
}
