:root {
  --bg: #f5efe7;
  --panel: #fffaf4;
  --panel-strong: #ffffff;
  --ink: #121826;
  --muted: #697586;
  --line: #e5ded4;
  --primary: #ff6a00;
  --primary-dark: #cf5200;
  --blue: #2563eb;
  --teal: #11b3a1;
  --success: #12b76a;
  --shadow: 0 24px 70px rgba(18, 24, 38, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans Georgian", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(18, 24, 38, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 24, 38, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 16% 8%, rgba(255, 106, 0, 0.15), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(17, 179, 161, 0.13), transparent 26%),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.download-link {
  border: 0;
  border-radius: 8px;
  padding: 14px 18px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(255, 106, 0, 0.24);
}

button:hover,
.download-link:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.secondary-button {
  color: var(--ink);
  background: #eef2f7;
  box-shadow: none;
}

.secondary-button:hover {
  background: #e2e8f0;
}

.preview-shell {
  width: min(1280px, calc(100vw - var(--sidebar-w, 230px) - 64px));
  max-width: 1280px;
  margin: 32px 32px 48px calc(var(--sidebar-w, 230px) + 32px);
  padding-left: 0;
}

body[data-site-header-page="visualization"] .site-header-host {
  left: 50% !important;
  transform: translateX(-50%);
  width: calc(100vw - 40px);
  max-width: 1840px;
}

body[data-site-header-page="visualization"] .sidebar,
body[data-site-header-page="visualization"] .material-switcher,
body[data-site-header-page="visualization"] .sidebar-footer {
  background: rgba(251, 247, 240, 0.94);
  border-color: rgba(88, 105, 146, 0.12);
  box-shadow: 12px 0 30px rgba(36, 49, 80, 0.06);
}

body[data-site-header-page="visualization"] .sidebar {
  top: calc(var(--site-header-offset, 88px) + 44px);
  min-height: calc(100vh - var(--site-header-offset, 88px) - 44px);
}

body[data-site-header-page="visualization"] .nav-label,
body[data-site-header-page="visualization"] .material-tab-sub,
body[data-site-header-page="visualization"] .user-role {
  color: #7c879e;
}

body[data-site-header-page="visualization"] .material-tab {
  padding: 14px 14px;
  border-radius: 18px;
  color: #3f4c66;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(88, 105, 146, 0.12);
  box-shadow: 0 8px 18px rgba(36, 49, 80, 0.04);
}

body[data-site-header-page="visualization"] .material-tab:hover,
body[data-site-header-page="visualization"] .material-tab.active {
  background: rgba(47, 102, 246, 0.09);
  border-color: rgba(47, 102, 246, 0.22);
  color: #2f66f6;
  box-shadow: 0 14px 26px rgba(47, 102, 246, 0.1);
}

body[data-site-header-page="visualization"] .material-tab-icon {
  width: 38px;
  height: 38px;
  background: rgba(234, 239, 251, 0.98);
  color: #66738d;
}

body[data-site-header-page="visualization"] .material-tab:hover .material-tab-icon,
body[data-site-header-page="visualization"] .material-tab.active .material-tab-icon {
  background: rgba(47, 102, 246, 0.12);
  color: #2f66f6;
}

body[data-site-header-page="visualization"] .material-tab-name,
body[data-site-header-page="visualization"] .user-name {
  color: #1d2940;
}

body[data-site-header-page="visualization"] .material-tab-dot {
  opacity: 0.5;
}

body[data-site-header-page="visualization"] .material-tab.active .material-tab-dot {
  opacity: 1;
}

body[data-site-header-page="visualization"] .sidebar-footer {
  margin-top: auto;
  padding: 16px 14px 18px;
  border-top: 1px solid rgba(88, 105, 146, 0.1);
}

body[data-site-header-page="visualization"] .user-card {
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 105, 146, 0.1);
  box-shadow: 0 10px 22px rgba(36, 49, 80, 0.05);
}

body[data-site-header-page="visualization"] .user-avatar {
  background: linear-gradient(135deg, #2f66f6, #5f8cff);
  box-shadow: 0 10px 20px rgba(47, 102, 246, 0.22);
}

.upload-stage,
.result-stage,
.modal__panel,
.loading-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.94);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 900;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.04;
  letter-spacing: 0;
}

#upload-title {
  font-size: 32px;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 17px;
}

