/* Kavin Inc · Robot Programmer Training
   Theme: Luxury Warm Ivory & Cyber Neon Emerald
   Features: Dynamic animatable movement, laser TCP reticle, plasma arc flares, tactile chips, glowing HUD
*/

:root {
  --tr-ivory-bg: #FAF7F0;
  --tr-ivory-card: #FFFFFF;
  --tr-ivory-elevated: #FCFAF5;
  --tr-ivory-border: #DCD5C8;
  --tr-ivory-border-subtle: #EBE5DB;
  --tr-ivory-muted: #F2ECE1;
  --tr-text-primary: #0A261B;
  --tr-text-secondary: #486457;
  --tr-text-muted: #6E877B;
  --tr-neon: #00FF88;
  --tr-neon-glow: rgba(0, 255, 136, 0.4);
  --tr-neon-subtle: rgba(0, 255, 136, 0.12);
  --tr-neon-border: rgba(0, 255, 136, 0.32);
  --tr-emerald: #10B981;
  --tr-emerald-deep: #047857;
  --tr-emerald-dark: #07261B;
  --tr-arc-neon: #FF9900;
  --tr-arc-flare: #FFAA00;
  --tr-arc-glow: rgba(255, 153, 0, 0.55);
}

.training-page {
  padding-top: 112px;
  background: radial-gradient(circle at 12% 18%, rgba(0, 255, 136, 0.06) 0%, transparent 40%),
              radial-gradient(circle at 88% 82%, rgba(16, 185, 129, 0.07) 0%, transparent 45%),
              var(--tr-ivory-bg);
  color: var(--tr-text-primary);
  min-height: 100vh;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tr-wrap {
  max-width: 1440px;
  margin: auto;
  padding: 30px 32px 80px;
  box-sizing: border-box;
}

.tr-breadcrumb {
  font-size: 0.82rem;
  color: var(--tr-text-muted);
  margin: 10px 0 32px;
}
.tr-breadcrumb a {
  color: var(--tr-emerald-deep);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}
.tr-breadcrumb a:hover {
  color: var(--tr-neon);
  text-decoration: underline;
}

/* Hero Section */
.tr-hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 64px;
  align-items: center;
  padding: 24px 0 42px;
}

.tr-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #046647;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 255, 136, 0.12);
}

.tr-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tr-neon);
  box-shadow: 0 0 8px var(--tr-neon);
  animation: neonBeaconPulse 1.8s infinite;
}

@keyframes neonBeaconPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(0, 255, 136, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
}

.training-page h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 18px 0 24px;
  color: var(--tr-text-primary);
}

.training-page h1 span {
  display: inline-block;
  background: linear-gradient(135deg, #056645 0%, #10B981 45%, #00FF88 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 14px rgba(0, 255, 136, 0.3));
}

.tr-hero > div > p:last-of-type {
  max-width: 650px;
  color: var(--tr-text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
}

.tr-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.tr-tags span {
  padding: 8px 15px;
  border: 1px solid var(--tr-ivory-border);
  border-radius: 24px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--tr-ivory-card);
  color: #174231;
  box-shadow: 0 2px 6px rgba(10, 36, 25, 0.05);
  transition: all 0.22s ease;
}
.tr-tags span:hover {
  border-color: var(--tr-neon);
  box-shadow: 0 4px 14px rgba(0, 255, 136, 0.25);
  transform: translateY(-2px);
}

/* Session Console Card */
.tr-session-card {
  padding: 32px;
  border: 1px solid rgba(0, 255, 136, 0.28);
  background: var(--tr-ivory-card);
  border-radius: 24px;
  box-shadow: 0 20px 50px -20px rgba(6, 36, 25, 0.1), 0 0 22px rgba(0, 255, 136, 0.08);
  position: relative;
  overflow: hidden;
}
.tr-session-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #047857 0%, #10B981 50%, #00FF88 100%);
}

.training-page button,
.training-page input,
.training-page select {
  font: inherit;
  box-sizing: border-box;
}

