/* ============================================================
   Внутренние страницы: кабинеты ролей, чат с ИИ, страницы ошибок
   ============================================================ */

.stage--inner {
  grid-template-rows: auto auto;
  align-content: start;
  gap: clamp(16px, 3vh, 40px);
  padding-bottom: clamp(24px, 6vh, 64px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vh, 24px);
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3.4vw, 44px);
  border: 1px solid rgba(232, 207, 138, 0.28);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(30, 4, 8, 0.9), rgba(11, 2, 4, 0.94));
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255, 225, 170, 0.14);
  backdrop-filter: blur(6px);
  animation: panel-in 0.6s ease both;
}

.panel.is-revealed,
.card.is-revealed {
  animation-delay: var(--reveal-delay, 0ms);
}

.panel--message {
  align-items: center;
  max-width: 620px;
  text-align: center;
}

.panel--chat {
  max-width: 840px;
}

.panel__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(232, 207, 138, 0.7);
}

.panel__roleline {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 20px);
}

.panel__num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(48px, 6vw, 68px);
  aspect-ratio: 1;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  color: #fff;
  background: radial-gradient(circle at 50% 32%, #191510, #05040a 74%);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.55), 0 0 26px rgba(255, 196, 110, 0.28);
}

.panel__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #f8f2e7;
}

.panel__role {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: rgba(246, 239, 226, 0.78);
}

.panel__role strong {
  color: var(--gold-soft);
}

.panel__icon {
  margin-right: 6px;
}

.panel__desc {
  margin: 0;
  max-width: 74ch;
  font-size: 0.94rem;
  line-height: 1.6;
  color: rgba(246, 239, 226, 0.8);
}

.panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}

.card {
  padding: clamp(16px, 2.2vw, 24px);
  border: 1px solid rgba(232, 207, 138, 0.22);
  border-radius: 18px;
  background: rgba(10, 2, 4, 0.5);
  animation: panel-in 0.55s ease both;
}

.card__title {
  margin: 0 0 12px;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.card__title--spaced {
  margin-top: 22px;
}

.card__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card__list li {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(246, 239, 226, 0.88);
}

.card__bullet {
  color: var(--gold);
  font-size: 0.78rem;
  line-height: 1.75;
}

.card__note {
  margin: 12px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(246, 239, 226, 0.58);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions__form {
  margin: 0;
}

/* переключатель роли внутри кабинета */
.switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.switch__select {
  flex: 1;
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid rgba(232, 207, 138, 0.32);
  border-radius: var(--radius-pill);
  background: rgba(12, 2, 4, 0.9);
  color: var(--cream);
  font-size: 0.86rem;
}

.switch__select option {
  background: #1b0206;
  color: var(--cream);
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.meta div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(232, 207, 138, 0.18);
}

.meta dt {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 207, 138, 0.72);
}

.meta dd {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(246, 239, 226, 0.9);
}

code {
  font-family: ui-monospace, Consolas, 'Courier New', monospace;
  font-size: 0.86em;
  color: var(--gold-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  border: 1px solid rgba(232, 207, 138, 0.2);
  border-radius: var(--radius-pill);
  background: rgba(10, 2, 4, 0.42);
  font-size: 0.74rem;
  color: rgba(246, 239, 226, 0.7);
}

/* ------------------------------ страницы роли ------------------------------ */

.pages {
  margin-top: 22px;
}

.pages__title {
  margin: 0 0 12px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.pages__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.pages__card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid rgba(212, 175, 55, 0.26);
  border-radius: 16px;
  background: rgba(10, 2, 4, 0.5);
  color: var(--cream);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.pages__card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.12);
}

.pages__card.is-entry {
  border-color: rgba(212, 175, 55, 0.6);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.05));
}

.pages__name {
  font-size: 0.98rem;
  font-weight: 600;
}

.pages__tag {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(212, 175, 55, 0.85);
  color: #2b1c02;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.pages__tag--soft {
  background: transparent;
  border: 1px solid rgba(232, 207, 138, 0.4);
  color: var(--gold-soft);
  font-weight: 500;
}

/* ------------------------------ чат ------------------------------ */

.chat__head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat__bot {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 22%, #f6ecd2, #9c8447 56%, #463713);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.55);
}

.chat__visor {
  position: absolute;
  left: 12%;
  top: 16%;
  width: 76%;
  height: 74%;
  border-radius: 46% 46% 52% 52%;
  background: radial-gradient(circle at 50% 28%, #1d2a38, #05070c 76%);
}

.chat__eyes {
  position: absolute;
  left: 24%;
  top: 40%;
  display: flex;
  justify-content: space-between;
  width: 52%;
}

.chat__eyes i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a5e2ff;
  box-shadow: 0 0 12px #6cc7ff;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(232, 207, 138, 0.2);
  border-radius: 18px;
  background: rgba(6, 1, 2, 0.55);
}

.chat__log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 44vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.chat__msg {
  display: flex;
}

.chat__msg--bot {
  justify-content: flex-start;
}

.chat__msg--me {
  justify-content: flex-end;
}

.chat__bubble {
  max-width: 78%;
  margin: 0;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.chat__msg--bot .chat__bubble {
  border: 1px solid rgba(232, 207, 138, 0.22);
  border-bottom-left-radius: 5px;
  background: rgba(40, 6, 10, 0.85);
}

.chat__msg--me .chat__bubble {
  border-bottom-right-radius: 5px;
  background: linear-gradient(180deg, #e6cf8f, #b8933c);
  color: #2a1a04;
}

.chat__typing {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(232, 207, 138, 0.75);
}

.chat__form {
  display: flex;
  gap: 10px;
  margin: 0;
}

.chat__input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid rgba(232, 207, 138, 0.3);
  border-radius: var(--radius-pill);
  background: rgba(12, 2, 4, 0.85);
  color: var(--cream);
  font-size: 0.92rem;
}

.chat__input::placeholder {
  color: rgba(246, 239, 226, 0.45);
}

.chat__disclaimer {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: rgba(246, 239, 226, 0.55);
}

/* ------------------------------ ошибки ------------------------------ */

.message__code {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 9vw, 5.5rem);
  letter-spacing: 0.1em;
  color: rgba(232, 207, 138, 0.22);
}

.message__details {
  max-width: 100%;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  font-size: 0.76rem;
  color: #ffcbbd;
  text-align: left;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .chat__form {
    flex-direction: column;
  }

  .chat__bubble {
    max-width: 90%;
  }

  .panel {
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .card {
    animation: none;
  }
}
