/* Rawasheen 3D studio — extends app.css tokens (light/dark). */
.studio__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
.studio__lede { color: var(--ink-2); margin: 0; max-width: 62ch; font-size: 15.5px; }
.studio__grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 18px; align-items: start; }
.stage { position: relative; height: clamp(480px, 74vh, 800px); border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 55% 35%, var(--surface) 0%, var(--paper) 62%, var(--stone) 140%); box-shadow: var(--shadow); }
.stage__canvas { position: absolute; inset: 0; }
.r3d-canvas { display: block; touch-action: none; outline: none; }
.r3d-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.stage__loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.stage__hint { position: absolute; top: 12px; inset-inline-start: 12px; font-size: 12.5px; color: var(--ink-2); background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; backdrop-filter: blur(6px); pointer-events: none; max-width: calc(100% - 24px); }
.stage__tip { position: absolute; transform: translate(-50%, -100%); background: var(--ink); color: var(--paper); font-size: 13px; padding: 4px 10px; border-radius: 6px;
  pointer-events: none; white-space: nowrap; z-index: 4; }
.stage__note { position: absolute; top: 48px; inset-inline-start: 12px; font-size: 12px; color: var(--ink-2); background: var(--warn-soft); border: 1px solid var(--warn);
  border-radius: 8px; padding: 5px 10px; max-width: 340px; }
.stage__toolbar { position: absolute; inset-inline: 10px; bottom: 10px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.stage__toolbar.is-off .tool:disabled { display: none; }
.tools { display: flex; gap: 4px; align-items: center; background: color-mix(in srgb, var(--surface) 86%, transparent); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px; backdrop-filter: blur(8px); pointer-events: auto; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tools__sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 4px; }
.tool { border: 0; background: transparent; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.tool:hover { background: var(--stone); color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-line); }
.tool--primary { background: var(--ink); color: var(--paper); }
.tool--primary:hover { background: var(--accent-ink); color: var(--paper); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.stage__tour { position: absolute; bottom: 64px; inset-inline-end: 12px; width: min(360px, calc(100% - 24px)); background: var(--raised); border: 1px solid var(--accent-line);
  border-inline-start: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 28px rgba(30,20,10,.16); z-index: 5; }
.tour__k { font-size: 12px; color: var(--accent-ink); font-weight: 650; }
.tour__t { font-size: 17px; font-weight: 700; margin: 2px 0; }
.tour__p { margin: 4px 0 10px; font-size: 14.5px; color: var(--ink-2); }
.tour__nav { display: flex; gap: 6px; align-items: center; }
.tour__skip { margin-inline-start: auto; }
.tour__dots { display: flex; gap: 4px; margin-top: 10px; }
.tour__dots span { width: 18px; height: 3px; border-radius: 2px; background: var(--line-2); }
.tour__dots span.on { background: var(--accent); }
.fallback { position: absolute; inset: 0; overflow: auto; padding: 18px; display: grid; gap: 8px; align-content: start; }
.fallback > strong { font-size: 16px; } .fallback p { margin: 0; color: var(--ink-2); font-size: 14px; }
.fallback .diagram { max-width: 520px; }

/* panel */
.p3d { position: sticky; top: 72px; max-height: clamp(480px, 74vh, 800px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 16px 18px; box-shadow: var(--shadow); }
.p3d__sec + .p3d__sec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.p3d__h { font-size: 15px; margin: 0; font-weight: 700; }
.p3d__sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 10px; }
.pgroup { margin-bottom: 10px; }
.pgroup__t { font-size: 12.5px; color: var(--muted); font-weight: 650; margin-bottom: 5px; }
.pgroup__list { display: flex; flex-wrap: wrap; gap: 5px; }
.pbtn { border: 1px solid var(--line-2); background: var(--raised); border-radius: 999px; padding: 3px 11px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.pbtn:hover, .pbtn:focus-visible { border-color: var(--accent); }
.pbtn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pbtn--ctx { border-style: dashed; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font-size: inherit; font-weight: inherit; text-decoration: underline; text-underline-offset: 3px; }
.lenslist { display: grid; gap: 6px; }
.lbtn { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: right; border: 1px solid var(--line); background: var(--raised); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.lbtn:hover, .lbtn:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.lbtn__go { color: var(--accent-ink); }
.p3d__legend .legrow { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin: 4px 0; }
.p3d__back { font-size: 13px; margin-bottom: 10px; display: inline-block; }
.p3d__eyebrow { font-size: 12.5px; color: var(--muted); font-weight: 650; }
.p3d__title { font-size: 22px; margin: 2px 0 6px; font-weight: 700; line-height: 1.35; }
.p3d__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.p3d__en { font-size: 12.5px; color: var(--muted); direction: ltr; unicode-bidi: isolate; }
.p3d__gloss { font-size: 15.5px; line-height: 1.8; margin: 6px 0 10px; }
.p3d__fn, .p3d__rel, .p3d__src { display: grid; gap: 4px; margin: 10px 0; font-size: 14px; }
.p3d__k { font-size: 12px; color: var(--muted); font-weight: 700; }
.p3d__note { font-size: 13px; background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.p3d__note strong { color: var(--warn); }
.p3d__geo { margin: 8px 0; font-size: 13px; }
.p3d__geo summary { cursor: pointer; color: var(--muted); }
.geo { width: 100%; border-collapse: collapse; margin-top: 6px; }
.geo th, .geo td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.geo th { color: var(--muted); font-weight: 600; width: 34%; }
.geo--source { color: var(--ok); } .geo--assumed { color: var(--warn); }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qlist li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--raised); }
.qlist__k { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.qlist__q { margin: 0 0 4px; font-size: 13.5px; line-height: 1.75; }
.qlist__n { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ev { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 1px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.ev--general { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 9%, transparent); }
.ev--mixed { color: var(--timber); border-color: var(--timber-line); background: var(--timber-soft); }
.ev--jeddah-only { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.ev--illustrative { color: var(--muted); border-style: dotted; border-color: var(--line-2); }
.bt--jeddah-pilot { background: var(--warn-soft); color: var(--warn); }
.zonekey { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.zk { border: 0; border-radius: 6px; padding: 3px 10px; font-size: 13px; font-weight: 650; cursor: pointer; color: #fff; }
.zk--crown { background: #7e63a0; } .zk--body { background: #6e4b33; } .zk--base { background: #a86b2c; }
.studio__model-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; line-height: 1.7; }
.studio__links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 1000px) {
  .studio__grid { grid-template-columns: 1fr; }
  .stage { height: clamp(380px, 64vh, 640px); }
  .p3d { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .studio__head { display: block; }
  .stage { height: 62vh; min-height: 360px; border-radius: 12px; }
  .stage__hint { font-size: 11.5px; top: 8px; inset-inline-start: 8px; }
  .stage__toolbar { inset-inline: 6px; bottom: 6px; gap: 4px; }
  .tools { flex-wrap: wrap; justify-content: center; border-radius: 14px; }
  .tool { padding: 5px 9px; font-size: 12.5px; }
  .stage__tour { bottom: auto; top: 44px; }
}
@media (prefers-reduced-motion: reduce) { .stage__tour { transition: none; } }
