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

:root {
  --bg:             #f5f5f7;
  --bg-card:        #ffffff;
  --bg-soft:        #fafafc;
  --text-primary:   #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary:  #aeaeb2;
  --border:         rgba(0,0,0,0.08);
  --border-strong:  rgba(0,0,0,0.14);
  --accent:         #0071e3;
  --accent-hover:   #0077ed;
  --danger:         #ff3b30;
  --success:        #34c759;
  --warning:        #ff9500;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.14), 0 4px 16px rgba(0,0,0,0.08);
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  18px;
  --spring: cubic-bezier(.34,1.1,.64,1);
  --ease:   cubic-bezier(.25,.46,.45,.94);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Nav */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  text-decoration: none;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-logo-mark { color: var(--accent); font-size: 10px; }
.nav-logo-sub { color: var(--text-secondary); font-weight: 400; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-player {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 10px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.nav-logout {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.nav-logout:hover { color: var(--text-primary); background: var(--bg-soft); }

/* Footer */
footer {
  text-align: center;
  padding: 28px 20px;
  color: var(--text-tertiary);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* Buttons */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--spring), background 0.15s var(--ease), opacity 0.15s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-soft);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-card); border-color: var(--border-strong); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover:not(:disabled) { background: rgba(255,59,48,0.08); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 10px;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); color: var(--text-primary); }

.btn-sm { font-size: 12px; padding: 6px 12px; }

/* Inputs */
.input {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}

.input.mono { font-family: 'DM Mono', monospace; letter-spacing: 0.02em; }

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-soft); }

.table-actions {
  text-align: right;
  white-space: nowrap;
}

/* Empty state */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.empty-title { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 100px);
  background: #1d1d1f;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.4s var(--spring), opacity 0.3s var(--ease);
  z-index: 1000;
  max-width: 90vw;
}

.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  padding: 20px;
}

.modal-backdrop.show { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.25s var(--spring);
}

.modal-backdrop.show .modal { transform: scale(1); }

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-field { margin-bottom: 14px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* Utility */
.mono { font-family: 'DM Mono', monospace; }
.muted { color: var(--text-secondary); }
.tiny { font-size: 11px; }
.text-right { text-align: right; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.5s var(--ease) both; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--accent);
}
