/* ===== Mahjong Score App – Dark Refined Theme ===== */

/* ---- Base ---- */
body {
  background: #0d1117;
  color: #e2e8f0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ---- Rank colors ---- */
.rank-1 { color: #fbbf24; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #f97316; }
.rank-4 { color: #475569; }

/* ---- Card hover ---- */
.card-hover { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* ---- Point badge ---- */
.point-pos  { background: rgba(34,197,94,0.12);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.point-neg  { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.point-zero { background: rgba(148,163,184,0.08); color: #64748b; border: 1px solid rgba(148,163,184,0.2); }

/* ---- Tab ---- */
.tab-active {
  border-bottom: 2px solid #f59e0b;
  color: #fbbf24;
  background: transparent;
}
.tab-inactive {
  border-bottom: 2px solid transparent;
  color: #64748b;
}
.tab-inactive:hover { color: #94a3b8; }

/* ---- Header ---- */
.app-header {
  background: rgba(13,17,23,0.95);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---- Cards ---- */
/* base card */
.dcard {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.75rem;
}
/* elevated card */
.dcard-hi {
  background: #1c2128;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 0.75rem;
}
/* amber accent card (record form) */
.dcard-amber {
  background: linear-gradient(135deg, #1c1a0e 0%, #1e1b0f 100%);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 0.75rem;
}

/* ---- Table ---- */
.table-responsive { overflow-x: auto; }
thead tr { border-bottom: 1px solid rgba(255,255,255,0.08); }
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2d333b; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #444c56; }

/* ---- Modal ---- */
.modal-backdrop {
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  background: #161b22;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 1rem;
}
.modal-header {
  background: #161b22;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* ---- Inputs ---- */
input, select, textarea {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  border-radius: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: #3d4451; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}
.score-input { transition: border-color 0.2s; }

/* ---- Alert ---- */
.alert-success {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  color: #4ade80;
  border-radius: 0.5rem;
}
.alert-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
  border-radius: 0.5rem;
}

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.8s linear infinite; }

/* ---- Rank badge ---- */
.rank-badge {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.rank-badge-1 { background: rgba(251,191,36,0.15);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.rank-badge-2 { background: rgba(148,163,184,0.1);  color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }
.rank-badge-3 { background: rgba(249,115,22,0.12);  color: #fb923c; border: 1px solid rgba(249,115,22,0.25); }
.rank-badge-4 { background: rgba(71,85,105,0.15);   color: #475569; border: 1px solid rgba(71,85,105,0.25); }

/* ---- Chart ---- */
.chart-wrap { position: relative; height: 200px; }

/* ---- Crown ---- */
.crown::before { content: '👑 '; }

/* ---- Section label ---- */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Rule tags ---- */
.tag-uma {
  background: rgba(59,130,246,0.1);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 4px;
  font-size: 0.68rem;
  padding: 1px 6px;
}
.tag-yakitori {
  background: rgba(249,115,22,0.1);
  color: #fb923c;
  border: 1px solid rgba(249,115,22,0.2);
  border-radius: 4px;
  font-size: 0.68rem;
  padding: 1px 6px;
}

/* ---- Session active badge ---- */
.session-active-badge {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  color: #4ade80;
  border-radius: 9999px;
  font-size: 0.7rem;
  padding: 3px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Hanchan result card ---- */
.result-cell {
  background: #1c2128;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.5rem;
}
.result-cell-1st {
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: 0.5rem;
}

/* ---- Btn base ---- */
.btn-primary {
  background: #f59e0b;
  color: #0d1117;
  font-weight: 700;
  border-radius: 0.5rem;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #fbbf24; }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #64748b;
  border-radius: 0.5rem;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); color: #94a3b8; }

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239,68,68,0.3);
  color: #f87171;
  border-radius: 0.5rem;
  transition: border-color 0.15s, background 0.15s;
}
.btn-danger:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.5); }
