#starfield {
    display: block;
    margin: auto;
    background-color: black; 
    cursor: grab;
}
#starfield:active {
    cursor: grabbing;
}
.outer-frame {
    background-color: #ffbbaa;
    border-radius: 10px 10px 10px 10px;
    padding: 8px 10px 8px 9px;
    display: inline-block;
    box-sizing: border-box;
}
.inner-frame {
    background-color: #212832;
    border-radius: 6px;
    padding: 8px 8px 8px 8px;
    position: relative;
    display: inline-block;
}
.crosshair {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.crosshair .vertical,
.crosshair .horizontal {
    position: absolute;
    background-color: #556b9e;
}
.crosshair .vertical {
    width: 1px;
    top: 0; bottom: 0;
}
.crosshair .horizontal {
    height: 1px;
    left: 0; right: 0;
}

/* D3 Elements */
.star {
    fill: white;
    cursor: pointer;
    transition: fill 0.2s;
}
.star:hover {
    fill: #ffd;
}
.tooltip {
    position: absolute;
    padding: 6px 10px;
    background: rgba(0,0,0,0.7);
    border-radius: 5px;
    pointer-events: none;
    font-size: 12px;
    color: #eee;
    font-family: monospace;
    display: none;
}
.selected-circle {
    fill: none;
    stroke: #ffaa00;
    stroke-width: 2px;
    pointer-events: none; 
}

/* D-pad */
.lcars-dpad {
    position: relative;
    width: 250px;
    height: 250px;
    background-color: #f96;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: auto;
}
.direction {
    position: absolute;
    background-color: #fba; 
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 2;
}
.direction:hover{
    background-color: #9966ff;
}
.up, .down {
    width: 60px;
    height: 90px;
}
.left, .right {
    width: 90px;
    height: 60px;
}
.up {
    top: 0;
    border-radius: 0 0 10px 10px;
}
.down {
    bottom: 0;
    border-radius: 10px 10px 0 0;
}
.left {
    left: 0;
    border-radius: 0 10px 10px 0;
}
.right {
    right: 0;
    border-radius: 10px 0 0 10px;
}
.center {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: #9966ff;
    border-radius: 50%;
    border: 4px solid #52526a;
    z-index: 3;
}
.direction::after {
    content: "";
    position: absolute;
    background-color: #ff5555;
}
.up::after {
    bottom: 0;
    left: 15px;
    width: 30px;
    height: 6px;
}
.down::after {
    top: 0;
    left: 15px;
    width: 30px;
    height: 6px;
}
.left::after {
    right: 0;
    top: 15px;
    width: 6px;
    height: 30px;
}
.right::after {
    left: 0;
    top: 15px;
    width: 6px;
    height: 30px;
}
/* Sliders */
.lcars-slider {
    border-left: 30px solid #ffaa90; 
    padding: 20px 30px;
    border-radius: 0 30px 30px 0;
    box-sizing: border-box;
}
.lcars-slider-red {
    border-left: 30px solid #f55;
    margin-top: 10px;
    padding: 20px 30px;
    border-radius: 0 30px 30px 0;
    box-sizing: border-box;
}
.lcars-title {
    text-transform: uppercase;
    color: #fa0;
    font-size: 1.4em;
    margin-bottom: 30px;
    text-align: left;
}

.lcars-label {
    text-transform: uppercase;
    color: #f90;
    font-size: 1em;
    margin: 25px 0 5px;
}

.sensor-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    cursor: pointer;
}

.segment {
    flex: 1;
    height: 20px;
    background-color: black;
    border: 1px solid #222;
    transition: background-color 0.2s;
}

.segment.red {
    background-color: #aa0000;
}

.segment.yellow {
    background-color: #e6c700;
}

