:root {
  --bg-color: #121318;
  --card-bg: #1e2029;
  --accent-color: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --text-main: #ffffff;
  --text-muted: #8e95a5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

/* PWA Banner */
.pwa-banner {
  background: var(--card-bg);
  border-bottom: 1px solid #2a2d3d;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pwa-banner-info { display: flex; align-items: center; gap: 12px; }
.app-icon { width: 40px; height: 40px; border-radius: 10px; }
.pwa-banner-info p { font-size: 12px; color: var(--text-muted); }
.ios-hint { font-size: 12px; color: var(--accent-color); line-height: 1.3; }

/* Layout */
.app-container {
  padding: 20px 16px;
  max-width: 480px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.user-info { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.btn-text { background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer; }

/* Balance Card */
.balance-card {
  background: linear-gradient(135deg, #1e2029 0%, #262936 100%);
  border: 1px solid #2d3142;
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 24px;
}
.card-label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.balance-card h1 { font-size: 32px; font-weight: 700; margin: 12px 0; color: #fff; }
.rate-badge { display: inline-block; background: rgba(59, 130, 246, 0.1); color: var(--accent-color); padding: 6px 14px; border-radius: 20px; font-size: 13px; }

/* Actions */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-action {
  padding: 16px;
  border-radius: 14px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}
.btn-deposit { background: var(--accent-green); }
.btn-withdraw { background: #2a2d3d; border: 1px solid #3b3f54; }
.btn-primary { background: var(--accent-color); color: #fff; padding: 8px 16px; border-radius: 8px; border: none; font-weight: 600; }


/* Auth Centered Layout */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border: 1px solid #2d3142;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  width: 140px;
  height: 30px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Tabs */
.auth-tabs {
  display: flex;
  background: #121318;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Form Controls */
.auth-form .form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: #121318;
  border: 1px solid #2d3142;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-color);
}

.btn-block {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  margin-top: 10px;
  cursor: pointer;
}

/* Alert Notifications */
.auth-alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
}

/* Modal Overlay & Base */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid #2d3142;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

/* Modal Form Extras */
.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.calc-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #121318;
  border: 1px dashed #2d3142;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.calc-preview strong {
  color: var(--accent-green);
  font-size: 15px;
}