/* Scoped copy of the local app's style.css (app/static/css/style.css) for
   embedding inside a real WordPress page/theme instead of owning the whole
   document: every selector is prefixed under .snk-app-root instead of using
   bare html/body/#id rules, so nothing here can leak into or collide with
   the site's theme or other plugins.

   Every `rem` from the original has been converted to its px equivalent
   (assuming the standard 16px root, what the local app was actually tuned
   against) and every text-ish form control got an explicit `line-height` -
   both were previously silently inherited from the *host page's* root
   font-size/line-height, which a real WordPress theme controls, not us
   (unlike the local app's own nearly-bare page). Two real, reported bugs
   traced to exactly this: input fields rendering visibly taller than the
   local app's, and a label ("מידת אקסטרוד השם") wrapping that doesn't
   wrap in the local app. Every other value is unchanged from the original. */

.snk-app-root {
  --bg:          #0d1117;
  --panel:       #12161e;
  --card:        #161b24;
  --line:        rgba(255,255,255,.14);
  --text:        #e8ecf2;
  --muted:       #98a2b3;
  --accent:      #dca24a;
  --accent-soft: #d3a05a;
  --accent2:     #2f86ff;
  --ok:          #33bd6b;
  --input:       #10151d;

  display: block;
  font-size: 16px; /* fixed baseline every px value below was computed against */
  /* height is set inline per-instance by templates/app-root.php, from the
     shortcode's `height` attribute (SNK_Shortcode::DEFAULT_HEIGHT if
     omitted) - nothing to declare here, and no fallback needed since that
     inline style is always present whenever this class is used for the
     logged-in app view. */
  background: var(--bg); color: var(--text);
  font-family: "Rubik", "Segoe UI", system-ui, sans-serif;
  direction: rtl;
}
.snk-app-root * { box-sizing: border-box; }
.snk-app-root [hidden] { display: none !important; }

.snk-app-root #app   { display: flex; flex-direction: column; height: 100%; }
.snk-app-root #topbar{ flex-shrink: 0; background: var(--panel);
         border-bottom: 1px solid var(--line); padding: 12px 22px; }
.snk-app-root #topbar h1 { font-size: 20.8px; font-weight: 800; color: var(--accent);
             letter-spacing: .3px; margin: 0 0 2px; font-family: inherit !important; }
.snk-app-root #topbar .subtitle { font-size: 13.6px; font-weight: 400; color: var(--muted); }
.snk-app-root #main  { display: flex; flex: 1; min-height: 0; }

.snk-app-root #viewport { position: relative; flex: 1; min-width: 0; background: #05070a; }
.snk-app-root #three-canvas { display: block; width: 100%; height: 100%; }
.snk-app-root #panel    { width: 380px; flex-shrink: 0; background: var(--panel);
            border-left: 1px solid var(--line); overflow-y: auto; padding: 12px 14px; }
.snk-app-root #mobileNotice { display: none; }

/* card */
.snk-app-root .card   { background: var(--card); border: 1px solid var(--line);
          border-radius: 11px; padding: 9px 12px; margin-bottom: 6px; }
.snk-app-root .card h2{ font-size: 15.2px; color: var(--accent); margin: 0 0 6px;
          font-weight: 700; letter-spacing: .2px; font-family: inherit !important; }
.snk-app-root .card.locked        { opacity: .5; pointer-events: none; }
.snk-app-root .card.locked h2     { color: var(--muted); }

/* accordion: cards 3/4/5 (מידות/מסגרת/טבעת) - collapsed by default, only one
   open at a time (see main.js initAccordion). A locked card's toggle is
   inert for free: .card.locked already sets pointer-events:none on the
   whole card, the h2 included, and gets its normal dimmed look - no extra
   "disabled toggle" styling needed on top of that. */
.snk-app-root .card.accordion h2.accordion-toggle {
  margin: 0; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
}
.snk-app-root .card.accordion h2.accordion-toggle::after {
  content: "▾"; font-size: 12px; color: var(--muted); transition: transform .15s ease; margin-inline-start: 8px;
}
.snk-app-root .card.accordion.open h2.accordion-toggle::after { transform: rotate(180deg); }
.snk-app-root .card.accordion .card-body { margin-top: 10px; }

/* buttons */
.snk-app-root button.primary {
  background: var(--accent-soft); color: #201603; border: none;
  border-radius: 9px; padding: 11px; font-weight: 700; font-size: 14.72px;
  cursor: pointer; width: 100%; margin-bottom: 6px;
}
.snk-app-root button.primary:hover    { filter: brightness(1.06); }
.snk-app-root button.primary:disabled { opacity: .45; cursor: not-allowed; }
.snk-app-root button.primary.alt { background: var(--ok); color: #fff; }

.snk-app-root button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 7px 10px; font-size: 13.12px; cursor: pointer; width: 100%;
}
.snk-app-root button.ghost:hover { color: var(--text); border-color: var(--accent2); }
.snk-app-root button.ghost:disabled { opacity: .4; cursor: not-allowed; }