.training-page button {
  cursor: pointer;
  border: 1px solid var(--tr-ivory-border);
  border-radius: 11px;
  padding: 10px 16px;
  background: var(--tr-ivory-card);
  color: var(--tr-text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 42px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.training-page button:hover {
  border-color: var(--tr-neon);
  background: #F0FDF5;
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.2);
  transform: translateY(-1px);
}
.training-page button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.training-page .tr-primary {
  background: linear-gradient(135deg, #056645 0%, #047857 50%, #059669 100%);
  border-color: var(--tr-neon);
  color: #FFFFFF;
  box-shadow: 0 4px 16px -2px rgba(0, 255, 136, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.training-page .tr-primary:hover {
  background: linear-gradient(135deg, #045237 0%, #056645 50%, #10B981 100%);
  border-color: var(--tr-neon);
  box-shadow: 0 6px 24px rgba(0, 255, 136, 0.55), 0 0 14px rgba(0, 255, 136, 0.3);
  transform: translateY(-2px);
}

.training-page input,
.training-page select {
  border: 1px solid var(--tr-ivory-border);
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--tr-ivory-card);
  min-width: 0;
  max-width: 100%;
  color: var(--tr-text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.training-page input:focus,
.training-page select:focus {
  border-color: var(--tr-neon);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.25);
  outline: none;
}

.training-page label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #2F5242;
}

.tr-session-card form {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}
.tr-session-card input {
  width: 100%;
}
.tr-session-card details {
  margin-top: 18px;
}
.tr-session-card summary {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tr-emerald-deep);
  cursor: pointer;
  transition: color 0.15s ease;
}
.tr-session-card summary:hover {
  color: var(--tr-neon);
}

.tr-small {
  font-size: 0.75rem;
  color: var(--tr-text-muted);
  line-height: 1.7;
}

.tr-status {
  font-size: 0.85rem;
  line-height: 1.6;
  min-height: 28px;
  padding: 14px 18px;
  background: #E9F7EF;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  color: #0A3D28;
  box-shadow: 0 2px 8px rgba(10, 36, 25, 0.05);
}
.tr-status.is-error {
  background: #FFF1EE;
  border-color: #F87171;
  color: #9B3325;
}

/* Question Set Tabs */
.tr-sets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0;
}
.tr-sets button {
  text-align: left;
  padding: 18px 20px;
  background: var(--tr-ivory-card);
  border: 1px solid var(--tr-ivory-border);
  border-radius: 18px;
  box-shadow: 0 4px 14px -3px rgba(10, 36, 25, 0.06);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.tr-sets button:hover {
  transform: translateY(-3px);
  border-color: var(--tr-neon);
  box-shadow: 0 8px 24px -4px rgba(0, 255, 136, 0.25);
}
.tr-sets button[aria-current="true"] {
  background: var(--tr-emerald-dark);
  border-color: var(--tr-neon);
  color: #FFFFFF;
  box-shadow: inset 0 3px 0 var(--tr-neon), 0 10px 28px -6px rgba(0, 255, 136, 0.35);
  transform: translateY(-2px);
}
.tr-sets button[aria-current="true"] span {
  color: #FFFFFF;
  font-weight: 800;
}
.tr-sets button[aria-current="true"] small {
  color: #6EE7B7;
  opacity: 1;
}
.tr-sets small {
  display: block;
  margin-top: 6px;
  font-weight: 400;
  opacity: 0.85;
}

/* Lab Layout */
.tr-learning-link { color: #047857; font-weight: 700; text-decoration: underline; }

.tr-lab {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.tr-editor,
.tr-preview {
  background: var(--tr-ivory-card);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 24px;
  padding: 28px;
  min-width: 0;
  box-shadow: 0 20px 45px -20px rgba(6, 36, 25, 0.08);
}
.tr-preview {
  position: sticky;
  top: 128px;
}

.tr-section-heading h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.55rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 10px 0 6px;
  color: var(--tr-text-primary);
}
.tr-section-heading p {
  font-size: 0.85rem;
  color: var(--tr-text-secondary);
  line-height: 1.7;
  margin: 0;
}

.tr-limits {
  background: #EDFAF2;
  border-left: 4px solid var(--tr-neon);
  padding: 14px 18px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #064E3B;
  border-radius: 0 10px 10px 0;
  margin: 20px 0;
  box-shadow: 0 2px 10px rgba(0, 255, 136, 0.08);
}
.tr-limits:empty {
  display: none;
}

/* Program Editor Lines */
.tr-line {
  border: 1px solid var(--tr-ivory-border);
  background: var(--tr-ivory-elevated);
  border-radius: 16px;
  padding: 20px;
  margin: 18px 0;
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tr-line:hover {
  border-color: rgba(0, 255, 136, 0.4);
}
.tr-line legend {
  padding: 0 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--tr-emerald-deep);
  letter-spacing: 0.06em;
}
.tr-line p {
  font-size: 0.84rem;
  line-height: 1.7;
  margin: 0 0 16px;
  color: var(--tr-text-secondary);
}

.tr-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tr-field select {
  width: 100%;
  font-family: Consolas, monospace;
  font-size: 0.8rem;
  margin-top: 5px;
}
.tr-field .tr-field-feedback {
  font-size: 0.72rem;
  line-height: 1.5;
  margin-top: 6px;
  color: #C2410C;
  font-weight: 600;
}
.tr-field.is-correct select {
  border-color: var(--tr-emerald);
  background: #F0FDF5;
}
.tr-field.is-wrong select {
  border-color: #E0886A;
  background: #FFF8F3;
}

.tr-given {
  font-family: Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.77rem;
  line-height: 1.7;
  color: #0A3D28;
  padding: 14px 16px;
  background: #EFF8F3;
  border-left: 3px solid var(--tr-emerald);
  border-radius: 8px;
}

.tr-submit-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.tr-submit-row > span {
  width: 100%;
}

.tr-grade {
  padding: 20px;
  background: #E8F8EE;
  border: 1px solid #A7F3D0;
  border-radius: 14px;
  margin-top: 22px;
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.12);
}
.tr-grade h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 8px;
  color: #065F46;
}
.tr-grade p {
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--tr-text-secondary);
}

/* Card Builder & Slots with Animatable Pulse */
.tr-card-status {
  font-size: 0.78rem;
  line-height: 1.8;
  color: #064E3B;
  padding: 14px 16px;
  background: #ECFDF5;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  margin: 18px 0;
}

.training-page .tr-slot {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 2px dashed rgba(16, 185, 129, 0.4);
  background: var(--tr-ivory-card);
  color: #4A6354;
  font-family: Consolas, monospace;
  font-size: 0.77rem;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  overflow-wrap: anywhere;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.training-page .tr-slot:hover {
  border-color: rgba(0, 255, 136, 0.6);
  background: #F4FAF6;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.15);
}
.training-page .tr-slot.is-filled {
  border-style: solid;
  background: #EDFBF3;
  border-color: var(--tr-emerald);
  color: #044C34;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}
.training-page .tr-slot.is-target {
  border: 2px solid var(--tr-neon);
  background: #F0FDF5;
  color: #044C34;
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.25), 0 0 16px rgba(0, 255, 136, 0.25);
  animation: slotPulseNeon 2s ease-in-out infinite;
}
@keyframes slotPulseNeon {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.25), 0 0 14px rgba(0, 255, 136, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(0, 255, 136, 0.45), 0 0 22px rgba(0, 255, 136, 0.45); }
}
.training-page .tr-slot.is-drop-over {
  border: 2px solid var(--tr-arc-neon);
  background: #FFF8E7;
  color: #8C4700;
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.35), 0 0 24px rgba(255, 153, 0, 0.45);
  transform: scale(1.02);
}

