/* KSIM_V57 — avalik režiimivalik ja juhendatud esimene kontakt. */

.mode-selector {
  position: absolute;
  z-index: 500;
  inset: 0;
  display: none;
  overflow: hidden;
  color: #effcff;
  background: #071323;
}

.mode-selector.open {
  display: grid;
  place-items: center;
}

.mode-selector-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(3, 31, 58, .985), rgba(0, 13, 33, .99));
}

.mode-selector-backdrop::before,
.mode-selector-backdrop::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(50, 147, 199, .22);
  border-radius: 50%;
  box-shadow:
    0 0 0 .65cqw rgba(61, 173, 225, .035),
    0 0 0 1.3cqw rgba(61, 173, 225, .025);
}

.mode-selector-backdrop::before {
  width: 35cqw;
  height: 35cqw;
  right: -9cqw;
  top: -13cqw;
}

.mode-selector-backdrop::after {
  width: 22cqw;
  height: 22cqw;
  left: -8cqw;
  bottom: -10cqw;
  border-color: rgba(211, 163, 48, .23);
}

.mode-selector-shell {
  position: relative;
  z-index: 1;
  width: min(91%, 1500px);
  height: 91%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: .8cqw;
  padding: 1.2cqw 1.45cqw .9cqw;
  overflow: hidden;
  border: 1px solid rgba(91, 218, 255, .54);
  background:
    linear-gradient(rgba(72, 171, 219, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 171, 219, .035) 1px, transparent 1px),
    rgba(2, 18, 40, .95);
  background-size: 1.15cqw 1.15cqw;
  box-shadow: 0 1.6cqw 5cqw rgba(24, 76, 108, .17), inset 0 0 2cqw rgba(58, 174, 224, .06);
  backdrop-filter: blur(14px) saturate(1.06);
}

.mode-selector-header {
  display: grid;
  justify-items: center;
  text-align: center;
}

.mode-version {
  margin-bottom: .25cqw;
  color: #93eaff;
  font-size: clamp(9px, .62cqw, 12px);
  font-weight: 900;
  letter-spacing: .15em;
}

.mode-selector-header h1 {
  margin: 0;
  color: #f7fdff;
  font-size: clamp(28px, 2.7cqw, 48px);
  line-height: 1;
  letter-spacing: -.035em;
}

.mode-selector-header p {
  margin: .38cqw 0 0;
  color: #c1e0ec;
  font-size: clamp(12px, .92cqw, 17px);
  font-weight: 650;
}

.mode-role-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .55cqw;
}

.mode-role-line > span {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: .55cqw;
  align-items: center;
  min-width: 0;
  padding: .42cqw .65cqw;
  border: 1px solid rgba(92, 211, 255, .28);
  background: rgba(2, 24, 48, .76);
}

.mode-role-line img {
  grid-row: 1 / 3;
  width: 1.75cqw;
  height: 1.75cqw;
  min-width: 21px;
  min-height: 21px;
  object-fit: contain;
  filter: saturate(.8);
}

.mode-role-line b {
  overflow: hidden;
  color: #effcff;
  font-size: clamp(10px, .73cqw, 14px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-role-line small {
  overflow: hidden;
  color: #b8d7e2;
  font-size: clamp(8px, .52cqw, 10px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9cqw;
  min-height: 0;
}

.mode-card {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  column-gap: .85cqw;
  align-content: start;
  padding: 1cqw 1.1cqw .85cqw;
  overflow: hidden;
  border: 1px solid rgba(89, 215, 255, .58);
  background: linear-gradient(145deg, rgba(4, 32, 61, .94), rgba(2, 16, 38, .93));
  box-shadow: 0 .7cqw 2.2cqw rgba(32, 87, 118, .09);
}

.mode-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -42% 45%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 190, 239, .11), rgba(62, 190, 239, 0) 70%);
  pointer-events: none;
}

.mode-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 28%;
  right: 28%;
  top: 38%;
  bottom: 13%;
  background: url("../../assets/tall-white-pixel.png") center / contain no-repeat;
  opacity: .13;
  filter: grayscale(.18) saturate(.55);
  image-rendering: pixelated;
  pointer-events: none;
}

.mode-card-program::before {
  left: 18%;
  right: 18%;
  top: 40%;
  bottom: 14%;
  background-image: url("../../assets/contact-team-pixel.png");
  opacity: .105;
}

.mode-card-demo {
  border-color: rgba(111, 226, 255, .72);
  background: linear-gradient(145deg, rgba(5, 43, 74, .96), rgba(2, 23, 51, .95));
}

.mode-card-demo::after {
  background: radial-gradient(circle, rgba(62, 190, 239, .13), rgba(62, 190, 239, 0) 70%);
}

.mode-card-kicker {
  grid-column: 1 / -1;
  justify-self: start;
  margin-bottom: .35cqw;
  padding: .2cqw .42cqw;
  border: 1px solid rgba(92, 211, 255, .28);
  color: #93eaff;
  background: rgba(2, 24, 48, .8);
  font-size: clamp(8px, .52cqw, 10px);
  font-weight: 950;
  letter-spacing: .12em;
}

