.monitor {
  position: relative;
  z-index: 2;
  width: min(780px, 83vw);
  filter: drop-shadow(0 27px 20px rgba(0, 0, 0, 0.45));
  transform: rotateX(0.5deg);
  transform-style: preserve-3d;
}

.monitor__case {
  position: relative;
  padding: 16px 24px 15px;
  border: 1px solid #777967;
  border-radius: 18px 18px 13px 13px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.1), transparent 8%, transparent 90%, rgba(0, 0, 0, 0.13)),
    linear-gradient(180deg, #c4c1a9, #a5a28c 56%, #8d8a77);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.45),
    inset -7px -8px 15px rgba(67, 67, 54, 0.26),
    0 18px 38px rgba(0, 0, 0, 0.5);
}

.monitor__case::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle at 8% 21%, rgba(55, 52, 38, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 91% 74%, rgba(255, 255, 230, 0.15) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 9%, rgba(72, 66, 43, 0.12) 0 1.5px, transparent 2.5px);
  background-size: 43px 37px, 61px 53px, 79px 67px;
  mix-blend-mode: multiply;
  opacity: 0.7;
}

.monitor__case::before {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 13px;
}

.monitor__top-details {
  display: flex;
  justify-content: space-between;
  padding: 0 6px 8px;
  color: rgba(43, 44, 37, 0.62);
  font-family: var(--condensed);
  font-size: 7px;
  letter-spacing: 1.5px;
}

.monitor__bezel {
  position: relative;
  padding: clamp(11px, 2vw, 22px);
  border: 2px solid #46483f;
  border-radius: 25px;
  background: linear-gradient(135deg, #30332c, #121512 50%, #393a32);
  box-shadow:
    inset 8px 8px 20px rgba(0, 0, 0, 0.8),
    inset -2px -2px 4px rgba(239, 239, 211, 0.17),
    0 1px rgba(255, 255, 255, 0.2);
}

.monitor__bezel,
.monitor__controls,
.monitor__top-details {
  position: relative;
  z-index: 1;
}

.crt-screen {
  position: relative;
  height: clamp(300px, 46vw, 460px);
  overflow: hidden;
  border: 2px solid #080b09;
  border-radius: 48% / 8%;
  background:
    radial-gradient(ellipse at center, rgba(30, 75, 36, 0.28), transparent 73%),
    #061009;
  box-shadow:
    inset 0 0 55px 18px #010302,
    inset 0 0 25px rgba(66, 255, 89, 0.16),
    0 0 2px rgba(164, 255, 173, 0.4);
  outline: none;
  cursor: text;
}

.crt-screen:focus-visible {
  box-shadow:
    inset 0 0 55px 18px #010302,
    inset 0 0 25px rgba(66, 255, 89, 0.2),
    0 0 0 2px rgba(118, 255, 131, 0.46),
    0 0 18px rgba(118, 255, 131, 0.2);
}

.crt-screen__glow,
.crt-screen__scanlines,
.crt-screen__noise,
.crt-screen__reflection {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.crt-screen__glow {
  background: radial-gradient(ellipse, rgba(91, 255, 108, 0.055), transparent 68%);
  animation: crt-flicker 4s steps(1) infinite;
}

.crt-screen__scanlines {
  z-index: 4;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.2) 3px,
    rgba(0, 0, 0, 0.2) 4px
  );
  opacity: 0.67;
}

.crt-screen__reflection {
  z-index: 3;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.055), transparent 18%, transparent 74%, rgba(255, 255, 255, 0.025));
}

.crt-screen__noise {
  z-index: 3;
  background:
    repeating-radial-gradient(circle at 23% 47%, rgba(168, 255, 175, 0.11) 0 0.45px, transparent 0.8px 2px),
    repeating-linear-gradient(91deg, transparent 0 4px, rgba(128, 255, 139, 0.035) 5px 6px);
  background-size: 7px 5px, 13px 100%;
  mix-blend-mode: screen;
  opacity: 0.17;
  animation: crt-noise 190ms steps(2) infinite;
}

.terminal-content {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: clamp(25px, 4vw, 42px) clamp(26px, 5vw, 56px);
  color: var(--phosphor);
  text-shadow: 0 0 6px rgba(107, 255, 121, 0.58);
}

[hidden] {
  display: none !important;
}

.round-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--phosphor);
  background:
    radial-gradient(ellipse at center, rgba(21, 72, 29, 0.26), transparent 68%),
    rgba(3, 10, 5, 0.94);
  text-align: center;
  text-shadow: 0 0 7px rgba(107, 255, 121, 0.6);
}

