* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    font-family: 'Courier New', monospace;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    margin: 0;
    position: relative;
}

.main-container {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    justify-content: center;
    align-items: flex-start;
}

.menu-bar {
    background-color: #2d2d2d;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.menu-title {
    color: #00ff00;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.reset-btn {
    background-color: #ff5f56;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reset-btn:hover {
    background-color: #ff3b30;
}

.reset-btn:active {
    background-color: #d63031;
}

/* Server-management menu actions */
.menu-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-btn,
.menu-select {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 7px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.menu-btn:hover,
.menu-select:hover {
    background-color: #4a4a4a;
    border-color: #00ff00;
}

.menu-btn:active {
    background-color: #555;
}

.menu-btn:disabled,
.menu-btn:disabled:hover {
    background-color: #2a2a2a;
    color: #666;
    border-color: #444;
    cursor: not-allowed;
}

#powerBtn {
    background-color: #2e7d32;
    border-color: #2e7d32;
    color: #ffffff;
}

#powerBtn:hover {
    background-color: #388e3c;
}

/* Off state: power button shows red and terminal is overlaid */
.menu-bar.powered-off #powerBtn {
    background-color: #b71c1c;
    border-color: #b71c1c;
}

.power-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.92);
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    z-index: 10;
}

.power-overlay-text strong {
    color: #ff5f56;
}

