:root {
  --pg-bg: #f7efd9;
  --pg-surface: #fffaf0;
  --pg-surface-2: #eadcb9;
  --pg-text: #2e2618;
  --pg-muted: #725f41;
  --pg-accent: #b88724;
  --pg-success: #2f8f5b;
  --pg-warning: #c17716;
  --pg-danger: #b84535;
  --pg-shadow: 0 16px 38px rgba(96, 70, 30, 0.18);
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(201, 160, 61, 0.22), transparent 28%),
    linear-gradient(135deg, #f7efd9 0%, #f3e6c5 48%, #fff8e8 100%);
}

body.case-focus::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(36, 26, 12, 0.54);
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: caseFocusFade 3s ease forwards;
}

.femida-shell {
  width: min(1260px, calc(100% - 24px));
}

.pg-panel {
  background: rgba(255, 250, 240, 0.9);
  border-color: rgba(159, 118, 36, 0.24);
}

.pg-card {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(159, 118, 36, 0.2);
}

.pg-chip {
  background: rgba(184, 135, 36, 0.12);
  border-color: rgba(184, 135, 36, 0.24);
}

.pg-btn--primary {
  background: linear-gradient(135deg, #b88724, #d6ab4c);
  color: #20170a;
}

.pg-btn--ghost {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(184, 135, 36, 0.28);
}

.law-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(340px, 1.2fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.case-panel,
.scales-panel,
.choice-block {
  padding: 16px;
}

.case-panel {
  position: relative;
  overflow: hidden;
  z-index: 1;
  color: #1f170b;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 246, 221, 0.94)),
    linear-gradient(135deg, rgba(184, 135, 36, 0.24), transparent);
  border: 2px solid rgba(143, 100, 27, 0.32);
  box-shadow: 0 18px 44px rgba(96, 70, 30, 0.22);
}

body.case-focus .case-panel {
  z-index: 40;
  animation: casePanelLift 0.42s ease both;
}

.case-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, #8f641b, #d6ab4c, #2f8f5b);
}

.case-head h2,
.scales-head h2,
.choice-head h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.case-number-title {
  margin: 2px 0 12px;
  color: #3a2709;
  font-size: clamp(1.65rem, 5vw, 2.65rem);
  font-weight: 900;
  line-height: 0.95;
}

.case-head p {
  margin: 10px 0 0;
  color: #4d3d24;
  font-size: 1.02rem;
}

.law-kicker {
  display: block;
  color: #8d6518;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.facts-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.facts-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(184, 135, 36, 0.22);
  font-weight: 700;
}

.case-panel.is-case-intro .facts-list li,
.case-panel.is-case-intro .profile-card {
  opacity: 0;
  transform: translateY(10px);
}

.facts-list li,
.profile-card {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.facts-list li.is-revealed,
.profile-card.is-revealed,
.case-panel.is-case-intro .facts-list li.is-revealed,
.case-panel.is-case-intro .profile-card.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.fact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #f0d895;
  color: #38240a;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 rgba(143, 100, 27, 0.14);
}

.fact-icon--noise,
.fact-icon--money,
.fact-icon--first {
  font-family: var(--pg-font);
}

.profile-card {
  padding: 14px;
  background: rgba(47, 143, 91, 0.09);
  border-color: rgba(47, 143, 91, 0.22);
}

.profile-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

.profile-card p {
  margin: 8px 0 0;
  color: var(--pg-muted);
}

.scales-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.scales-visual {
  position: relative;
  min-height: 260px;
  margin: 16px 0 12px;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12)),
    repeating-linear-gradient(90deg, rgba(184, 135, 36, 0.08) 0 1px, transparent 1px 42px);
  border: 1px solid rgba(184, 135, 36, 0.2);
}

.scale-beam {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 78px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8f641b, #d3aa4d, #8f641b);
  transform-origin: 50% 50%;
  transition: transform 0.45s ease;
}

.scales-visual.is-right .scale-beam {
  transform: rotate(0deg);
}

.scales-visual.is-wrong .scale-beam {
  transform: rotate(-7deg);
}

.scales-visual.is-waiting .scale-beam {
  transform: rotate(4deg);
}