.segment.green {
    background-color: #999933;
}
/* Scan Area */
.lcars-scan-area {
    position: relative;
    flex: 1;
    margin: 40px auto;
    width: 100%;
    height: 100%;
    border: 10px solid #ffaa00;
    border-left:0px;
    border-right:0px;
    border-radius: 0px;
    background-color: black;
    overflow: hidden;
}
.scan-circle {
    position: absolute;
    left:10%;
    top:10%;
    
    width: 80%;
    height: 80%;
    border-radius: 50%;
    border: 2px dashed #ffbbaa;
    animation: rotatescan 20s linear infinite;
}
.scan-beam {
    position: absolute;
    width: 4px;
    height: 100%;
    background-color: #ffbbaa;
    top: 0;
    left: 50%;
    transform-origin: bottom center;
    animation: rotatescan 2s linear infinite;
}
scan-circle,
.scan-beam {
    z-index: 2;
}
/* Starfield Styles */
.scanfield {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}
.scstar {
    position: absolute;
    width: 2px;
    height: 2px;
    background-color: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: twinkle 2s infinite ease-in-out alternate;
}
/* Random star positions and delays */
.scstar:nth-child(1) { top: 10%; left: 20%; animation-delay: 0s; }
.scstar:nth-child(2) { top: 30%; left: 40%; animation-delay: 0.5s; }
.scstar:nth-child(3) { top: 70%; left: 80%; animation-delay: 1s; }
.scstar:nth-child(4) { top: 50%; left: 10%; animation-delay: 0.3s; }
.scstar:nth-child(5) { top: 60%; left: 30%; animation-delay: 1.5s; }
.scstar:nth-child(6) { top: 20%; left: 70%; animation-delay: 0.8s; }
.scstar:nth-child(7) { top: 80%; left: 60%; animation-delay: 1.2s; }
.scstar:nth-child(8) { top: 40%; left: 50%; animation-delay: 0.6s; }
.scstar:nth-child(9) { top: 15%; left: 85%; animation-delay: 0.4s; }
.scstar:nth-child(10) { top: 65%; left: 25%; animation-delay: 1.1s; }
/* Animations */
@keyframes rotatescan {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes twinkle {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1.5);
  }
}

