/* ═══════════════════════════════════════════════════════
   PicoBerry Experience — Scoped Stylesheet
   All rules scoped to #experience-root or #community
   to avoid breaking the original picoberry.ai design.
═══════════════════════════════════════════════════════ */

/* ── 1. Design Tokens (global — needed by #toast, #share-modal too) ── */
:root {
  --bg:        #09090b;
  --bg-card:   rgba(255,255,255,0.03);
  --border:    rgba(255,255,255,0.09);
  --border-hi: rgba(255,255,255,0.18);
  --primary:   #ff005c;
  --pr:        255,0,92;
  --accent:    #6500ff;
  --ac:        101,0,255;
  --text:      #f4f4f5;
  --muted:     rgba(244,244,245,0.5);
  --subtle:    rgba(244,244,245,0.25);
  --r:         12px;
  --rl:        20px;
  --rxl:       28px;
}

/* ── 2. Scoped reset — ONLY inside our sections ─────── */
#experience-root *, #experience-root *::before, #experience-root *::after,
#community *,       #community *::before,       #community *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#experience-root {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
}
#community {
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
}

/* ── 3. Layout ───────────────────────────────────────── */
#experience-root .wrap,
#community .wrap {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
}
#experience-root section { padding: 72px 0; }

/* ── 4. Cards / Buttons / Inputs ─────────────────────── */
#experience-root .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  backdrop-filter: blur(12px);
  padding: 28px;
}

#experience-root .btn,
#community .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  transition: transform .2s, box-shadow .2s, opacity .2s;
  white-space: nowrap; min-height: 44px; padding: 0 22px;
}
#experience-root .btn-p,
#community .btn-p { background: var(--primary); color: #fff; }
#experience-root .btn-p:hover:not(:disabled),
#community .btn-p:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 28px rgba(var(--pr),.45);
}
#experience-root .btn-p:disabled { opacity: .4; cursor: not-allowed; }

#experience-root .btn-g,
#community .btn-g {
  background: rgba(255,255,255,.05); color: var(--text);
  border: 1px solid var(--border);
  font-family: 'Inter', sans-serif;
  font-size: .875rem; font-weight: 500;
  letter-spacing: 0; text-transform: none;
}
#experience-root .btn-g:hover,
#community .btn-g:hover { background: rgba(255,255,255,.09); border-color: var(--border-hi); }

#experience-root .inp,
#experience-root textarea.inp {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#experience-root .inp:focus,
#experience-root textarea.inp:focus {
  border-color: rgba(var(--pr),.5);
  box-shadow: 0 0 0 3px rgba(var(--pr),.1);
}
#experience-root .inp::placeholder,
#experience-root textarea.inp::placeholder { color: var(--subtle); }
#experience-root textarea.inp { resize: none; min-height: 72px; line-height: 1.6; }

/* ── 5. Steps ────────────────────────────────────────── */
#experience-root .steps {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex-wrap: wrap; margin-bottom: 28px;
}
#experience-root .step {
  display: flex; align-items: center; gap: 8px;
  font-size: .78rem; color: var(--subtle);
  transition: color .3s;
}
#experience-root .step.active { color: var(--text); }
#experience-root .step.done   { color: var(--primary); }
#experience-root .step .lbl   { display: none; }
#experience-root .snum {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  flex-shrink: 0; transition: all .3s;
}
#experience-root .step.active .snum { border-color: var(--primary); background: rgba(var(--pr),.15); color: var(--primary); }
#experience-root .step.done   .snum { background: var(--primary); border-color: var(--primary); color: #fff; }
#experience-root .sline { width: 20px; height: 1px; background: var(--border); flex-shrink: 0; }

/* Step data-state: locked */
#experience-root .step[data-state="locked"] .snum {
  border-color: rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.18);
}
#experience-root .step[data-state="locked"] .snum-n { display: none; }
#experience-root .step[data-state="active"]  .snum-lock,
#experience-root .step[data-state="done"]    .snum-lock { display: none; }
#experience-root .step[data-state="locked"] .lbl-ko { color: var(--subtle); }

/* Step sublabels */
#experience-root .slabels { display: flex; flex-direction: column; gap: 1px; }
#experience-root .lbl-ko  { font-size: .78rem; }
#experience-root .lbl-sub { font-size: .58rem; color: var(--subtle); display: none; }
@media (min-width: 480px) {
  #experience-root .step .lbl-ko  { display: inline; }
  #experience-root .step .lbl-sub { display: block; }
}

