/* ==========================================================================
   PDA / КПК — интерфейс по макетам
   Вёрстка идёт в фиксированном холсте 1000x693 (.pda-canvas),
   который масштабируется под физическую область экрана КПК
   через --pda-scale (выставляет pda.js).
   ========================================================================== */

#cef-pda {
  /* геометрия экрана внутри interfaces/pda/img/PDA.png (1024x716) */
  --pda-screen-left: 9.668%;
  --pda-screen-top: 10.894%;
  --pda-screen-width: 76.269%;
  --pda-screen-height: 75.559%;

  --pda-canvas-w: 1000px;
  --pda-canvas-h: 693px;
  --pda-scale: 1;

  --pda-font: "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  --pda-bg: #131517;
  --pda-bg-deep: #0b0c0d;
  --pda-nav: #1b1d1f;
  --pda-panel: #1c1e20;
  --pda-panel-2: #232628;
  --pda-panel-3: #2b2e30;
  --pda-line: rgba(255, 255, 255, 0.09);
  --pda-line-strong: rgba(255, 255, 255, 0.18);

  --pda-text: #ededed;
  --pda-muted: #8d9195;
  --pda-dim: #5e6266;

  --pda-green: #3fbf63;
  --pda-green-soft: rgba(63, 191, 99, 0.14);
  --pda-red: #e0313f;
  --pda-red-soft: rgba(224, 49, 63, 0.14);

  --pda-light: #f4ecec;
  --pda-light-2: #efe4e4;

  z-index: 9700;
  font-family: var(--pda-font);
  color: var(--pda-text);
  background: transparent !important;
  -webkit-font-smoothing: antialiased;
}

/* --- сброс нативных контролов (CEF) ------------------------------------- */
#cef-pda button,
#cef-pda input,
#cef-pda textarea,
#cef-pda select {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

#cef-pda button {
  cursor: pointer;
}

#cef-pda button::-moz-focus-inner {
  padding: 0;
  border: 0;
}

#cef-pda ::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

#cef-pda ::-webkit-scrollbar-track {
  background: transparent;
}

#cef-pda ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 3px;
}

#cef-pda ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.78);
}

#cef-pda input::placeholder,
#cef-pda textarea::placeholder {
  color: var(--pda-dim);
}

/* --- сцена --------------------------------------------------------------- */
#cef-pda.cef-screen {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

#cef-pda.cef-screen.is-visible {
  visibility: visible;
}

#cef-pda.cef-screen.is-interactive {
  pointer-events: auto;
}

#cef-pda .pda-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  opacity: 0;
  transition: opacity 0.2s linear;
}

#cef-pda.is-open .pda-backdrop {
  opacity: 1;
}

#cef-pda .pda-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
}

#cef-pda .pda-device {
  position: relative;
  width: min(92vw, 128.49vh);
  /* 1024/716 = 1.4302 → высота ограничивает ширину */
  aspect-ratio: 1024 / 716;
  opacity: 0;
  transform: translateY(4%) scale(0.965);
  transform-origin: 50% 60%;
  transition:
    opacity 0.26s ease,
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 3vh 6vh rgba(0, 0, 0, 0.65));
}

#cef-pda.is-open .pda-device {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#cef-pda .pda-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* индикаторы на корпусе */
#cef-pda .pda-led {
  position: absolute;
  border-radius: 40%;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#cef-pda .pda-led--red {
  left: 3.52%;
  top: 11.59%;
  width: 2.34%;
  height: 1.82%;
  background: #ff2f3e;
  box-shadow:
    0 0 0.6vh rgba(255, 47, 62, 0.9),
    0 0 2.2vh rgba(255, 47, 62, 0.75);
}

#cef-pda .pda-led--green {
  left: 3.32%;
  top: 14.94%;
  width: 2.44%;
  height: 1.82%;
  background: #3dff6a;
  box-shadow:
    0 0 0.6vh rgba(61, 255, 106, 0.9),
    0 0 2.2vh rgba(61, 255, 106, 0.7);
}

