body {
  margin: 0;
  padding: 20px;
  font-family: 'Orbitron', sans-serif;
  min-height: 100vh;
  background: linear-gradient(45deg, #0a0a2e, #1a1a3a);
  color: #00fff2;
  transition: all 0.3s ease;
  overflow-x: hidden; /* Prevent horizontal scroll */
  overflow-y: hidden; /* Prevent body scrollbars by default */
}

body.light-mode {
  background: linear-gradient(45deg, #e0e0ff, #f0f0ff);
  color: #1a1a3a;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 20px;
  flex-wrap: wrap; /* Allow wrapping on small screens */
  gap: 10px;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.title {
  font-size: 2em;
  text-shadow: 0 0 10px rgba(0, 255, 242, 0.7);
  margin: 0;
}

body.light-mode .title {
  text-shadow: none;
}

.main-content {
  display: flex;
  gap: 20px;
  height: calc(100vh - 120px); /* Adjust height */
}

.controls-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 350px;
  flex-shrink: 0;
  overflow-y: auto; /* Make this column scrollable */
  padding-right: 10px; /* For scrollbar spacing */
}

/* --- Mobile View --- */
body.mobile-view {
    overflow-y: auto; /* Allow the whole page to scroll */
}

body.mobile-view .main-content {
    flex-direction: column;
    height: auto; /* Let content determine height */
}

body.mobile-view .controls-column {
    width: 100%;
    overflow-y: visible; /* Don't scroll internally */
    padding-right: 0;
    box-sizing: border-box;
}

body.mobile-view #canvas-container {
    height: 60vh; /* Set a fixed viewport height */
    min-height: 400px;
    flex-grow: 0;
}

/* Custom Scrollbar for Webkit browsers */
.controls-column::-webkit-scrollbar {
  width: 8px;
}
.controls-column::-webkit-scrollbar-track {
  background: rgba(10, 10, 46, 0.5);
  border-radius: 4px;
}
.controls-column::-webkit-scrollbar-thumb {
  background: #00fff2;
  border-radius: 4px;
}
.controls-column::-webkit-scrollbar-thumb:hover {
  background: #5ffff8;
}

body.light-mode .controls-column::-webkit-scrollbar-track {
  background: rgba(230, 230, 255, 0.5);
}
body.light-mode .controls-column::-webkit-scrollbar-thumb {
  background: #4a4a8a;
}
body.light-mode .controls-column::-webkit-scrollbar-thumb:hover {
  background: #6a6ab5;
}

#canvas-container {
  position: relative;
  flex-grow: 1;
  height: 100%; /* Fill available height */
  border: 2px solid #00fff2;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 255, 242, 0.3);
  overflow: hidden;
}

body.light-mode #canvas-container {
  border-color: #4a4a8a;
  box-shadow: 0 0 20px rgba(74, 74, 138, 0.2);
}

#main-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}

body.light-mode #main-canvas {
    background-color: rgba(255, 255, 255, 0.4);
}

.controls, .global-controls {
  padding: 20px;
  background: rgba(10, 10, 46, 0.8);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 242, 0.5);
  transition: all 0.3s ease;
}

body.light-mode .controls, body.light-mode .global-controls {
  background: rgba(230, 230, 255, 0.8);
  border-color: rgba(74, 74, 138, 0.4);
}

.control-group {
  margin-bottom: 15px;
}

.card-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-shadow: 0 0 8px rgba(0, 255, 242, 0.7);
}

body.light-mode .card-title {
    text-shadow: none;
}

.control-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
}

.instructions {
    font-size: 0.8em;
    color: #9f9ffc;
    border-top: 1px solid rgba(0, 255, 242, 0.2);
    padding-top: 10px;
    margin-top: 15px;
    line-height: 1.5;
}
.instructions.small {
    font-size: 0.7em;
    margin-top: 5px;
    padding-top: 5px;
    text-align: center;
}
body.light-mode .instructions {
    color: #4a4a8a;
    border-top-color: rgba(74, 74, 138, 0.2);
}

.text-input, .action-btn, .theme-button, .select-input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #00fff2;
  background-color: rgba(0, 255, 242, 0.1);
  color: #00fff2;
  font-family: 'Orbitron', sans-serif;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.select-input {
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2300fff2' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.text-input::placeholder {
    color: rgba(0, 255, 242, 0.5);
}

