/* Tema: Abundancia · oro + esmeralda + verde oscuro (estética inversión) */
:root {
  --bg: #0a1813;
  --bg-grad-1: #0a1813;
  --bg-grad-2: #0f2419;
  --bg-card: #132621;
  --bg-soft: #1a342b;
  --bg-hover: #244a3a;
  --border: #2a4a3a;
  --text: #f3f1de;
  --text-dim: #a5b8ac;
  --gold: #d4af37;
  --gold-soft: #e8c767;
  --gold-dim: #a8862b;
  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-dim: #064e3b;
  --primary: var(--emerald);
  --primary-hover: var(--emerald-hover);
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #3b82f6;
  --success: #22c55e;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Header */
header {
  background: linear-gradient(90deg, #0f2419 0%, #142a1e 100%);
  border-bottom: 1px solid var(--gold-dim);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
}
header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
header h1 {
  font-size: 1.35rem;
  color: var(--gold);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1::before {
  content: '💰';
  font-size: 1.2rem;
}
header h1 .sub { color: var(--text-dim); font-weight: 400; font-size: 0.9rem; }
.user-chip {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.user-chip .badge {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #1a1a1a;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at top, rgba(212, 175, 55, 0.08), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(16, 185, 129, 0.06), transparent 60%);
}
.login-card {
  background: linear-gradient(180deg, #162a22 0%, #122620 100%);
  padding: 36px 32px;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(212, 175, 55, 0.08) inset;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--emerald), var(--gold));
}
.login-card h1 {
  margin-bottom: 8px;
  font-size: 1.7rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-card h1::before { content: '💰'; }
.login-card p.lead {
  color: var(--text-dim);
  margin-bottom: 24px;
  font-size: 0.92rem;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

/* Forms */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  background: #0a1612;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Buttons */
button {
  padding: 11px 18px;
  border: none;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--emerald) 0%, #0d9c6d 100%);
  color: white;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
button:hover:not(:disabled) {
  background: linear-gradient(135deg, #14c98c 0%, var(--emerald) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
button.secondary {
  background: var(--bg-hover);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) { background: #2f5a47; box-shadow: none; }
button.danger {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}
button.warning {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}
button.info { background: linear-gradient(135deg, var(--info), #2563eb); }
button.small { padding: 7px 11px; font-size: 0.8rem; }
button.full { width: 100%; }

/* Cards / Sections */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: linear-gradient(180deg, var(--bg-card) 0%, #101f1a 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.card h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--gold-soft);
  letter-spacing: 0.3px;
}

/* Stats */
.stat {
  background: linear-gradient(180deg, var(--bg-card) 0%, #101f1a 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: 0.7;
}
.stat:hover { transform: translateY(-2px); border-color: var(--gold-dim); }
.stat .label {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .value {
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 6px;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}
.stat .value.small { font-size: 1.2rem; }
.stat .value.text { color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table th, table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
table th {
  background: #0e1f19;
  color: var(--gold-dim);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
table tr { transition: background 0.12s; }
table tbody tr:hover { background: rgba(212, 175, 55, 0.04); }
table td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--gold-soft); font-weight: 600; }
table td.center { text-align: center; }

/* Badges */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tag.ok { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.tag.pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag.missing { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }
.tag.info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.tag.neutral { background: rgba(148, 163, 184, 0.12); color: var(--text-dim); }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.9rem; border: 1px solid transparent; }
.alert.error { background: rgba(220, 38, 38, 0.08); border-color: rgba(220, 38, 38, 0.4); color: #fca5a5; }
.alert.success { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.alert.info { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.4); color: #93c5fd; }

/* Utility */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spaced { margin-top: 12px; }
.muted { color: var(--text-dim); font-size: 0.85rem; }
.mono { font-family: "Consolas", "Monaco", monospace; font-size: 0.85rem; }
.hidden { display: none !important; }
.link { color: var(--gold-soft); text-decoration: none; font-weight: 500; }
.link:hover { color: var(--gold); text-decoration: underline; }

/* Progress bar */
.progress {
  background: #0a1612;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--border);
}
.progress .bar {
  background: linear-gradient(90deg, var(--emerald), var(--gold));
  height: 100%;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Highlight user's turn */
tr.my-turn { background: rgba(212, 175, 55, 0.08) !important; }
tr.my-turn td:first-child {
  border-left: 3px solid var(--gold);
  font-weight: 700;
  color: var(--gold-soft);
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal {
  background: linear-gradient(180deg, var(--bg-card) 0%, #101f1a 100%);
  padding: 26px;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal h3 { margin-bottom: 16px; color: var(--gold); }

/* Hero decoration (login) */
.hero-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
  margin-bottom: 20px;
  padding: 0 4px;
}
.hero-chart div {
  flex: 1;
  background: linear-gradient(180deg, var(--gold) 0%, var(--emerald) 100%);
  border-radius: 2px 2px 0 0;
  opacity: 0.7;
  animation: grow 1s ease-out forwards;
  transform-origin: bottom;
}
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (max-width: 640px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  header { padding: 12px 16px; }
  .stat .value { font-size: 1.4rem; }
}