.tr-code-slots .tr-field label {
  font-size: 0.68rem;
  margin-bottom: 6px;
  color: #385E4D;
}
.tr-card-tray {
  margin-top: 16px;
  padding: 16px;
  background: #F4EFE6;
  border-radius: 14px;
  border: 1px solid var(--tr-ivory-border);
}
.tr-line .tr-card-tray-label {
  font-size: 0.72rem;
  line-height: 1.6;
  color: #4A6354;
  margin: 0 0 12px;
  font-weight: 600;
}
.tr-card-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Tactile Code Cards */
.training-page .tr-code-card {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 100%;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid #D5CEBF;
  border-bottom: 3px solid var(--tr-emerald-deep);
  border-radius: 10px;
  box-shadow: 0 3px 8px -2px rgba(10, 36, 25, 0.1);
  cursor: grab;
  touch-action: none;
  text-align: left;
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
.tr-code-card::before {
  content: '⠿';
  color: var(--tr-emerald);
  font-size: 16px;
  font-weight: 400;
  opacity: 0.75;
}
.training-page .tr-code-card strong {
  font-size: 0.82rem;
  color: var(--tr-text-primary);
  white-space: normal;
  overflow-wrap: anywhere;
}
.tr-code-card small {
  display: none;
}
.training-page .tr-code-card:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--tr-neon);
  border-bottom-color: var(--tr-neon);
  box-shadow: 0 10px 24px -4px rgba(0, 255, 136, 0.35), 0 0 14px rgba(0, 255, 136, 0.2);
}
.training-page .tr-code-card:active {
  cursor: grabbing;
  transform: translateY(1px);
}
.training-page .tr-code-card:focus-visible {
  outline: 3px solid var(--tr-neon);
  outline-offset: 3px;
}