/* Unlock glow */
#experience-root .card.exp-just-unlocked {
  border-color: rgba(255,0,92,.45);
  box-shadow: 0 0 28px rgba(255,0,92,.12), 0 0 0 1px rgba(255,0,92,.1);
  transition: border-color 1.8s ease, box-shadow 1.8s ease;
}

/* ── 6. Typography ───────────────────────────────────── */
#experience-root .eyebrow,
#community .eyebrow {
  font-family: 'Orbitron', sans-serif;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--muted); margin-bottom: 12px;
}
#experience-root .title,
#community .title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  font-weight: 900; line-height: 1.12; margin-bottom: 12px;
}
#experience-root .badge-p,
#community .badge-p {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  background: rgba(var(--pr),.12); color: var(--primary);
  border: 1px solid rgba(var(--pr),.28);
}
#experience-root .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary);
  animation: pulse-dot 2s ease infinite;
}

/* Progress bar */
#experience-root .prog-bar  { width: 100%; height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; }
#experience-root .prog-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 2px; transition: width .6s ease; }

/* Spinner */
#experience-root .spin {
  width: 34px; height: 34px;
  border: 2.5px solid rgba(var(--pr),.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinning .9s linear infinite;
  flex-shrink: 0;
}

/* Chips */
#experience-root .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#experience-root .chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  font-size: .78rem; color: var(--muted);
  cursor: pointer; transition: all .18s;
  white-space: nowrap; min-height: 36px;
  display: inline-flex; align-items: center;
}
#experience-root .chip:hover,
#experience-root .chip:active {
  border-color: rgba(var(--pr),.45);
  color: var(--primary);
  background: rgba(var(--pr),.08);
}

/* API note */
#experience-root .api-note {
  font-size: .74rem; color: var(--subtle);
  background: rgba(255,200,50,.05);
  border: 1px solid rgba(255,200,50,.14);
  border-radius: 8px; padding: 9px 12px; margin-top: 10px; line-height: 1.5;
}
#experience-root .api-note a { color: var(--primary); }

/* ── 7. 3D Viewer ────────────────────────────────────── */
#experience-root .viewer-wrap {
  position: relative; border-radius: var(--r);
  background: #0b0b0d; border: 1px solid var(--border);
  overflow: hidden; height: 360px;
}
#viewer-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

#experience-root .v-loading {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  background: rgba(9,9,11,.93);
  transition: opacity .4s;
}
#experience-root .v-lbl {
  font-family: 'Orbitron', sans-serif;
  font-size: .72rem; letter-spacing: .05em;
  color: var(--muted); animation: blink 2s ease infinite;
}
#experience-root .v-toolbar {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; align-items: center; gap: 8px;
  z-index: 20; pointer-events: none; flex-wrap: wrap;
}
#experience-root .v-toolbar > * { pointer-events: all; }
#experience-root .wire-toggle {
  display: flex; border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(9,9,11,.75); backdrop-filter: blur(8px);
}
#experience-root .wtb {
  padding: 7px 11px; border: none; background: transparent;
  color: rgba(255,255,255,.4);
  font-size: .65rem; font-weight: 700;
  font-family: 'Orbitron', sans-serif;
  text-transform: uppercase; letter-spacing: .06em;
  cursor: pointer; transition: all .18s;
  min-height: 32px; min-width: 44px;
}
#experience-root .wtb + .wtb { border-left: 1px solid rgba(255,255,255,.1); }
#experience-root .wtb:hover  { color: rgba(255,255,255,.8); background: rgba(255,255,255,.06); }
#experience-root .wtb.active        { background: rgba(var(--ac),.25); color: #a78bff; }
#experience-root .wtb.wire.active   { background: rgba(var(--ac),.35); color: #c4b5fd; }
#experience-root .wtb.grid.active   { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
#experience-root .wtb.rotate.active { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
#experience-root .poly-badge {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 7px;
  background: rgba(9,9,11,.75); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.1);
  font-family: 'Orbitron', sans-serif; font-size: .62rem;
  color: rgba(255,255,255,.45); letter-spacing: .04em;
  white-space: nowrap;
}
#experience-root .poly-badge strong { color: #a78bff; }
#experience-root .poly-num { color: #c4b5fd; font-weight: 700; }
#experience-root .capture-btn {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px; border: none;
  background: rgba(var(--pr),.85); backdrop-filter: blur(8px);
  color: #fff; font-family: 'Orbitron', sans-serif;
  font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; cursor: pointer;
  transition: all .2s; min-height: 32px;
  box-shadow: 0 0 16px rgba(var(--pr),.3);
}
#experience-root .capture-btn:hover:not(:disabled) {
  background: var(--primary); box-shadow: 0 0 24px rgba(var(--pr),.5); transform: scale(1.03);
}
#experience-root .capture-btn:not(:disabled):not(.captured) {
  animation: capture-pulse 2.8s ease infinite;
}
@keyframes capture-pulse {
  0%,100% { box-shadow: 0 0 16px rgba(var(--pr),.35); }
  50%      { box-shadow: 0 0 30px rgba(var(--pr),.75), 0 0 0 5px rgba(var(--pr),.12); }
}
#experience-root .capture-btn.captured { opacity: .45; cursor: not-allowed; box-shadow: none; animation: none; }
#experience-root .capture-btn:disabled { cursor: not-allowed; }
#experience-root .v-hint {
  position: absolute; bottom: 10px; left: 50%;
  transform: translateX(-50%);
  font-size: .65rem; color: var(--subtle);
  background: rgba(0,0,0,.5); padding: 3px 10px;
  border-radius: 999px; pointer-events: none;
  white-space: nowrap; z-index: 5;
}
@keyframes flash-white { 0% { opacity: .9; } 100% { opacity: 0; } }
.capture-flash {
  position: absolute; inset: 0; background: #fff; z-index: 30;
  animation: flash-white .35s ease forwards; pointer-events: none;
}

