
:root {
  --pg-bg: #0b1118;
  --pg-surface: rgba(17, 25, 36, 0.82);
  --pg-surface-strong: rgba(22, 32, 46, 0.94);
  --pg-card: rgba(255, 255, 255, 0.055);
  --pg-card-border: rgba(139, 173, 213, 0.18);
  --pg-text: #edf6ff;
  --pg-muted: #a9bacb;
  --pg-accent: #7ec3ff;
  --pg-accent-2: #4ee2a0;
  --pg-danger: #ff7b7b;
  --pg-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--pg-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(126, 195, 255, 0.19), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(78, 226, 160, 0.13), transparent 30%),
    linear-gradient(135deg, #080d13 0%, #101823 48%, #071018 100%);
}

button, input, textarea, select { font: inherit; }

button { color: inherit; }

.pg-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 30px);
}

.pg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.pg-title {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.pg-subtitle {
  max-width: 690px;
  margin: 12px 0 0;
  color: var(--pg-muted);
  font-size: clamp(0.98rem, 1.7vw, 1.1rem);
  line-height: 1.55;
}

.pg-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(460px, 100%);
}

.pg-chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(139, 173, 213, 0.16);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  color: var(--pg-muted);
}

.pg-chip strong,
.pg-chip span { color: var(--pg-text); }

.pg-panel {
  border-radius: 24px;
  background: linear-gradient(180deg, var(--pg-surface-strong), var(--pg-surface));
  border: 1px solid rgba(139, 173, 213, 0.18);
  box-shadow: var(--pg-shadow);
  backdrop-filter: blur(14px);
}

.pg-card {
  border-radius: 18px;
  background: var(--pg-card);
  border: 1px solid var(--pg-card-border);
}

.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 15px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.pg-btn:hover { transform: translateY(-1px); }

.pg-btn--primary {
  color: #06111a;
  background: linear-gradient(135deg, #9bd4ff, #55e0a4);
  box-shadow: 0 14px 32px rgba(74, 190, 255, 0.25);
}

.pg-btn--ghost {
  color: var(--pg-text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(139, 173, 213, 0.18);
}

@media (max-width: 760px) {
  .pg-header { display: grid; }
  .pg-chip-row { justify-content: flex-start; min-width: 0; }
}

.diag-layout {
  display: grid;
  gap: 16px;
}

.diag-main,
.tool-panel,
.log-panel {
  padding: 16px;
}

.diag-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.complaint-card,
.workflow-row,
.tool-grid,
.summary-grid {
  display: grid;
  gap: 12px;
}

.complaint-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 16px;
}

.complaint-card h2,
.tool-panel h2 {
  margin: 4px 0 6px;
}

.complaint-card p,
.tool-help,
.phase-card p {
  margin: 0;
  color: var(--pg-muted);
}

.section-kicker {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7ec3ff;
}

.workflow-row {
  margin-top: 12px;
}

.phase-card {
  padding: 14px;
}

.phase-card strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 1rem;
}

.garage {
  margin-top: 16px;
}

.car-stage {
  position: relative;
  min-height: 460px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(61, 156, 240, 0.18), transparent 35%),
    linear-gradient(180deg, #182433, #0f1722);
  border: 1px solid rgba(112, 138, 170, 0.25);
}

.road-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.3) 0,
    rgba(255, 255, 255, 0.3) 18px,
    transparent 18px,
    transparent 36px
  );
  opacity: 0.35;
  z-index: 0;
}

.road-mark--left {
  left: 16%;
}

.road-mark--right {
  right: 16%;
}

.car-illustration {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.car-shadow {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 61%;
  height: 56px;
  border-radius: 50%;
  background: rgba(2, 8, 13, 0.46);
  filter: blur(12px);
}

.car-body {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 31%;
  height: 112px;
  border-radius: 42px 54px 28px 28px;
  background: linear-gradient(180deg, #d3e5f4, #758ca2 72%, #5d7084);
  border: 3px solid rgba(255, 255, 255, 0.15);
}

.car-cabin {
  position: absolute;
  left: 23%;
  right: 18%;
  top: -42px;
  height: 58px;
  border-radius: 28px 34px 8px 8px;
  background: linear-gradient(180deg, #bdd7eb, #7894ae);
}

.car-window {
  position: absolute;
  top: -30px;
  height: 34px;
  background: rgba(27, 45, 62, 0.72);
  border-radius: 8px;
}

.car-window--front {
  left: 34%;
  width: 18%;
}

.car-window--rear {
  left: 54%;
  width: 16%;
}

.car-light {
  position: absolute;
  top: 42px;
  width: 20px;
  height: 12px;
  border-radius: 999px;
}

.car-light--front {
  left: 6px;
  background: #ffe08a;
}

.car-light--rear {
  right: 8px;
  background: #ff8a8a;
}

.car-wheel {
  position: absolute;
  top: 58%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #616b77 0 18%, #1c232b 18% 44%, #05080b 44% 100%);
  border: 6px solid #11161b;
}

.car-wheel--front {
  left: 24%;
}

.car-wheel--rear {
  right: 24%;
}

.zone {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 2px dashed rgba(126, 195, 255, 0.18);
  background: rgba(126, 195, 255, 0.06);
  color: #dceefe;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.18s ease, background 0.18s ease;
  z-index: 3;
}

.zone span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 14, 20, 0.46);
}

.zone:hover,
.zone.is-hovered,
.zone.is-selected {
  border-color: rgba(126, 195, 255, 0.62);
  background: rgba(126, 195, 255, 0.14);
  transform: scale(1.02);
}

.zone.is-correct {
  border-color: rgba(62, 207, 142, 0.8);
  background: rgba(62, 207, 142, 0.14);
}

.zone.is-wrong {
  border-color: rgba(232, 93, 93, 0.75);
  background: rgba(232, 93, 93, 0.14);
}

.zone--engine {
  left: 11%;
  top: 34%;
  width: 26%;
  height: 22%;
}

.zone--salon {
  left: 39%;
  top: 20%;
  width: 29%;
  height: 27%;
}

.zone--wheel {
  right: 17%;
  top: 50%;
  width: 20%;
  height: 22%;
}

.zone--suspension {
  left: 33%;
  bottom: 10%;
  width: 34%;
  height: 16%;
}

.tool-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tool-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  min-height: 92px;
  text-align: left;
  cursor: grab;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(126, 195, 255, 0.14), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(154, 190, 226, 0.24);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 12px 26px rgba(2, 8, 13, 0.16);
  transition: transform 0.14s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 20%, rgba(126, 195, 255, 0.22), transparent 34%);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.tool-card:hover,