#cef-pda.is-led-red .pda-led--red,
#cef-pda.is-led-green .pda-led--green {
  opacity: 1;
}

/* --- экран --------------------------------------------------------------- */
#cef-pda .pda-screen {
  position: absolute;
  left: var(--pda-screen-left);
  top: var(--pda-screen-top);
  width: var(--pda-screen-width);
  height: var(--pda-screen-height);
  overflow: hidden;
  background: var(--pda-bg-deep);
}

#cef-pda .pda-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--pda-canvas-w);
  height: var(--pda-canvas-h);
  transform: scale(var(--pda-scale));
  transform-origin: 0 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.045), transparent 62%),
    linear-gradient(180deg, #17191b 0%, #101214 58%, #0c0e0f 100%);
  font-size: 16px;
  line-height: 1.35;
}

/* блики и микрорельеф стекла */
#cef-pda .pda-glass {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0%, transparent 26%, transparent 74%, rgba(255, 255, 255, 0.028) 100%),
    radial-gradient(140% 120% at 50% 50%, transparent 48%, rgba(0, 0, 0, 0.5) 100%);
  mix-blend-mode: screen;
  opacity: 0.65;
}

#cef-pda .pda-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.022) 0px,
    rgba(255, 255, 255, 0.022) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

/* --- верхняя навигация --------------------------------------------------- */
#cef-pda .pda-nav {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 66px;
  background: linear-gradient(180deg, rgba(30, 33, 35, 0.98), rgba(22, 24, 26, 0.98));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

#cef-pda .pda-nav-btn {
  position: relative;
  padding: 9px 20px;
  border-radius: 9px;
  color: var(--pda-muted);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition:
    color 0.16s ease,
    background-color 0.16s ease;
}

#cef-pda .pda-nav-btn:hover {
  color: #c9cdd1;
  background: rgba(255, 255, 255, 0.04);
}

#cef-pda .pda-nav-btn.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

#cef-pda .pda-nav-badge {
  position: absolute;
  top: 12px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pda-green);
  font-size: 0;
}

/* --- контейнер вкладок --------------------------------------------------- */
#cef-pda .pda-views {
  position: absolute;
  left: 0;
  top: 66px;
  z-index: 10;
  width: 100%;
  height: calc(var(--pda-canvas-h) - 66px);
}

#cef-pda .pda-view {
  position: absolute;
  inset: 0;
  display: none;
  padding: 26px 56px 24px;
}

#cef-pda .pda-view.is-active {
  display: block;
  animation: pda-view-in 0.24s ease both;
}

#cef-pda .pda-view--flush {
  padding: 0;
}

@keyframes pda-view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#cef-pda .pda-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.55) transparent;
}

/* ==========================================================================
   ЭКРАН ВХОДА
   ========================================================================== */

#cef-pda .pda-lock {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(120% 100% at 50% -10%, rgba(255, 255, 255, 0.05), transparent 60%),
    linear-gradient(180deg, #191b1d, #0d0f10);
}

#cef-pda.is-unlocked .pda-lock {
  display: none;
}

#cef-pda .pda-lock-logo {
  width: 74px;
  height: 74px;
  margin-bottom: 52px;
  opacity: 0.92;
}

#cef-pda .pda-lock-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

#cef-pda .pda-lock-title {
  margin: 0 0 46px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.005em;
  text-align: center;
}

#cef-pda .pda-code {
  display: flex;
  gap: 18px;
}

#cef-pda .pda-code-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 146px;
  height: 138px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  background: linear-gradient(180deg, #303234, #26282a);
  color: #6f7376;
  font-size: 66px;
  font-weight: 600;
  line-height: 1;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

#cef-pda .pda-code-cell.is-filled {
  color: #dfe3e6;
  border-color: rgba(255, 255, 255, 0.16);
}

#cef-pda .pda-code-cell.is-caret {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