.tr-field.is-correct .tr-slot {
  border-color: var(--tr-emerald);
  background: #F0FDF5;
}
.tr-field.is-wrong .tr-slot {
  border-color: #DF8C6E;
  background: #FFF7F2;
}

.tr-quiz-slot {
  margin: 14px 0;
}
.tr-question .tr-card-options {
  display: grid;
  grid-template-columns: 1fr;
}
.tr-question .tr-code-card {
  font-family: 'Plus Jakarta Sans', sans-serif;
  width: 100%;
}

.tr-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: #042417;
  color: #FFFFFF;
  border: 2px solid var(--tr-neon);
  font: 700 14px Consolas, monospace;
  padding: 14px 22px;
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(0, 255, 136, 0.5), 0 0 25px rgba(0, 255, 136, 0.3);
}

.tr-challenge-badge {
  font-size: 0.76rem;
  color: #065F46;
  font-weight: 800;
  background: #E6F8EE;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 12px 0;
}

/* Preview Panel & RAPID Code Terminal */
.tr-preview-tabs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 0.72rem;
  color: var(--tr-text-muted);
}
.tr-preview-tabs button {
  font-size: 0.7rem;
  min-height: 34px;
  padding: 6px 12px;
}

.tr-preview #program-code {
  font-family: Consolas, monospace;
  background: #071711;
  color: #D7EDE1;
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 12px 0 18px;
  overflow-x: auto;
  line-height: 1.8;
  font-size: 0.72rem;
  max-width: 100%;
  min-height: 180px;
  max-height: 170px;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.6), 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
}

.tr-code-line {
  display: block;
  padding: 1px 6px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.tr-code-line.is-active {
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.22) 0%, rgba(0, 255, 136, 0.04) 100%);
  color: #FFFFFF;
  border-left: 3px solid var(--tr-neon);
  box-shadow: inset 0 0 8px rgba(0, 255, 136, 0.15), 0 0 12px rgba(0, 255, 136, 0.25);
  padding-left: 8px;
  font-weight: 700;
  animation: codeLineFlash 1.5s ease-in-out infinite alternate;
}
@keyframes codeLineFlash {
  0% { border-left-color: var(--tr-neon); box-shadow: inset 0 0 8px rgba(0, 255, 136, 0.15), 0 0 8px rgba(0, 255, 136, 0.2); }
  100% { border-left-color: #34D399; box-shadow: inset 0 0 12px rgba(0, 255, 136, 0.25), 0 0 16px rgba(0, 255, 136, 0.4); }
}

.tr-target-label {
  font-family: 'Space Grotesk', Consolas, monospace;
  font-size: 0.8rem !important;
  font-weight: 700;
  color: var(--tr-neon) !important;
  background: #072218;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 10px;
  padding: 9px 14px;
  margin: 10px 0;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
}

.tr-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}
.tr-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--tr-text-secondary);
  font-weight: 700;
}
.tr-controls select {
  padding: 6px 10px;
  font-size: 0.72rem;
}

