:root {
  --ink: #102d34;
  --muted: #6d8388;
  --line: #d9e7e9;
  --soft: #f3f8f8;
  --paper: #fff;
  --brand: #0d7381;
  --brand-dark: #084c58;
  --brand-pale: #e7f5f5;
  --gold: #c8a25d;
  --danger: #a93636;
  --shadow: 0 22px 55px rgba(12, 66, 76, .11);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #edf5f5; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(163, 220, 224, .22), transparent 27rem),
    #f7fafa;
  font-family: Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.boot, .fatal {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 28px;
  text-align: center;
}
.boot__mark, .brand__mark {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  box-shadow: 0 9px 26px rgba(8, 76, 88, .22);
}
.boot__mark { width: 70px; height: 70px; border-radius: 23px; font: 700 37px Georgia, serif; }
.boot h1, .fatal h1 { margin: 23px 0 8px; font-size: clamp(24px, 4vw, 38px); }
.boot p, .fatal p { margin: 0; color: var(--muted); line-height: 2; }
.boot__line { width: 220px; height: 4px; margin-top: 28px; overflow: hidden; border-radius: 99px; background: #dfecee; }
.boot__line span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--brand); animation: loading 1.15s ease-in-out infinite alternate; }
@keyframes loading { to { transform: translateX(-138px); } }
.fatal__icon { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; color: #fff; background: var(--danger); font-size: 34px; font-weight: 700; }
.fatal__actions { display: flex; gap: 10px; margin-top: 26px; }

.studio { min-height: 100vh; padding-bottom: 102px; }
.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 clamp(18px, 3vw, 44px);
  border-bottom: 1px solid rgba(193, 217, 220, .86);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; color: inherit; text-decoration: none; }