#cef-pda .pda-lock.is-ok .pda-code-cell {
  border-color: rgba(63, 191, 99, 0.55);
  background: linear-gradient(180deg, rgba(63, 191, 99, 0.2), rgba(63, 191, 99, 0.1));
  color: #58e07c;
  box-shadow: 0 0 26px rgba(63, 191, 99, 0.22);
}

#cef-pda .pda-lock.is-error .pda-code-cell {
  border-color: rgba(224, 49, 63, 0.55);
  background: linear-gradient(180deg, rgba(224, 49, 63, 0.2), rgba(224, 49, 63, 0.1));
  color: #ff5566;
  box-shadow: 0 0 26px rgba(224, 49, 63, 0.22);
  animation: pda-code-shake 0.42s ease;
}

@keyframes pda-code-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  45% {
    transform: translateX(7px);
  }
  70% {
    transform: translateX(-4px);
  }
}

#cef-pda .pda-lock-hint {
  margin-top: 74px;
  color: var(--pda-muted);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: color 0.2s ease;
}

#cef-pda .pda-lock.is-ok .pda-lock-hint {
  color: var(--pda-green);
}

#cef-pda .pda-lock.is-error .pda-lock-hint {
  color: var(--pda-red);
}

/* ==========================================================================
   ГЛАВНАЯ — новости
   ========================================================================== */

#cef-pda .pda-home-title {
  margin: 4px 0 22px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#cef-pda .pda-news-scroll {
  height: calc(100% - 66px);
  padding-right: 14px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 82%, rgba(0, 0, 0, 0.25) 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 82%, rgba(0, 0, 0, 0.25) 100%);
}

#cef-pda .pda-news-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding-bottom: 6px;
}

#cef-pda .pda-news-card {
  display: block;
  padding: 14px 14px 16px;
  border: 1px solid var(--pda-line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  text-align: left;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease;
}

#cef-pda .pda-news-card:hover {
  border-color: var(--pda-line-strong);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
}

#cef-pda .pda-news-thumb {
  display: block;
  width: 100%;
  height: 108px;
  margin-bottom: 14px;
  border-radius: 10px;
  object-fit: cover;
  background: #202325;
}

#cef-pda .pda-news-name {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.28;
}

#cef-pda .pda-news-more {
  color: var(--pda-dim);
  font-size: 13px;
  font-weight: 600;
}

#cef-pda .pda-news-card:hover .pda-news-more {
  color: var(--pda-muted);
}

#cef-pda .pda-news-card.is-unread .pda-news-more {
  color: var(--pda-green);
}

/* ==========================================================================
   СООБЩЕНИЯ
   ========================================================================== */

#cef-pda .pda-msg {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  height: 100%;
}

#cef-pda .pda-msg-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

#cef-pda .pda-search {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 20px;
  border: 1px solid var(--pda-line);
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.035);
}

#cef-pda .pda-search input {
  width: 100%;
  color: var(--pda-text);
  font-size: 15px;
}

#cef-pda .pda-contacts {
  position: relative;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--pda-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

#cef-pda .pda-contacts-list {
  height: 100%;
  padding: 8px;
}

#cef-pda .pda-contact {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  text-align: left;
  transition: background-color 0.15s ease;
}

#cef-pda .pda-contact:hover {
  background: rgba(255, 255, 255, 0.045);
}

#cef-pda .pda-contact.is-active {
  background: rgba(255, 255, 255, 0.085);
}

#cef-pda .pda-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

#cef-pda .pda-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #26292b;
}

#cef-pda .pda-avatar .pda-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  border: 2px solid #1a1c1e;
  border-radius: 50%;
  background: var(--pda-dim);
}

#cef-pda .pda-avatar.is-online .pda-dot {
  background: var(--pda-green);
}

#cef-pda .pda-avatar.is-blocked .pda-dot {
  background: var(--pda-red);
}

#cef-pda .pda-contact-body {
  min-width: 0;
  flex: 1;
}