/* ── 8. Result Grid ──────────────────────────────────── */
#experience-root .result-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }

/* ── 9. Share Buttons ────────────────────────────────── */
#experience-root .sh-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 12px 14px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: rgba(255,255,255,.04); color: var(--text);
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: all .18s; text-decoration: none; min-height: 44px;
}
#experience-root .sh-btn:hover        { background: rgba(255,255,255,.08); border-color: var(--border-hi); transform: translateY(-1px); }
#experience-root .sh-btn.tw:hover     { background: rgba(29,155,240,.12); border-color: rgba(29,155,240,.35); }
#experience-root .sh-btn.lk:hover     { background: rgba(var(--pr),.1);  border-color: rgba(var(--pr),.35); }

/* ── 10. Gallery ─────────────────────────────────────── */
#gallery .g-scroll,
#community .g-scroll {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 10px 0 18px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  cursor: grab;
}
#gallery .g-scroll::-webkit-scrollbar,
#community .g-scroll::-webkit-scrollbar { display: none; }
#gallery .g-scroll.grabbing,
#community .g-scroll.grabbing { cursor: grabbing; }

#gallery .g-card,
#community .g-card {
  flex-shrink: 0; width: 164px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--bg-card); overflow: hidden;
  position: relative; transition: transform .3s, box-shadow .3s;
}
#gallery .g-card:hover,
#community .g-card:hover { transform: translateY(-5px); box-shadow: 0 16px 32px rgba(0,0,0,.45); }
#gallery .g-card.mine,
#community .g-card.mine  { border-color: rgba(var(--pr),.5); box-shadow: 0 0 16px rgba(var(--pr),.12); }

#gallery .g-thumb,
#community .g-thumb {
  width: 100%; height: 196px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
#gallery .g-thumb img,
#community .g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }


#gallery .g-meta,
#community .g-meta { padding: 10px 12px; }
#gallery .g-prompt,
#community .g-prompt {
  font-size: .7rem; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px;
}
#gallery .g-user,
#community .g-user { font-size: .65rem; color: var(--subtle); }
#gallery .g-user em,
#community .g-user em { color: var(--primary); font-style: normal; }

#gallery .g-tag,
#community .g-tag {
  position: absolute; top: 6px; right: 6px;
  background: var(--primary); color: #fff;
  font-family: 'Orbitron', sans-serif; font-size: .52rem; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: .05em;
}

/* Curated label */
#gallery .curated-label {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Orbitron', sans-serif;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--subtle);
}
#gallery .curated-star { color: var(--primary); }
#gallery .curated-pill {
  background: rgba(var(--pr),.1); color: var(--primary);
  border: 1px solid rgba(var(--pr),.25);
  border-radius: 999px; padding: 1px 9px; font-size: .6rem;
}

