/* === AI-Skills sidebar base ===================================== */

.ai-skill-side.ps-widget {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 6px 0 0 !important;
}

.ai-skill-side {
  position: fixed;
  right: 18px;
  top: 86px;
  width: 320px;
  max-width: 32vw;
  z-index: 1200;
  pointer-events: auto;
}

.ai-skill-side__inner {
  background: radial-gradient(circle at top left, #1c1033 0, #05030b 55%, #030208 100%);
  border-radius: 18px;
  padding: 12px 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.85);
  color: #f5f1ff;
  font-family: inherit;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* no horizontal scroll in sidebar */
}

/* mobile: drop into normal flow */
@media (max-width: 980px) {
  .ai-skill-side {
    position: static;
    width: auto;
    max-width: 640px;
    margin: 18px auto 26px !important;
  }
}

/* === Header + profile =========================================== */

.ai-skill-side__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ai-skill-side__header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-skill-side__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 10%, #ffdeff 0, #b261ff 40%, #5c2aff 100%);
  box-shadow: 0 0 18px rgba(173, 110, 255, 0.8);
  font-size: 14px;
}

.ai-skill-side__icon i {
  color: #13061b;
}

.ai-skill-side__title {
  font-size: 15px;
  font-weight: 700;
}

/* expand / shrink toggle */

.ai-skill-side__expand-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 8, 60, 0.95);
  color: #ece6ff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.ai-skill-side__expand-btn i {
  font-size: 11px;
}

.ai-skill-side__expand-btn:hover {
  background: linear-gradient(135deg, #5a2fff, #b44cff);
  color: #fff;
}

/* profile row */

.ai-skill-side__profile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.ai-skill-side__avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(182, 141, 255, 0.45);
  flex-shrink: 0;
}

.ai-skill-side__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-skill-side__user {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-skill-side__display-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.ai-skill-side__username {
  font-size: 12px;
  color: #a99fd2;
}

/* Bio row:
   - hidden in shrunk mode
   - visible only in expanded
   - editable for owner
*/

.ai-skill-side__bio-row {
  display: none;
  margin-top: 6px;
}

/* shrunk: no bio, ever */
.ai-skill-side:not(.ai-skill-side--expanded) .ai-skill-side__bio-row {
  display: none !important;
}

/* textarea for owner */

.ai-skill-side__bio-input {
  width: 100%;
  min-height: 64px;
  max-height: 140px;
  resize: vertical;
  border-radius: 12px;
  border: 1px dashed rgba(235, 158, 255, 0.65);
  background: rgba(5, 3, 20, 0.85);
  color: #f5f1ff;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.4;
}

.ai-skill-side__bio-input::placeholder {
  color: #b8aee5;
}

.ai-skill-side__bio-input:focus {
  outline: none;
  border-style: solid;
  border-color: #a469ff;
}

.ai-skill-side__bio-save {
  flex-shrink: 0;
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #3f8bff, #9b5bff);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.ai-skill-side__bio-save:hover {
  filter: brightness(1.08);
}

/* read-only bio for visitors */
.ai-skill-side__bio-view {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 3, 20, 0.85);
  color: #f5f1ff;
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* visitor mode: no textarea, no save */
.ai-skill-side--readonly .ai-skill-side__bio-input,
.ai-skill-side--readonly .ai-skill-side__bio-save {
  display: none !important;
}

.ai-skill-side--readonly .ai-skill-side__bio-view {
  display: block;
}

/* mobile tweak: avatar slightly smaller */
@media (max-width: 640px) {
  .ai-skill-side__avatar-wrap {
    width: 64px;
    height: 64px;
  }
}

/* === Add skill button ========================================== */

.ai-skill-add {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 4px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #3515ff, #9f3bff);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.ai-skill-add__pulse {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 1px solid rgba(171, 122, 255, 0.35);
  opacity: 0.5;
  pointer-events: none;
}

/* === New skill chooser ========================================= */

.ai-skill-new {
  background: rgba(4, 2, 15, 0.9);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px;
  margin-bottom: 10px;
}

.ai-skill-new__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.ai-skill-new__choice {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 6, 28, 0.9);
  color: #e8e3ff;
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
}

