:root {
  --color-primary:    #b8ffa0;
  --color-primary-dim:#b8e4a0;
  --color-bg:         #0c100c;
  --color-border:     #2f4f2f;
  --color-accent:     #6cb03e;
  --color-accent-hi:  #8fdf5a;
  --color-text-blue:  #a0c0e0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
}

body {
  background: radial-gradient(circle at 20% 30%, #0a0f0a, #030603);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', 'Fira Code', monospace;
  padding: 1rem;
}

.dashboard-wrapper {
  max-width: 1200px;
  width: 100%;
  height: auto;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.dashboard {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  width: 100%;
  justify-content: center;
  align-items: flex-start;
}

/* SQUARE PANEL */
.face-panel {
  flex: 1;
  min-width: 200px;
  aspect-ratio: 1 / 1;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 28px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--color-primary) 15%, transparent),
              inset 0 0 10px color-mix(in srgb, var(--color-bg) 60%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.crt-effect {
  position: relative;
}
.crt-effect::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    color-mix(in srgb, var(--color-primary) 3%, transparent) 0px,
    color-mix(in srgb, var(--color-primary) 3%, transparent) 2px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

.face-panel canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  background: var(--color-bg);
  cursor: pointer;
}

/* TERMINAL PANEL */
.terminal-panel {
  flex: 1.5;
  min-width: 260px;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 28px;
  padding: 1rem;
  box-shadow: 0 0 20px color-mix(in srgb, var(--color-primary) 15%, transparent),
              inset 0 0 10px color-mix(in srgb, var(--color-bg) 60%, transparent);
  display: flex;
  flex-direction: column;
  height: auto;
  max-height: 70vh;
  overflow: hidden;
}

.command-history {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-entry {
  color: var(--color-primary-dim);
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.visitor-msg {
  color: var(--color-text-blue);
}

.stray-msg {
  color: var(--color-primary);
  margin-left: 0.5rem;
  border-left: 2px solid var(--color-accent);
  padding-left: 0.5rem;
}

/* PIXEL-STYLE SCROLLBAR */
.command-history::-webkit-scrollbar,
.command-editor::-webkit-scrollbar {
  width: 8px;
}
.command-history::-webkit-scrollbar-track,
.command-editor::-webkit-scrollbar-track {
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
}
.command-history::-webkit-scrollbar-thumb,
.command-editor::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 0;
  border: 1px solid var(--color-accent);
}
.command-history::-webkit-scrollbar-thumb:hover,
.command-editor::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent-hi);
}

.input-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: nowrap;
  border-top: 1px solid var(--color-border);
  padding-top: 0.8rem;
  margin-top: 0.5rem;
  font-family: inherit;
  flex-shrink: 0;
}

.input-prompt {
  color: var(--color-primary);
  font-weight: bold;
  white-space: nowrap;
  padding-top: 0.1rem;
  flex-shrink: 0;
}

.command-editor {
  background: transparent;
  border: none;
  color: var(--color-primary-dim);
  font-family: 'Courier New', 'Fira Code', monospace;
  font-size: 1rem;
  outline: none;
  flex: 1;
  min-width: 0;
  display: block;
  max-height: calc(1.4rem * 5);
  overflow-y: auto;
  caret-color: transparent;
  word-break: break-all;
}

.editable-area {
  display: inline;
  white-space: pre-wrap;
  word-break: break-all;
  outline: none;
  background: transparent;
  color: var(--color-primary-dim);
  font-family: inherit;
  font-size: inherit;
}

.block-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2rem;
  background-color: var(--color-primary-dim);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  box-shadow: 0 0 4px #8bc48a;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── ADMIN MODE ───────────────────────────────────────────────────── */
.dashboard.admin-mode .face-panel {
  display: none;
}
.dashboard.admin-mode .terminal-panel {
  flex: 1;
  max-height: 85vh;
}

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: 16px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.15);
  font-family: 'Courier New', 'Fira Code', monospace;
  color: var(--color-primary);
}

.modal-title {
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.5;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.6rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.modal-field label {
  font-size: 0.8rem;
  opacity: 0.6;
}

.modal-field input,
.modal-field textarea {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  color: var(--color-primary-dim);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  width: 100%;
}

.modal-field input:focus,
.modal-field textarea:focus {
  border-color: var(--color-accent);
}

.modal-error {
  font-size: 0.8rem;
  color: #ff6b6b;
  margin-bottom: 0.8rem;
  min-height: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.modal-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.35rem 0.9rem;
  color: var(--color-primary-dim);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.modal-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-primary);
}

.modal-btn.primary {
  border-color: var(--color-accent);
  color: var(--color-primary);
}

.modal-btn.primary:hover {
  background: rgba(108, 176, 62, 0.15);
}

/* ── RESPONSIVE ───────────────────────────────────────────────────── */
@media (max-width: 700px) {
  body {
    padding: 0.5rem;
  }
  .dashboard {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .face-panel {
    max-width: 240px;
    width: 100%;
  }
  .terminal-panel {
    max-height: 55vh;
    width: 100%;
    padding: 0.8rem;
  }
  .input-prompt, .editable-area {
    font-size: 0.85rem;
  }
}

@media (max-height: 600px) {
  .terminal-panel {
    max-height: 50vh;
  }
  .face-panel {
    max-width: 180px;
  }
}