.action-btn, .theme-button {
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  margin-top: 10px;
}

.action-btn.small-btn {
    width: auto;
    padding: 5px 12px;
    font-size: 1.2em;
    line-height: 1;
    margin-top: 0;
}

.action-btn:hover, .theme-button:hover {
  background-color: rgba(0, 255, 242, 0.3);
  box-shadow: 0 0 15px rgba(0, 255, 242, 0.5);
}

.action-btn.active {
    background-color: rgba(0, 255, 242, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 242, 0.7);
    color: #fff;
}

.action-btn.danger {
    border-color: #ff3b3b;
    background-color: rgba(255, 59, 59, 0.1);
    color: #ff3b3b;
}

.action-btn.danger:hover {
    background-color: rgba(255, 59, 59, 0.3);
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.5);
}

.action-btn.danger.exponential-btn {
    background-color: #4d0000;
    border: 2px solid #ff3b3b;
    color: #ffaaaa;
    font-size: 1.1em;
    text-shadow: 0 0 10px #ff3b3b;
    box-shadow: 0 0 5px rgba(255, 59, 59, 0.5), inset 0 0 10px rgba(255, 59, 59, 0.3);
    transition: all 0.2s ease-in-out;
}
.action-btn.danger.exponential-btn:hover {
    background-color: #990000;
    color: #ffffff;
    box-shadow: 0 0 20px #ff3b3b, inset 0 0 15px rgba(255, 150, 150, 0.4);
    transform: translateY(-2px);
}
.action-btn.danger.exponential-btn:active {
    background-color: #ff3b3b;
    box-shadow: 0 0 30px #ffffff, inset 0 0 20px rgba(0,0,0,0.5);
    transform: translateY(1px);
}

.light-code-switch .control-label {
    color: #ffd700;
    text-shadow: 0 0 8px #ffd700;
}
body.light-mode .light-code-switch .control-label {
    color: #b8860b;
    text-shadow: none;
}

.light-code-switch .switch-slider {
    border-color: #ffd700;
}
.light-code-switch .switch-slider:before {
    background-color: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}
.light-code-switch input:checked + .switch-slider {
    background-color: rgba(255, 215, 0, 0.3);
}

body.light-mode .text-input, body.light-mode .action-btn, body.light-mode .theme-button, body.light-mode .select-input {
    border-color: #4a4a8a;
    background-color: rgba(74, 74, 138, 0.1);
    color: #1a1a3a;
}
body.light-mode .select-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%231a1a3a' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
}

body.light-mode .text-input::placeholder {
    color: rgba(74, 74, 138, 0.5);
}

body.light-mode .action-btn:hover, body.light-mode .theme-button:hover {
    background-color: rgba(74, 74, 138, 0.2);
    box-shadow: 0 0 10px rgba(74, 74, 138, 0.3);
}

body.light-mode .action-btn.active {
    background-color: rgba(74, 74, 138, 0.3);
    box-shadow: 0 0 10px rgba(74, 74, 138, 0.4);
}

body.light-mode .action-btn.danger {
    border-color: #d90000;
    background-color: rgba(217, 0, 0, 0.1);
    color: #d90000;
}
body.light-mode .action-btn.danger:hover {
    background-color: rgba(217, 0, 0, 0.2);
    box-shadow: 0 0 10px rgba(217, 0, 0, 0.3);
}

.theme-button.danger {
    border-color: #ff3b3b;
    background-color: rgba(255, 59, 59, 0.1);
    color: #ff3b3b;
}

.theme-button.danger:hover {
    background-color: rgba(255, 59, 59, 0.3);
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.5);
}

body.light-mode .theme-button.danger {
    border-color: #d90000;
    background-color: rgba(217, 0, 0, 0.1);
    color: #d90000;
}
body.light-mode .theme-button.danger:hover {
    background-color: rgba(217, 0, 0, 0.2);
    box-shadow: 0 0 10px rgba(217, 0, 0, 0.3);
}

/* --- New UI Card Styles --- */

.node-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
#node-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.node-card {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
        "thumb name"
        "thumb controls"
        "sliders sliders"
        "program program";
    gap: 10px 15px;
    align-items: center;
    padding: 10px;
    background: rgba(0, 255, 242, 0.05);
    border: 1px solid rgba(0, 255, 242, 0.2);
    border-radius: 8px;
}