.round-overlay::before,
.round-overlay::after {
  content: "";
  width: min(330px, 70%);
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(90deg, transparent, rgba(118, 255, 131, 0.65), transparent);
}

.round-overlay::before {
  order: -1;
  margin-bottom: 14px;
}

.round-overlay__eyebrow {
  color: rgba(145, 255, 155, 0.58);
  font-size: clamp(7px, 1vw, 10px);
  letter-spacing: 2.5px;
}

.round-overlay h2 {
  margin: 10px 0 0;
  color: var(--phosphor-bright);
  font: 500 clamp(18px, 3vw, 30px)/1.1 var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.round-overlay p {
  max-width: 430px;
  margin: 12px 0 3px;
  color: rgba(157, 255, 167, 0.62);
  font-size: clamp(7px, 1.05vw, 10px);
}

.round-overlay__countdown {
  margin-top: 10px;
  color: var(--phosphor-bright);
  font: 500 clamp(28px, 5vw, 52px)/1 var(--mono);
  letter-spacing: 4px;
}

.round-overlay small {
  margin-top: 7px;
  color: rgba(145, 255, 155, 0.48);
  font-size: clamp(6px, 0.85vw, 8px);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.round-overlay::after {
  margin-top: 14px;
}

.results-panel {
  width: min(590px, 100%);
  max-height: 145px;
  margin-top: 9px;
  overflow: auto;
  border-block: 1px solid rgba(118, 255, 131, 0.28);
  background: rgba(0, 0, 0, 0.18);
  scrollbar-color: rgba(118, 255, 131, 0.45) transparent;
  scrollbar-width: thin;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: rgba(178, 255, 186, 0.76);
  font: clamp(7px, 1vw, 9px)/1.25 var(--mono);
  text-align: right;
}

.results-table th,
.results-table td {
  padding: 6px 7px;
  border-bottom: 1px solid rgba(118, 255, 131, 0.1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: rgba(178, 255, 186, 0.5);
  background: #061009;
  font-size: 0.82em;
  font-weight: 500;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.results-table th:first-child,
.results-table td:first-child {
  width: 9%;
  text-align: center;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  width: 37%;
  text-align: left;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3),
.results-table th:nth-child(4),
.results-table td:nth-child(4) {
  width: 17%;
}

.results-table th:last-child,
.results-table td:last-child {
  width: 20%;
}

.results-table tbody tr[data-rank="1"] {
  color: var(--phosphor-bright);
  background: rgba(118, 255, 131, 0.08);
}

.results-table tbody tr.is-current-player {
  color: #071509;
  background: rgba(153, 255, 163, 0.86);
  text-shadow: none;
}

.results-table tbody tr.is-current-player td:nth-child(2)::after {
  content: "YOU";
  float: right;
  margin-left: 6px;
  padding: 1px 3px;
  color: #d9ffdc;
  background: #173e1c;
  font-size: 0.7em;
  letter-spacing: 0.5px;
}

.round-overlay .results-empty {
  margin: 0;
  padding: 20px;
  color: rgba(145, 255, 155, 0.48);
  font-size: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

body[data-fase="RESULTADOS"] .round-overlay {
  padding-block: 15px;
}

.terminal-content__bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: clamp(16px, 2.5vw, 29px);
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(118, 255, 131, 0.44);
  font-size: clamp(7px, 1.15vw, 11px);
  letter-spacing: 1px;
}

.code-preview {
  max-height: calc(100% - 72px);
  margin: 0;
  overflow: auto;
  color: inherit;
  font: clamp(8px, 1.55vw, 14px)/1.62 var(--mono);
  white-space: pre;
  scrollbar-width: none;
}

.code-preview::-webkit-scrollbar {
  display: none;
}

.code-done {
  color: rgba(195, 255, 200, 0.78);
}

.code-pending {
  color: rgba(118, 255, 131, 0.4);
}

.code-current {
  display: inline-block;
  min-width: 0.62em;
  height: 1.18em;
  padding-inline: 0.05em;
  color: #031006;
  background: var(--phosphor-bright);
  box-shadow: 0 0 8px rgba(118, 255, 131, 0.8);
  text-align: center;
  text-shadow: none;
  vertical-align: -0.18em;
  animation: cursor-pulse 1.15s steps(2) infinite;
}

.code-current--space,
.code-current--newline {
  color: rgba(3, 16, 6, 0.68);
  font-size: 0.78em;
  font-weight: 600;
}

.crt-screen.is-correct .code-current {
  animation: key-correct 120ms ease-out;
}

.crt-screen.is-error {
  animation: screen-error 160ms ease-out;
}

.crt-screen.is-error .code-current {
  color: #1a0302;
  background: #ff8069;
  box-shadow: 0 0 12px rgba(255, 72, 48, 0.9);
}

.crt-screen.is-complete {
  animation: exercise-complete 420ms ease-out;
}

.terminal-hint {
  position: absolute;
  right: clamp(26px, 5vw, 56px);
  bottom: clamp(18px, 3vw, 29px);
  left: clamp(26px, 5vw, 56px);
  margin: 0;
  color: rgba(145, 255, 155, 0.62);
  font-size: clamp(7px, 1.08vw, 10px);
  letter-spacing: 0.2px;
}

.terminal-hint span {
  margin-right: 8px;
  color: var(--phosphor-bright);
}

.terminal-hint strong {
  color: var(--phosphor-bright);
  font-weight: 500;
  text-transform: uppercase;
}

.terminal-hint .terminal-hint__message {
  margin: 0;
  color: rgba(145, 255, 155, 0.62);
}

.crt-screen.is-error .terminal-hint__message {
  color: #ff9a85;
}

.monitor__controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 28px;
  min-height: 58px;
  padding: 10px 10px 0 17px;
  color: #4b4d42;
}

.monitor__badge {
  font-family: var(--condensed);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.6px;
  line-height: 0.8;
}

.monitor__badge small {
  font-size: 5px;
  letter-spacing: 2.5px;
}

.monitor__vents {
  display: flex;
  gap: 3px;
}

.monitor__vents i {
  display: block;
  width: 3px;
  height: 24px;
  border-radius: 2px;
  background: #777765;
  box-shadow: inset 1px 0 rgba(0, 0, 0, 0.32);
}

.power-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 6px;
  letter-spacing: 0.7px;
}

.power-control i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64ec70;
  box-shadow: 0 0 6px rgba(55, 255, 72, 0.7);
}

.power-control button {
  width: 29px;
  height: 29px;
  border: 2px solid #595b4f;
  border-radius: 3px;
  background: linear-gradient(135deg, #494b42, #242620);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.monitor__stand {
  width: 38%;
  height: 22px;
  margin: -1px auto 0;
  border-inline: 1px solid #666758;
  background: linear-gradient(90deg, #888673, #b6b39d 45%, #777563);
  clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
}

.monitor__foot {
  width: 49%;
  height: 12px;
  margin: 0 auto;
  border: 1px solid #68695a;
  border-radius: 4px 4px 7px 7px;
  background: linear-gradient(180deg, #b0ad97, #777562);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.42);
}

@keyframes cursor-pulse {
  0%, 70% { opacity: 1; }
  71%, 100% { opacity: 0.62; }
}

@keyframes key-correct {
  from { transform: scale(1.16); }
  to { transform: scale(1); }
}

@keyframes screen-error {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-3px); }
  70% { transform: translateX(3px); }
}

@keyframes exercise-complete {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.65); }
  100% { filter: brightness(1); }
}