#cef-pda .pda-contact-name {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#cef-pda .pda-contact-last {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--pda-dim);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#cef-pda .pda-contact.is-blocked .pda-contact-last {
  color: rgba(224, 49, 63, 0.8);
}

#cef-pda .pda-contact.is-unread .pda-contact-last {
  color: var(--pda-green);
}

/* кнопка/форма добавления контакта */
#cef-pda .pda-contacts-add {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  z-index: 5;
}

#cef-pda .pda-add-btn {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border-radius: 21px;
  background: var(--pda-light);
  color: #1b1d1f;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  transition: background-color 0.15s ease;
}

#cef-pda .pda-add-btn:hover {
  background: #ffffff;
}

#cef-pda .pda-add-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

#cef-pda .pda-add-form {
  display: none;
  padding: 12px;
  border-radius: 18px;
  background: var(--pda-light);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

#cef-pda .pda-contacts-add.is-form-open .pda-add-form {
  display: block;
  animation: pda-pop 0.18s ease both;
}

#cef-pda .pda-add-form input {
  display: block;
  width: 100%;
  height: 38px;
  margin-bottom: 8px;
  padding: 0 16px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 19px;
  color: #1b1d1f;
  font-size: 13.5px;
}

#cef-pda .pda-add-form input::placeholder {
  color: rgba(27, 29, 31, 0.42);
}

#cef-pda .pda-add-form .pda-add-btn {
  box-shadow: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

/* правая колонка — чат */
#cef-pda .pda-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--pda-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

#cef-pda .pda-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--pda-line);
}

#cef-pda .pda-chat-title {
  flex: 1;
  min-width: 0;
}

#cef-pda .pda-chat-name {
  font-size: 16px;
  font-weight: 700;
}

#cef-pda .pda-chat-status {
  color: var(--pda-green);
  font-size: 12px;
  font-weight: 600;
}

#cef-pda .pda-chat-status.is-off {
  color: var(--pda-dim);
}

#cef-pda .pda-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--pda-muted);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

#cef-pda .pda-icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

#cef-pda .pda-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#cef-pda .pda-chat-log {
  flex: 1;
  min-height: 0;
  padding: 14px 16px 6px;
}

#cef-pda .pda-day {
  display: flex;
  justify-content: center;
  margin: 4px 0 12px;
}

#cef-pda .pda-day span {
  padding: 4px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--pda-muted);
  font-size: 11.5px;
  font-weight: 600;
}

#cef-pda .pda-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

#cef-pda .pda-row-avatar {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #26292b;
}

#cef-pda .pda-bubble {
  position: relative;
  max-width: 74%;
  padding: 9px 44px 9px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.36;
  word-break: break-word;
  cursor: default;
}

#cef-pda .pda-row--in .pda-bubble {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.06);
  color: var(--pda-text);
  border-bottom-left-radius: 5px;
}

#cef-pda .pda-row--out {
  flex-direction: row-reverse;
}

#cef-pda .pda-row--out .pda-bubble {
  background: var(--pda-light);
  color: #1b1d1f;
  border-bottom-right-radius: 5px;
}

#cef-pda .pda-bubble-time {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 10.5px;
  font-weight: 600;
}

#cef-pda .pda-row--out .pda-bubble-time {
  color: rgba(27, 29, 31, 0.42);
}

#cef-pda .pda-bubble--system {
  padding-right: 52px;
  background: transparent;
  border: 1px dashed rgba(63, 191, 99, 0.4);
  color: var(--pda-green);
  font-weight: 600;
}

#cef-pda .pda-bubble--deleted {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: transparent;
  color: var(--pda-dim);
  font-style: italic;
}

#cef-pda .pda-bubble.is-selected {
  outline: 1px solid rgba(255, 255, 255, 0.35);
}

/* поле ввода */
#cef-pda .pda-chat-foot {
  position: relative;
  padding: 10px 16px 14px;
}

#cef-pda .pda-chat-input {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 16px 0 20px;
  border: 1px solid var(--pda-line);
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.035);
}