.node-card > .thumbnail-container { grid-area: thumb; }
.node-card > .text-input { grid-area: name; }
.node-card > .node-controls { grid-area: controls; }
.node-card > .node-sliders { grid-area: sliders; }
.node-card > .node-program-upload { grid-area: program; }

body.light-mode .node-card {
    background: rgba(74, 74, 138, 0.05);
    border-color: rgba(74, 74, 138, 0.2);
}
.node-card .text-input {
    margin: 0;
}
.node-card .action-btn {
    margin: 0;
}

.node-controls {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 5px;
    align-items: center;
}

.node-controls .action-btn {
    padding: 5px;
    min-width: 30px;
    text-align: center;
}

.node-sliders {
    grid-column: 1 / -1; /* Span full width */
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.node-slider.slider-container {
    grid-template-columns: 100px 1fr;
    padding: 0;
}

.node-program-upload {
    grid-column: 1 / -1; /* Span full width */
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.node-program-upload .action-btn {
    width: 100%;
    margin: 0;
    padding: 8px;
}
.node-program-upload .file-name {
    font-size: 0.7em;
    color: #9f9ffc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
body.light-mode .node-program-upload .file-name {
    color: #4a4a8a;
}

.color-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 30px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}
.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}
.color-input::-webkit-color-swatch {
    border-radius: 5px;
    border: 1px solid #00fff2;
}
body.light-mode .color-input::-webkit-color-swatch {
    border-color: #4a4a8a;
}

.thumbnail-container {
    position: relative;
    width: 60px;
    height: 60px;
    cursor: pointer;
    margin: 0 auto;
}
#target-controls .thumbnail-container {
    margin-bottom: 10px;
}
.thumbnail {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00fff2;
}
body.light-mode .thumbnail {
    border-color: #4a4a8a;
}
.image-upload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.switch-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.3);
  transition: .4s;
  border-radius: 28px;
  border: 1px solid #00fff2;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #00fff2;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .switch-slider {
  background-color: rgba(0, 255, 242, 0.3);
}
input:checked + .switch-slider:before {
  transform: translateX(22px);
}
body.light-mode .switch-slider {
    border-color: #4a4a8a;
}
body.light-mode .switch-slider:before {
    background-color: #4a4a8a;
}
body.light-mode input:checked + .switch-slider {
    background-color: rgba(74, 74, 138, 0.3);
}

.slider-container {
  margin: 15px 0;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
}

.slider-label {
  color: #00fff2;
  font-size: 0.9em;
  text-transform: uppercase;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.slider-label.small {
    font-size: 0.8em;
    text-align: right;
    padding-right: 10px;
}

body.light-mode .slider-label {
  color: #1a1a3a;
  text-shadow: none;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #0a0a2e;
  border-radius: 2px;
  outline: none;
  border: 1px solid #00fff2;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #00fff2;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 255, 242, 0.8);
}

body.light-mode input[type="range"] {
    background: #e0e0ff;
    border-color: #4a4a8a;
}

body.light-mode input[type="range"]::-webkit-slider-thumb {
    background: #4a4a8a;
    box-shadow: 0 0 10px rgba(74, 74, 138, 0.5);
}

#power-controls .slider-container, #power-console .power-sliders-section .slider-container {
    padding-left: 0;
    padding-right: 0;
    margin-top: 5px;
    margin-bottom: 5px;
}

#power-controls .instructions.small {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 255, 242, 0.2);
}

body.light-mode #power-controls .instructions.small {
    border-top-color: rgba(74, 74, 138, 0.2);
}