.tool-card.is-selected {
  transform: translateY(-2px);
  border-color: rgba(126, 195, 255, 0.68);
  background:
    linear-gradient(135deg, rgba(126, 195, 255, 0.2), rgba(74, 222, 128, 0.06)),
    rgba(126, 195, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 16px 32px rgba(2, 8, 13, 0.24);
}

.tool-card:hover::before,
.tool-card.is-selected::before {
  opacity: 1;
}

.tool-card.is-selected {
  outline: 2px solid rgba(126, 195, 255, 0.18);
  outline-offset: 2px;
}

.tool-card.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.tool-card__icon {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.34), transparent 38%),
    linear-gradient(145deg, rgba(126, 195, 255, 0.36), rgba(42, 67, 92, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px rgba(0, 0, 0, 0.2);
  color: #ffffff;
  font-size: 1.55rem;
  margin: 0;
}

.tool-card__content {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
}

.tool-card strong {
  display: block;
  color: var(--pg-text);
  font-size: 0.96rem;
  line-height: 1.2;
}

.tool-card__content span {
  display: block;
  color: var(--pg-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  margin-top: 5px;
}

.log-list {
  margin: 0;
  padding-left: 18px;
  color: var(--pg-text);
}

.log-list li + li {
  margin-top: 8px;
}

.log-panel {
  padding: 10px;
}

.log-panel summary {
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(130, 156, 189, 0.14);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.log-summary-title {
  font-size: 1rem;
}

.log-panel summary::-webkit-details-marker {
  display: none;
}

.log-panel summary::after {
  content: "▾";
  color: rgba(232, 238, 245, 0.72);
}

.log-panel[open] summary::after {
  content: "▴";
}

.log-panel .log-list {
  padding: 12px 0 4px 18px;
}

.result-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 10, 15, 0.72);
  backdrop-filter: blur(6px);
  z-index: 40;
}

.result-modal[hidden] {
  display: none;
}

.result-card {
  width: min(520px, 100%);
  padding: 22px;
  text-align: center;
}

.summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0;
}

.summary-grid .pg-card {
  padding: 14px;
}

.summary-grid span {
  display: block;
  color: var(--pg-muted);
  margin-bottom: 6px;
}

@media (min-width: 980px) {
  .diag-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.72fr);
    align-items: start;
  }

  .workflow-row,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .complaint-card {
    grid-template-columns: 1fr;
  }

  .tool-panel__head {
    flex-direction: column;
  }

  .car-stage {
    min-height: min(46vh, 380px);
  }

  .diag-main,
  .tool-panel,
  .log-panel {
    padding: 14px;
  }

  .workflow-row {
    gap: 10px;
  }

  .phase-card {
    padding: 12px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-card {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
    min-height: 82px;
  }

  .tool-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 1.35rem;
  }

  .log-panel summary {
    padding: 10px 12px;
  }

  .log-panel .log-list {
    padding-top: 10px;
  }
}

@media (max-width: 640px) {
  .complaint-card {
    padding: 12px;
  }

  .phase-card strong {
    font-size: 0.98rem;
  }

  .tool-card span {
    font-size: 0.82rem;
  }

  .zone {
    font-size: 0.88rem;
  }

  .car-wheel {
    width: 64px;
    height: 64px;
  }

  .car-body {
    left: 9%;
    right: 9%;
  }

  .zone--engine {
    left: 6%;
    width: 30%;
  }

  .zone--salon {
    left: 36%;
    width: 30%;
  }

  .zone--wheel {
    right: 10%;
    width: 23%;
  }

  .zone--suspension {
    left: 28%;
    width: 40%;
  }
}