.mode-card-demo .mode-card-kicker {
  border-color: rgba(255, 210, 31, .3);
  color: #ffe58a;
  background: rgba(2, 24, 48, .8);
}

.mode-card-icon {
  grid-row: 2 / 4;
  width: 4.2cqw;
  height: 4.2cqw;
  min-width: 46px;
  min-height: 46px;
  padding: .55cqw;
  border: 1px solid rgba(92, 211, 255, .28);
  background: rgba(2, 24, 48, .76);
  object-fit: contain;
}

.mode-card-demo .mode-card-icon {
  border-color: rgba(111, 226, 255, .48);
  background: rgba(2, 24, 48, .8);
}

.mode-card h2 {
  margin: 0;
  color: #f7fdff;
  font-size: clamp(20px, 1.65cqw, 30px);
  line-height: 1.05;
}

.mode-card p {
  margin: .38cqw 0 .45cqw;
  color: #c1e0ec;
  font-size: clamp(10px, .72cqw, 14px);
  line-height: 1.35;
}

.mode-card > button,
.mode-card > small {
  grid-column: 1 / -1;
}

.mode-journey,
.mode-program-metrics {
  grid-column: 1 / -1;
  align-self: center;
  position: relative;
  z-index: 1;
  min-height: 0;
}

.mode-journey {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .42cqw;
  padding: .6cqw;
  border: 1px solid rgba(92, 211, 255, .28);
  background: rgba(2, 24, 48, .76);
}

.mode-journey span {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .32cqw;
  align-items: center;
  min-width: 0;
  padding: .35cqw .4cqw;
  border: 1px solid rgba(89, 215, 255, .28);
  color: #d9f7ff;
  background: rgba(3, 20, 42, .82);
  font-size: clamp(8px, .53cqw, 10px);
  font-weight: 850;
}

.mode-journey span b {
  color: #83dff5;
  font-size: clamp(8px, .49cqw, 10px);
  letter-spacing: .05em;
}

.mode-journey em,
.mode-program-metrics em {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: .18cqw;
  color: #b8d7e2;
  font-size: clamp(8px, .52cqw, 10px);
  font-style: normal;
  font-weight: 800;
  letter-spacing: .025em;
}

.mode-program-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5cqw;
  padding: .72cqw;
  border: 1px solid rgba(92, 211, 255, .28);
  background: rgba(2, 24, 48, .76);
}

.mode-program-metrics span {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 4.5cqw;
  padding: .45cqw;
  border: 1px solid rgba(89, 215, 255, .28);
  background: rgba(3, 20, 42, .82);
}

.mode-program-metrics span b {
  color: #65e2ff;
  font-size: clamp(22px, 2cqw, 36px);
  line-height: 1;
}

.mode-program-metrics span small {
  margin-top: .2cqw;
  color: #c1e0ec;
  font-size: clamp(8px, .52cqw, 10px);
  font-weight: 800;
  text-align: center;
}

.mode-primary-button,
.mode-secondary-button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 2.8cqw;
  border: 1px solid;
  padding: .68cqw .9cqw;
  font-size: clamp(10px, .75cqw, 14px);
  font-weight: 950;
  letter-spacing: .055em;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.mode-primary-button {
  border-color: #55dcff;
  color: #fff;
  background: linear-gradient(110deg, #125276, #238db9);
  box-shadow: 0 .45cqw 1.2cqw rgba(18, 88, 123, .18);
}

.mode-secondary-button {
  border-color: #55dcff;
  color: #fff;
  background: linear-gradient(145deg, rgba(5, 43, 74, .93), rgba(2, 23, 51, .95));
  box-shadow: 0 .45cqw 1.2cqw rgba(18, 88, 123, .18);
}

.mode-primary-button:hover,
.mode-secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 .6cqw 1.5cqw rgba(22, 89, 120, .22);
}

.mode-primary-button:focus-visible,
.mode-secondary-button:focus-visible,
.mode-text-button:focus-visible {
  outline: 3px solid rgba(111, 226, 255, .72);
  outline-offset: 2px;
}

.mode-card > small {
  position: relative;
  z-index: 1;
  margin-top: .35cqw;
  color: #b8d7e2;
  font-size: clamp(8px, .5cqw, 10px);
  text-align: center;
}

.mode-selector-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8cqw;
  min-height: 1.7cqw;
  color: #c1e0ec;
  font-size: clamp(9px, .57cqw, 11px);
  font-weight: 700;
}

.mode-text-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: .1cqw .2cqw;
  color: #93eaff;
  background: transparent;
  font-size: inherit;
  font-weight: 900;
  cursor: pointer;
}

.mode-menu-button {
  border-color: rgba(255, 210, 31, .52) !important;
  color: #ffe990 !important;
}