.scale-column {
  position: absolute;
  left: calc(50% - 8px);
  top: 78px;
  width: 16px;
  height: 132px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(#d3aa4d, #8f641b);
}

.scale-base {
  position: absolute;
  left: calc(50% - 74px);
  bottom: 26px;
  width: 148px;
  height: 24px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(90deg, #8f641b, #d3aa4d, #8f641b);
}

.scale-pan {
  position: absolute;
  top: 38px;
  width: clamp(112px, 38%, 172px);
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 14px 14px 26px 26px;
  background: rgba(255, 252, 244, 0.94);
  border: 2px solid rgba(184, 135, 36, 0.45);
  box-shadow: 0 12px 18px rgba(96, 70, 30, 0.14);
  text-align: center;
  font-weight: 800;
}

.scale-pan::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -42px;
  width: 2px;
  height: 42px;
  background: rgba(143, 100, 27, 0.65);
}

.scale-pan--facts {
  left: 0;
}

.scale-pan--norm {
  right: 0;
}

.drop-zone::after {
  content: none;
}

.drop-zone:not(.has-choice) {
  border-color: rgba(47, 143, 91, 0.58);
  box-shadow: 0 0 24px 7px rgba(47, 143, 91, 0.16), 0 12px 18px rgba(96, 70, 30, 0.14);
  animation: emptyChoicePulse 1.35s ease-in-out infinite;
}

.drop-active {
  outline: 3px solid rgba(47, 143, 91, 0.45);
  outline-offset: 2px;
  background: rgba(47, 143, 91, 0.12);
}

.sentence-zone {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 14px;
  border-radius: 14px;
  border: 2px dashed rgba(184, 135, 36, 0.42);
  background: rgba(255, 255, 255, 0.42);
}

@keyframes emptyChoicePulse {
  0%,
  100% {
    border-color: rgba(47, 143, 91, 0.46);
    box-shadow: 0 0 18px 4px rgba(47, 143, 91, 0.12), 0 12px 18px rgba(96, 70, 30, 0.14);
  }

  50% {
    border-color: rgba(47, 143, 91, 0.9);
    box-shadow: 0 0 38px 12px rgba(47, 143, 91, 0.24), 0 12px 18px rgba(96, 70, 30, 0.14);
  }
}

@keyframes caseFocusFade {
  0%,
  78% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes casePanelLift {
  from {
    transform: translateY(8px) scale(0.985);
  }

  to {
    transform: translateY(0) scale(1);
  }
}

.sentence-zone strong {
  font-size: 1.02rem;
}

.slot-button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 48px;
  align-content: center;
  padding: 8px;
  border-radius: 10px;
  color: var(--pg-text);
  cursor: pointer;
  text-align: center;
}

.slot-button:hover,
.slot-button:focus-visible {
  background: rgba(47, 143, 91, 0.1);
}

.slot-button--wide {
  justify-items: start;
  text-align: left;
  padding: 8px 0;
}

.slot-kicker {
  color: #8d6518;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.check-button {
  width: 100%;
  margin-top: 12px;
}

.law-feedback {
  min-height: 46px;
  margin: 12px 0 0;
  color: var(--pg-muted);
}

.law-feedback.is-right {
  color: var(--pg-success);
  font-weight: 800;
}

.law-feedback.is-wrong {
  color: var(--pg-danger);
  font-weight: 800;
}

.choice-panel {
  display: grid;
  gap: 14px;
}

.choice-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.law-card {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid rgba(184, 135, 36, 0.24);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--pg-text);
  text-align: left;
  cursor: grab;
  transition: transform 0.14s ease, border-color 0.18s ease, background 0.18s ease;
}

.law-card strong {
  display: block;
  line-height: 1.2;
}

.law-card span {
  display: block;
  margin-top: 5px;
  color: var(--pg-muted);
  font-size: 0.84rem;
}

.law-card:hover,
.law-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(184, 135, 36, 0.58);
  background: #fffdf7;
}

.law-card.is-selected {
  border-color: rgba(47, 143, 91, 0.7);
  background: rgba(47, 143, 91, 0.12);
}

.law-card[draggable="true"]:active {
  cursor: grabbing;
}

.law-modal p {
  color: var(--pg-muted);
}

.intro-image {
  display: block;
  width: calc(100% + 44px);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  margin: -22px -22px 16px;
  border-radius: 16px 16px 0 0;
  border: 0;
  box-shadow: none;
}

.specialty-badge {
  display: inline-flex;
  justify-content: center;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(47, 143, 91, 0.1);
  color: #2f6f49;
  font-size: 0.84rem;
  font-weight: 900;
}

.case-panel.is-hard-mode .profile-card {
  display: none;
}

.choice-modal-card {
  text-align: left;
}

.choice-modal-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  max-height: min(56dvh, 460px);
  overflow: auto;
  padding-right: 4px;
}

.choice-modal-card .pg-btn {
  width: 100%;
}

@media (max-width: 1040px) {
  .law-layout {
    grid-template-columns: 1fr 1fr;
  }

  .choice-panel {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .femida-shell {
    width: min(100% - 14px, 1260px);
  }

  .law-layout,
  .choice-panel {
    grid-template-columns: 1fr;
  }

  .scales-head {
    align-items: stretch;
    flex-direction: column;
  }

  .scales-visual {
    min-height: 236px;
  }

  .scale-beam {
    left: 5%;
    right: 5%;
  }

  .scale-pan {
    width: 39%;
    font-size: 0.86rem;
  }

  .choice-panel {
    display: none;
  }

  .case-panel,
  .scales-panel {
    padding: 14px;
  }

  .case-head p {
    font-size: 0.98rem;
  }

  .facts-list li {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .fact-icon {
    width: 32px;
    height: 32px;
  }

  .sentence-zone {
    min-height: 88px;
  }
}
