:root {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --border: #334155;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

header, main, footer {
  width: 100%;
  max-width: 580px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.input-group input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: monospace;
  font-size: 1rem;
}

.input-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.output-group {
  margin-top: 1.5rem;
  text-align: center;
}

.code-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

#totp-display {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 4px;
  font-family: monospace;
  color: var(--accent);
}

button {
  background: var(--accent);
  color: #0f172a;
  border: none;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.timer-container {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 1rem 0 0.5rem;
  overflow: hidden;
}

#timer-bar {
  height: 100%;
  background: var(--accent);
  width: 100%;
}

#timer-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.trust-badge {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #4ade80;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.compatibilility-info h3 {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.tag {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.content-section {
  margin-top: 2.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.content-section h2 {
  color: var(--text);
  font-size: 1.2rem;
  margin-top: 2rem;
}

.content-section h3 {
  color: var(--text);
  font-size: 1rem;
  margin-top: 1.5rem;
}

.content-section h4 {
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.content-section p {
  margin-bottom: 1rem;
}

.content-section ol,
.content-section ul {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.content-section li {
  margin-bottom: 0.5rem;
}

.content-section code {
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.content-section a {
  color: var(--accent);
  text-decoration: none;
}

.content-section a:hover {
  text-decoration: underline;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-item {
  background: rgba(56, 189, 248, 0.05);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

details {
  background: #131d31;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  transition: background 0.3s;
}

details:hover {
  background: #1a2740;
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  outline: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "➕ ";
}

details[open] summary::before {
  content: "➖ ";
}

details p {
  margin: 1rem 0 0 0;
  color: var(--text-muted);
  line-height: 1.7;
}

footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 0.3rem;
}

footer a:hover {
  text-decoration: underline;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  body {
    padding: 1rem;
  }
  
  header, main, footer {
    max-width: 100%;
  }
  
  .card {
    padding: 1rem;
  }
  
  #totp-display {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }
  
  .code-wrapper {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  button {
    width: 100%;
  }
  
  .content-section {
    font-size: 0.9rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  details, button, #timer-bar {
    transition: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --border: #ffffff;
    --text-muted: #cccccc;
  }
}