/* WallyMud - Retro CRT Terminal Stylesheet */
:root {
  --bg-color: #0b0c10;
  --term-bg: #050505;
  --text-color: #c5c6c7;
  --green: #45f248;
  --cyan: #66fcf1;
  --yellow: #f9d342;
  --red: #ff3344;
  --magenta: #d946ef;
  --blue: #3b82f6;
  --white: #ffffff;
  --combat-red: rgba(239, 68, 68, 0.4);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Courier New', Courier, monospace, 'VT323';
  font-size: 15px;
  line-height: 1.4;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* CRT Screen Container */
.crt-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--term-bg);
  position: relative;
  overflow: hidden;
  border: 4px solid #1f2833;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  transition: box-shadow 0.3s ease;
}

/* Combat Red Vignette Alert */
.crt-container.in-combat {
  box-shadow: inset 0 0 35px var(--combat-red), 0 0 25px rgba(239, 68, 68, 0.8);
  border-color: #ef4444;
  animation: combat-pulse 1.5s infinite alternate;
}

@keyframes combat-pulse {
  from { box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.4), 0 0 15px rgba(239, 68, 68, 0.6); }
  to { box-shadow: inset 0 0 45px rgba(239, 68, 68, 0.7), 0 0 30px rgba(239, 68, 68, 1); }
}

/* Subtle CRT Scanlines */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 10;
}

/* Terminal Header */
.term-header {
  background: #1f2833;
  color: var(--cyan);
  padding: 6px 14px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #45a29e;
  font-size: 13px;
  letter-spacing: 1px;
}

.term-header .title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-header .status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* Output Window */
#output {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  z-index: 1;
  scroll-behavior: smooth;
}

/* Color Classes */
.c-r { color: #f87171; }
.c-g { color: #4ade80; }
.c-y { color: #fde047; }
.c-b { color: #60a5fa; }
.c-m { color: #e879f9; }
.c-c { color: #22d3ee; }
.c-w { color: #f3f4f6; }
.c-R { color: #ef4444; font-weight: bold; }
.c-G { color: #22c55e; font-weight: bold; }
.c-Y { color: #eab308; font-weight: bold; }
.c-B { color: #3b82f6; font-weight: bold; }
.c-M { color: #d946ef; font-weight: bold; }
.c-C { color: #06b6d4; font-weight: bold; }
.c-W { color: #ffffff; font-weight: bold; }

/* Input Bar & Prompt */
.term-input-area {
  display: flex;
  flex-direction: column;
  background: #0d1117;
  border-top: 1px solid #30363d;
  padding: 8px 14px;
  z-index: 2;
}

.prompt-line {
  color: var(--cyan);
  margin-bottom: 4px;
  font-weight: bold;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-cursor {
  color: var(--green);
  font-weight: bold;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: inherit;
  font-size: 16px;
}

/* Mobile Virtual Compass & Quick Bar */
.mobile-controls {
  display: none;
  background: #161b22;
  padding: 8px;
  border-top: 1px solid #30363d;
  justify-content: space-between;
  align-items: center;
}

@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 38px);
  gap: 4px;
}

.dpad button, .quick-actions button {
  background: #21262d;
  color: var(--cyan);
  border: 1px solid #30363d;
  border-radius: 4px;
  font-family: inherit;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.dpad button:active, .quick-actions button:active {
  background: var(--cyan);
  color: #000;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 60px);
  gap: 6px;
}

/* Login Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal {
  background: #161b22;
  border: 2px solid var(--cyan);
  padding: 24px;
  width: 90%;
  max-width: 420px;
  border-radius: 6px;
  box-shadow: 0 0 25px rgba(102, 252, 241, 0.3);
}

.modal h2 {
  color: var(--cyan);
  margin-bottom: 16px;
  text-align: center;
  font-size: 18px;
  letter-spacing: 2px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  color: var(--text-color);
  margin-bottom: 4px;
  font-size: 13px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  color: var(--white);
  font-family: inherit;
  border-radius: 4px;
}

.modal-btn {
  width: 100%;
  padding: 10px;
  background: #238636;
  color: #fff;
  border: none;
  font-family: inherit;
  font-weight: bold;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.modal-btn:hover {
  background: #2ea043;
}
