/* Packlyn Design Software â€” Plyn, same look as on packlyn.ca */
/* ---------- Plyn (same look as on packlyn.ca) ---------- */
.plw { position: fixed; right: 20px; bottom: 20px; width: 62px; height: 62px; z-index: 700; }
body.view-editor .plw { bottom: 24px; right: 24px; }
.plf { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .2s ease; }
.plf:hover { transform: translateY(-2px) scale(1.06); }
.plf .plyn-face { width: 100%; height: 100%; filter: drop-shadow(0 5px 10px rgba(0,0,0,.3)); pointer-events: none; }
.ikav { position: relative; flex: none; display: block; width: 40px; height: 40px; }
.ikav .plyn-face { width: 40px; height: 40px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.plp { position: fixed; right: 20px; bottom: 96px; width: min(372px, calc(100vw - 40px)); height: min(520px, calc(100vh - 150px)); display: flex; flex-direction: column; background: #fff; color: #1d1d1f; border: 1px solid #d2d2d7; border-radius: 22px; box-shadow: 0 24px 64px rgba(0,0,0,.3); overflow: hidden; z-index: 710; font-size: 14px; user-select: text; }
body.view-editor .plp { bottom: 98px; }
.plh { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; color: #fff; background: radial-gradient(70% 140% at 0 0, rgba(233,185,73,.22), transparent 70%), linear-gradient(135deg, #0d4a37, #062a1f); }
.plh div { flex: 1; min-width: 0; }
.plh strong { display: block; font-size: 16px; line-height: 1.2; }
.plh small { display: block; margin-top: 2px; font-size: 12px; color: rgba(255,255,255,.82); }
.plx { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.plm { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 12px; line-height: 1.5; background: #f5f5f7; }
.plg { position: relative; align-self: flex-start; margin-left: 48px; max-width: calc(94% - 48px); padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: #fff; color: #1d1d1f; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.12)) drop-shadow(0 0 .6px rgba(0,0,0,.25)); transform-origin: 0 100%; animation: plpop .24s ease-out both; }
.plg::after { content: ""; position: absolute; left: -10px; bottom: 8px; width: 12px; height: 14px; background: #fff; clip-path: polygon(100% 0, 100% 100%, 0 66%); }
.plg a { color: #0a5fd0; }
.plg ul { margin: 6px 0; padding-left: 18px; }
.pl-src { display: block; margin-top: 6px; font-size: 11.5px; color: #6e6e73; }
.pl-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pl-acts .chip { border-color: transparent; background: #e4f2ed; color: #0b6e4f; }
.pfc { position: absolute; left: -50px; bottom: -5px; width: 40px; height: 40px; pointer-events: none; }
.pfc .plyn-face { width: 40px; height: 40px; }
.pltd .pl-text { display: flex; gap: 5px; align-items: center; padding: 3px 1px; }
.pltd i { width: 7px; height: 7px; border-radius: 50%; background: #8e8e93; animation: pldot 1.2s infinite; display: block; }
.pltd i:nth-child(2) { animation-delay: .15s; } .pltd i:nth-child(3) { animation-delay: .3s; }
@keyframes plpop { 0% { opacity: 0; transform: scale(.92); } 100% { opacity: 1; transform: none; } }
@keyframes pldot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
.plu { align-self: flex-end; max-width: 84%; padding: 9px 13px; border-radius: 18px 18px 6px 18px; background: #0b6e4f; color: #fff; animation: plpop .2s ease-out both; transform-origin: 100% 100%; }
.pl-chips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px 28px 0 12px; background: #fff; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.pl-chips .chip { white-space: nowrap; background: #fff; color: #33433e; border-color: #d2d2d7; }
.plf2 { flex: none; display: flex; gap: 8px; padding: 10px 12px 12px; background: #fff; }
.pl-in { flex: 1; min-width: 0; padding: 10px 14px; border: 2px solid #0b6e4f; border-radius: 999px; color: #1d1d1f; background: #f5f5f7; }
.pl-in:focus { outline: none; background: #fff; }
.pl-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #0b6e4f; color: #fff; display: grid; place-items: center; }
.pl-send .ico { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) { .plg, .plu, .pltd i { animation: none !important; } .popover, .toast, .modal-back { animation: none; } }

/* Plyn's welcome: three short paragraphs */
.pl-welcome p { margin: 0 0 8px; line-height: 1.5; }
.pl-welcome p:first-child { font-weight: 600; }
.pl-welcome p:last-child { margin-bottom: 0; }

/* ---------- Plyn AI studio (AI Tools page and the Plyn AI window) ---------- */
.ps { display: grid; gap: 14px; }
.ps-page { margin-bottom: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px 24px; box-shadow: var(--sh-1); }
.ps-head { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.ps-face { width: 52px; height: 52px; background: none; }
.ps-head h2 { margin: 0 0 2px; font: 700 20px/1.25 var(--font); color: var(--ink); }
.ps-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 70ch; }
.ps-credits { justify-self: end; align-self: start; font: 600 12px var(--font); color: var(--teal); background: var(--teal-tint); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.ps-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-tab { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font: 600 13px var(--font); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.ps-tab .ico { width: 16px; height: 16px; }
.ps-tab:hover { border-color: var(--line-2); color: var(--ink); }
.ps-tab.on { background: var(--chrome); border-color: var(--chrome); color: #fff; }
.ps-tab.on .ps-cost { color: rgba(255, 255, 255, .7); }
.ps-tab .pro-mini { margin-left: 0; }
.ps-cost { font: 500 11px var(--font); color: var(--muted); }
.ps-form { display: grid; gap: 10px; }
.ps-prompt { width: 100%; resize: vertical; min-height: 76px; font: 500 14px/1.5 var(--font); border-radius: 14px; padding: 12px 14px; }
.ps-fields { display: grid; gap: 10px; }
.ps-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.ps-what { margin: 0; color: var(--muted); font-size: 12.5px; }
.ps-usecol { padding: 8px 0; }
.ps-go-row { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.ps-note { margin: 0 auto 0 0; font-size: 12.5px; color: var(--muted); }
.ps-note.warn { color: var(--warn); font-weight: 600; }
.ps-go { height: 42px; padding: 0 20px; }
.ps-out:empty { display: none; }
.ps-out { display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.ps-busy { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px; border-radius: 16px; background: var(--panel-2); }
.ps-busy b { display: block; font: 700 15px var(--font); color: var(--ink); }
.ps-busy small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ps-busy.small { grid-template-columns: 26px 1fr; padding: 12px; grid-column: 1 / -1; }
.ps-time { font-variant-numeric: tabular-nums; }
.ps-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 9%, var(--panel)); color: var(--ink); font-size: 13px; }
.ps-error > .ico { color: var(--danger); width: 18px; height: 18px; flex: none; }
.ps-error span { flex: 1 1 240px; }
.ps-res-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ps-res-head b { font: 700 15px var(--font); }
.ps-res-head small { color: var(--muted); font-size: 12px; }
.ps-res-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.ps-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-words { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); }
.ps-meta { align-items: center; color: var(--muted); font-size: 12.5px; grid-template-columns: auto auto 1fr; }
.ps-meta .btn { justify-self: end; }
.ps-sw { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 6px; }
.ps-sw i { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.ps-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.ps-copy { display: grid; gap: 6px; }
.ps-copy-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.ps-copy-row > span { flex: 1 1 auto; min-width: 0; font: 500 14px/1.45 var(--font); color: var(--ink); }
.ps-pals { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ps-pal { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.ps-pal small { color: var(--muted); font-size: 12px; min-height: 2.6em; }
.ps-pal .ps-sw { margin: 0; }
.ps-pal-prev { position: relative; display: grid; gap: 2px; height: 96px; padding: 14px; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.ps-pal-prev b { font: 700 15px var(--font); }
.ps-pal-prev span { font-size: 12px; opacity: .85; }
.ps-pal-prev i { position: absolute; bottom: 12px; width: 34px; height: 12px; border-radius: 999px; right: 14px; }
.ps-pal-prev i + i { right: 54px; }
.ps-media { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ps-media-prev { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; aspect-ratio: 1; background: var(--panel-2); }
.ps-media-prev img { max-width: 100%; max-height: 100%; display: block; }
.ps-media-prev.checker { padding: 18px; }
.ps-media-side { display: grid; gap: 12px; align-content: start; }
.ps-modal .modal-body { padding-top: 6px; }
.badge.plyn { background: var(--gold-tint); color: var(--gold-dk); }
@media (max-width: 760px) { .ps-head { grid-template-columns: 44px 1fr; } .ps-credits { grid-column: 1 / -1; justify-self: start; } .ps-media { grid-template-columns: 1fr; } .ps-meta { grid-template-columns: 1fr; } }
:root[data-theme="dark"] .ps-tab.on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }

/* Plyn in the dark theme: the same panel, in the app's dark surfaces */
:root[data-theme="dark"] .plp { background: var(--panel); color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .plm { background: var(--bg); }
:root[data-theme="dark"] .plg, :root[data-theme="dark"] .plg::after { background: var(--panel-3); color: var(--ink); }
:root[data-theme="dark"] .plg a { color: #7fb8ff; }
:root[data-theme="dark"] .pl-src { color: var(--muted); }
:root[data-theme="dark"] .pl-chips, :root[data-theme="dark"] .plf2 { background: var(--panel); }
:root[data-theme="dark"] .pl-chips .chip { background: var(--panel-2); color: var(--ink-2); border-color: var(--line-2); }
:root[data-theme="dark"] .pl-in { background: var(--panel-2); color: var(--ink); border-color: var(--teal-2); }
:root[data-theme="dark"] .pl-in:focus { background: var(--panel-3); }
:root[data-theme="dark"] .pl-acts .chip { background: color-mix(in srgb, var(--teal-2) 22%, transparent); color: #9fe3cf; }

/* ---------- Plyn's face (js/04e-plyn-face.js): exactly the packlyn.ca character, nothing placed behind him ---------- */
.plyn-face { display: inline-block; flex: none; width: 40px; height: 40px; line-height: 0; vertical-align: middle; background: none; }
.plyn-face svg { width: 100%; height: 100%; display: block; overflow: visible; }
.plyn-face .pf-eye, .plyn-face .pf-brow, .plyn-face .pf-m-smile { transform-box: view-box; } /* each part's centre is set on the element */
.plyn-face .pf-look { transform: translate(var(--pf-lx, 0px), var(--pf-ly, 0px)); transition: transform .38s ease; }
.plyn-face .pf-brow, .plyn-face .pf-eye, .plyn-face .pf-m-smile { transition: transform .3s ease; }
.plyn-face.pf-blink .pf-eye { animation: pfBlink .17s ease-in-out; }
@keyframes pfBlink { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.1); } }
.plyn-face .pf-m-calm { display: none; }
.plyn-face .pf-glow { opacity: 0; }
/* listening: eyebrows lift a little, eyes open a touch wider */
.plyn-face[data-state="listening"] .pf-brow { transform: translateY(-1.8px); }
.plyn-face[data-state="listening"] .pf-eye { transform: scale(1.04); }
/* thinking: one eyebrow up, eyes look up, the antenna glows */
.plyn-face[data-state="thinking"] .pf-brow-l { transform: translateY(-2.4px) rotate(-6deg); }
.plyn-face[data-state="thinking"] .pf-brow-r { transform: translateY(-.8px); }
.plyn-face[data-state="thinking"] .pf-glow { animation: pfGlow 1.6s ease-in-out infinite; }
@keyframes pfGlow { 0%, 100% { opacity: .15; } 50% { opacity: .85; } }
/* responding: talking */
.plyn-face[data-state="responding"] .pf-m-smile { animation: pfTalk .3s ease-in-out infinite alternate; }
@keyframes pfTalk { from { transform: scaleY(.72); } to { transform: scaleY(1.06); } }
/* success: a wider smile and happy eyebrows */
.plyn-face[data-state="success"] .pf-m-smile { transform: scale(1.12, 1.18); }
.plyn-face[data-state="success"] .pf-brow { transform: translateY(-2px); }
.plyn-face[data-state="success"] .pf-eye { transform: scaleY(.92); }
/* error: calm and neutral, never sad */
.plyn-face[data-state="error"] .pf-m-smile { display: none; }
.plyn-face[data-state="error"] .pf-m-calm { display: inline; }
.plyn-face[data-state="error"] .pf-brow { transform: translateY(.8px); }
@media (prefers-reduced-motion: reduce) { .plyn-face *, .plyn-face.pf-blink .pf-eye { animation: none !important; transition: none !important; } }

/* Plyn AI Markdown formatting */
.plg .pl-text { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; overflow-wrap: anywhere; }
.plg .pl-text > :first-child { margin-top: 0; }
.plg .pl-text > :last-child { margin-bottom: 0; }
.plg .pl-text p { margin: 0 0 9px; }
.plg .pl-text h1,
.plg .pl-text h2,
.plg .pl-text h3,
.plg .pl-text h4 { margin: 12px 0 6px; font-size: 1em; font-weight: 700; line-height: 1.35; }
.plg .pl-text ul,
.plg .pl-text ol { margin: 6px 0 10px; padding-left: 20px; }
.plg .pl-text li { margin: 3px 0; }
.plg .pl-text li > p { margin: 0; }
.plg .pl-text table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 10px 0; font-size: 12px; }
.plg .pl-text th,
.plg .pl-text td { border: 1px solid #d8dce0; padding: 7px 9px; text-align: left; vertical-align: top; }
.plg .pl-text th { background: #f0f4f2; font-weight: 700; }
.plg .pl-text code { font-size: .9em; overflow-wrap: anywhere; }
.plg .pl-text pre { max-width: 100%; overflow-x: auto; padding: 10px; border-radius: 8px; background: #f0f4f2; }
.plg .pl-text pre code { overflow-wrap: normal; }
.plg .pl-text blockquote { margin: 8px 0; padding-left: 10px; border-left: 3px solid #0b6e4f; }
.plg .pl-text hr { border: 0; border-top: 1px solid #d8dce0; margin: 12px 0; }
:root[data-theme="dark"] .plg .pl-text th,
:root[data-theme="dark"] .plg .pl-text pre { background: var(--panel-2); }
:root[data-theme="dark"] .plg .pl-text th,
:root[data-theme="dark"] .plg .pl-text td { border-color: var(--line-2); }
:root[data-theme="dark"] .plg .pl-text hr { border-top-color: var(--line-2); }

/* Plyn AI readable Markdown improvements */
.plg .pl-text strong,
.plg .pl-text b { font-weight: 800; }
.plg .pl-text table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  overflow-wrap: normal;
  word-break: normal;
}
.plg .pl-text th,
.plg .pl-text td {
  min-width: 115px;
  max-width: 240px;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}
.plg .pl-text th:first-child,
.plg .pl-text td:first-child { min-width: 75px; }
.plg .pl-text h1,
.plg .pl-text h2,
.plg .pl-text h3 { font-weight: 800; }
/* Plyn AI table layout refinement */
.plg .pl-text table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  table-layout: auto;
}
.plg .pl-text th,
.plg .pl-text td {
  min-width: 160px;
  max-width: none;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
.plg .pl-text th:first-child,
.plg .pl-text td:first-child {
  min-width: 65px;
  width: 65px;
}
/* Plyn AI natural table row sizing */
.plg .pl-text table {
  display: table;
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
  overflow: visible;
  border-collapse: collapse;
}
.plg .pl-text th,
.plg .pl-text td {
  height: auto;
  min-height: 0;
  vertical-align: top;
}
/* Plyn AI visible horizontal scrollbar */
.plg .pl-text {
  scrollbar-width: thin;
  scrollbar-color: #8a9e98 #edf2f0;
}
.plg .pl-text::-webkit-scrollbar {
  height: 9px;
}
.plg .pl-text::-webkit-scrollbar-track {
  background: #edf2f0;
  border-radius: 10px;
}
.plg .pl-text::-webkit-scrollbar-thumb {
  background: #8a9e98;
  border-radius: 10px;
  border: 2px solid #edf2f0;
}
.plg .pl-text::-webkit-scrollbar-thumb:hover {
  background: #526f65;
}
/* Plyn AI final table scrolling fix */
.plg .pl-text {
  min-width: 0;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  overflow-wrap: anywhere;
}

.plg .pl-text::-webkit-scrollbar {
  display: none;
}

.plg .pl-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #8a9e98 #edf2f0;
  margin: 10px 0;
}

.plg .pl-table-wrap::-webkit-scrollbar {
  height: 9px;
}

.plg .pl-table-wrap::-webkit-scrollbar-track {
  background: #edf2f0;
  border-radius: 10px;
}

.plg .pl-table-wrap::-webkit-scrollbar-thumb {
  background: #8a9e98;
  border-radius: 10px;
  border: 2px solid #edf2f0;
}

.plg .pl-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #526f65;
}

.plg .pl-table-wrap table {
  display: table;
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
  border-collapse: collapse;
  margin: 0;
}

.plg .pl-table-wrap th,
.plg .pl-table-wrap td {
  min-width: 120px;
  max-width: none;
  height: auto;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  vertical-align: top;
}

.plg .pl-table-wrap th:first-child,
.plg .pl-table-wrap td:first-child {
  min-width: 65px;
  width: 65px;
}