@keyframes crt-flicker {
  0%, 96%, 100% { opacity: 1; }
  97% { opacity: 0.74; }
  98% { opacity: 0.92; }
}

@keyframes crt-noise {
  0% { background-position: 0 0, 0 0; }
  25% { background-position: 3px -2px, -4px 0; }
  50% { background-position: -2px 3px, 2px 0; }
  75% { background-position: 4px 1px, -1px 0; }
  100% { background-position: -3px -1px, 4px 0; }
}

@media (max-width: 760px) {
  .monitor {
    width: min(100%, 650px);
  }

  .monitor__case {
    padding: 10px 12px 12px;
  }

  .monitor__controls {
    min-height: 43px;
  }
}

@media (max-width: 480px) {
  .crt-screen {
    height: 255px;
  }

  .monitor__top-details,
  .monitor__vents,
  .terminal-hint {
    display: none;
  }

  .monitor__controls {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .round-overlay::before,
  .round-overlay::after {
    display: none;
  }

  .round-overlay h2 {
    margin-top: 5px;
  }

  .round-overlay p {
    margin-block: 5px 2px;
  }

  .results-panel {
    max-height: 102px;
    margin-top: 4px;
  }

  .results-table th,
  .results-table td {
    padding: 4px 3px;
  }

  .round-overlay__countdown {
    margin-top: 5px;
  }
}