#cef-pda .pda-chat-input input {
  flex: 1;
  min-width: 0;
  color: var(--pda-text);
  font-size: 14.5px;
}

#cef-pda .pda-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--pda-muted);
  transition: color 0.15s ease;
}

#cef-pda .pda-send:hover {
  color: var(--pda-green);
}

#cef-pda .pda-send svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

#cef-pda .pda-attach svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

#cef-pda .pda-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--pda-dim);
  font-size: 15px;
  text-align: center;
}

/* ==========================================================================
   КАРТА
   ========================================================================== */

#cef-pda .pda-map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #141613;
}

#cef-pda .pda-map-canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
}

#cef-pda .pda-map-canvas.is-dragging {
  cursor: grabbing;
}

#cef-pda .pda-map-plane {
  position: absolute;
  inset: 0;
  transform: translate(var(--map-x, 0px), var(--map-y, 0px)) scale(var(--map-z, 1));
  transform-origin: 50% 50%;
  transition: transform 0.16s ease-out;
}

#cef-pda .pda-map-plane img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

#cef-pda .pda-map-marker {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  color: #e9e9e9;
}

#cef-pda .pda-map-marker svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
}

#cef-pda .pda-map-marker--danger {
  color: #f08a2c;
}

#cef-pda .pda-map-marker--quest {
  color: #f2c94c;
}

#cef-pda .pda-map-marker--friend {
  color: #55d174;
}

#cef-pda .pda-map-marker--death {
  color: #e6e6e6;
}

#cef-pda .pda-map-marker--player {
  color: #ffffff;
}

#cef-pda .pda-map-zone {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  width: var(--msize, 150px);
  height: var(--msize, 150px);
  margin-top: calc(var(--msize, 150px) / -2);
  margin-left: calc(var(--msize, 150px) / -2);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.08);
  backdrop-filter: brightness(1.55) contrast(1.12) saturate(1.1);
  -webkit-backdrop-filter: brightness(1.55) contrast(1.12) saturate(1.1);
}

#cef-pda .pda-map-zone-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  color: #f0f0f0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

#cef-pda .pda-map-chip {
  position: absolute;
  left: var(--mx);
  top: var(--my);
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 12px 6px 9px;
  border-radius: 14px;
  background: rgba(20, 22, 24, 0.88);
  color: #f0f0f0;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

#cef-pda .pda-map-chip svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

#cef-pda .pda-map-legend-btn {
  position: absolute;
  bottom: 18px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 9px 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(18, 20, 22, 0.9);
  color: #e8e8e8;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 0.15s ease;
}

#cef-pda .pda-map-legend-btn:hover {
  background: rgba(34, 37, 40, 0.95);
}

#cef-pda .pda-map-zoom {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#cef-pda .pda-map-zoom button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(18, 20, 22, 0.9);
  color: #e8e8e8;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

#cef-pda .pda-map-zoom button:hover {
  background: rgba(34, 37, 40, 0.95);
}

#cef-pda .pda-legend {
  position: absolute;
  bottom: 62px;
  left: 50%;
  z-index: 7;
  display: none;
  width: 460px;
  transform: translateX(-50%);
  padding: 16px 18px;
  border: 1px solid var(--pda-line);
  border-radius: 16px;
  background: rgba(18, 20, 22, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

#cef-pda .pda-legend.is-open {
  display: block;
  animation: pda-pop 0.18s ease both;
}

#cef-pda .pda-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
}

#cef-pda .pda-legend-item {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--pda-muted);
  font-size: 13px;
  font-weight: 600;
}

#cef-pda .pda-legend-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* ==========================================================================
   РАДИО
   ========================================================================== */

#cef-pda .pda-radio {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: 8px;
}

#cef-pda .pda-stations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

#cef-pda .pda-station {
  position: relative;
  overflow: hidden;
  height: 140px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: var(--pda-light);
  color: #17191b;
  text-align: left;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease;
}

#cef-pda .pda-station:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

