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

:root {
  --bg: #0a0a1a;
  --fg: #e0e0e0;
  --accent: #00d4aa;
  --danger: #ff4444;
  --warn: #ff8800;
  --card: #1a1a2e;
  --border: #333;
}

body {
  font-family: 'Courier New', Courier, monospace;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

header h1 {
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

#status {
  font-size: 0.8rem;
  color: #888;
  word-break: break-all;
}

#config-section {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
}

#config-section.hidden {
  display: none;
}

#config-section h2 {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--accent);
  letter-spacing: 0.1em;
}

#discover-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

#discover-section label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#discover-section input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  margin-top: 4px;
  transition: border-color 0.2s;
}

#discover-section input:focus {
  outline: none;
  border-color: var(--accent);
}

#discover-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.2s;
  margin-top: 8px;
}

#discover-btn:hover {
  background: var(--accent);
  color: #000;
}

#discover-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#discover-status {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #888;
  min-height: 1.2em;
}

#manual-section.hidden {
  display: none;
}

#config-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.75rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#config-form input[type="text"],
#config-form input[type="password"],
#config-form input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  margin-top: 4px;
  transition: border-color 0.2s;
}

#config-form input:focus {
  outline: none;
  border-color: var(--accent);
}

#config-form .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#config-form .checkbox-label input {
  width: auto;
  cursor: pointer;
}

#config-form button {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: opacity 0.2s;
}

#config-form button:hover {
  opacity: 0.85;
}

#config-form button:active {
  opacity: 0.7;
}

#alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

#alert-overlay.hidden {
  display: none;
}

#alert-content {
  text-align: center;
  padding: 20px;
  width: 100%;
  max-width: 500px;
}

#alert-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: pulse 1s ease infinite;
}

#alert-content h2 {
  font-size: 2rem;
  letter-spacing: 0.2em;
  color: var(--danger);
  margin-bottom: 8px;
}

#alert-phase {
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  color: var(--warn);
  margin-bottom: 16px;
  min-height: 1.5em;
}

#email-list {
  margin: 16px 0;
  max-height: 200px;
  overflow-y: auto;
}

.email-item {
  background: var(--card);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 8px;
  text-align: left;
  border-radius: 0 6px 6px 0;
}

.email-item strong {
  color: var(--accent);
  font-size: 0.9rem;
}

.email-item small {
  color: #888;
  font-size: 0.75rem;
}

#acknowledge-btn {
  padding: 18px 36px;
  font-size: 1.2rem;
  font-family: inherit;
  font-weight: bold;
  letter-spacing: 0.2em;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--danger);
  border-radius: 12px;
  cursor: pointer;
  margin-top: 20px;
  animation: pulse-border 1s ease infinite;
  text-transform: uppercase;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#acknowledge-btn:hover {
  background: #cc0000;
}

#acknowledge-btn:active {
  background: #990000;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--danger); }
  50% { border-color: #ff8888; }
}

body.alerting #alert-overlay {
  animation: bgFlash 0.5s ease infinite alternate;
}

@keyframes bgFlash {
  from { background: rgba(255, 0, 0, 0.08); }
  to { background: rgba(255, 0, 0, 0.2); }
}

.hidden {
  display: none !important;
}