/* High-Tech Teach Pendant CAD Viewport (SVG Path) */
.tr-path svg {
  display: block;
  width: 100%;
  height: auto;
  background: #071711;
  border: 1px solid rgba(0, 255, 136, 0.28);
  border-radius: 18px;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.7), 0 10px 30px -10px rgba(0, 255, 136, 0.15);
  max-height: 240px;
}

.tr-path rect[fill="url(#tr-grid)"] {
  fill: url(#tr-grid);
}
.tr-path rect[x="160"][y="248"] {
  fill: #143527 !important;
  stroke: rgba(0, 255, 136, 0.35) !important;
  stroke-width: 1.5px !important;
}

.tr-svg-label {
  font-family: 'Space Grotesk', Consolas, monospace;
  font-size: 11px;
  fill: #6EE7B7 !important;
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* Path Segments & Animatable Flows */
[data-segment-line] {
  transition: stroke-width 0.2s ease, opacity 0.2s ease;
}
[data-segment-line].is-active-segment {
  opacity: 1 !important;
  stroke-width: 7px !important;
  filter: drop-shadow(0 0 8px var(--tr-neon)) drop-shadow(0 0 16px rgba(0, 255, 136, 0.6)) !important;
}
[data-segment-line][stroke="#e67e22"].is-active-segment {
  filter: drop-shadow(0 0 10px var(--tr-arc-neon)) drop-shadow(0 0 20px rgba(255, 153, 0, 0.8)) !important;
}
[data-segment-line][stroke-dasharray].is-active-segment {
  animation: neonSegmentFlow 0.8s linear infinite;
}
@keyframes neonSegmentFlow {
  to {
    stroke-dashoffset: -28;
  }
}

/* Target Coordinates & Glowing Halo */
[data-target-point][role="button"] {
  cursor: pointer;
}
[data-target-point][role="button"]:focus-visible {
  outline: none;
}

.tr-point-halo {
  fill: var(--tr-neon);
  stroke: var(--tr-neon);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.is-selected-point > .tr-point-halo {
  opacity: 0.7 !important;
  animation: targetHaloPulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
}
[data-target-point][role="button"]:focus-visible .tr-point-halo {
  opacity: 0.85;
}

@keyframes targetHaloPulse {
  0% { transform: scale(1); opacity: 0.8; stroke-width: 2.5; }
  50% { transform: scale(1.4); opacity: 0.25; stroke-width: 1.5; }
  100% { transform: scale(1); opacity: 0.8; stroke-width: 2.5; }
}

.is-selected-point > text {
  fill: var(--tr-neon) !important;
  font-weight: 800;
  filter: drop-shadow(0 0 5px rgba(0, 255, 136, 0.8));
}

/* Animated Robot TCP Tool Marker Reticle */
#tool-marker {
  filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.75));
  transition: transform 0.05s linear;
}
#tool-marker .tr-tool-beacon {
  animation: reticleBeaconPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes reticleBeaconPulse {
  0% { r: 18px; opacity: 0.8; stroke-width: 1.8px; }
  50% { r: 25px; opacity: 0.2; stroke-width: 1px; }
  100% { r: 18px; opacity: 0.8; stroke-width: 1.8px; }
}

/* Welding State: High-Intensity Plasma Arc Flare */
#tool-marker.is-welding {
  filter: drop-shadow(0 0 10px rgba(255, 153, 0, 0.95)) drop-shadow(0 0 24px rgba(255, 184, 0, 0.75));
}
#tool-marker.is-welding .tr-tool-beacon {
  stroke: rgba(255, 153, 0, 0.7);
  fill: rgba(255, 153, 0, 0.25);
  animation: arcPulse 0.4s infinite alternate;
}
#tool-marker.is-welding .tr-tool-cross {
  stroke: var(--tr-arc-neon);
}
#tool-marker.is-welding .tr-tool-ring,
#tool-marker.is-welding > circle {
  stroke: var(--tr-arc-flare);
  fill: #261500;
}
#tool-marker.is-welding .tr-tool-core {
  fill: #FFF7B0;
  animation: arcCoreFlicker 0.15s infinite alternate;
}
#tool-marker.is-welding .tr-tool-arc-flare {
  opacity: 1;
  animation: arcPlasmaFlare 0.3s cubic-bezier(0.2, 0.8, 0.4, 1) infinite alternate;
}