#cef-pda .pda-station.is-active {
  box-shadow:
    0 0 0 2px var(--pda-green),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

#cef-pda .pda-station-freq {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

#cef-pda .pda-station-band {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.55;
}

#cef-pda .pda-station-name {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}

#cef-pda .pda-station-note {
  position: absolute;
  right: 14px;
  bottom: 12px;
  left: 16px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.55;
}

#cef-pda .pda-station-live {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  opacity: 0;
}

#cef-pda .pda-station.is-active .pda-station-live {
  opacity: 1;
}

#cef-pda .pda-station-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pda-green);
  animation: pda-pulse 1.4s ease-in-out infinite;
}

@keyframes pda-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* шкала частот */
#cef-pda .pda-tuner {
  position: relative;
  margin-top: auto;
  padding: 12px 20px 10px;
  border: 1px solid var(--pda-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  user-select: none;
}

#cef-pda .pda-tuner-scale {
  position: relative;
  height: 20px;
}

#cef-pda .pda-tuner-tick {
  position: absolute;
  left: var(--tx);
  transform: translateX(-50%);
  color: #d9dcde;
  font-size: 12px;
  font-weight: 700;
}

#cef-pda .pda-tuner-scale--am .pda-tuner-tick {
  font-size: 9.5px;
  opacity: 0.75;
}

#cef-pda .pda-tuner-line {
  height: 2px;
  margin: 3px 0;
  background: var(--pda-green);
  box-shadow: 0 0 8px rgba(63, 191, 99, 0.45);
}

#cef-pda .pda-tuner-needle {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: var(--nx, 50%);
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #ff2b3a;
  box-shadow: 0 0 10px rgba(255, 43, 58, 0.7);
  transition: left 0.14s ease-out;
  pointer-events: none;
}

#cef-pda .pda-transport {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 16px;
}

#cef-pda .pda-transport button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 32px;
  border: 1px solid var(--pda-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--pda-muted);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

#cef-pda .pda-transport button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

#cef-pda .pda-transport button.is-active {
  border-color: rgba(63, 191, 99, 0.5);
  color: var(--pda-green);
}

#cef-pda .pda-transport svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

#cef-pda .pda-nowplaying {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  color: var(--pda-muted);
  font-size: 13px;
  font-weight: 600;
}

#cef-pda .pda-nowplaying svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

#cef-pda .pda-volume {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 10px 0 4px;
  color: var(--pda-dim);
  font-size: 12px;
  font-weight: 700;
}

#cef-pda .pda-volume-bar {
  position: relative;
  width: 170px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

#cef-pda .pda-volume-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--vol, 60%);
  border-radius: 2px;
  background: var(--pda-green);
}

/* ==========================================================================
   ПУТЕВОДИТЕЛЬ
   ========================================================================== */

#cef-pda .pda-guide {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#cef-pda .pda-crumbs {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#cef-pda .pda-crumb {
  color: var(--pda-dim);
  text-transform: uppercase;
  transition: color 0.15s ease;
}

#cef-pda .pda-crumb:hover {
  color: var(--pda-muted);
}

#cef-pda .pda-crumb.is-active {
  color: #ffffff;
}

#cef-pda .pda-crumb-sep {
  color: var(--pda-dim);
}

#cef-pda .pda-guide-body {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  min-height: 0;
  flex: 1;
}

#cef-pda .pda-guide-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 10px;
}

#cef-pda .pda-cat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#cef-pda .pda-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--pda-muted);
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background-color 0.15s ease;
}

#cef-pda .pda-cat-head:hover {
  color: #d5d8da;
  border-color: rgba(255, 255, 255, 0.26);
}

#cef-pda .pda-cat.is-open .pda-cat-head {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

#cef-pda .pda-cat-arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

#cef-pda .pda-cat.is-open .pda-cat-arrow {
  transform: rotate(180deg);
}

#cef-pda .pda-cat-items {
  display: none;
  flex-direction: column;
  gap: 10px;
}

