/* Gopuram Studio — mobile first. Colours and type follow sakthi3dprints.in. */
@font-face { font-family: 'Manrope'; src: url(vendor/fonts/manrope-latin-wght-normal.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url(vendor/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
:root {
  --bg: #f7f6f2; --card: #fffdf8; --ink: #232924; --muted: #6c7068; --line: #e2e1d8; --soft: #f1eee6;
  --orange: #e86735; --orange-d: #c9532a; --dark: #171c18; --ok: #2f7d3a; --warn: #b5650d; --bad: #b3261e;
  --stage: #efe9de; --r: 14px; --font: 'Manrope', system-ui, sans-serif; --mono: 'Plex Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-tap-highlight-color: transparent; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #e8673580; outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; }

/* ---------- frame ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--line); z-index: 5; }
.brand { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--soft); flex: none; }
.title { display: grid; line-height: 1.15; min-width: 0; }
.title b { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.title span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tabs { margin-left: auto; display: flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 7px 13px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--muted); min-height: 36px; }
.tabs button[aria-selected=true] { background: var(--dark); color: #fff; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); flex: none; padding: 0; font-weight: 800; }
.icon-btn[aria-pressed=true] { background: var(--dark); color: #fff; border-color: var(--dark); }

/* ---------- design view: phone = stage on top, controls below ---------- */
.design { display: grid; grid-template-rows: minmax(250px, 46%) 1fr; min-height: 0; }
.stage { position: relative; min-height: 0; background: var(--stage); overflow: hidden; }
#view, #view canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
.stage-name { position: absolute; left: 12px; top: 10px; margin: 0; max-width: calc(100% - 70px); font-size: 13px; font-weight: 700;
  background: #fffdf8d9; padding: 5px 10px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px); }
.stage-name:empty { display: none; }
.stage-tools { position: absolute; right: 10px; top: 10px; display: grid; gap: 8px; }
.stage-tools .icon-btn { background: #fffdf8e6; backdrop-filter: blur(6px); }
.pill { position: absolute; left: 12px; bottom: 26px; max-width: calc(100% - 24px); display: flex; gap: 7px; align-items: center;
  border: 0; border-radius: 999px; padding: 8px 13px; background: #fffdf8ee; box-shadow: 0 4px 16px #0000001a; font-size: 13px; font-weight: 600; text-align: left; }
.pill .ok { color: var(--ok); } .pill .warn { color: var(--warn); } .pill .bad { color: var(--bad); }
.pill small { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; font-weight: 600; font-size: 14px; text-align: center; padding: 0 40px;
  background: #efe9de66; pointer-events: none; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #23292422; border-top-color: var(--orange); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.hint { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); margin: 0; background: #171c18cc; color: #fff; padding: 8px 14px;
  border-radius: 999px; font-size: 13px; font-weight: 600; pointer-events: none; animation: fade 4s var(--ease) forwards; }
@keyframes fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: var(--card); border-radius: 18px 18px 0 0;
  margin-top: -16px; z-index: 2; box-shadow: 0 -8px 24px #0000000f; }
.sections { display: flex; gap: 4px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.sections button { flex: 1; border: 0; background: none; padding: 9px 4px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); min-height: 40px; }
.sections button[aria-selected=true] { background: var(--soft); color: var(--ink); }
.sec-body { overflow: auto; padding: 14px 16px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.actions { display: flex; gap: 10px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-weight: 750; font-size: 15px; white-space: nowrap; }
.actions .btn { flex: 1; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-d); }
.btn.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 13px; }
.btn.rolling svg { animation: spin .6s var(--ease); }

/* ---------- controls ---------- */
.group { margin: 0 0 20px; }
.group > h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.lead { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
.scroller { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.product { flex: none; width: 104px; scroll-snap-align: start; border: 2px solid var(--line); border-radius: var(--r); background: #fff; padding: 0; overflow: hidden; text-align: left; }
.product img, .product .ph { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--stage); }
.product span { display: block; padding: 6px 8px 8px; font-size: 12px; font-weight: 700; line-height: 1.2; }
.product[aria-pressed=true] { border-color: var(--orange); box-shadow: 0 0 0 3px #e8673526; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.chip { flex: none; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 650; font-size: 14px; }
.chip[aria-pressed=true] { background: var(--dark); border-color: var(--dark); color: #fff; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 6px; font-weight: 650; font-size: 13px; min-height: 40px; color: var(--muted); }
.seg button[aria-pressed=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px #0000001f; }
.design-card { background: var(--soft); border-radius: var(--r); padding: 12px 14px; margin-bottom: 18px; }
.design-card .row1 { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.code { font: 500 12px var(--mono); color: var(--orange-d); }
.design-card h2 { font-size: 17px; margin: 4px 0 4px; letter-spacing: -.01em; }
.design-card p { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.design-card p.open { -webkit-line-clamp: unset; }
.link { border: 0; background: none; padding: 4px 0; color: var(--orange-d); font-weight: 700; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.field { margin: 0 0 16px; }
.field > label, .field > .lab { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.field .val { font: 500 13px var(--mono); color: var(--muted); }
.ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: -2px; }
input[type=range] { width: 100%; height: 30px; accent-color: var(--orange); margin: 0; }
select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px; }
input[type=number] { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px; }
.field.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field.inline > .lab { display: grid; margin: 0; }
.field.inline > .lab small { color: var(--muted); font-weight: 500; font-size: 12px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; }
.stepper button { width: 52px; height: 46px; border: 0; background: none; font-size: 22px; font-weight: 700; color: var(--ink); }
.stepper button:disabled { color: #c9c8bf; cursor: default; }
.stepper output { min-width: 44px; text-align: center; font: 600 18px var(--mono); }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-weight: 600; font-size: 14px; }
.toggle input { width: 44px; height: 26px; appearance: none; background: #cfcfc7; border-radius: 999px; position: relative; transition: background .2s; flex: none; margin: 0; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px #0003; }
.toggle input:checked { background: var(--ok); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
details.more { border-top: 1px solid var(--line); margin: 6px 0 0; padding-top: 4px; }
details.more > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 48px; font-weight: 700; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: '+'; font-size: 22px; color: var(--muted); }
details.more[open] > summary::after { content: '–'; }
details.more > summary small { color: var(--muted); font-weight: 500; font-size: 12px; display: block; }
.term { color: var(--muted); font-weight: 500; font-size: 12px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px; }
.swatch { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 5px; font-size: 11px; font-weight: 650; text-align: center; line-height: 1.15; }
.swatch i { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch[aria-pressed=true] i { box-shadow: 0 0 0 3px var(--orange); }
.modes { display: grid; gap: 8px; }
.mode { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; align-items: start; text-align: left; border: 2px solid var(--line); border-radius: var(--r); background: #fff; padding: 11px 13px; }
.mode b { font-size: 14px; } .mode small { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.mode i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #b9b8ae; margin-top: 1px; }
.mode[aria-pressed=true] { border-color: var(--orange); } .mode[aria-pressed=true] i { border: 5px solid var(--orange); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ok); background: #2f7d3a14; border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.banner { border-radius: var(--r); padding: 12px 14px; margin: 0 0 16px; font-size: 13.5px; background: #b5650d14; color: #6b3d07; display: grid; gap: 8px; }
.banner.ok { background: #2f7d3a12; color: #1d4f25; }

/* ---------- explore ---------- */
.explore { overflow: auto; padding: 16px 16px 40px; overscroll-behavior: contain; }
.ex-head h1 { font-size: 22px; letter-spacing: -.02em; margin: 2px 0 4px; }
.ex-head p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.ex-filters { display: grid; gap: 10px; margin-bottom: 16px; position: sticky; top: -16px; z-index: 2; background: var(--bg); padding: 10px 0; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.card { background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 10px #0000000d; display: flex; flex-direction: column; }
.card .pic { border: 0; padding: 0; background: var(--stage); display: block; width: 100%; aspect-ratio: 1; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .bd { padding: 10px 11px 12px; display: grid; gap: 4px; flex: 1; align-content: start; }
.card h3 { font-size: 14px; margin: 0; line-height: 1.25; }
.card .meta { font-size: 12px; color: var(--muted); }
.card .acts { display: flex; gap: 6px; margin-top: 6px; }
.card .acts .btn { flex: 1; min-height: 40px; padding: 0 10px; font-size: 13px; }
.card .acts .icon-btn { width: 40px; height: 40px; }
.card.skel .pic, .card.skel .bar { background: linear-gradient(90deg, #ece6da 0%, #f6f1e8 50%, #ece6da 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.card.skel .bar { height: 12px; border-radius: 6px; } .card.skel .bar.s { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.ex-more { display: grid; justify-items: center; gap: 8px; margin-top: 18px; }
.ex-more p { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }

/* ---------- sheets ---------- */
dialog.sheet { border: 0; padding: 0; width: 100%; max-width: 100%; max-height: 88dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink);
  box-shadow: 0 -10px 40px #0003; display: none; flex-direction: column; }
dialog.sheet[open] { display: flex; animation: up .3s var(--ease); }
dialog.sheet::backdrop { background: #171c1866; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 19px; }
.sheet-body { overflow: auto; padding: 4px 16px max(22px, env(safe-area-inset-bottom)); }
.files { display: grid; gap: 8px; margin-bottom: 14px; }
.file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; text-align: left; min-height: 56px; }
.file div { flex: 1; min-width: 0; } .file b { display: block; font-size: 14px; } .file small { color: var(--muted); font-size: 12px; }
.file .dot, .sheet .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px #0002; display: inline-block; vertical-align: -2px; }
.file .dots { display: flex; flex-direction: column; gap: 3px; }
.checks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; font-size: 14px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; }
.checks .ok { color: var(--ok); font-weight: 800; } .checks .warn { color: var(--warn); font-weight: 800; } .checks .bad { color: var(--bad); font-weight: 800; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin: 4px 0 12px; }
.sheet td, .sheet th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.sheet td:last-child, .sheet th:last-child { text-align: right; }
.sheet th { color: var(--muted); font-weight: 600; font-size: 12px; }
.sheet ol, .sheet ul { padding-left: 20px; margin: 4px 0 12px; font-size: 14px; } .sheet li { margin: 4px 0; }
.sheet h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.licence { font-size: 12px; color: var(--muted); background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 6px 0 14px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s var(--ease); z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tour ---------- */
.tour { position: fixed; inset: 0; z-index: 40; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px #171c18a8; transition: all .35s var(--ease); pointer-events: none; }
.tour-card { position: fixed; left: 12px; right: 12px; background: #fff; border-radius: 18px; padding: 16px 16px 14px; box-shadow: 0 12px 40px #0004; transition: top .35s var(--ease), bottom .35s var(--ease); }
.tour-card .step { font: 500 12px var(--mono); color: var(--orange-d); }
.tour-card h3 { margin: 4px 0 6px; font-size: 18px; }
.tour-card p { margin: 0 0 14px; color: #4b5049; font-size: 14.5px; }
.tour-card .row { display: flex; gap: 10px; align-items: center; }
.tour-card .row .btn { min-height: 44px; }
.tour-card .dots { display: flex; gap: 5px; margin-right: auto; }
.tour-card .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); } .tour-card .dots i.on { background: var(--orange); }
.tour-skip { border: 0; background: none; color: var(--muted); font-weight: 700; padding: 8px; }

/* ---------- tablets and desktops ---------- */
@media (min-width: 700px) {
  .tour-card { left: auto; right: auto; width: 340px; }
  .ex-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .explore { padding: 24px 28px 48px; }
}
@media (min-width: 960px) {
  .design { grid-template-columns: 384px 1fr; grid-template-rows: 1fr; }
  .stage { grid-column: 2; grid-row: 1; }
  .panel { grid-column: 1; grid-row: 1; border-radius: 0; margin: 0; border-right: 1px solid var(--line); box-shadow: none; }
  .pill { bottom: 18px; left: 18px; }
  .stage-name { left: 18px; top: 16px; font-size: 14px; }
  .stage-tools { right: 16px; top: 16px; }
  dialog.sheet { width: 560px; max-height: 84vh; margin: auto; border-radius: 22px; }
  .toast { bottom: 28px; }
  .top { padding: 10px 18px; }
  .title b { font-size: 16px; }
}
/* small phones (360 px): the header keeps the brand, tabs and help only */
@media (max-width: 380px) {
  .title span { display: none; }
  .title b { font-size: 14px; }
  .tabs button { padding: 7px 10px; }
  .sections button { font-size: 13px; }
  .actions .btn { padding: 0 12px; font-size: 14px; }
}
@media (max-width: 340px) { .title { display: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
