/* Зачёт: сигналы регулировщика. Стили scoped, чтобы не красить .site-header. */

html,
body.page--regulator {
  height: 100%;
  margin: 0;
}

body.page--regulator {
  display: flex;
  flex-direction: column;
  background: #15202c;
  color: #222;
  overflow: hidden;
}

body.page--regulator .site-header {
  position: static;
  flex-shrink: 0;
  padding-block: 0.35rem;
  background: rgba(12, 22, 34, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.page--regulator .site-header__bar {
  min-height: 48px;
}

body.page--regulator .nav-links a[aria-current="page"] {
  font-weight: 600;
}

html[data-theme="light"] body.page--regulator .site-header {
  background: rgba(250, 249, 246, 0.94);
  border-bottom: 1px solid rgba(226, 221, 208, 0.45);
}

#app {
  flex: 1;
  min-height: 0;
  display: flex;
}

#scene {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

#scene canvas {
  display: block;
}

#flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s;
}

#flash.red {
  background: rgba(255, 30, 30, 0.55);
  opacity: 1;
  transition: none;
}

#flash.green {
  background: rgba(40, 200, 90, 0.35);
  opacity: 1;
  transition: none;
}

#vlabel {
  position: absolute;
  display: none;
  pointer-events: none;
  transform: translateY(-50%);
  white-space: nowrap;
  background: rgba(20, 90, 50, 0.85);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 5px 11px;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#vlabel::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right-color: rgba(20, 90, 50, 0.85);
  border-left: 0;
}

#outcome {
  position: absolute;
  right: 16px;
  bottom: 16px;
  max-width: 340px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: translateY(20px);
  transition: 0.3s;
  pointer-events: none;
  line-height: 1.35;
}

#outcome.show {
  opacity: 1;
  transform: none;
}

#outcome.ok {
  background: rgba(25, 140, 70, 0.92);
}

#outcome.bad {
  background: rgba(200, 40, 40, 0.94);
}

#outcome.warn {
  background: rgba(210, 140, 0, 0.94);
}

#panel {
  width: 400px;
  max-width: 100%;
  background: #f4f6f8;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-left: 4px solid #0a5cad;
}

#panel .reg-head {
  background: #0a5cad;
  color: #fff;
  padding: 12px 16px;
}

#panel .reg-head h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

#panel .reg-crumb {
  margin: 0 0 6px;
  font-size: 12px;
  opacity: 0.85;
}

#panel .reg-crumb a {
  color: #d6ecff;
  text-decoration: none;
}

#panel .reg-crumb a:hover {
  text-decoration: underline;
}

#progress {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 4px;
}

#content {
  padding: 14px 16px;
  flex: 1;
}

#qtext {
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 14px;
  font-weight: 500;
}

.ans {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin: 6px 0;
  border: 2px solid #c9d2dc;
  background: #fff;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
}

.ans:hover:not(:disabled) {
  border-color: #0a5cad;
}

.ans.correct {
  border-color: #1e9e4a;
  background: #e5f7ea;
}

.ans.wrong {
  border-color: #d33;
  background: #fdeaea;
}

.ans:disabled {
  cursor: default;
}

body.page--regulator .rsya-slot--reg {
  position: relative;
  margin: 10px 0 2px;
  padding: 8px 10px 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #c9d2dc;
  box-shadow: none;
  max-width: 100%;
}

body.page--regulator .rsya-slot--reg .rsya-slot__label {
  color: #667;
  opacity: 0.85;
}

#feedback {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  display: none;
}

#feedback.ok {
  display: block;
  background: #e5f7ea;
  border-left: 4px solid #1e9e4a;
}

#feedback.bad {
  display: block;
  background: #fdeaea;
  border-left: 4px solid #d33;
}

.btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button.b {
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: #0a5cad;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

button.b.sec {
  background: #5d6b7a;
}

button.b.play {
  background: #1e9e4a;
}

button.b.play.alt {
  background: #e08a00;
}

button.b:disabled {
  opacity: 0.45;
  cursor: default;
}

#panel details {
  margin: 10px 16px 16px;
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
}

#panel summary {
  cursor: pointer;
  font-weight: 600;
}

.rhyme {
  font-style: italic;
  color: #444;
  margin: 8px 0;
  padding-left: 10px;
  border-left: 3px solid #f0b400;
}

.result {
  text-align: center;
  padding: 20px 0;
}

.result h2 {
  margin: 6px 0;
}

.pass {
  color: #1e9e4a;
}

.fail {
  color: #d33;
}

.reg-links {
  margin: 0 16px 16px;
  font-size: 13px;
  line-height: 1.45;
  color: #445;
}

.reg-links a {
  color: #0a5cad;
}

.reg-noscript,
#reg-webgl-fail {
  margin: 0;
  padding: 1rem 1.1rem;
  background: #1b2a3a;
  color: #e8eef4;
  font-size: 15px;
  line-height: 1.45;
}

.reg-noscript a,
#reg-webgl-fail a {
  color: #7ec8ff;
}

@media (max-width: 900px) {
  body.page--regulator {
    overflow: auto;
  }

  #app {
    flex-direction: column;
    min-height: calc(100dvh - 56px);
  }

  #scene {
    height: 42vh;
    flex: none;
  }

  #panel {
    width: 100%;
    flex: 1;
    border-left: 0;
    border-top: 4px solid #0a5cad;
  }

  body.page--regulator .rsya-slot--reg {
    margin: 8px 0 0;
    padding: 4px 6px;
    max-height: 72px;
    overflow: hidden;
  }

  body.page--regulator .rsya-slot--reg .rsya-slot__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  body.page--regulator #rsya-card {
    height: 56px;
    max-height: 56px;
    overflow: hidden;
  }

  body.page--regulator #rsya-card iframe,
  body.page--regulator #rsya-card > div {
    max-height: 56px !important;
  }
}