#cef-pda .pda-cat.is-open .pda-cat-items {
  display: flex;
  animation: pda-pop 0.18s ease both;
}

#cef-pda .pda-entry {
  position: relative;
  overflow: hidden;
  padding: 14px 18px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  text-align: left;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}

#cef-pda .pda-entry-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-position: center;
  background-size: cover;
  opacity: 0.7;
  filter: grayscale(0.15);
  transition: opacity 0.16s ease;
}

#cef-pda .pda-entry-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(11, 13, 14, 0.93) 14%, rgba(11, 13, 14, 0.42) 100%);
}

#cef-pda .pda-entry:hover .pda-entry-bg,
#cef-pda .pda-entry.is-active .pda-entry-bg {
  opacity: 0.9;
}

#cef-pda .pda-entry.is-locked .pda-entry-bg {
  opacity: 0.32;
}

#cef-pda .pda-entry-name,
#cef-pda .pda-entry-desc {
  position: relative;
  z-index: 2;
}

#cef-pda .pda-entry-name {
  color: #b9bdc0;
  font-size: 17px;
  font-weight: 700;
}

#cef-pda .pda-entry-desc {
  margin-top: 4px;
  color: var(--pda-dim);
  font-size: 11.5px;
  line-height: 1.35;
}

#cef-pda .pda-entry:hover {
  border-color: rgba(255, 255, 255, 0.26);
}

#cef-pda .pda-entry.is-active {
  border-color: rgba(255, 255, 255, 0.5);
}

#cef-pda .pda-entry.is-active .pda-entry-name {
  color: #ffffff;
}

#cef-pda .pda-entry.is-active .pda-entry-desc {
  color: var(--pda-muted);
}

#cef-pda .pda-entry.is-locked {
  cursor: default;
}

#cef-pda .pda-entry.is-locked .pda-entry-name,
#cef-pda .pda-entry.is-locked .pda-entry-desc {
  color: var(--pda-dim);
  opacity: 0.55;
}

#cef-pda .pda-article {
  min-height: 0;
  padding-right: 14px;
}

#cef-pda .pda-article-img {
  display: block;
  width: 100%;
  height: 214px;
  margin-bottom: 16px;
  border-radius: 14px;
  object-fit: cover;
  background: #202325;
}

#cef-pda .pda-article-title {
  margin: 0 0 10px;
  font-size: 21px;
  font-weight: 700;
}

#cef-pda .pda-article-text {
  color: #c8ccce;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  text-align: justify;
}

#cef-pda .pda-article-text p {
  margin: 0 0 10px;
}

/* заметки */
#cef-pda .pda-note {
  padding: 14px 18px;
  border: 1px solid var(--pda-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  transition: border-color 0.16s ease;
}

#cef-pda .pda-note:hover,
#cef-pda .pda-note.is-active {
  border-color: var(--pda-line-strong);
}

#cef-pda .pda-note-name {
  font-size: 16px;
  font-weight: 700;
}

#cef-pda .pda-note-meta {
  margin-top: 3px;
  color: var(--pda-dim);
  font-size: 11.5px;
  font-weight: 600;
}

/* ==========================================================================
   ОВЕРЛЕИ: модальные окна, меню, подтверждения
   ========================================================================== */

@keyframes pda-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#cef-pda .pda-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 26px 56px;
}

#cef-pda .pda-overlay.is-open {
  display: flex;
}

#cef-pda .pda-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 8, 0.55);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

#cef-pda .pda-sheet {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  padding: 20px 24px 22px;
  border: 1px solid var(--pda-line);
  border-radius: 18px;
  background: rgba(24, 26, 28, 0.96);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.65);
  animation: pda-pop 0.2s ease both;
}

#cef-pda .pda-sheet-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #d7dadc;
  font-size: 20px;
  line-height: 1;
  transition: background-color 0.15s ease;
}

#cef-pda .pda-sheet-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

#cef-pda .pda-sheet-scroll {
  min-height: 0;
  padding-right: 14px;
}