/* amber-outlined variant, e.g. "reset" actions */
.snk-app-root button.ghost.accent {
  border: 1.5px solid var(--accent); color: var(--accent);
  font-weight: 700; padding: 10px; margin-bottom: 6px;
}
.snk-app-root button.ghost.accent:hover:not(:disabled) { background: rgba(220,162,74,.1); border-color: var(--accent); color: var(--accent); }

/* download button price/credit-icon readout */
.snk-app-root .snk-price { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 6px; }
.snk-app-root .snk-price img { width: 16px; height: 16px; display: inline-block; }

/* fields */
.snk-app-root label { display: block; font-size: 11.2px; color: var(--muted); margin-bottom: 3px; }
.snk-app-root .field-row { margin-bottom: 8px; }
.snk-app-root .field-row-2 { display: flex; gap: 8px; margin-bottom: 8px; }
.snk-app-root .field-row-2 .field { flex: 1; }
.snk-app-root .checkbox-row { display: flex; align-items: center; gap: 6px; font-size: 13.12px; color: var(--text); }
.snk-app-root .radio-row    { display: flex; gap: 18px; }
.snk-app-root .radio-option { display: flex; align-items: center; gap: 6px; font-size: 13.6px; color: var(--text); cursor: pointer; }

.snk-app-root .select {
  width: 100%; background: var(--input); border: 1px solid var(--line);
  color: var(--text); border-radius: 9px; font-size: 14.4px;
  /* same "must not inherit theme sizing" reasoning as the inputs below */
  height: 39px !important;
  padding: 0 12px !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%238a93a6' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: left 12px center;
}
.snk-app-root .select:hover, .snk-app-root .select:focus { border-color: var(--accent); outline: none; }

/* Custom shape picker (card 2): a native <select> can't show a per-option
   hover preview image (the open dropdown is OS-rendered, not reachable from
   the page), so this replaces its visible UI with a plain div-based listbox
   while the real <select id="shape-select"> stays in the DOM (just hidden)
   as the single source of truth for `.value` and the "change" event -
   everything elsewhere that reads/listens to it keeps working unchanged. */
.snk-app-root .shape-combo { position: relative; }
.snk-app-root .shape-combo-btn { text-align: right; }
.snk-app-root .shape-combo-panel {
  position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; left: 0;
  max-height: 260px; overflow-y: auto;
  background: var(--input); border: 1px solid var(--line); border-radius: 9px;
  padding: 4px; box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.snk-app-root .shape-combo-row {
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 12.8px;
}
.snk-app-root .shape-combo-row:hover, .snk-app-root .shape-combo-row.highlighted { background: rgba(220,162,74,.15); color: var(--accent); }
.snk-app-root .shape-preview-box {
  position: fixed; z-index: 50; width: 140px; height: 140px; box-sizing: border-box;
  background: #f4f1ea; border-radius: 10px; border: 1px solid rgba(0,0,0,.15);
  box-shadow: 0 10px 24px rgba(0,0,0,.45); padding: 12px;
  display: flex; align-items: center; justify-content: center;
}
.snk-app-root .shape-preview-box svg { width: 100%; height: 100%; }

.snk-app-root input[type=number], .snk-app-root input[type=file], .snk-app-root input[type=text] {
  width: 100%; background: var(--input); border: 1px solid var(--line);
  color: var(--text); border-radius: 7px; font-size: 13.6px;
  /* Explicit height (not just padding+line-height) so this is completely
     immune to the host theme's own `input` rules, which can otherwise beat
     these on specificity/source order and inflate the field regardless of
     the font-size/line-height fix - !important is deliberate here, the one
     place in this stylesheet it's actually warranted: an embedded widget's
     form controls must not inherit a size decided by a page it doesn't own. */
  height: 31px !important;
  padding: 0 7px !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}
.snk-app-root input[type=number]:focus, .snk-app-root input[type=text]:focus { outline: none; border-color: var(--accent); }
.snk-app-root input[type=checkbox] { accent-color: var(--accent2); width: 15px; height: 15px; }
.snk-app-root input[type=radio]    { accent-color: var(--accent2); width: 15px; height: 15px; cursor: pointer; }
.snk-app-root input[type=range]    { accent-color: var(--accent); width: 100%; }

.snk-app-root .readout { background: var(--input); border: 1px solid var(--line); border-radius: 7px;
           padding: 7px; font-size: 13.6px; color: var(--muted); }

.snk-app-root .info { font-size: 11.52px; color: var(--muted); line-height: 1.45; margin-top: 4px; }

/* spinner */
.snk-app-root .spinner { position: absolute; inset: 0; display: flex; flex-direction: column;
           align-items: center; justify-content: center; gap: 14px;
           background: rgba(16,19,26,.6); color: var(--text); z-index: 5; }
.snk-app-root .spin    { width: 44px; height: 44px; border: 4px solid var(--line);
           border-top-color: var(--accent); border-radius: 50%;
           animation: snk-spin 1s linear infinite; }
@keyframes snk-spin { to { transform: rotate(360deg); } }

/* full-width dimensions readout, one line, house style shared across apps */
.snk-app-root .dims-readout { position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
                 background: var(--panel); border-top: 1px solid var(--line);
                 text-align: center; font-size: 14.4px; font-weight: 600;
                 color: var(--accent); padding: 10px 16px; letter-spacing: .2px; }

.snk-app-root .banner { position: absolute; left: 0; right: 0; z-index: 4;
          background: linear-gradient(180deg, #3a2c0c, #2c2109);
          color: var(--accent); border-top: 1px solid rgba(220,162,74,.5);
          text-align: center; font-size: 14.4px; font-weight: 600;
          padding: 9px 16px; pointer-events: none; }
/* sits just above the dims readout when both are visible, flush to the bottom otherwise */
.snk-app-root .banner { bottom: 0; }
.snk-app-root .dims-readout:not([hidden]) ~ .banner { bottom: 41px; }

/* view-tools: the floating top-left camera/guide toolbar over the 3D canvas
   (per VIEW-TOOLS-BUTTONS.md) - #viewport above is already position:relative. */
.snk-app-root #view-tools {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 6px; z-index: 4;
}
.snk-app-root #view-tools button {
  background: rgba(30,36,48,.8); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 13.12px; line-height: 1.2; cursor: pointer;
}
.snk-app-root #view-tools button:hover { border-color: var(--accent2); }

