:root {
  --bg: #111113;
  --surface: #1a1a1e;
  --border: #2a2a2e;
  --text: #e4e4e7;
  --text-muted: #8a8a8e;
  --accent: #4f8ff7;
  --accent-hover: #3d7ae0;
  --input-bg: #141416;
  --error: #e05555;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.screen {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---- LOGIN SCREEN ---- */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 28px;
}

.input-group {
  margin-bottom: 20px;
  text-align: left;
}

.input-group input {
  width: 100%;
}

.error-msg {
  display: block;
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 6px;
  min-height: 1.2em;
}

/* ---- SHARED INPUT / BUTTON STYLES ---- */

input[type="password"],
textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ---- MAIN SCREEN ---- */

#main-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  gap: 20px;
}

/* ---- MODE TOGGLE ---- */

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mode-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
  user-select: none;
}

.mode-label.active {
  color: var(--text);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  inset: 0;
  background-color: var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text);
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .slider {
  background-color: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
}

/* ---- OUTPUT AREA ---- */

#output-area {
  width: 100%;
}

.output-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#output-text {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  min-height: 80px;
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

/* ---- RESPONSIVE ---- */

@media (max-width: 500px) {
  .login-card {
    margin: 0 16px;
    padding: 32px 24px;
  }

  .app-header {
    padding: 14px 16px;
  }

  .app-body {
    padding: 24px 16px;
  }
}