@keyframes arcPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}
@keyframes arcCoreFlicker {
  0% { opacity: 0.75; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1.3); }
}
@keyframes arcPlasmaFlare {
  0% { transform: scale(0.85) rotate(0deg); opacity: 0.85; stroke: #FF9900; }
  50% { transform: scale(1.35) rotate(45deg); opacity: 0.55; stroke: #FFE600; }
  100% { transform: scale(0.95) rotate(90deg); opacity: 0.95; stroke: #FF5500; }
}

/* Current Step & Status Card */
.tr-current-step {
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: var(--tr-ivory-elevated);
  padding: 16px 18px;
  border-radius: 16px;
  margin-top: 16px;
  box-shadow: 0 4px 14px rgba(10, 36, 25, 0.04);
}
.tr-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tr-preview .tr-step-header h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0;
  color: var(--tr-text-primary);
}

.tr-arc-state {
  font: 800 0.68rem 'Space Grotesk', Arial, sans-serif;
  padding: 6px 12px;
  white-space: nowrap;
  background: #E8F5EE;
  color: #046647;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  letter-spacing: 0.08em;
  transition: all 0.2s ease;
}
.tr-arc-state.is-on {
  background: linear-gradient(135deg, #B45309 0%, #D97706 100%);
  color: #FFFBEB;
  border-color: #F59E0B;
  box-shadow: 0 0 16px rgba(255, 153, 0, 0.65);
  animation: arcBadgeGlow 0.8s infinite alternate;
}
@keyframes arcBadgeGlow {
  0% { box-shadow: 0 0 10px rgba(255, 153, 0, 0.5); }
  100% { box-shadow: 0 0 20px rgba(255, 153, 0, 0.9), 0 0 6px #FFE29A; }
}

.tr-preview .tr-step-route {
  font-family: Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--tr-emerald-deep);
  margin: 8px 0;
}
.tr-current-step .tr-small {
  margin: 6px 0 0;
  font-size: 0.72rem;
}

/* Step Views Grid */
.tr-step-views-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: var(--tr-text-secondary);
  font-weight: 800;
  margin: 20px 0 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tr-step-views {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.training-page .tr-step-view {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 14px;
  background: var(--tr-ivory-card);
  border: 1px solid var(--tr-ivory-border);
  border-radius: 12px;
  font-size: 0.74rem;
  min-width: 0;
  overflow-wrap: anywhere;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(10, 36, 25, 0.05);
}
.tr-step-view strong {
  color: var(--tr-emerald-deep);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}
.tr-step-view small {
  font-weight: 400;
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--tr-text-muted);
}
.training-page .tr-step-view:hover {
  transform: translateY(-2px);
  border-color: var(--tr-neon);
  box-shadow: 0 8px 20px -4px rgba(0, 255, 136, 0.25);
}
.training-page .tr-step-view.is-active {
  background: #F0FDF5;
  border: 2px solid var(--tr-neon);
  box-shadow: 0 6px 20px -4px rgba(0, 255, 136, 0.35), 0 0 0 1px var(--tr-neon);
  padding: 13px;
  transform: translateY(-2px);
}

/* Inline Step Visualizer */
.tr-inline-step {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  border-top: 1px solid var(--tr-ivory-border-subtle);
  padding-top: 18px;
}
.tr-inline-step svg {
  display: block;
  width: 100%;
  height: auto;
  background: #071711;
  border: 1px solid rgba(0, 255, 136, 0.25);
  border-radius: 12px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}
.tr-inline-step svg rect:first-child {
  fill: #071711 !important;
}
.tr-inline-step strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  color: var(--tr-emerald-deep);
}
.tr-inline-step p {
  font-size: 0.74rem;
  line-height: 1.7;
  margin: 7px 0;
  color: var(--tr-text-secondary);
}
.training-page .tr-inline-step button {
  font-size: 0.72rem;
  padding: 8px 12px;
  min-height: 38px;
}
.tr-inline-step.is-active svg {
  border: 2px solid var(--tr-neon);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.35);
}
.tr-mini-label {
  font: 22px 'Space Grotesk', Consolas, monospace;
  fill: #6EE7B7 !important;
}
[data-mini-tool] circle {
  stroke: var(--tr-neon) !important;
  fill: #042417 !important;
  filter: drop-shadow(0 0 4px var(--tr-neon));
}
[data-mini-tool].is-welding circle {
  stroke: var(--tr-arc-flare) !important;
  fill: #261500 !important;
  filter: drop-shadow(0 0 6px var(--tr-arc-neon));
}
.tr-inline-step .tr-mini-phase {
  font-size: 0.68rem;
  color: #8C5200;
  font-weight: 700;
  background: #FFF7E6;
  border-radius: 7px;
  padding: 6px 10px;
}

.tr-preview-note {
  border-top: 1px solid var(--tr-ivory-border-subtle);
  padding-top: 14px;
}

/* Quiz Exercise View */
.tr-question label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--tr-ivory-border);
  background: var(--tr-ivory-card);
  border-radius: 12px;
  margin-top: 8px;
  font-size: 0.84rem;
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tr-question input {
  margin-top: 4px;
  accent-color: var(--tr-emerald-deep);
}
.tr-question label:hover {
  border-color: rgba(0, 255, 136, 0.5);
  background: #F4FAF6;
}
.tr-question label:has(input:checked) {
  background: #EDFBF3;
  border-color: var(--tr-emerald);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}