body[data-game-mode="demo"] #commandCenterToggle,
body[data-game-mode="demo"] #analysisToggle,
body[data-game-mode="demo"] .incoming-contact-panel {
  display: none !important;
}

body[data-game-mode="demo"] .scene .tutorial-coach.visible {
  z-index: 30 !important;
  left: 1.1% !important;
  right: auto !important;
  bottom: 2.2% !important;
  display: block !important;
  width: 18.5% !important;
  max-width: none !important;
  padding: .48cqw .58cqw !important;
  border: 1px solid rgba(255, 210, 31, .68) !important;
  border-radius: .25cqw !important;
  background: rgba(3, 19, 38, .94) !important;
  box-shadow: 0 0 .8cqw rgba(255, 210, 31, .16) !important;
}

body[data-game-mode="demo"] .scene .tutorial-coach strong {
  color: #ffe58a !important;
  font-size: clamp(8px, .55cqw, 11px) !important;
  letter-spacing: .05em;
}

body[data-game-mode="demo"] .scene .tutorial-coach span {
  margin-top: .2cqw !important;
  color: #e8f8ff !important;
  font-size: clamp(8px, .49cqw, 10px) !important;
  line-height: 1.28 !important;
  white-space: normal !important;
}

body[data-game-mode="demo"] .fixed-bottom-hud {
  border-color: rgba(255, 210, 31, .2);
}

.demo-result-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .55cqw;
  align-items: center;
  padding: .42cqw .55cqw;
  border: 1px solid rgba(255, 210, 31, .52);
  background: rgba(3, 19, 38, .94);
}

.demo-result-note img {
  width: 2.1cqw;
  height: 2.1cqw;
  min-width: 24px;
  min-height: 24px;
  object-fit: contain;
}

.demo-result-note strong,
.demo-result-note span {
  display: block;
}

.demo-result-note strong {
  color: #ffe58a;
  font-size: clamp(9px, .62cqw, 12px);
}

.demo-result-note span {
  margin-top: .08cqw;
  color: #d7eef7;
  font-size: clamp(8px, .49cqw, 10px);
}

.demo-result-actions {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .35cqw;
}

.demo-result-actions button {
  min-width: 0;
}

body[data-game-mode="demo"] .scene[data-step-type="result"] .interactive-area {
  overflow: hidden !important;
}

body[data-game-mode="demo"] .scene[data-step-type="result"] .result-dashboard {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto !important;
  gap: .22cqw !important;
  overflow: hidden !important;
  padding-bottom: 0 !important;
}

body[data-game-mode="demo"] .result-dashboard > .metric-row,
body[data-game-mode="demo"] .result-dashboard > .human-reaction-card,
body[data-game-mode="demo"] .result-dashboard > .result-branch-summary,
body[data-game-mode="demo"] .result-dashboard > .result-health-v46 {
  display: none !important;
}

body[data-game-mode="demo"] .result-hero {
  gap: .3cqw !important;
}

body[data-game-mode="demo"] .result-hero p {
  display: none !important;
}

body[data-game-mode="demo"] .result-medal {
  width: 3.7cqw !important;
  height: 3.7cqw !important;
  min-width: 42px !important;
  min-height: 42px !important;
}

body[data-game-mode="demo"] .result-consciousness {
  width: 2.8cqw !important;
  height: 2.8cqw !important;
  min-width: 31px !important;
  min-height: 31px !important;
}

body[data-game-mode="demo"] .result-diagnosis {
  min-height: 0;
  gap: .35cqw;
  margin-top: 0;
  overflow: hidden;
}

body[data-game-mode="demo"] .diagnosis-card {
  min-height: 0;
  padding: .38cqw;
  overflow: hidden;
}

body[data-game-mode="demo"] .diagnosis-card p {
  margin-top: .12cqw;
  font-size: clamp(8px, .5cqw, 10px);
  line-height: 1.18;
}

body[data-game-mode="demo"] .result-components {
  gap: .14cqw;
}

body[data-game-mode="demo"] .result-component i {
  min-height: 3px;
}

body[data-game-mode="demo"] .scene[data-step-type="result"] .result-actions {
  min-height: 0;
  padding-bottom: 0 !important;
}

@container (max-width: 980px) {
  .mode-selector-shell {
    width: 95%;
    height: 94%;
    padding: .8cqw 1cqw .65cqw;
  }

  .mode-choice-grid {
    gap: .65cqw;
  }

  .mode-card {
    padding: .75cqw .85cqw .65cqw;
  }

  .mode-card-icon {
    width: 3.5cqw;
    height: 3.5cqw;
  }

  .mode-role-line small {
    display: none;
  }
}

@media (max-width: 720px) {
  .mode-selector {
    position: fixed;
    overflow: auto;
  }

  .mode-selector-shell {
    width: 100%;
    min-height: 100%;
    height: auto;
    overflow: visible;
  }

  .mode-role-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-choice-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 310px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-primary-button,
  .mode-secondary-button {
    transition: none;
  }
}
