@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface2: #f2f2f0;
  --border: #e2e2de;
  --border2: #d0d0ca;
  --accent: #1a1a2e;
  --accent-blue: #2563eb;
  --accent-red: #dc2626;
  --accent-green: #16a34a;
  --accent-amber: #d97706;
  --text: #1a1a1a;
  --text2: #4a4a4a;
  --muted: #9a9a94;
  --serif: 'Crimson Pro', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --r: 8px;
  --r2: 12px;
  --t: 0.18s ease;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ── LAYOUT ── */
.page-wrap {
  min-height: 100vh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px 48px;
}
@media(min-width:640px){ .page-wrap { align-items: center; padding: 40px 24px; } }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-md);
}
.card-header { padding: 24px 24px 18px; border-bottom: 1px solid var(--border); }
.card-body { padding: 24px; }

/* ── BRAND ── */
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.brand-logo {
  width: 28px; height: 28px; background: var(--accent);
  border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-logo span { color: white; font-size: 12px; font-weight: 700; font-family: var(--serif); }
.brand-name { font-size: 13px; font-weight: 600; color: var(--text2); }

.card-title { font-family: var(--serif); font-size: clamp(20px,5vw,26px); font-weight: 600; line-height: 1.2; color: var(--text); letter-spacing: -0.2px; }
.card-subtitle { margin-top: 5px; font-size: 13px; color: var(--muted); }

/* ── FORM ── */
.field { margin-bottom: 14px; }
label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text2); margin-bottom: 5px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--r); padding: 11px 14px; color: var(--text);
  font-family: var(--sans); font-size: 15px; outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-user-select: text; user-select: text; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(26,26,46,0.07);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.error-msg { font-size: 12px; color: var(--accent-red); margin-top: -6px; margin-bottom: 10px; min-height: 16px; font-weight: 500; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; font-family: var(--sans); font-size: 14px; font-weight: 600;
  border: none; border-radius: var(--r); cursor: pointer; transition: all var(--t);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; letter-spacing: 0.1px;
}
.btn-primary { background: var(--accent); color: white; width: 100%; font-size: 15px; box-shadow: var(--shadow); }
.btn-primary:hover { background: #2d2d4e; }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); flex: 1; }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--surface2); }
.btn-secondary:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.btn-danger-outline { background: transparent; color: var(--accent-red); border: 1.5px solid #fecaca; font-size: 13px; padding: 8px 16px; }
.btn-danger-outline:hover { background: #fef2f2; }
.btn-ghost { background: transparent; color: var(--text2); border: 1.5px solid var(--border); width: 100%; }
.btn-ghost:hover { border-color: var(--text2); color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-blue { background: var(--accent-blue); color: white; flex: 1; }
.btn-blue:hover { background: #1d4ed8; }

/* ── AUTH TABS ── */
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab { flex: 1; padding: 13px 12px; font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all var(--t); margin-bottom: -1px; -webkit-tap-highlight-color: transparent; }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── USER BADGE ── */
.user-badge { font-size: 13px; color: var(--text2); margin-bottom: 16px; padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); display: flex; justify-content: space-between; align-items: center; }
.user-email { font-weight: 500; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-link { font-size: 12px; font-weight: 600; color: var(--accent-red); cursor: pointer; background: none; border: none; font-family: var(--sans); padding: 0; flex-shrink: 0; margin-left: 8px; }

/* ── INFO GRID ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.info-item { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 14px; }
.info-label { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.info-value { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--text); }

/* ── RULES ── */
.rules { list-style: none; margin-bottom: 18px; }
.rules li { font-size: 13px; color: var(--text2); padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; }
.rules li:last-child { border: none; }
.rules li::before { content: '•'; color: var(--muted); flex-shrink: 0; margin-top: 1px; font-size: 16px; }

/* ── NOTICE ── */
.notice { padding: 11px 14px; border-radius: var(--r); font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.notice.warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.notice.danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.notice.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.notice.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }

/* ── WARNING OVERLAY ── */
#warning-overlay { position: fixed; inset: 0; background: rgba(220,38,38,0.05); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.2s ease; padding: 20px; }
#warning-overlay.show { opacity: 1; visibility: visible; }
.warning-box { background: var(--surface); border: 1px solid #fca5a5; border-radius: var(--r2); padding: 28px 24px; max-width: 320px; width: 100%; text-align: center; box-shadow: 0 20px 40px rgba(220,38,38,0.1); animation: popIn 0.25s ease; }
.warning-icon { font-size: 32px; margin-bottom: 10px; display: block; }
.warning-title { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--accent-red); margin-bottom: 6px; }
.warning-msg { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ── TOAST ── */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(60px); background: var(--accent); color: white; font-size: 13px; font-weight: 500; padding: 10px 20px; border-radius: 100px; z-index: 9999; transition: transform 0.3s ease, opacity 0.3s ease; opacity: 0; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-md); }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--accent-red); }
.toast.success { background: var(--accent-green); }

/* ── BADGE ── */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 100px; }
.badge-blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-green { background: #f0fdf4; color: var(--accent-green); border: 1px solid #bbf7d0; }
.badge-red { background: #fef2f2; color: var(--accent-red); border: 1px solid #fecaca; }
.badge-amber { background: #fffbeb; color: var(--accent-amber); border: 1px solid #fde68a; }
.badge-gray { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }

/* ── DIVIDER ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── ANIMATIONS ── */
@keyframes popIn { from{transform:scale(.94) translateY(-6px);opacity:0} to{transform:scale(1) translateY(0);opacity:1} }
@keyframes slideIn { from{opacity:0;transform:translateX(14px)} to{opacity:1;transform:translateX(0)} }
@keyframes fadeUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }

/* ── SELECTABILITY ── */
* { -webkit-user-select: none; user-select: none; }
input, textarea, select { -webkit-user-select: text !important; user-select: text !important; }
