/* ============================================================
   StepAnd.me — Minimal Styles
   Dark theme, mobile-first, DSGVO-compliant (no external fonts)
   ============================================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-card-hover: #1f1f2c;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #606078;
  --accent-primary: #ff6b35;
  --accent-secondary: #ff8c5a;
  --accent-glow: rgba(255, 107, 53, 0.3);
  --success: #2ed573;
  --danger: #ff4757;
  --warning: #ffa502;
  --gold: #ffd700;
  --border: #252530;
  --border-light: #333340;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.screen.active { display: block; }

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  min-width: 56px;
}

.nav-btn svg {
  width: 22px; height: 22px;
  transition: all 0.2s;
}

.nav-btn.active {
  color: var(--accent-primary);
}

.nav-btn.active svg {
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.nav-btn:active {
  transform: scale(0.92);
}

.nav-btn-legal {
  opacity: 0.6;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  text-align: center;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.gold { border-left: 3px solid var(--gold); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-secondary);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
}

/* ============================================================
   INPUTS
   ============================================================ */
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--accent-primary);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ============================================================
   HABIT LIST
   ============================================================ */
.habit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.habit-item.completed {
  opacity: 0.6;
  border-color: var(--success);
}

.habit-check {
  width: 28px; height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
  color: transparent;
}

.habit-check:hover {
  border-color: var(--accent-primary);
}

.habit-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.habit-info {
  flex: 1;
  min-width: 0;
}

.habit-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.habit-streak {
  color: var(--accent-primary);
  font-weight: 700;
}

.habit-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1rem;
  opacity: 0;
  transition: all 0.2s;
}

.habit-item:hover .habit-delete {
  opacity: 0.6;
}

.habit-delete:hover {
  opacity: 1 !important;
  color: var(--danger);
}

/* ============================================================
   ADD HABIT FAB
   ============================================================ */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px + var(--safe-bottom));
  right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-glow);
  z-index: 90;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:active {
  transform: scale(0.9);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.modal-sheet {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0 auto 16px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ============================================================
   BOSS SCREEN
   ============================================================ */
.boss-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.boss-visual {
  position: relative;
  width: 180px; height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boss-sprite {
  font-size: 5rem;
  filter: drop-shadow(0 0 20px var(--accent-glow));
  animation: bossFloat 3s ease-in-out infinite;
  transition: all 0.3s;
}

.boss-sprite.hit {
  animation: bossHit 0.3s ease;
}

@keyframes bossFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes bossHit {
  0% { transform: translateX(0); filter: brightness(2); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); filter: brightness(1); }
}

.boss-name {
  font-size: 1.2rem;
  font-weight: 900;
  text-align: center;
}

.boss-hp-bar {
  width: 100%;
  max-width: 300px;
  height: 20px;
  background: var(--bg-card);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--danger), var(--accent-primary));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.boss-hp-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.boss-reward {
  text-align: center;
  padding: 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.boss-defeated {
  text-align: center;
  padding: 20px;
  animation: fadeIn 0.5s;
}

.boss-defeated .trophy {
  font-size: 4rem;
  animation: bossFloat 2s ease-in-out infinite;
}

/* ============================================================
   IDENTITY SCREEN
   ============================================================ */
.identity-header {
  text-align: center;
  padding: 20px 0;
}

.identity-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 12px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.identity-name {
  font-size: 1.3rem;
  font-weight: 900;
}

.identity-title {
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.identity-level {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.xp-bar {
  width: 100%;
  max-width: 280px;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px auto;
}

.xp-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   LEGAL PAGES
   ============================================================ */
.legal-content {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 0;
}

.legal-content h1 {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 16px;
  color: var(--accent-primary);
}

.legal-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 8px;
  color: var(--text-primary);
}

.legal-content h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 16px 0 6px;
}

.legal-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.legal-content ul {
  margin: 8px 0 8px 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legal-content li {
  margin-bottom: 4px;
}

.legal-content a {
  color: var(--accent-primary);
  text-decoration: none;
}

.legal-content a:hover {
  text-decoration: underline;
}

.legal-content .last-updated {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 24px;
  font-style: italic;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 0.8rem;
}

/* ============================================================
   PARTICLES (minimal)
   ============================================================ */
.particle {
  position: fixed;
  pointer-events: none;
  z-index: 300;
  border-radius: 50%;
  animation: particleFly var(--dur, 0.8s) ease-out forwards;
}

@keyframes particleFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx, 0), var(--ty, -60px)) scale(0); }
}

/* ============================================================
   LEGAL FOOTER
   ============================================================ */
.legal-footer {
  position: fixed;
  bottom: var(--nav-height);
  left: 0; right: 0;
  text-align: center;
  padding: 4px;
  font-size: 0.55rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  z-index: 50;
  pointer-events: none;
}

.legal-footer a {
  color: var(--accent-primary);
  pointer-events: auto;
  text-decoration: none;
}

.legal-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 768px) {
  .screen {
    max-width: 600px;
    margin: 0 auto;
  }
  
  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}