.brand__mark { width: 42px; height: 42px; border-radius: 14px; font: 700 24px Georgia, serif; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.topbar__center { display: flex; align-items: center; gap: 8px; color: #526e74; font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #2caa69; box-shadow: 0 0 0 5px rgba(44, 170, 105, .1); }
.topbar__actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; direction: rtl; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: .2s ease; }
.icon-button:hover { border-color: #a9cbd0; transform: translateY(-1px); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.store-link { padding: 10px 16px; color: #fff; border-radius: 12px; background: var(--ink); text-decoration: none; font-size: 12px; }

.workspace {
  display: grid;
  grid-template-columns: 214px minmax(360px, 1fr) minmax(390px, 510px);
  gap: 18px;
  max-width: 1680px;
  min-height: calc(100vh - 178px);
  margin: 0 auto;
  padding: 20px clamp(14px, 2vw, 30px);
}
.steps, .preview, .configurator { border: 1px solid rgba(205, 224, 226, .93); border-radius: var(--radius); background: rgba(255, 255, 255, .91); box-shadow: 0 15px 45px rgba(14, 74, 83, .06); }
.steps { padding: 18px 12px; overflow: hidden; }
.steps__head { display: flex; justify-content: space-between; padding: 0 8px; font-size: 11px; color: var(--muted); }
.steps__head b { color: var(--brand); }
.steps__progress { height: 4px; margin: 11px 8px 18px; overflow: hidden; border-radius: 9px; background: #e8f0f1; }
.steps__progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--brand)); transition: width .35s ease; }
.steps__list { display: flex; flex-direction: column; gap: 5px; max-height: calc(100vh - 178px); overflow: auto; padding-left: 3px; scrollbar-width: thin; }
.step-button {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 9px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  text-align: right;
  cursor: pointer;
  transition: .18s ease;
}
.step-button:hover { background: var(--soft); }
.step-button.is-active { color: var(--brand-dark); background: var(--brand-pale); }
.step-button.is-done::after { content: "✓"; margin-right: auto; color: var(--brand); font-size: 11px; }
.step-button__icon { flex: 0 0 auto; display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 10px; color: #789096; background: #fff; font-size: 12px; font-weight: 700; }
.step-button.is-active .step-button__icon { color: #fff; border-color: var(--brand); background: var(--brand); }
.step-button__text { overflow: hidden; }
.step-button__text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.step-button__text small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }

.preview { position: relative; min-width: 0; padding: 16px; overflow: hidden; background: linear-gradient(145deg, rgba(247, 252, 252, .96), rgba(234, 245, 246, .9)); }
.preview__top { position: relative; z-index: 3; display: flex; justify-content: space-between; align-items: center; }
.stock-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(44, 170, 105, .16); border-radius: 99px; color: #268254; background: rgba(255,255,255,.72); font-size: 10px; }
.stock-pill i { width: 6px; height: 6px; border-radius: 50%; background: #2caa69; }
.stock-pill.is-out { color: #9c3d3d; border-color: rgba(169,54,54,.2); }
.stock-pill.is-out i { background: var(--danger); }
.view-tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); }
.view-tabs button { padding: 6px 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; }
.view-tabs button.is-active { color: var(--ink); background: #fff; box-shadow: 0 3px 10px rgba(15,70,78,.08); }
.garment-stage { position: relative; min-height: 570px; height: calc(100vh - 300px); display: grid; place-items: center; overflow: hidden; border-radius: 18px; }
.stage-glow { position: absolute; width: 72%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(171, 218, 221, .45), rgba(216, 239, 241, .14) 52%, transparent 70%); }
.stage-glow::after { content: ""; position: absolute; inset: 74% 2% auto; height: 35px; border-radius: 50%; background: radial-gradient(ellipse, rgba(20,70,78,.17), transparent 66%); filter: blur(8px); }
.garment { position: relative; z-index: 1; width: min(86%, 540px); height: 94%; display: grid; place-items: center; transform: scale(1); transition: transform .25s ease; }
.garment > img { width: 100%; height: 100%; object-fit: contain; object-position: center; filter: drop-shadow(0 18px 21px rgba(13,64,72,.17)); transition: opacity .2s ease; }
.garment__layers { position: absolute; inset: 0; pointer-events: none; }
.garment-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; filter: drop-shadow(0 10px 18px rgba(10,45,50,.08)); }
.garment-mask { position: absolute; inset: 0; background: var(--mask-color, #123); -webkit-mask: var(--mask-url) center / contain no-repeat; mask: var(--mask-url) center / contain no-repeat; mix-blend-mode: multiply; opacity: .92; }
.stage-placeholder { position: relative; z-index: 2; display: grid; place-items: center; color: var(--muted); }
.stage-placeholder span { display: grid; place-items: center; width: 96px; height: 96px; border: 1px dashed #a9c8cc; border-radius: 30px; color: #8ab3b9; font: 700 50px Georgia, serif; }
.stage-placeholder p { margin-top: 16px; font-size: 11px; }
.zoom-controls { position: absolute; z-index: 4; bottom: 14px; left: 4px; display: flex; flex-direction: column; gap: 5px; }
.zoom-controls button { width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.85); cursor: pointer; font-size: 18px; }
.selection-strip { position: relative; z-index: 3; min-height: 42px; display: flex; justify-content: center; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.selection-chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; max-width: 145px; padding: 6px 8px; border: 1px solid rgba(196,218,221,.85); border-radius: 10px; background: rgba(255,255,255,.76); font-size: 9px; }
.selection-chip img, .selection-chip i { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px; object-fit: cover; background: var(--chip-color, #e8f0f1); }
.selection-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview__hint { margin: 12px 0 0; color: #7a9297; text-align: center; font-size: 9px; line-height: 1.8; }
.preview__hint span { color: var(--gold); }

.configurator { min-width: 0; display: flex; flex-direction: column; padding: 23px; }
.configurator__head { display: flex; justify-content: space-between; gap: 20px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--brand); font-size: 10px; font-weight: 700; }
.configurator h1 { margin: 0; font-size: clamp(21px, 2.1vw, 29px); letter-spacing: -.5px; }
.step-count { align-self: flex-start; padding: 7px 9px; border-radius: 9px; color: var(--muted); background: var(--soft); font-size: 9px; direction: ltr; }
.step-description { min-height: 42px; margin: 10px 0 17px; padding-bottom: 14px; border-bottom: 1px solid #e7eff0; color: var(--muted); font-size: 11px; line-height: 1.95; }
.options { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 2px 12px; scrollbar-color: #c1d7da transparent; scrollbar-width: thin; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-card { position: relative; min-height: 83px; display: grid; grid-template-columns: 57px 1fr; align-items: center; gap: 10px; padding: 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; text-align: right; cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.option-card:hover:not(:disabled) { transform: translateY(-1px); border-color: #9cc7cd; box-shadow: 0 8px 20px rgba(9,78,89,.07); }
.option-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,115,129,.09); }
.option-card.is-selected::after { content: "✓"; position: absolute; top: 7px; left: 7px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: var(--brand); font-size: 9px; }
.option-card:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.25); }
.option-card__visual { width: 57px; height: 63px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; background: linear-gradient(145deg, #edf5f5, #dfecee); }
.option-card__visual img { width: 100%; height: 100%; object-fit: cover; }
.option-card__swatch { width: 36px; height: 36px; border: 4px solid #fff; border-radius: 50%; background: var(--swatch, #dce8e9); box-shadow: 0 0 0 1px #cadcde; }
.option-card__letter { color: #7aa3a9; font: 700 21px Georgia, serif; }
.option-card__body { min-width: 0; }
.option-card__body strong { display: block; padding-left: 19px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.option-card__body p { display: -webkit-box; min-height: 27px; margin: 5px 0 4px; overflow: hidden; color: var(--muted); font-size: 8.5px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.option-card__body small { color: var(--brand); font-size: 8.5px; font-weight: 700; }
.configurator__footer { display: flex; gap: 9px; padding-top: 14px; border-top: 1px solid #e6eeee; }
.button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; padding: 0 18px; border: 1px solid transparent; border-radius: 13px; text-decoration: none; cursor: pointer; transition: .18s ease; font-size: 11px; font-weight: 700; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button--primary { flex: 1; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); box-shadow: 0 9px 22px rgba(8,76,88,.16); }
.button--primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 11px 28px rgba(8,76,88,.22); }
.button--ghost { color: var(--ink); border-color: var(--line); background: #fff; }

.tailoring-grid { display: grid; gap: 11px; }
.tailoring-card { position: relative; display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: #fff; cursor: pointer; text-align: right; }
.tailoring-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,115,129,.08); }
.tailoring-card__icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; color: var(--brand); background: var(--brand-pale); font-size: 22px; }
.tailoring-card strong { display: block; font-size: 13px; }
.tailoring-card p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.8; }
.tailoring-card small { color: var(--brand); font-size: 9px; font-weight: 700; }
.measure-box { margin-top: 15px; padding: 15px; border: 1px solid #dce9ea; border-radius: 17px; background: #f8fbfb; }
.measure-box__head { margin-bottom: 12px; }
.measure-box__head strong { display: block; font-size: 12px; }
.measure-box__head small { color: var(--muted); font-size: 8.5px; }
.measure-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.field label { display: block; margin-bottom: 5px; color: #526b70; font-size: 9px; }
.field__control { position: relative; }
.field input, .field textarea { width: 100%; border: 1px solid #d5e4e6; border-radius: 11px; color: var(--ink); background: #fff; outline: none; transition: .18s ease; }
.field input { height: 42px; padding: 0 10px 0 37px; direction: ltr; text-align: center; }
.field textarea { min-height: 88px; padding: 11px; resize: vertical; line-height: 1.8; }
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,115,129,.07); }
.field__unit { position: absolute; top: 50%; left: 8px; transform: translateY(-50%); color: #8ba0a5; font-size: 8px; }
.profile-check { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: #536e73; font-size: 9px; cursor: pointer; }
.profile-check input { accent-color: var(--brand); }
.validation-note { display: none; margin: 9px 0 0; color: var(--danger); font-size: 9px; }
.validation-note.is-visible { display: block; }

.review-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: #fbfdfd; }
.review-card + .review-card { margin-top: 10px; }
.review-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 11px; }
.review-card__head strong { font-size: 12px; }
.review-card__head button { border: 0; color: var(--brand); background: none; cursor: pointer; font-size: 9px; }
.review-list { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; margin: 0; }
.review-list div { min-width: 0; display: flex; justify-content: space-between; gap: 6px; padding-bottom: 6px; border-bottom: 1px dashed #e0eaea; font-size: 9px; }
.review-list dt { color: var(--muted); }
.review-list dd { margin: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.review-price { display: flex; align-items: center; justify-content: space-between; }
.review-price span { color: var(--muted); font-size: 10px; }
.review-price strong { color: var(--brand-dark); font-size: 20px; }
.note-field { margin-top: 12px; }

.checkout-bar {
  position: fixed;
  z-index: 60;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(230px, .8fr) 1fr minmax(330px, .85fr);
  align-items: center;
  gap: 20px;
  padding: 11px clamp(18px, 3vw, 44px) calc(11px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(191,215,218,.95);
  background: rgba(255,255,255,.94);
  box-shadow: 0 -12px 32px rgba(15,70,80,.08);
  backdrop-filter: blur(20px);
}
.checkout-bar__meta span, .checkout-bar__meta small, .checkout-bar__meta strong { display: block; }
.checkout-bar__meta span { color: var(--muted); font-size: 9px; }
.checkout-bar__meta strong { margin: 3px 0; color: var(--brand-dark); font-size: 19px; }
.checkout-bar__meta small { color: #70878c; font-size: 8px; }
.checkout-bar__selection { display: flex; justify-content: center; gap: 6px; overflow: hidden; }
.mini-chip { flex: 0 1 auto; max-width: 130px; padding: 7px 9px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; color: #566f74; background: #f8fbfb; text-overflow: ellipsis; white-space: nowrap; font-size: 8.5px; }
.checkout-button { height: 61px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px; border: 0; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #0e7d8c, #084d59); box-shadow: 0 11px 25px rgba(8,76,88,.21); text-align: right; cursor: pointer; transition: .2s ease; }
.checkout-button:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(8,76,88,.28); }
.checkout-button:disabled { opacity: .65; cursor: wait; }
.checkout-button strong, .checkout-button small { display: block; }
.checkout-button strong { font-size: 11px; }
.checkout-button small { margin-top: 5px; opacity: .73; font-size: 8px; }
.checkout-button svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(180deg); }

.toast { position: fixed; z-index: 100; top: 90px; left: 50%; max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; color: #fff; background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, -12px); transition: .25s ease; font-size: 10px; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--danger); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 175px minmax(330px, 1fr) minmax(350px, 440px); }
  .option-grid { grid-template-columns: 1fr; }
  .garment-stage { min-height: 490px; }
}

@media (max-width: 920px) {
  .studio { padding-bottom: 92px; }
  .topbar { height: 66px; grid-template-columns: 1fr auto; }
  .topbar__center { display: none; }
  .brand small, .store-link { display: none; }
  .workspace { display: flex; flex-direction: column; min-height: auto; padding: 10px; }
  .steps { order: 1; padding: 10px; border-radius: 16px; }
  .steps__head, .steps__progress { display: none; }
  .steps__list { max-height: none; flex-direction: row; gap: 6px; overflow-x: auto; padding: 0; }
  .step-button { flex: 0 0 auto; width: auto; min-width: 90px; padding: 7px; }
  .step-button__icon { width: 27px; height: 27px; }
  .step-button__text strong { max-width: 82px; }
  .step-button__text small, .step-button.is-done::after { display: none; }
  .preview { order: 2; padding: 11px; }
  .garment-stage { min-height: 420px; height: 50vh; max-height: 570px; }
  .preview__hint { display: none; }
  .configurator { order: 3; padding: 18px 14px; }
  .option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkout-bar { min-height: 78px; grid-template-columns: 1fr minmax(290px, 1fr); gap: 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .checkout-bar__selection { display: none; }
  .checkout-button { height: 56px; }
}

@media (max-width: 560px) {
  .studio { padding-bottom: 84px; }
  .topbar { padding: 0 12px; }
  .brand__mark { width: 38px; height: 38px; }
  .brand strong { font-size: 14px; }
  .icon-button { width: 37px; height: 37px; }
  .workspace { gap: 8px; padding: 8px; }
  .preview, .configurator { border-radius: 16px; }
  .garment-stage { min-height: 350px; height: 45vh; }
  .view-tabs button { padding: 5px 8px; }
  .selection-strip { justify-content: flex-start; }
  .option-grid { grid-template-columns: 1fr; }
  .option-card { min-height: 78px; grid-template-columns: 53px 1fr; }
  .option-card__visual { width: 53px; height: 59px; }
  .measure-grid, .review-list { grid-template-columns: 1fr; }
  .checkout-bar { grid-template-columns: 112px 1fr; }
  .checkout-bar__meta span, .checkout-bar__meta small { display: none; }
  .checkout-bar__meta strong { font-size: 14px; }
  .checkout-button { padding: 0 13px; }
  .checkout-button strong { font-size: 9.5px; }
  .checkout-button small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