#power-console {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.power-source-section {
    display: flex;
    gap: 15px;
    align-items: center;
}
.power-source-details {
    flex-grow: 1;
}
.power-source-details .text-input {
    margin: 0;
    font-size: 0.8em;
}
.power-source-details .instructions.small {
    margin-top: 8px;
    padding: 0;
    border: none;
    text-align: left;
}
.power-readout-section {
    position: relative;
    border: 1px solid rgba(0, 255, 242, 0.2);
    border-radius: 8px;
    padding: 5px;
    background: rgba(0,0,0,0.2);
}
body.light-mode .power-readout-section {
    border-color: rgba(74, 74, 138, 0.2);
    background: rgba(255,255,255,0.2);
}
#power-graph-canvas {
    width: 100%;
    height: 80px;
    display: block;
}
#power-readout-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    text-align: center;
    text-shadow: 0 0 15px #00fff2, 0 0 20px #00fff2;
    pointer-events: none;
}
body.light-mode #power-readout-container {
    color: #1a1a3a;
    text-shadow: 0 0 10px rgba(74, 74, 138, 0.4);
}
.power-readout-display {
    font-size: 2.2em;
    font-weight: bold;
    letter-spacing: 1px;
}
.power-readout-unit {
    font-size: 1em;
    display: block;
    margin-top: -5px;
    color: #00fff2;
}
body.light-mode .power-readout-unit {
    color: #4a4a8a;
}
#power-console .slider-container {
    padding: 0;
    margin: 10px 0;
}
.amplifier-section {
    text-align: center;
}
.amplifier-section .instructions.small {
    margin-top: 8px;
}

.target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.target-header .card-title {
    margin: 0;
}

#target-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px; /* Or adjust as needed */
    overflow-y: auto;
    padding-right: 5px; /* for scrollbar */
    margin-bottom: 10px;
}

#target-list::-webkit-scrollbar {
  width: 5px;
}
#target-list::-webkit-scrollbar-track {
  background: rgba(10, 10, 46, 0.5);
  border-radius: 4px;
}
#target-list::-webkit-scrollbar-thumb {
  background: #00fff2;
  border-radius: 4px;
}
body.light-mode #target-list::-webkit-scrollbar-track {
  background: rgba(230, 230, 255, 0.5);
}
body.light-mode #target-list::-webkit-scrollbar-thumb {
  background: #4a4a8a;
}

.target-card {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(0, 255, 242, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.target-card:hover {
    background-color: rgba(0, 255, 242, 0.1);
}

.target-card.active {
    border-color: #00fff2;
    background-color: rgba(0, 255, 242, 0.15);
    box-shadow: 0 0 10px rgba(0, 255, 242, 0.4);
}

body.light-mode .target-card {
    border-color: rgba(74, 74, 138, 0.2);
}
body.light-mode .target-card:hover {
    background-color: rgba(74, 74, 138, 0.1);
}
body.light-mode .target-card.active {
    border-color: #4a4a8a;
    background-color: rgba(74, 74, 138, 0.15);
    box-shadow: 0 0 10px rgba(74, 74, 138, 0.3);
}

.target-card .text-input {
    margin: 0;
    align-self: center;
}

.target-card-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    justify-content: center;
}
.target-card-actions .action-btn {
    padding: 5px;
    font-size: 0.8em;
    min-width: 28px;
    width: 28px;
    height: 28px;
    line-height: 1;
    margin: 0;
    cursor: pointer;
    z-index: 10;
}

#target-selector {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 15px;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.radio-group input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 0.15em solid #00fff2;
    border-radius: 50%;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
    cursor: pointer;
}

body.light-mode .radio-group input[type="radio"] {
    border-color: #4a4a8a;
}

.radio-group input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    background-color: #00fff2;
}

body.light-mode .radio-group input[type="radio"]::before {
    background-color: #4a4a8a;
}

.radio-group input[type="radio"]:checked::before {
    transform: scale(1);
}

.radio-group label {
    font-size: 0.9em;
    cursor: pointer;
}

body.light-mode .action-btn:disabled, body.light-mode .action-btn[disabled] {
    background-color: rgba(74, 74, 138, 0.05);
    color: rgba(74, 74, 138, 0.4);
    border-color: rgba(74, 74, 138, 0.2);
    cursor: not-allowed;
    box-shadow: none;
}

#usb-controls {
    transition: all 0.3s ease, box-shadow 0.5s ease-in-out; /* Add box-shadow transition */
}

#usb-controls.connected {
    border-color: #33ffff;
    box-shadow: 0 0 25px rgba(0, 255, 242, 0.6), inset 0 0 10px rgba(0, 255, 242, 0.2);
}

body.light-mode #usb-controls.connected {
    border-color: #4a4a8a;
    box-shadow: 0 0 25px rgba(74, 74, 138, 0.5), inset 0 0 10px rgba(74, 74, 138, 0.2);
}