/* Client: simulated web browser (second screen) */
.browser {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 520px;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.browser-header {
    background-color: #2d2d2d;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: move;
}

/* While dragging, don't let the iframe (or other frames) capture the mouse */
body.dragging-active iframe {
    pointer-events: none;
}

.browser-title {
    color: #cccccc;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.browser-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px;
    background-color: #e8eaed;
    border-bottom: 1px solid #ccc;
}

.browser-nav {
    border: 1px solid #bbb;
    background: #fff;
    border-radius: 4px;
    width: 32px;
    cursor: pointer;
    font-size: 14px;
}

/* Address-bar lock indicator */
.browser-lock {
    display: flex;
    align-items: center;
    padding: 0 2px;
}
.browser-lock svg { display: block; }
.browser-lock.lock-secure { color: #1a7f37; }   /* green: valid HTTPS */
.browser-lock.lock-insecure { color: #d93025; }  /* red: broken/invalid cert */
.browser-lock.lock-none { color: #9aa0a6; }      /* gray: plain HTTP / no cert */

.browser-address {
    flex: 1;
    border: 1px solid #bbb;
    border-radius: 14px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
    outline: none;
}

.browser-go {
    border: none;
    background: #1a73e8;
    color: #fff;
    border-radius: 4px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}

.browser-viewport {
    flex: 1;
    min-height: 0;
    background: #fff;
}

.browser-viewport iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.browser-status {
    background-color: #f1f3f4;
    border-top: 1px solid #ddd;
    padding: 4px 12px;
    font-size: 12px;
    color: #5f6368;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 20px;
}

/* DNS settings — overlay modal opened from the menu bar */
.dns-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.dns-overlay.open {
    display: block;
}

.dns-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 420px;
    max-height: 70%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dns-header {
    background-color: #2d2d2d;
    color: #cccccc;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dns-close {
    border: none;
    background: transparent;
    color: #cccccc;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}

.dns-close:hover {
    color: #ffffff;
}

.dns-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px;
    background-color: #e8eaed;
    border-bottom: 1px solid #ccc;
}

.dns-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #bbb;
    border-radius: 14px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: Arial, Helvetica, sans-serif;
    outline: none;
}

.dns-add {
    border: none;
    background: #1a73e8;
    color: #fff;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.dns-list {
    flex: 1;
    min-height: 120px;
    overflow-y: auto;
    padding: 6px;
    background: #fff;
}

.dns-empty {
    color: #9aa0a6;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    padding: 10px;
    line-height: 1.4;
}

.dns-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid #f1f3f4;
    font-family: Arial, Helvetica, sans-serif;
}

.dns-name {
    font-size: 13px;
    color: #202124;
    font-weight: 600;
    word-break: break-all;
}

.dns-target {
    font-size: 11px;
    color: #5f6368;
    margin-left: auto;
    white-space: nowrap;
}

.dns-del {
    border: none;
    background: transparent;
    color: #9aa0a6;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
}

.dns-del:hover {
    color: #d93025;
}

/* Test link styling to look like a button */
.test-link {
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.test-link:hover {
    text-decoration: none;
}

.test-link:visited {
    color: white;
}

.terminal {
    background-color: #000000;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 800px;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    cursor: default;
}

.help-panel {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    width: 300px;
    height: 500px;
    overflow-y: auto;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    position: fixed;
    right: 20px;
    top: 100px;
}

.help-panel h3 {
    color: #00ff00;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.help-panel h4 {
    color: #00ff00;
    margin: 15px 0 8px 0;
    font-size: 14px;
}

.command-section {
    margin-bottom: 15px;
}

.command-item {
    margin-bottom: 6px;
    padding-left: 10px;
}

.command-item code {
    background-color: #2d2d2d;
    color: #00ff00;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.terminal.dragging {
    cursor: grabbing;
}

.terminal-header {
    background-color: #2d2d2d;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #333;
    cursor: grab;
}

.terminal-header:active {
    cursor: grabbing;
}

.terminal-buttons {
    display: flex;
    gap: 6px;
}

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.btn.close {
    background-color: #ff5f56;
}

.btn.minimize {
    background-color: #ffbd2e;
}

.btn.maximize {
    background-color: #27ca3f;
}

.terminal-title {
    color: #ffffff;
    font-size: 12px;
    margin-left: 12px;
}

.terminal-body {
    flex: 1;
    padding: 12px;
    background-color: #000000;
    color: #00ff00;
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

.content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 0;
    overflow-y: auto;
}

.output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.line {
    margin-bottom: 4px;
}

.prompt {
    color: #00ff00;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: nowrap;
}

.cursor {
    animation: blink 1s infinite;
    color: #00ff00;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.input-line {
    display: flex;
    align-items: center;
    line-height: 1.4;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    flex-shrink: 0;
    position: relative; /* anchor for the custom terminal cursor */
}

.input {
    background: transparent;
    border: none;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    outline: none;
    flex: 1;
    padding: 0;
    margin: 0;
    line-height: 1.4;
    caret-color: transparent;
}

.input::placeholder {
    color: #666;
}

/* Custom terminal cursor: a block that follows the caret. It is created and
   positioned by script.js, and is ONLY visible while the input is focused
   (i.e. when you can actually type commands). */
.terminal-cursor {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 1.1em;
    background: #00ff00;
    pointer-events: none;
    display: none;
}

.input-line.input-focused .terminal-cursor {
    display: block;
    animation: blink 1s step-end infinite;
}

/* Scrollbar styling */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== Fullscreen Program Overlay (nano, vi, etc.) ===== */

.program-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    z-index: 10;
    padding: 0;
    overflow: hidden;
}

/* Editor title bar (nano header) */
.editor-titlebar {
    background-color: #ffffff;
    color: #000000;
    padding: 0 4px;
    line-height: 1.4;
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

/* Editor content area */
.editor-content {
    flex: 1;
    white-space: pre;
    overflow: hidden;
    padding: 0 4px;
    min-height: 0;
}

.editor-content.editor-help {
    color: #00ff00;
    padding: 8px;
}

/* Cursor block */
.editor-cursor {
    background-color: #00ff00;
    color: #000000;
}

/* Status bar */
.editor-statusbar {
    background-color: #ffffff;
    color: #000000;
    padding: 0 4px;
    line-height: 1.4;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

/* Nano shortcut bar */
.editor-shortcuts {
    background-color: #000000;
    color: #cccccc;
    padding: 0 4px;
    line-height: 1.6;
    flex-shrink: 0;
    font-size: 13px;
    white-space: nowrap;
}

.nano-shortcut-key {
    background-color: #ffffff;
    color: #000000;
    padding: 0 2px;
    font-weight: bold;
}

/* w3m link styles */
.w3m-link {
    color: #5fafff;
    text-decoration: underline;
}

.w3m-link-active {
    background-color: #5fafff;
    color: #000000;
    text-decoration: none;
}

/* Vi-specific styles */
.vi-tilde {
    color: #4444ff;
}

.vi-statusline {
    display: flex;
    justify-content: space-between;
}

.vi-pos {
    margin-left: auto;
    padding-right: 8px;
}

/* Vi/Vim command line */
.editor-commandline {
    padding: 0 4px;
    line-height: 1.4;
    flex-shrink: 0;
    white-space: nowrap;
    color: #00ff00;
    min-height: 1.4em;
}

/* === Config chooser (index.html landing page) === */
.chooser-body {
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
}

.chooser {
    width: 100%;
    max-width: 760px;
    color: #e0e0e0;
}

.chooser-header {
    text-align: center;
    margin: 24px 0 32px;
}

.chooser-header h1 {
    color: #00ff00;
    font-size: 40px;
    letter-spacing: 2px;
}

.chooser-header p {
    color: #9aa0a6;
    margin-top: 8px;
}

.chooser-section {
    margin-bottom: 32px;
}

.chooser-section h2 {
    font-size: 16px;
    color: #e0e0e0;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.chooser-hint {
    color: #9aa0a6;
    font-size: 13px;
    margin-bottom: 12px;
}

.config-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.config-card {
    text-align: left;
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.config-card:hover {
    background-color: #3a3a3a;
    border-color: #00ff00;
}

.config-card-title {
    font-size: 15px;
    color: #00ff00;
    margin-bottom: 6px;
}

.config-card-desc {
    font-size: 12px;
    color: #9aa0a6;
    line-height: 1.5;
}

.load-config-btn {
    display: inline-block;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 9px 16px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.load-config-btn:hover {
    background-color: #4a4a4a;
    border-color: #00ff00;
}

.load-error {
    color: #ff5f56;
    font-size: 13px;
    margin-top: 12px;
    min-height: 1.2em;
}