.tr-question .tr-explanation {
  font-size: 0.78rem;
  line-height: 1.7;
  padding-top: 12px;
  color: var(--tr-text-secondary);
}

.tr-quiz-icon {
  font-size: 4rem;
  color: var(--tr-emerald);
  font-family: Consolas, monospace;
  background: #EDFBF3;
  border: 1px solid rgba(0, 255, 136, 0.3);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  margin-top: 24px;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.12);
}
.tr-preview h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.5;
  margin: 20px 0 12px;
}
.tr-preview p,
.tr-preview a {
  font-size: 0.84rem;
  line-height: 1.8;
}
.tr-preview a {
  color: var(--tr-emerald-deep);
  font-weight: 700;
  text-decoration: none;
}
.tr-preview a:hover {
  color: var(--tr-neon);
  text-decoration: underline;
}

/* Reference Footer */
.tr-reference {
  margin-top: 48px;
  border-top: 1px solid var(--tr-ivory-border);
  padding-top: 32px;
  max-width: 950px;
}
.tr-reference h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
}
.tr-reference p {
  font-size: 0.84rem;
  color: var(--tr-text-secondary);
  line-height: 1.8;
  margin-top: 12px;
}
.tr-reference a {
  text-decoration: underline;
  color: var(--tr-emerald-deep);
}
.tr-reference a:hover {
  color: var(--tr-neon);
}

.training-page [hidden] {
  display: none !important;
}
.training-page :focus-visible {
  outline: 3px solid var(--tr-neon);
  outline-offset: 3px;
}

.tr-resume-key {
  width: 100%;
  font-family: Consolas, monospace !important;
  font-size: 0.7rem !important;
  background: #F4EFE6 !important;
}
.tr-session-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* Responsive & Layout Viewports */
@media (min-width: 851px) {
  .tr-preview {
    max-height: calc(100dvh - 148px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1100px) {
  .tr-hero {
    gap: 32px;
  }
  .tr-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tr-preview {
    padding: 22px;
  }
}

@media (max-width: 850px) {
  .tr-hero,
  .tr-lab {
    grid-template-columns: 1fr;
  }
  .tr-preview {
    position: static;
  }
  .tr-sets {
    grid-template-columns: repeat(2, 1fr);
  }
  .tr-hero {
    padding-top: 0;
  }
  .tr-wrap {
    padding: 24px 18px 48px;
  }
  .tr-editor {
    padding: 20px;
  }
  .tr-session-card {
    padding: 24px;
  }
  .training-page h1 {
    font-size: 3rem;
  }
  .tr-lab {
    gap: 20px;
  }
  .tr-sets button {
    padding: 16px;
  }
}

@media (max-width: 500px) {
  .tr-inline-step {
    grid-template-columns: 1fr;
  }
  .tr-inline-step svg {
    max-width: 320px;
  }
  .tr-step-views {
    grid-template-columns: 1fr;
  }
  .tr-sets {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .training-page * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
