/* Perry chat — tokens match public/assets/css/peraoke.css.
   Merge into peraoke.css later if you prefer one file. */
.perry-root {
  --perry-teal: var(--teal, #1ED1CF);
  --perry-ink: #3EA9A4;
  --perry-teal-2: #3EA9A4;
  --perry-mint: var(--mint, #7BE8C0);
  --perry-panel: var(--panel, #25282B);
  --perry-radius: var(--radius, 12px);
  --perry-font: var(--font, "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif);
  position: fixed;
  z-index: 75;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(0.45rem, env(safe-area-inset-bottom));
  font-family: var(--perry-font);
  color: #fff;
  pointer-events: none;
}
.perry-root > * { pointer-events: auto; }

.perry-launch {
  position: relative;
  z-index: 3;
  width: 168px; height: 250px; padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: visible;
  display: block;
  flex: none;
  transition: width .2s, height .2s, transform .2s;
}
.perry-launch img {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: bottom right;
  display: block;
  pointer-events: none;
}
.perry-root[data-open] .perry-launch {
  width: 210px; height: 314px;
}
.perry-launch:hover { transform: translateY(-2px); }

.perry-root {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
}
.perry-panel {
  position: relative;
  z-index: 1;
  width: min(340px, calc(100vw - 7rem));
  margin-right: -52px;
  padding-right: 36px;
}
.perry-root[data-list] .perry-panel {
  width: min(680px, calc(100vw - 7rem));
}
.perry-dock {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: .65rem;
}
.perry-box,
.perry-list {
  background: #0b0c0e;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  box-shadow: none;
  overflow: hidden;
}
.perry-box {
  flex: 0 0 360px;
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 380px;
  max-height: min(520px, calc(100dvh - 2rem));
  background: #0b0c0e;
  padding-right: 8px;
}

.perry-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
  background: #141618;
  position: relative;
}
.perry-head::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 72px; height: 2px;
  background: var(--perry-teal);
}
.perry-head__who { min-width: 0; flex: 1; line-height: 1.25; }
.perry-head__who strong {
  display: block;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.perry-head__who span {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: #9aa3a2;
}
.perry-x {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 0; background: none; color: rgba(255,255,255,.72);
  border-radius: 8px; cursor: pointer; flex: none;
}
.perry-x:hover { color: #fff; background: rgba(255,255,255,.08); }

.perry-log {
  flex: 1 1 auto;
  min-height: 140px;
  overflow-y: auto;
  padding: .85rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  scrollbar-width: thin;
}
.perry-msg {
  max-width: 92%;
  padding: .55rem .75rem;
  border-radius: 12px;
  font-size: .9rem;
  line-height: 1.45;
  font-weight: 600;
}
.perry-msg--perry {
  align-self: flex-start;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
}
.perry-msg--you {
  align-self: flex-end;
  background: var(--perry-teal);
  color: #05201F;
}
.perry-msg a,
.perry-relink {
  color: var(--perry-mint);
  font-weight: 800;
  border-bottom: 1px solid rgba(123,232,192,.45);
}
.perry-relink {
  display: inline;
  padding: 0;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.perry-msg--you a,
.perry-msg--you .perry-relink { color: #05201F; border-bottom-color: rgba(5,32,31,.35); }
.perry-msg b { color: var(--perry-mint); font-weight: 800; }
.perry-msg--you b { color: #05201F; }
.perry-msg .fa { font-family: "Vazirmatn", Tahoma, sans-serif; font-weight: 600; }

.perry-form {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem .7rem .75rem;
  border-top: 1px solid rgba(255,255,255,.09);
  background: #141618;
}
.perry-form input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: .55rem .9rem;
  outline: none;
  color: #fff;
  font-size: 16px;
}
.perry-form input::placeholder { color: rgba(255,255,255,.5); }
.perry-form input:focus {
  border-color: rgba(255,255,255,.28);
  box-shadow: none;
}
.perry-send {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--perry-teal);
  color: #05201F;
  cursor: pointer;
  flex: none;
  transition: background-color .16s;
}
.perry-send:hover { background: var(--perry-mint); }

.perry-list {
  flex: 1 1 300px;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  max-height: min(520px, calc(100dvh - 2rem));
  background: #0b0c0e;
}
.perry-list__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .55rem .55rem .55rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  font-size: .9rem;
  color: #fff;
}
.perry-list__n {
  color: var(--perry-teal);
  font-weight: 800;
}
.perry-list__head-title { min-width: 0; flex: 1; }
.perry-list__x { flex: none; }
.perry-list__head .fa {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  letter-spacing: 0;
  text-transform: none;
  font-size: .85rem;
  color: rgba(255,255,255,.62);
}
.perry-list__scroll {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}
.perry-row {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr);
  gap: .65rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: .5rem .8rem;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font: inherit;
}
.perry-row:hover,
.perry-row:focus-visible { background: rgba(30,209,207,.08); }
.perry-row--on {
  background: rgba(30,209,207,.08);
  box-shadow: inset 3px 0 0 var(--perry-teal);
}
.perry-row img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 50%;
  background: #111;
  flex: none;
}
.perry-row--artist img {
  width: 40px; height: 40px;
  border-radius: 50%;
}
.perry-row__ph {
  width: 62px; height: 35px;
  border-radius: 5px;
  background: #111;
}
.perry-row__ph--round { width: 40px; height: 40px; border-radius: 50%; }
.perry-row__main { min-width: 0; }
.perry-row__t {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perry-row__sub {
  display: block;
  font-size: .75rem;
  color: rgba(255,255,255,.58);
}
.perry-row__fa {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: .8rem;
  color: rgba(255,255,255,.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
}

@media (max-width: 720px) {
  .perry-root {
    left: max(0.75rem, env(safe-area-inset-left));
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.2rem, env(safe-area-inset-bottom));
    width: auto;
  }
  .perry-launch {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 119px;
    height: 177px;
  }
  .perry-root[data-open] .perry-launch { width: 130px; height: 195px; }
  .perry-root[data-list] .perry-panel,
  .perry-panel {
    width: 100%;
    max-width: none;
    margin-right: 0;
    padding-right: 0;
  }
  .perry-dock { flex-direction: column; gap: 12px; align-items: stretch; }
  .perry-box {
    flex: none;
    width: 100%;
    min-height: 220px;
    max-height: 42dvh;
    padding-right: 5rem;
  }
  .perry-list {
    flex: none;
    width: 100%;
    max-width: none;
    max-height: 28dvh;
    min-width: 0;
  }
}

@media (pointer: coarse) {
  .perry-send, .perry-x { min-width: 44px; min-height: 44px; }
  .perry-launch { min-width: 0; min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .perry-launch { transition: none; }
}