/* "guide" link - styled as a button, brand-colored so it reads as a
   call-to-action; data-driven (see main.js initGuideButton) - hidden
   entirely when no guide URL is configured. It's an <a>, not a <button>, so
   unlike the two view buttons above it isn't exempt from the surrounding
   WordPress theme's own line-height - without an explicit line-height here
   matching the view buttons', an inherited value bigger than ~1.2 (common
   for theme body text) makes this one visibly taller than its neighbors. */
.snk-app-root .guide-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #201603; font-weight: 700;
  font-family: inherit; border: 1px solid var(--accent-soft);
  border-radius: 8px; padding: 6px 18px; font-size: 13.12px; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.snk-app-root .guide-btn:hover { filter: brightness(1.06); }
/* critical: lets JS hide the link via the `hidden` attribute - without
   this, the inline-flex display above would win over [hidden]'s default. */
.snk-app-root .guide-btn[hidden] { display: none; }

/* Login gate uses the self-contained snk-login-note styles printed inline
   by SNK_Shortcode::login_note() (login-note-snippet.md) - nothing needed
   here, deliberately, so it renders identically regardless of this
   stylesheet's own state. */

/* msgbox */
.snk-app-root .msgbox { position: fixed; inset: 0; z-index: 9999; display: flex;
          align-items: center; justify-content: center; padding: 20px;
          background: rgba(8,11,20,.66); }
.snk-app-root .msgbox[hidden] { display: none; }
.snk-app-root .msgbox-card {
  width: min(430px,100%); text-align: center; direction: rtl;
  background: #1e2438; border: 1px solid #2b3350; border-top: 4px solid #ff5c72;
  border-radius: 16px; padding: 26px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  animation: snk-pop .16s ease-out;
}
.snk-app-root .msgbox-icon  { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.snk-app-root .msgbox-title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: #e7eaf3; font-family: inherit !important; }
.snk-app-root .msgbox-msg   { margin: 0 0 20px; font-size: 14px; line-height: 1.65; color: #9aa3bd; }
.snk-app-root .msgbox-btn   { min-width: 130px; padding: 10px 18px; border-radius: 10px; border: none;
                font-weight: 700; font-size: 14px; color: #fff; cursor: pointer;
                background: linear-gradient(90deg, #5b8cff, #7c5cff); }
@keyframes snk-pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .snk-app-root .msgbox-card { animation: none; } }

/* Mobile layout (<=768px): #main flips from a row (viewport | panel) to a
   column (viewport on top, panel below) - the 3D view keeps a fixed-height
   "slice" of the screen instead of fighting the panel for space, and the
   panel takes the rest and scrolls internally (already has overflow-y:
   auto). Deliberately placed as the LAST rules in this file: #main/
   #viewport/#panel above are the same specificity as these (an extra
   .snk-app-root class on both sides doesn't change that they tie), so with
   an unconditional rule and a media-query rule tied on specificity, source
   order decides - putting this block last is what makes it actually win on
   a real phone. See MOBILE-RESPONSIVE-GUIDE.md section 3.1 (ported from the
   local app - same fix, same file-order reasoning). */
@media (max-width: 768px) {
  .snk-app-root #main { flex-direction: column; }
  /* #panel comes first in the DOM (it's the right-hand side of the desktop
     RTL row) - order:-1 puts #viewport visually first/on top without
     touching markup. */
  .snk-app-root #viewport { order: -1; flex: 0 0 42vh; min-height: 220px; }
  .snk-app-root #panel { width: 100%; flex: 1; min-height: 0; }
  /* Full brand-color background (not just colored text) so it actually
     reads as a prominent notice, matching button.primary's look. */
  .snk-app-root #mobileNotice {
    display: block; text-align: center; font-weight: 700; font-size: 13px;
    background: var(--accent-soft); color: #201603;
    border-radius: 9px; padding: 8px 10px; margin-bottom: 8px;
  }
}