/* Text input */
.lcars-input{
    background: #0a0f1a;
    color: #f7c64a;
    border: 3px #89f;
    border-radius: 22px 999px 999px 22px; 
    padding: 12px 80px 12px 16px; /* room for the cap */
    appearance:none;
    -webkit-appearance:none;
    font-family: 'Orbitron', 'Eurostile', 'Bank Gothic', 'Microgramma', sans-serif;
    font-size: 18px;
    letter-spacing: .14em;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.lcars-input-pos{
    position: relative;
    width: 45%;
}
.lcars-input::placeholder{color:#ffd70088}
/* Nav control Grid New */
.gridh-container{
    position: relative;
    flex: 1;
    margin: 40px auto;
    width: 100%;
    height: 100%;
    align-items:center;
    justify-content:center;
    background:#000;
    overflow:hidden;
    font-family: monospace;
    color:#f7c64a;
}
.grid-hud{

}
.grid-hud::before {
    content:"";
    position:absolute;
    inset:0px;
    background-image:
      linear-gradient(to right, rgba(136,153,255,0.15) 2px, transparent 1px),
      linear-gradient(to bottom, rgba(136,153,255,0.15) 2px, transparent 1px);
    background-size: calc(100%/4) calc(100%/3);
    pointer-events:none;
    border: 10px solid #c9f;
    border-right: 1px solid rgba(136,153,255,0.15);
    border-left: 1px solid rgba(136,153,255,0.15);
}
.svg-navf {
    position:absolute;
    top:0; bottom:0;
    height:100%;
    width:auto;
}
.bracket-path {
    fill:none;
    stroke:#f7c64a;
    stroke-width:14;
    stroke-linejoin:round;
    stroke-linecap:round;
}
.left-outer-brk { left:2%; height:70%; top:15%; }
.right-outer-brk { right:2%; height:70%; top:15%; transform:scaleX(-1); }
.left-inner-brk { left:30%; height:30%; top:35%; }
.right-inner-brk { right:30%; height:30%; top:35%; transform:scaleX(-1); }
.num-navf { position:absolute; font-size:14px; }
.num-navf.tl { top:5%; left:2%; }
.num-navf.bl { bottom:5%; left:2%; }
.num-navf.tr { top:5%; right:2%; }
.num-navf.br { bottom:5%; right:2%; }
.center-navf {
    position:absolute;
    top:50%; left:50%;
    transform:translate(-50%,-50%);
    font-size:20px;
    animation:glow-7s 2s infinite alternate;
    text-align:center;
    color:#f7c64a;
}
@keyframes glow-7s {
    from { text-shadow:0 0 4px #ff9b00; opacity:.7; }
    to   { text-shadow:0 0 18px #ff9b00; opacity:1; }
}
.star-navf {
    position:absolute;
    background:#f5f6fa;
    border-radius:50%;
    animation:twinkle-3s 3s infinite alternate;
}
@keyframes twinkle-3s {
    from { opacity:.3; transform:scale(.8); }
    to   { opacity:1; transform:scale(1.2); }
}
:root {
    --lcars-gauge-frame: #fa0; /* A muted purple for the main housing */
    --lcars-gauge-bg: #000; /* Deep blue for the gauge background */
    --lcars-gauge-text: #fc9; /* Light blue for text and gauge-markings */
    --lcars-gauge-indicator: #89f; /* Bright yellow for the main indicator */
    --lcars-gauge-pointer: #f0c413; /* Orange for side pointers */
    --lcars-gauge-warning: #f20; /* Red for the warning indicator */
    --lcars-gauge-font: 'Antonio', sans-serif;
}

/* Main container for the entire gauge assembly */
.lcars-gauge-container {
    position: relative;
    width: 180px;
    height: 500px;
    font-family: var(--lcars-gauge-font);
    color: var(--lcars-gauge-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The main purple frame structure */
.lcars-gauge-frame {
    position: absolute;
    width: 130px;
    height: 480px;
    background-color: var(--lcars-gauge-frame);
    /* Simulates the top and bottom rounded caps */
    border-radius: 20px;
}

/* The side tabs on the main frame */
.lcars-gauge-frame::before,
.lcars-gauge-frame::after {
    content: '';
    position: absolute;
    background-color: var(--lcars-gauge-frame);
    width: 20px;
    height: 60px;
    left: -20px;
}

.lcars-gauge-frame::before {
     top: 100px;
}

.lcars-gauge-frame::after {
     bottom: 100px;
}

.lcars-gauge-frame-right-tab {
     position: absolute;
     background-color: var(--lcars-gauge-frame);
     width: 20px;
     height: 60px;
     right: -20px;
}
.gauge-tab-top {
    top: 100px;
}
.gauge-tab-bottom {
    bottom: 100px;
}

/* The inner blue area where readings are displayed */
.gauge-core {
    position: relative;
    width: 100px;
    height: 440px;
    background-color: var(--lcars-gauge-bg);
    border-radius: 5px;
    z-index: 2;
    overflow: hidden;
}

/* Containers for the numeric gauge-markings */
.gauge-markings-container {
    position: absolute;
    top: 10px;
    bottom: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 16px;
    letter-spacing: 1px;
}

.gauge-marking {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    white-space: nowrap;
}

.gauge-marking span:nth-child(2) {
    color: var(--lcars-gauge-indicator);
    padding: 0 3px;
}

/* The yellow indicator bar that shows the current level */
.gauge-indicator-bar {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    background-color: var(--lcars-gauge-indicator);
    border-radius: 2px;
    transition: height 0.3s ease-out; /* Faster transition for input response */
    z-index: 3;
}

/* The blinking red warning indicator at the bottom */
.gauge-warning-bar {
    position: absolute;
    top: 35px;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 6px;
    background-color: var(--lcars-gauge-warning);
    border-radius: 2px;
    z-index: 4;
    animation: gauge-blink 1.5s infinite;
}

@keyframes gauge-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* The orange pointers on the sides of the frame */
.gauge-pointer {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 5;
}

.gauge-pointer.left {
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 20px solid var(--lcars-gauge-pointer);
}

.gauge-pointer.right {
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-right: 20px solid var(--lcars-gauge-pointer);
}

.gauge-pointer.left.ptr-red {
    border-left-color: var(--lcars-gauge-warning);
}
.gauge-pointer.right.ptr-red {
    border-right-color: var(--lcars-gauge-warning);
}