/* Community grid */
#community .g-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 24px;
}
#community .g-grid .g-card { width: auto; }
#community .g-grid .g-thumb { height: 0; padding-bottom: 100%; position: relative; }
#community .g-grid .g-thumb > * { position: absolute; inset: 0; height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; }
#community .g-grid .g-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

#community .load-more-wrap { display: flex; justify-content: center; padding: 4px 0 16px; }

/* ── 11. Modal ───────────────────────────────────────── */
.modal-wrap {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.78); backdrop-filter: blur(10px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-wrap.open { display: flex; }
.modal-wrap .modal {
  background: #111114; border: 1px solid var(--border);
  border-radius: var(--rxl); padding: 28px;
  max-width: 450px; width: 100%;
  animation: modal-in .25s ease;
  max-height: 90vh; overflow-y: auto;
  box-sizing: border-box;
}
.modal-wrap .modal * { box-sizing: border-box; margin: 0; padding: 0; }
.modal-wrap .modal-hd  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-wrap .modal-ttl { font-family: 'Orbitron', sans-serif; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text); }
.modal-wrap .mclose    {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1.1rem; padding: 6px;
  min-width: 36px; min-height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.modal-wrap .mclose:hover { color: var(--text); }
.modal-wrap .modal-bd { display: flex; flex-direction: column; gap: 0; }
.modal-wrap .col { display: flex; flex-direction: column; }
.modal-wrap .gap2 { gap: 8px; }
.modal-wrap .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; cursor: pointer;
  font-family: 'Orbitron', sans-serif; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  min-height: 44px; padding: 0 22px; width: 100%; margin-bottom: 8px;
  transition: transform .2s, box-shadow .2s;
}
.modal-wrap .btn-p { background: var(--primary); color: #fff; }
.modal-wrap .btn-g { background: rgba(255,255,255,.05); color: var(--text); border: 1px solid var(--border); font-family: 'Inter',sans-serif; font-size: .875rem; font-weight: 500; letter-spacing:0; text-transform:none; }
.modal-wrap .w-full { width: 100%; }

/* ── 12. Toast ───────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #18181b; border: 1px solid rgba(255,255,255,.12);
  color: var(--text); padding: 10px 20px; border-radius: 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .875rem; font-weight: 500; z-index: 9999;
  pointer-events: none; opacity: 0;
  transition: opacity .3s, transform .3s;
  white-space: nowrap; box-shadow: 0 4px 24px rgba(0,0,0,.45);
  max-width: 90vw; box-sizing: border-box;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 13. Utilities (scoped) ──────────────────────────── */
#experience-root .hidden,
#community .hidden { display: none !important; }
#experience-root .col  { display: flex; flex-direction: column; }
#experience-root .row  { display: flex; align-items: center; }
#experience-root .gap2 { gap: 8px; }
#experience-root .gap3 { gap: 12px; }
#experience-root .mt5  { margin-top: 20px; }
#experience-root .w-full,
#community .w-full { width: 100%; }
#experience-root .anim { animation: fade-in .4s ease both; }

/* ── 14. Animations ──────────────────────────────────── */
@keyframes spinning  { to { transform: rotate(360deg); } }
@keyframes blink     { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes modal-in  { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
@keyframes fade-in   { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── 15. Responsive ──────────────────────────────────── */
@media (min-width: 480px) {
  #experience-root .step .lbl { display: inline; }
  #community .g-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 640px) {
  #experience-root .wrap, #community .wrap { padding: 0 24px; }
  #experience-root .card    { padding: 34px; }
  #experience-root .sline   { width: 28px; }
  #experience-root .viewer-wrap { height: 420px; }
  #gallery .g-card, #community .g-card { width: 188px; }
  #gallery .g-thumb { height: 216px; }
}
@media (min-width: 768px) {
  #experience-root .result-grid { grid-template-columns: 1fr 268px; }
  #community .g-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  #community .g-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 479px) {
  #experience-root .v-toolbar  { gap: 5px; }
  #experience-root .wtb        { padding: 6px 8px; min-width: 36px; font-size: .58rem; }
  #experience-root .poly-badge { font-size: .58rem; padding: 4px 7px; }
  #experience-root .capture-btn { padding: 6px 10px; font-size: .6rem; }
}
