/* Goodara Backpack Studio — styled after goodara.com (tailwind.config.ts):
   ink surfaces, lime accent, royal blue, Inter. */
:root {
  color-scheme: dark;
  --ink-950: #0b0b0b;
  --ink-900: #0f0f0f;
  --ink-850: #161616;
  --ink-800: #1f1f1f;
  --ink-700: #262626;
  --ink-600: #333333;
  --ink-500: #4a4a4a;
  --lime: #ccff00;
  --lime-dim: #b4e600;
  --royal: #266bcc;
  --royal-hover: #1d57a8;
  --sale: #ff2e4d;
  --text: rgba(255, 255, 255, 0.82);
  --text-strong: #fff;
  --muted: rgba(255, 255, 255, 0.5);
  --radius: 12px;
  --shadow-glow: 0 0 0 1px rgba(204, 255, 0, 0.25), 0 12px 40px -12px rgba(204, 255, 0, 0.25);
  --shadow-lift: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink-900);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { background: var(--ink-800); border: 1px solid var(--ink-700); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; color: var(--lime); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }

/* ── buttons (same as goodara.com globals.css) ───────────────────────── */
.btn-lime, .btn-ghost, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 6px; padding: 9px 16px; font-size: 13.5px; font-weight: 700;
  transition: background-color .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn-lime { background: var(--lime); color: #000; border: 0; }
.btn-lime:hover { background: var(--lime-dim); }
.btn-ghost { background: var(--ink-850); border: 1px solid var(--ink-600); color: #fff; font-weight: 600; }
.btn-ghost:hover { background: var(--ink-800); border-color: var(--ink-500); }
.btn-primary { background: var(--royal); color: #fff; border: 0; }
.btn-primary:hover { background: var(--royal-hover); }
.btn-lime:active, .btn-ghost:active, .btn-primary:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ── top bar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 16px; flex: none;
  background: var(--ink-950); border-bottom: 1px solid var(--ink-700);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; stroke: none; }
.brand-mark g { stroke: #0f0f0f; }
.brand-name { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.brand-sep { width: 1px; height: 22px; background: var(--ink-600); }
.app-name { color: #fff; font-weight: 700; }
.pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--lime); border: 1px solid rgba(204,255,0,.35); background: rgba(204,255,0,.08); border-radius: 999px; padding: 2px 8px; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar-right .btn-ghost { padding: 9px 11px; }

/* ── layout ──────────────────────────────────────────────────────────── */
.studio {
  flex: 1; min-height: 0;
  display: grid; gap: 12px; padding: 12px;
  grid-template-columns: 260px minmax(0, 1fr) 340px;
}
.panel { background: var(--ink-850); border: 1px solid var(--ink-700); border-radius: var(--radius); min-height: 0; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; gap: 8px; }
.section-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #fff; }
.section-label .dot { width: 6px; height: 6px; border-radius: 2px; background: var(--lime); }
.empty { color: var(--muted); font-size: 13px; padding: 18px; text-align: center; }
.mini { background: var(--ink-800); border: 1px solid var(--ink-600); border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.mini:hover { border-color: var(--ink-500); }
.mini.on { background: var(--lime); color: #000; border-color: var(--lime); }

/* ── catalog ─────────────────────────────────────────────────────────── */
.filters { padding: 0 14px 10px; display: grid; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 8px; padding: 3px; }
.seg button { background: none; border: 0; border-radius: 6px; padding: 5px 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--ink-700); color: #fff; }
input[type=search], input[type=text], input:not([type]), select, textarea {
  width: 100%; background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--lime); }
.bag-grid { overflow: auto; padding: 0 14px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.bag-card {
  background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 10px; padding: 6px; text-align: left;
  transition: border-color .15s, transform .2s, box-shadow .2s;
}
.bag-card:hover { border-color: var(--ink-500); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.bag-card.on { border-color: var(--lime); box-shadow: var(--shadow-glow); }
.bag-card img { width: 100%; aspect-ratio: 1; border-radius: 6px; display: block; background: radial-gradient(circle at 50% 40%, #2a2a2a, #141414 75%); object-fit: cover; }
.bag-card .n { display: block; color: #fff; font-weight: 600; font-size: 12.5px; margin-top: 6px; line-height: 1.25; }
.bag-card .s { display: block; color: var(--muted); font-size: 11.5px; }

/* ── editor ──────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--ink-700); flex-wrap: wrap; }
.tool-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-group.right { margin-left: auto; gap: 12px; }
.tool-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-right: 2px; }
.tool { display: inline-flex; align-items: center; gap: 6px; background: var(--ink-800); border: 1px solid var(--ink-600); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: #fff; }
.tool:hover { border-color: var(--lime); color: var(--lime); }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--lime); width: 15px; height: 15px; margin: 0; }
.zoom { display: inline-flex; align-items: center; border: 1px solid var(--ink-600); border-radius: 8px; overflow: hidden; }
.zoom button { background: var(--ink-800); border: 0; width: 28px; height: 28px; font-size: 16px; }
.zoom button:hover { color: var(--lime); }
.zoom span { min-width: 52px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }

.canvas-wrap { position: relative; flex: 1; min-height: 0; overflow: auto; background:
  repeating-conic-gradient(#141414 0% 25%, #191919 0% 50%) 50% / 24px 24px; border-radius: 0; }
.canvas-stage { min-width: 100%; min-height: 100%; display: grid; place-items: center; padding: 18px; }
#editCanvas { display: block; box-shadow: 0 0 0 1px var(--ink-600), var(--shadow-lift); touch-action: none; image-rendering: auto; background: #222; }
#editCanvas.grab { cursor: grab; }
#editCanvas.grabbing { cursor: grabbing; }
.canvas-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; font-weight: 600; }
.statusbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--ink-700); font-size: 12.5px; }
.statusbar .grow { flex: 1; }
#statusBag { color: #fff; font-weight: 600; }
.variants { display: inline-flex; gap: 4px; }
.variants button { width: 26px; height: 24px; border-radius: 6px; border: 1px solid var(--ink-600); background: var(--ink-800); font-weight: 700; font-size: 12px; }
.variants button.on { background: var(--lime); color: #000; border-color: var(--lime); }

/* ── right column ────────────────────────────────────────────────────── */
.side { display: grid; grid-template-rows: minmax(160px, 0.9fr) minmax(240px, 1.3fr); gap: 12px; min-height: 0; }
.view3d { flex: 1; min-height: 0; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #2c2c2c, #111 72%); }
.view3d canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; }
.view3d canvas:active { cursor: grabbing; }
.view3d .empty { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; }
.view3d-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.view3d-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font-size: 12.5px; color: var(--muted);
  background: rgba(11,11,11,.7); border: 1px solid var(--ink-700); border-radius: 999px; padding: 5px 12px; white-space: nowrap; pointer-events: none; }
.view3d-hint b { color: #fff; }
.view-seg { grid-template-columns: 1fr 1fr; min-width: 210px; }
.editor.view-3d .sheet-only { display: none; }

.looks select { width: auto; padding: 4px 8px; font-size: 12px; }
.layer-list { list-style: none; margin: 0; padding: 0 10px 10px; overflow: auto; display: grid; gap: 5px; align-content: start; }
.layer {
  display: grid; grid-template-columns: 22px 34px 1fr auto; gap: 8px; align-items: center;
  padding: 5px 6px; border-radius: 8px; border: 1px solid var(--ink-700); background: var(--ink-900); cursor: pointer; user-select: none;
}
.layer:hover { border-color: var(--ink-500); }
.layer.on { border-color: var(--lime); background: rgba(204,255,0,.05); }
.layer.dragging { opacity: .4; }
.layer.drop-above { box-shadow: 0 -2px 0 var(--lime); }
.layer .eye { background: none; border: 0; padding: 0; color: var(--muted); display: grid; place-items: center; }
.layer .eye.off { opacity: .35; }
.layer canvas { width: 34px; height: 34px; border-radius: 5px; background: #333; display: block; }
.layer .ln { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .lt { font-size: 11px; color: var(--muted); }
.layer .acts { display: flex; gap: 2px; }
.layer .acts button { background: none; border: 0; color: var(--muted); padding: 3px; border-radius: 5px; display: grid; place-items: center; }
.layer .acts button:hover { color: #fff; background: var(--ink-700); }
.layer .acts button.del:hover { color: var(--sale); }

.props-body { overflow: auto; padding: 0 14px 14px; display: grid; gap: 10px; align-content: start; }
.row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; }
.row > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.row .inline { display: flex; align-items: center; gap: 8px; }
.row input[type=range] { width: 100%; accent-color: var(--lime); }
.row output { min-width: 38px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: #fff; }
.row input[type=color] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--ink-600); border-radius: 6px; background: none; cursor: pointer; }
.row input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.row input[type=color]::-webkit-color-swatch { border: 0; border-radius: 4px; }
.row textarea { width: 100%; min-height: 54px; resize: vertical; background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 8px; padding: 8px 10px; color: inherit; font: inherit; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(255,255,255,.15); padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips button { background: var(--ink-800); border: 1px solid var(--ink-600); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.chips button.on { background: var(--lime); color: #000; border-color: var(--lime); }
.props-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.props-actions .mini { padding: 5px 10px; }

/* ── dialog ──────────────────────────────────────────────────────────── */
.dialog { border: 1px solid var(--ink-600); border-radius: 14px; background: var(--ink-850); color: var(--text); padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: var(--shadow-lift); }
.dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(3px); }
.dialog-body { padding: 22px; display: grid; gap: 14px; }
.dialog h3 { margin: 0; color: #fff; font-size: 19px; }
.dialog h4 { margin: 0 0 6px; color: var(--lime); }
.dialog p { margin: 0; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; color: #fff; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.progress { position: relative; height: 34px; border-radius: 8px; background: var(--ink-900); border: 1px solid var(--ink-700); overflow: hidden; display: grid; place-items: center; font-size: 12.5px; font-weight: 600; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(204,255,0,.18); transition: width .3s; }
.progress span { position: relative; }
.error { background: rgba(255,46,77,.1); border: 1px solid rgba(255,46,77,.4); color: #ff8a9c; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.success ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ── toasts ──────────────────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--ink-800); border: 1px solid var(--ink-600); border-left: 3px solid var(--lime); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #fff; box-shadow: var(--shadow-lift); animation: toastIn .25s ease-out both; max-width: 340px; }
.toast.error { border-left-color: var(--sale); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── narrower screens ────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .studio { grid-template-columns: 220px minmax(0, 1fr) 300px; }
  .bag-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .studio { grid-template-columns: 1fr; height: auto; }
  .catalog { max-height: 300px; }
  .editor { height: 70vh; }
  .side { grid-template-rows: 300px auto auto; }
  .bag-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .topbar-right { width: 100%; justify-content: flex-end; flex-wrap: wrap; row-gap: 8px; }
}
.success p { margin-top: 10px !important; font-size: 12.5px; }

/* ── goodara.com: accounts, saving, sharing, buying ───────────────────── */
.design-name { width: 220px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 9px; color: #fff; font-weight: 600; }
.design-name:hover { border-color: var(--ink-600); }
.design-name:focus { border-color: var(--lime); background: var(--ink-850); outline: none; }
.design-name:disabled { color: var(--text); border-color: transparent; }
.save-state { font-size: 12px; white-space: nowrap; }
.topbar-right .account { text-decoration: none; display: inline-flex; align-items: center; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-lime span { white-space: nowrap; }
.banner { display: flex; align-items: center; gap: 10px; margin: 12px 12px 0; padding: 9px 14px; border-radius: 10px; background: rgba(204,255,0,.07); border: 1px solid rgba(204,255,0,.3); color: #fff; font-size: 13.5px; }
.banner .grow { flex: 1; }
.banner #bannerActions { display: flex; gap: 8px; }
.banner .btn-lime, .banner .btn-ghost { padding: 6px 12px; font-size: 13px; }
body.readonly .edit-only { display: none !important; }
body.readonly .layer .acts, body.readonly .layer .eye { visibility: hidden; }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.ticks li { position: relative; padding-left: 22px; }
.ticks li::before { content: ""; position: absolute; left: 3px; top: 5px; width: 9px; height: 5px; border-left: 2px solid var(--lime); border-bottom: 2px solid var(--lime); transform: rotate(-45deg); }
.small { font-size: 12.5px; }
.price-row { display: flex; align-items: baseline; gap: 8px; }
.price { color: #fff; font-size: 28px; font-weight: 800; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; }
#buyPane, #dlPane { display: grid; gap: 12px; }
.dialog.wide { width: min(860px, calc(100vw - 32px)); }
.dialog.video { width: min(1100px, calc(100vw - 32px)); }
.dialog.video video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head .btn-ghost { padding: 7px 12px; }
.mine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; }
.mine-card { position: relative; display: grid; gap: 4px; padding: 8px; text-align: left; background: var(--ink-900); border: 1px solid var(--ink-700); border-radius: 10px; color: var(--text); }
.mine-card:hover { border-color: var(--ink-500); }
.mine-card.on { border-color: var(--lime); }
.mine-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 7px; background: var(--ink-800); display: block; }
.mine-card .n { color: #fff; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-card .s { font-size: 11.5px; color: var(--muted); }
.mine-card .tag { position: absolute; top: 14px; left: 14px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; background: var(--lime); color: #000; }
.mine-card .del { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.6); border: 0; border-radius: 6px; padding: 4px; color: #fff; }
.mine-card .del:hover { color: var(--sale); }
@media (max-width: 1100px) { .design-name { width: 150px; } .save-state { display: none; } }