#cef-pda .pda-sheet-img {
  display: block;
  width: 100%;
  height: 210px;
  margin-bottom: 16px;
  border-radius: 12px;
  object-fit: cover;
  background: #202325;
}

#cef-pda .pda-sheet-title {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 700;
  text-align: center;
}

#cef-pda .pda-sheet-text {
  color: #c8ccce;
  font-size: 13.5px;
  line-height: 1.6;
  text-align: justify;
}

#cef-pda .pda-sheet-text p {
  margin: 0 0 10px;
}

/* подтверждение */
#cef-pda .pda-confirm {
  width: auto;
  min-width: 380px;
  max-width: 520px;
  padding: 24px 28px 20px;
  align-self: center;
}

#cef-pda .pda-confirm-text {
  margin-bottom: 18px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

#cef-pda .pda-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

#cef-pda .pda-btn {
  min-width: 120px;
  height: 34px;
  padding: 0 20px;
  border: 1px solid var(--pda-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--pda-text);
  font-size: 13.5px;
  font-weight: 700;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

#cef-pda .pda-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#cef-pda .pda-btn--danger {
  border-color: transparent;
  background: var(--pda-red);
  color: #fff;
}

#cef-pda .pda-btn--danger:hover {
  background: #f0404f;
}

/* контекстные меню */
#cef-pda .pda-menu-layer {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: none;
}

#cef-pda .pda-menu-layer.is-open {
  display: block;
}

#cef-pda .pda-menu {
  position: absolute;
  min-width: 190px;
  padding: 7px;
  border: 1px solid var(--pda-line);
  border-radius: 12px;
  background: rgba(26, 28, 30, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  animation: pda-pop 0.14s ease both;
}

#cef-pda .pda-menu--light {
  border-color: rgba(0, 0, 0, 0.1);
  background: var(--pda-light);
}

#cef-pda .pda-menu-item {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  color: #e2e5e7;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.13s ease;
}

#cef-pda .pda-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

#cef-pda .pda-menu--light .pda-menu-item {
  color: #1b1d1f;
}

#cef-pda .pda-menu--light .pda-menu-item:hover {
  background: rgba(0, 0, 0, 0.07);
}

#cef-pda .pda-menu-item--danger {
  color: #ef4b58;
}

#cef-pda .pda-menu-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* тост */
#cef-pda .pda-toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  z-index: 90;
  transform: translate(-50%, 14px);
  padding: 9px 20px;
  border: 1px solid var(--pda-line);
  border-radius: 12px;
  background: rgba(26, 28, 30, 0.97);
  color: var(--pda-text);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

#cef-pda .pda-toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================================
   ПРЕВЬЮ (когда window.cef не объявлен)
   ========================================================================== */

.pda-preview-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: 100%;
  padding: 8px 12px;
  background: rgba(12, 13, 14, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #d8dbdd;
  font: 600 12px/1.2 "Segoe UI", Arial, sans-serif;
  pointer-events: auto;
  transform: translateY(-100%);
  transition: transform 0.2s ease;
}

.pda-preview-bar.is-open {
  transform: none;
}

.pda-preview-toggle {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 100000;
  transform: translateX(-50%);
  padding: 3px 16px 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: rgba(12, 13, 14, 0.92);
  color: #9aa0a4;
  font: 700 11px/1.2 "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform 0.2s ease,
    color 0.15s ease;
}

.pda-preview-bar.is-open + .pda-preview-toggle {
  transform: translate(-50%, 37px);
}

.pda-preview-toggle:hover {
  color: #fff;
}

.pda-preview-bar b {
  margin-right: 6px;
  color: #6f7478;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pda-preview-bar button {
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: #d8dbdd;
  font: inherit;
  cursor: pointer;
}

.pda-preview-bar button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pda-preview-bar .pda-preview-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.12);
}

body.pda-preview-body {
  background:
    radial-gradient(90% 70% at 50% 0%, #23282c 0%, #0e1012 60%, #08090a 100%) fixed !important;
}