.upload-help,
.form-message,
.loading-card p {
  color: var(--muted);
  line-height: 1.65;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.upload-stage,
.result-stage {
  margin-top: 0;
  padding: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.visual-workbench {
  --workbench-height: clamp(560px, 51vw, 670px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 22px;
  align-items: stretch;
}

.upload-box {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 360px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 2px dashed #c9d2df;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 106, 0, 0.1), transparent 38%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.1), transparent 40%),
    #fffdf9;
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  min-width: 0;
}

.room-upload {
  width: 100%;
  height: var(--workbench-height);
  min-height: 0;
  aspect-ratio: auto;
}

.room-upload .upload-icon {
  width: 92px;
  height: 92px;
  font-size: 52px;
}

.room-upload .upload-title {
  font-size: clamp(28px, 4vw, 42px);
}

.room-upload .upload-help {
  max-width: 420px;
  font-size: 17px;
}

.upload-box:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 22px 46px rgba(18, 24, 38, 0.12);
}

.upload-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  font-size: 42px;
  line-height: 1;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.2);
}

.upload-title {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 950;
}

.upload-help {
  max-width: 300px;
  font-size: 15px;
  font-weight: 700;
}

.upload-box img {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-box.has-image {
  color: #fff;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.9);
  background: #111827;
}

.upload-box.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(18, 24, 38, 0.18), rgba(18, 24, 38, 0.7));
}

.upload-box.has-image img {
  display: block;
}

.upload-box.has-image .upload-help {
  color: rgba(255, 255, 255, 0.78);
}

.stage-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 22px;
}

.form-message {
  margin: 0;
}

.product-dock {
  position: sticky;
  top: 18px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  width: 100%;
  min-height: 0;
  height: var(--workbench-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 18px 44px rgba(18, 24, 38, 0.08);
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.add-product-button {
  width: 100%;
}

.product-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf9;
}

.product-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.product-card__title {
  font-size: 16px;
  font-weight: 950;
}

.remove-product-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #b42318;
  background: #fff1f0;
  box-shadow: none;
}

.remove-product-button:hover {
  color: #fff;
  background: #d92d20;
}

.product-upload {
  min-height: 190px;
}

.product-upload .upload-icon {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  font-size: 32px;
}

.product-upload .upload-title {
  font-size: 19px;
}

.product-upload .upload-help {
  font-size: 13px;
}

.product-card select,
.product-card input[type="text"] {
  padding: 12px 14px;
}

.product-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  border: 1px solid #dce7f0;
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(17, 179, 161, 0.1), rgba(37, 99, 235, 0.08));
}

.product-strip h2 {
  margin-bottom: 6px;
  font-size: 24px;
}

.product-strip p:last-child {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.6;
}

.modal,
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal[hidden],
.loading-overlay[hidden],
.result-stage[hidden] {
  display: none;
}

.modal__backdrop,
.loading-overlay::before {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(8px);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 26px;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink);
  background: #eef2f7;
  box-shadow: none;
}

.application-list {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.application-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 120px;
  padding: 18px;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  background: #fff;
}

.application-card img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f5f9;
}

.application-card__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.application-card__name {
  grid-column: 1 / -1;
  margin: 0;
  font-weight: 950;
}

.modal__actions,
.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.loading-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 30px;
  text-align: center;
}

.render-scene {
  position: relative;
  height: 190px;
  overflow: hidden;
  margin-bottom: 24px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #0f172a, #1d3b53);
  background-size: 38px 38px, 38px 38px, auto;
}

.render-scene span {
  position: absolute;
  bottom: 28px;
  width: 86px;
  height: 86px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 106, 0, 0.96), rgba(17, 179, 161, 0.9));
  animation: floatTile 1.8s ease-in-out infinite;
}

.render-scene span:nth-child(1) {
  left: 70px;
}

.render-scene span:nth-child(2) {
  left: 206px;
  animation-delay: 180ms;
}

.render-scene span:nth-child(3) {
  right: 70px;
  animation-delay: 360ms;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 70px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  animation: scan 2.1s linear infinite;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.progress-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal), var(--blue));
  animation: progress 1.4s ease-in-out infinite;
}

.result-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.comparison-strip {
  display: grid;
  gap: 16px;
}

.comparison-strip article,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel-strong);
}

.comparison-strip img,
.result-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 8px;
  background: #f1f5f9;
}

.result-products {
  display: grid;
  gap: 10px;
}

.result-product {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: #fff;
}

.result-product img {
  width: 58px;
  height: 58px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.result-product strong,
.result-product span {
  display: block;
}

.result-product span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-card img {
  min-height: 520px;
}

.download-link[href] {
  display: inline-flex;
}

.download-link:not([href]) {
  display: none;
}

@keyframes floatTile {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-18px) rotate(2deg);
  }
}

@keyframes scan {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(270px);
  }
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(240%);
  }
}

