/**
 * MUD3 Client - Main Styles
 * Base styles and layout (theme-independent)
 */

/* ==================== Reset & Base ==================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Crimson Pro', Georgia, serif;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input {
  font-family: inherit;
  border: none;
  outline: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ==================== App Layout ==================== */

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  position: relative;
  z-index: 1;
}

/* ==================== Top Bar (Logo + Stats) ==================== */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  flex-shrink: 0;
  gap: 1rem;
  z-index: 50;
  background: var(--bg-primary, #1a1412);
}

.theme-icon-btn {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  border-radius: 8px;
  transition: background 0.2s, transform 0.15s;
  color: var(--text-primary, #e8dcc8);
  background: transparent;
}
.theme-icon-btn:hover {
  background: var(--bg-tertiary, rgba(255,255,255,0.08));
}
.theme-icon-btn:active {
  transform: scale(0.95);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Top bar: two small icons (color theme + client mode) */
.top-bar-icons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.icon-btn-small {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: 6px;
  color: var(--text-primary, #e8dcc8);
  background: transparent;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
}

.icon-btn-small:hover:not(.dimmed) {
  background: var(--bg-tertiary, rgba(255,255,255,0.08));
}

.icon-btn-small:active:not(.dimmed) {
  transform: scale(0.95);
}

.icon-btn-small.dimmed {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Connect button now in logo dropdown */

.logo-dropdown-wrapper {
  position: relative;
}

.logo-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 8px;
  transition: background 0.2s;
}

.logo-icon {
  font-size: 1.4rem;
}

.logo-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 180px;
  padding: 0.5rem;
  border-radius: 8px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--bg-secondary, #231c16);
  border: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.logo-dropdown.open {
  display: flex;
}

.logo-dropdown .dropdown-item {
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  border-radius: 6px;
  font-size: 1rem;
  color: var(--menu-text, var(--text-primary, #e8dcc8));
}

.logo-dropdown .dropdown-item:hover {
  background: var(--bg-tertiary, rgba(255,255,255,0.05));
}

.dropdown-connect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
}

.dropdown-connect .connect-icon {
  font-size: 1rem;
}

.dropdown-connect.btn-disconnect {
  color: #ef4444;
}

.dropdown-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--menu-text, var(--text-primary, #e8dcc8));
}

.connection-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.status-indicator {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-indicator.disconnected {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.status-indicator.connecting {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
  animation: pulse 1.5s infinite;
}

.status-indicator.connected {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

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

.btn-connect, .btn-disconnect {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

/* ==================== Status Bar ==================== */

.top-bar .status-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0;
  font-size: 0.8rem;
  flex: 1;
}

.stat-group {
  display: flex;
  gap: 1.5rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-label {
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.stat-value.stat-critical {
  color: #ef4444;
  animation: pulse 1s infinite;
}

.stat-value.stat-low {
  color: #f97316;
}

.stat-value.stat-medium {
  color: #eab308;
}

.stat-value.stat-good {
  color: #22c55e;
}

/* ==================== Main Content ==================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  min-height: 0;
  position: relative;
}

.retro-wireplay-layout,
.retro-oldie-layout {
  display: none;
}

/* ==================== Bottom Controls ==================== */

.bottom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding: 0.25rem 0;
}

.controls-left {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  align-items: center;
}

.controls-left .action-btn {
  width: 48px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.controls-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.controls-right .combat-btn,
.controls-right .action-btn {
  width: 48px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.controls-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.bottom-controls .compass-grid {
  margin: 0;
}

.bottom-controls .direction-extras {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.bottom-controls .dir-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Compass Grid */
.compass-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compass-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.compass-btn {
  width: 48px;
  height: 40px;
  font-size: 0.75rem;
  font-weight: 600;
}

.compass-center {
  font-size: 1.25rem;
}

/* Direction Extras */
.direction-extras {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 0.5rem;
}

.dir-btn {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
}

.swamp-btn {
  grid-column: 1 / -1;
}

/* Action Grid */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.action-btn, .combat-btn {
  padding: 0.5rem;
  font-size: 0.75rem;
}

/* ==================== Terminal ==================== */

.terminal-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.terminal-frame {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Terminal Content */
.terminal {
  color: #e5e5e5;
  background: transparent;
}

.terminal-line {
  min-height: 1.4em;
}

.terminal.bell {
  animation: flash 0.1s;
}

@keyframes flash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}

.system-message {
  color: #a3a3a3;
  font-style: italic;
}

.local-echo {
  color: #737373;
}

/* ==================== Input Area ==================== */

.input-area {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.input-prompt {
  font-size: 1rem;
  opacity: 0.6;
}

.toggle-controls-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.6;
  padding: 0.25rem;
  transition: transform 0.2s, opacity 0.2s;
  color: inherit;
  line-height: 1;
}

.toggle-controls-btn:hover {
  opacity: 1;
}

.toggle-controls-btn.collapsed {
  transform: rotate(-90deg);
}

.bottom-controls.hidden {
  display: none !important;
}

.command-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  background: transparent;
  color: inherit;
}

.command-input::placeholder {
  opacity: 0.4;
}

.send-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.input-hints {
  display: flex;
  gap: 1rem;
  padding-left: 2rem;
}

.hint {
  font-size: 0.7rem;
  opacity: 0.4;
}

/* ==================== Footer ==================== */

.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--footer-text, var(--text-secondary, #c4b59d));
}

.app-footer a {
  color: var(--footer-link, var(--text-primary, #e8dcc8));
}

.separator {
  opacity: 0.5;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* ==================== Background ==================== */

.bg-decorations {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-pattern {
  position: absolute;
  inset: 0;
}

.bg-vignette {
  position: absolute;
  inset: 0;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
  .top-bar {
    padding: max(0.25rem, env(safe-area-inset-top)) 0.5rem;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .logo-btn {
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
  }

  .top-bar .status-bar {
    font-size: 0.6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.15rem 0.5rem;
    min-width: 0;
    overflow: hidden;
  }

  .stat-group {
    gap: 0.35rem;
  }

  .stat-label {
    font-size: 0.55rem;
  }

  .main-content {
    padding: 0 0.5rem 0.25rem;
    gap: 0.35rem;
  }

  .bottom-controls {
    flex-wrap: nowrap;
    gap: 0.25rem;
    padding: 0.25rem 0;
  }

  .compass-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    font-size: 1.1rem;
  }

  .dir-btn, .action-btn, .combat-btn {
    padding: 0.35rem;
    min-width: 36px;
  }

  .bottom-controls .dir-btn {
    width: 36px;
    height: 36px;
  }

  .controls-left .action-btn {
    width: 36px;
    height: 36px;
  }

  .controls-right .combat-btn,
  .controls-right .action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .input-hints {
    display: none;
  }

  .app-footer {
    display: none;
  }
}

@media (max-width: 480px) {
  .compass-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .dir-btn, .action-btn, .combat-btn {
    min-width: 32px;
  }

  .bottom-controls .dir-btn {
    width: 32px;
    height: 32px;
  }

  .controls-left .action-btn {
    width: 32px;
    height: 32px;
  }

  .controls-right .combat-btn,
  .controls-right .action-btn {
    width: 32px;
    height: 32px;
  }

  .action-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}






















