.ai-skill-new__choice--active {
  background: linear-gradient(135deg, #4d1dff, #b76aff);
  color: #fff;
}

.ai-skill-new__custom {
  margin-bottom: 8px;
}

.ai-skill-new__input {
  width: 100%;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #050312;
  color: #f5f1ff;
  padding: 6px 8px;
  font-size: 13px;
}

.ai-skill-new__input:focus {
  outline: none;
  border-color: #7a52ff;
}

.ai-skill-new__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.ai-skill-new__confirm,
.ai-skill-new__cancel {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ai-skill-new__confirm {
  background: #7b3bff;
  color: #fff;
}

.ai-skill-new__cancel {
  background: rgba(10, 7, 26, 0.9);
  color: #ddd;
}

/* === Skill cards =============================================== */

.ai-skill-side__body {
}

.ai-skill-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

.ai-skill-empty {
  font-size: 12px;
  color: #b7b1d7;
  padding: 4px 2px 0;
}

.ai-skill-card {
  background: radial-gradient(circle at top, #151023 0, #07030f 55%, #020108 100%);
  border-radius: 12px;
  padding: 7px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.ai-skill-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-skill-card__label {
  font-size: 13px;
  font-weight: 600;
}

.ai-skill-remove {
  border: 0;
  background: transparent;
  color: #9f8bd6;
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

/* === Links list (each row) ===================================== */

.ai-skill-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.ai-skill-links--empty {
  font-size: 12px;
  color: #9188ba;
}

.ai-skill-links__hint {
  opacity: 0.9;
}

/* each link tile: separated field */

.ai-skill-link {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  position: relative;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(10, 6, 28, 0.9);
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out, border-color 0.16s ease-out, background 0.16s ease-out;
}

.ai-skill-link:hover {
  transform: translateX(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75);
  border-color: rgba(166, 134, 255, 0.8);
  background: radial-gradient(circle at top left, #241242 0, #080417 55%, #050312 100%);
}

.ai-skill-link__body {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.ai-skill-link-thumb {
  position: relative;
  flex: 0 64px 64px;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 0, #692dff 0, #1a0e3a 45%, #050312 100%);
}

.ai-skill-link-thumb__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-skill-link-thumb--error {
  background: radial-gradient(circle at 30% 0, #444 0, #111 60%, #000 100%);
}

/* icon badge */

.ai-skill-link-thumb__icon {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(4, 2, 18, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #f6e7ff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.ai-skill-link__meta {
  flex: 1;
  min-width: 0;
}

.ai-skill-link__label {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: #f7f2ff;
  word-wrap: break-word;
  white-space: normal;
}

/* remove link button */

.ai-skill-link-remove {
  border: 0;
  background: transparent;
  color: #9f8bd6;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

/* === Add links buttons row ===================================== */

.ai-skill-addlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.ai-skill-addlinks__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(11, 7, 28, 0.95);
  color: #ded7ff;
  font-size: 11px;
  cursor: pointer;
}

.ai-skill-addlinks__btn:hover {
  background: linear-gradient(135deg, #3a24a8, #8b4bff);
  color: #fff;
}

.ai-skill-addlinks__icon i {
  font-size: 11px;
}

/* === Footer text =============================================== */

.ai-skill-side__footer {
  margin-top: 4px;
  font-size: 11px;
  color: #9e96d3;
  min-height: 14px;
}

/* === Toast ===================================================== */

.ai-skill-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(5, 3, 18, 0.96);
  color: #fff;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out;
  z-index: 9999;
}

.ai-skill-toast--visible {
  opacity: 1;
}

/* === Link popup (external URL) ================================ */

.ai-skill-link-popup {
  position: fixed;
  inset: 0;
  display: none;
  alignments: center;
  justify-content: center;
  z-index: 20000;
}

.ai-skill-link-popup--visible {
  display: flex;
}

.ai-skill-link-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.ai-skill-link-popup__box {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  background: #060313;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.85);
  padding: 10px 12px 11px;
  color: #f3eeff;
}

.ai-skill-link-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-skill-link-popup__title {
  font-size: 14px;
  font-weight: 600;
}

.ai-skill-link-popup__close {
  border: 0;
  background: transparent;
  color: #c9bcff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.ai-skill-link-popup__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.ai-skill-link-popup__label-main {
  font-size: 12px;
  color: #b7afd7;
}

.ai-skill-link-popup__url,
.ai-skill-link-popup__text {
  width: 100%;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #080418;
  color: #f5f1ff;
  padding: 6px 8px;
  font-size: 13px;
}

.ai-skill-link-popup__url:focus,
.ai-skill-link-popup__text:focus {
  outline: none;
  border-color: #7c57ff;
}

.ai-skill-link-popup__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.ai-skill-link-popup__save,
.ai-skill-link-popup__cancel {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ai-skill-link-popup__save {
  background: #7e3fff;
  color: #fff;
}

.ai-skill-link-popup__cancel {
  background: #141020;
  color: #e1dbff;
}

/* === Skill chooser popup (posts / rools / shared) ============== */

.ai-skill-chooser {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20010;
}

.ai-skill-chooser--visible {
  display: flex;
}

.ai-skill-chooser__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.ai-skill-chooser__box {
  position: relative;
  z-index: 1;
  width: min(1040px, 96vw);
  max-height: min(720px, 96vh);
  background: #060313;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.85);
  padding: 14px 18px 14px;
  color: #f3eeff;
  display: flex;
  flex-direction: column;
}

.ai-skill-chooser__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ai-skill-chooser__title {
  font-size: 14px;
  font-weight: 600;
}

.ai-skill-chooser__close {
  border: 0;
  background: transparent;
  color: #c9bcff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.ai-skill-chooser__body {
  flex: 1;
  min-height: 200px;
  max-height: 520px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.ai-skill-chooser__status {
  font-size: 12px;
  color: #b7afd7;
  margin-bottom: 6px;
}

.ai-skill-chooser__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: hidden;
}

.ai-skill-chooser__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #f2edff;
  cursor: pointer;
  text-align: left;
}

.ai-skill-chooser__item:hover {
  border-color: rgba(162, 132, 255, 0.7);
  background: radial-gradient(circle at top left, #241242 0, #0a051a 55%, #050312 100%);
}

.ai-skill-chooser__item--selected {
  border-color: rgba(162, 132, 255, 0.95);
  background: radial-gradient(circle at top left, #32185e 0, #110825 55%, #070418 100%);
}

.ai-skill-chooser__thumb {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.ai-skill-chooser__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-skill-chooser__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-skill-chooser__thumb-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(4, 2, 18, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #f6e7ff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.ai-skill-chooser__meta {
  flex: 1;
  min-width: 0;
}

.ai-skill-chooser__meta-title {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: #f7f2ff;
  word-wrap: break-word;
  white-space: normal;
}

.ai-skill-chooser__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-skill-chooser__label-main {
  font-size: 12px;
  color: #b7afd7;
}

.ai-skill-chooser__text {
  width: 100%;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #080418;
  color: #f5f1ff;
  padding: 6px 8px;
  font-size: 13px;
}

.ai-skill-chooser__text:focus {
  outline: none;
  border-color: #7c57ff;
}

.ai-skill-chooser__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.ai-skill-chooser__save,
.ai-skill-chooser__cancel {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ai-skill-chooser__save {
  background: #7e3fff;
  color: #fff;
}

.ai-skill-chooser__cancel {
  background: #141020;
  color: #e1dbff;
}

/* === Confirm delete popup ===================================== */

.ai-skill-confirm {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20030;
}

.ai-skill-confirm--visible {
  display: flex;
}

.ai-skill-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.ai-skill-confirm__box {
  position: relative;
  z-index: 1;
  width: min(360px, 90vw);
  background: #060313;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.9);
  padding: 12px 14px 11px;
  color: #f3eeff;
  font-size: 13px;
}

.ai-skill-confirm__message {
  margin-bottom: 10px;
  line-height: 1.4;
}

.ai-skill-confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.ai-skill-confirm__ok,
.ai-skill-confirm__cancel {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}

.ai-skill-confirm__ok {
  background: #ff4b81;
  color: #fff;
}

.ai-skill-confirm__cancel {
  background: #141020;
  color: #e1dbff;
}

/* ============================================================= */
/* =============== EXPANDED MODE 2×2 GRID PER SKILL ============ */
/* ============================================================= */

.ai-skill-side--expanded {
  position: fixed;
  left: 18px;
  right: 18px;
  top: 80px;
  bottom: 18px;
  width: auto;
  max-width: calc(100vw - 24px);
  z-index: 1300;
  box-sizing: border-box;
  overflow: hidden;
}

.ai-skill-side--expanded .ai-skill-side__inner {
  height: 100%;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
}

/* scroll body, not the whole page */
.ai-skill-side--expanded .ai-skill-side__body {
  flex: 1;
  overflow-y: auto;
  margin-top: 6px;
}

/* bigger cards in expanded mode */
.ai-skill-side--expanded .ai-skill-card {
  padding: 12px 14px 14px;
}

/* grid with 4 cells (2×2 links) */
.ai-skill-side--expanded .ai-skill-links {
  display: grid;
  grid-template-columns: minmax(0, 130px) minmax(0, 1fr) minmax(0, 130px) minmax(0, 1fr);
  column-gap: 26px;
  row-gap: 14px;
  margin-bottom: 10px;
}

/* link tiles still separated, but don't move sideways on hover */
.ai-skill-side--expanded .ai-skill-link {
  transform: none;
}

.ai-skill-side--expanded .ai-skill-link:hover {
  transform: translateY(-1px);
}

/* map up to 4 links into 2×2 grid */
.ai-skill-side--expanded .ai-skill-link:nth-child(1) {
  grid-column: 1 / span 2;
}

.ai-skill-side--expanded .ai-skill-link:nth-child(2) {
  grid-column: 3 / span 2;
}

.ai-skill-side--expanded .ai-skill-link:nth-child(3) {
  grid-column: 1 / span 2;
}

.ai-skill-side--expanded .ai-skill-link:nth-child(4) {
  grid-column: 3 / span 2;
}

/* Much bigger square thumbs in expanded mode */
.ai-skill-side--expanded .ai-skill-link-thumb {
  width: 144px;
  height: 144px;
  border-radius: 20px;
}

/* footer nicer in expanded */
.ai-skill-side--expanded .ai-skill-side__footer {
  margin-top: 8px;
}

/* In expanded mode the bio row becomes a proper hero card + pointer */
.ai-skill-side--expanded .ai-skill-side__bio-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 12px;
  margin-bottom: 10px;
  padding: 8px 10px 10px;
  border-radius: 14px;
  background: radial-gradient(circle at top left, rgba(124, 53, 215, 0.35), rgba(9, 3, 28, 0.98));
  border: 1px solid rgba(241, 186, 255, 0.68);
  box-shadow: 0 20px 65px rgba(0, 0, 0, 0.9);
  align-items: stretch;
  position: relative;
  overflow: visible;
}

/* POINTER – same place/orientation as before, new color #3b1b69,
   frame on two sides only, hanging out from the bubble */
.ai-skill-side--expanded .ai-skill-side__bio-row::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: -7.5px;              /* half outside, half inside */
  top: 14px;                /* adjust +/− 2px if you want */
  background: #381a63;      /* requested fill color */
  border-top: none;
  border-bottom: 1px solid rgba(241, 186, 255, 0.9);
  border-left: 1px solid rgba(241, 186, 255, 0.9);
  border-right: none;
  transform: rotate(45deg); /* “diamond” style pointer */
}

/* larger text inside bio when expanded */
.ai-skill-side--expanded .ai-skill-side__bio-input,
.ai-skill-side--expanded .ai-skill-side__bio-view {
  min-height: 90px;
  font-size: 13px;
  line-height: 1.55;
}

/* Slightly bigger name when expanded so bio + name feels like a card */
.ai-skill-side--expanded .ai-skill-side__display-name {
  font-size: 18px;
  font-weight: 700;
}

.ai-skill-side--expanded .ai-skill-side__username {
  font-size: 13px;
}

/* narrow screens in expanded: fall back to 2 columns (one per row) */
@media (max-width: 1024px) {
  .ai-skill-side--expanded {
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }

  .ai-skill-side--expanded .ai-skill-links {
    grid-template-columns: minmax(0, 130px) minmax(0, 1fr);
  }

  .ai-skill-side--expanded .ai-skill-link {
    grid-column: 1 / span 2 !important;
  }
}

/* === Inline viewer for video / external links ================== */

.ai-skill-viewer {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20020;
}

.ai-skill-viewer--visible {
  display: flex;
}

.ai-skill-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.ai-skill-viewer__box {
  position: relative;
  z-index: 1;
  width: min(960px, 96vw);
  max-height: min(640px, 96vh);
  background: #050313;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.9);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  color: #f5f1ff;
}

.ai-skill-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ai-skill-viewer__title {
  font-size: 14px;
  font-weight: 600;
}

.ai-skill-viewer__close {
  border: 0;
  background: transparent;
  color: #d2c8ff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.ai-skill-viewer__content {
  flex: 1;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-skill-viewer__video,
.ai-skill-viewer__iframe {
  width: 100%;
  height: min(520px, 60vh);
  border-radius: 12px;
  border: 0;
  background: #000;
}

/* === AI-Skill inline viewer: media left, sidebar right ============= */

.ai-skill-viewer__content {
  flex: 1;
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .ai-skill-viewer__content {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ai-skill-viewer__media {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}

.ai-skill-viewer__video,
.ai-skill-viewer__iframe {
  width: 100%;
  height: min(520px, 60vh);
  border-radius: 14px;
  border: 0;
  display: block;
  background: #000;
}

/* Right sidebar with title, tags, description and CTA */

.ai-skill-viewer__sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: radial-gradient(circle at top left, #22103f 0, #060315 55%, #04020c 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
}

.ai-skill-viewer__meta-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.ai-skill-viewer__meta-tags {
  font-size: 11px;
  color: #d0c3ff;
}

.ai-skill-viewer__meta-desc {
  font-size: 12px;
  color: #f1ecff;
  line-height: 1.45;
  white-space: pre-wrap;
}

.ai-skill-viewer__open-link {
  margin-top: auto;
  align-self: flex-start;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #ff4b81, #ffb563);
  color: #ffffff;
  text-decoration: none;
}

.ai-skill-viewer__open-link:hover {
  filter: brightness(1.05);
}

/* ============================================================= */
/* =============== MOBILE COMPACT LAUNCHER (<768px) ============= */
/* ============================================================= */

@media (max-width: 980px) {
  /* floating mini widget while collapsed */
  .ai-skill-side {
    position: fixed;
    top: 150px;
    right: 20px;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: 78vw;
    margin: 0 !important;
    z-index: 1600;
  }

  .ai-skill-side__inner {
    padding: 6px 9px;
    border-radius: 999px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9);
  }

  /* collapsed on mobile: show only header (icon + title + button) */
  .ai-skill-side:not(.ai-skill-side--expanded) .ai-skill-side__profile,
  .ai-skill-side:not(.ai-skill-side--expanded) .ai-skill-side__body,
  .ai-skill-side:not(.ai-skill-side--expanded) .ai-skill-side__footer,
  .ai-skill-side:not(.ai-skill-side--expanded) .ai-skill-side__bio-row {
    display: none !important;
  }

  /* expanded on mobile: full overlay card, slightly lower from top bar */
  .ai-skill-side--expanded {
    top: 64px;
    bottom: 14px;
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
    border-radius: 18px;
  }

  .ai-skill-side--expanded .ai-skill-side__inner {
    border-radius: 18px;
  }
}