@media (max-width: 900px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  body[data-site-header-page="visualization"] .site-header-host {
    left: 12px !important;
    right: 12px !important;
    transform: none;
    width: auto;
    max-width: calc(100vw - 24px);
  }

  .preview-shell {
    width: min(calc(100% - 24px), 720px);
    max-width: 100%;
    margin-top: 12px;
    margin-right: auto;
    margin-left: auto;
    padding-left: 0;
  }

  .visual-workbench,
  .product-grid,
  .application-card,
  .application-card__fields,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .upload-stage,
  .result-stage {
    min-width: 0;
    padding: clamp(14px, 4vw, 20px);
  }

  .section-head {
    display: block;
    margin-bottom: 18px;
  }

  .section-head .eyebrow {
    margin-bottom: 6px;
  }

  #upload-title,
  .section-head h2 {
    margin-bottom: 0;
    font-size: clamp(24px, 7vw, 32px);
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .visual-workbench,
  .product-dock,
  .product-grid,
  .product-card,
  .product-strip,
  .stage-actions,
  .comparison-strip,
  .result-card,
  .application-card,
  .application-card__fields {
    min-width: 0;
    width: 100%;
  }

  .upload-box {
    min-height: 260px;
  }

  .room-upload {
    height: auto;
    min-height: clamp(280px, 86vw, 420px);
    aspect-ratio: 4 / 3;
  }

  .room-upload .upload-icon {
    width: clamp(66px, 20vw, 84px);
    height: clamp(66px, 20vw, 84px);
    font-size: clamp(36px, 11vw, 46px);
  }

  .room-upload .upload-title {
    padding-inline: 12px;
    font-size: clamp(22px, 7vw, 30px);
    line-height: 1.25;
  }

  .room-upload .upload-help {
    max-width: 34rem;
    padding-inline: 14px;
    font-size: clamp(13px, 3.8vw, 16px);
    line-height: 1.55;
  }

  .product-dock {
    position: static;
    height: auto;
    padding: clamp(10px, 3.5vw, 16px);
  }

  .product-grid {
    padding-right: 0;
    overflow: visible;
  }

  .product-card {
    padding: clamp(10px, 3.5vw, 14px);
  }

  .product-card__title {
    min-width: 0;
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  .remove-product-button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
  }

  .product-upload {
    min-height: clamp(180px, 58vw, 240px);
  }

  .product-upload .upload-title {
    padding-inline: 8px;
    font-size: clamp(17px, 5vw, 20px);
    line-height: 1.3;
  }

  .product-upload .upload-help {
    max-width: 100%;
    padding-inline: 10px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .product-card select,
  .product-card input[type="text"],
  .modal__panel select,
  .modal__panel input,
  .modal__panel textarea {
    min-width: 0;
    font-size: 16px;
  }

  .product-strip {
    padding: clamp(14px, 4vw, 18px);
  }

  .product-strip h2 {
    font-size: clamp(20px, 6vw, 24px);
    line-height: 1.3;
  }

  .product-strip p:last-child,
  .form-message {
    font-size: 14px;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .stage-actions,
  .product-strip,
  .modal__actions,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-actions button,
  .modal__actions button,
  .result-actions button,
  .result-actions .download-link {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    text-align: center;
  }

  .modal,
  .loading-overlay {
    padding: 10px;
  }

  .modal__panel,
  .loading-card {
    width: 100%;
    max-width: 100%;
    padding: clamp(14px, 4vw, 22px);
  }

  .modal__panel {
    max-height: calc(100dvh - 20px);
  }

  .modal__header {
    align-items: flex-start;
    gap: 10px;
  }

  .modal__header h2,
  .loading-card h2 {
    font-size: clamp(21px, 6vw, 28px);
    line-height: 1.25;
  }

  .application-card {
    padding: 12px;
  }

  .result-card img {
    min-height: 0;
  }

  .comparison-strip article,
  .result-card {
    min-width: 0;
    padding: clamp(12px, 4vw, 18px);
  }

  .result-product {
    min-width: 0;
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .result-product img {
    width: 48px;
    height: 48px;
  }

  .result-product strong,
  .result-product span {
    overflow-wrap: anywhere;
  }

  .application-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .render-scene {
    height: 160px;
  }

  .render-scene span {
    width: 62px;
    height: 62px;
  }

  .render-scene span:nth-child(1) {
    left: 10%;
  }

  .render-scene span:nth-child(2) {
    left: calc(50% - 31px);
  }

  .render-scene span:nth-child(3) {
    right: 10%;
  }
}

@media (max-width: 420px) {
  body[data-site-header-page="visualization"] .site-header-host {
    left: 8px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px);
  }

  .preview-shell {
    width: calc(100% - 16px);
    margin-top: 8px;
  }

  .upload-stage,
  .result-stage {
    padding: 12px;
  }

  #upload-title,
  .section-head h2 {
    font-size: clamp(22px, 7vw, 28px);
  }

  .room-upload {
    min-height: 260px;
    aspect-ratio: 1 / 1;
  }

  .product-dock,
  .product-card {
    padding: 10px;
  }

  .product-upload {
    min-height: 170px;
  }

  .product-strip {
    margin-top: 16px;
    padding: 12px;
  }

  .stage-actions {
    margin-top: 16px;
  }
}