#broadcast-indicator-container {
    height: 10px;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#broadcast-indicator {
    width: 8px;
    height: 8px;
    background-color: #00fff2;
    border-radius: 50%;
    box-shadow: 0 0 10px #00fff2;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease;
}

#broadcast-indicator.flashing {
    animation: flash 1s ease-out;
}

#broadcast-indicator.blinking {
    animation: blink 1.5s infinite ease-in-out;
}

@keyframes blink {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
}

@keyframes flash {
    0% { opacity: 0; transform: scale(0.5); }
    20% { opacity: 1; transform: scale(1.2); }
    80% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

body.light-mode #broadcast-indicator {
    background-color: #4a4a8a;
    box-shadow: 0 0 10px #4a4a8a;
}

#defense-controls .control-label {
    color: #8affef;
}
body.light-mode #defense-controls .control-label {
    color: #0b8e7a;
}
#defense-controls .instructions.small {
    text-align: left;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    margin-bottom: 15px;
}
#defense-controls .slider-container {
    padding-left: 0;
    padding-right: 0;
}

/* Custom styles for USB card text */
#usb-controls .card-title,
#usb-controls .control-label,
#usb-controls .instructions {
    color: #c78eff; /* A nice purple */
}
body.light-mode #usb-controls .card-title,
body.light-mode #usb-controls .control-label,
body.light-mode #usb-controls .instructions {
    color: #6a0dad; /* A darker purple for light mode */
}

/* --- Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: rgba(10, 10, 46, 0.95);
  border: 1px solid #00fff2;
  border-radius: 12px;
  padding: 30px;
  width: 100%;
  max-width: 800px;
  height: 90vh;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 255, 242, 0.4);
}

body.light-mode .modal-content {
  background: rgba(240, 240, 255, 0.98);
  border-color: #4a4a8a;
  box-shadow: 0 0 20px rgba(74, 74, 138, 0.3);
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: #00fff2;
  font-size: 2em;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

body.light-mode .modal-close-btn {
  color: #4a4a8a;
}
.modal-close-btn:hover {
  color: #ffffff;
}
body.light-mode .modal-close-btn:hover {
  color: #1a1a3a;
}

#manual-content {
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 15px; /* For scrollbar */
  color: #e0e0ff;
}

#manual-content h2 {
  color: #00fff2;
  border-bottom: 2px solid #00fff2;
  padding-bottom: 10px;
  margin-top: 20px;
  margin-bottom: 15px;
}

#manual-content h3 {
  color: #c78eff;
  margin-top: 20px;
  margin-bottom: 10px;
}

#manual-content p, #manual-content li {
  line-height: 1.7;
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  font-size: 16px;
  margin-bottom: 10px;
}

#manual-content ul {
    list-style-type: disc;
    padding-left: 30px;
}

#manual-content strong {
    color: #fff;
    font-weight: 600;
}

body.light-mode #manual-content {
  color: #1a1a3a;
}
body.light-mode #manual-content h2 {
  color: #1a1a3a;
  border-bottom-color: #4a4a8a;
}
body.light-mode #manual-content h3 {
  color: #6a0dad;
}
body.light-mode #manual-content strong {
    color: #000;
}

.modal-footer {
  padding-top: 20px;
  border-top: 1px solid rgba(0, 255, 242, 0.2);
  text-align: right;
  flex-shrink: 0;
  margin-top: 10px;
}

body.light-mode .modal-footer {
    border-top-color: rgba(74, 74, 138, 0.2);
}
.modal-footer .action-btn {
    width: auto;
    margin-top: 0;
}

/* Print Styles */
@media print {
  body > *:not(#manual-printable-area) {
    display: none;
  }
  #manual-printable-area, #manual-printable-area * {
    visibility: visible;
  }
  #manual-printable-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }
  #manual-printable-area h1, #manual-printable-area h2, #manual-printable-area h3, #manual-printable-area strong {
    color: #000 !important;
  }
  #manual-printable-area h2 {
    border-color: #000 !important;
  }
  a[href]:after {
    content: none !important;
  }
  /* Page break control */
  h2 {
    page-break-before: always;
  }
  h2:first-of-type {
    page-break-before: auto;
  }
}