/* Profile portal — layout + theme-aware styling. */

.profile-app { max-width: 720px; padding-top: 16px; }

/* ── Hero card ──────────────────────────────────────────────────────────── */
.prof-hero {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg, 16px);
  padding: 22px 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}
.prof-avatar {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 3px solid var(--accent);
  font-size: 40px;
  cursor: pointer;
  transition: transform 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.prof-avatar:hover { transform: scale(1.05); }

.prof-id { flex: 1; min-width: 0; }
.prof-id-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.prof-name-input {
  font-size: 22px;
  font-weight: 800;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-strong);
  padding: 2px 0;
  outline: none;
  min-width: 0;
  flex: 1;
  max-width: 240px;
}
.prof-name-input:hover, .prof-name-input:focus {
  border-bottom-color: var(--accent);
}
.prof-title {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.prof-title:empty { display: none; }

.prof-level-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.prof-level-label { font-size: 14px; color: var(--text-muted); font-weight: 700; }
.prof-level-num   { font-size: 22px; color: var(--accent); font-weight: 900; min-width: 30px; }
.prof-xp-bar {
  flex: 1;
  height: 10px;
  background: rgba(0,0,0,0.10);
  border-radius: 5px;
  overflow: hidden;
  max-width: 260px;
}
body.dark .prof-xp-bar { background: rgba(255,255,255,0.16); }
.prof-xp-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 5px;
  transition: width 0.4s ease;
}
.prof-xp-text { font-size: 12px; color: var(--text-muted); min-width: 90px; text-align: right; }

.prof-totals {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--text);
  font-size: 14px;
}
.prof-totals b { color: var(--accent); font-size: 17px; font-weight: 800; margin-right: 3px; }
.prof-totals small { color: var(--text-muted); }

/* ── Sections ───────────────────────────────────────────────────────────── */
.prof-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.prof-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0 0 14px 0;
}
.prof-hint {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.prof-hint-warn { color: #e74c3c; }
body.dark .prof-hint-warn { color: #ff7066; }

/* ── Accent picker ──────────────────────────────────────────────────────── */
.prof-accent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.prof-accent-tile {
  border: 2px solid var(--border);
  border-radius: var(--radius-md, 10px);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.prof-accent-tile:hover:not(.locked) { transform: translateY(-2px); border-color: var(--accent); }
.prof-accent-tile.active { border-color: var(--accent); background: var(--accent-soft); }
.prof-accent-tile.locked { opacity: 0.45; cursor: not-allowed; }
.prof-accent-swatch {
  width: 38px; height: 38px;
  border-radius: 50%;
  margin: 0 auto 6px auto;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.prof-accent-label { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.prof-accent-lock-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Unlock grid ────────────────────────────────────────────────────────── */
.prof-unlock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.prof-unlock-tile {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md, 10px);
  text-align: center;
}
.prof-unlock-tile.unlocked { border-color: var(--accent); background: var(--accent-soft); }
.prof-unlock-tile.locked   { opacity: 0.55; }
.prof-unlock-icon { font-size: 26px; margin-bottom: 6px; }
.prof-unlock-name { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.prof-unlock-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── BGM picker ─────────────────────────────────────────────────────────── */
.prof-bgm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.prof-bgm-tile {
  padding: 10px 6px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  text-align: center;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--text-strong);
}
.prof-bgm-tile:hover { border-color: var(--accent); }
.prof-bgm-tile.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── XP log ─────────────────────────────────────────────────────────────── */
.prof-log {
  list-style: none;
  padding: 0; margin: 0;
  max-height: 280px;
  overflow-y: auto;
}
.prof-log li {
  display: flex; justify-content: space-between;
  align-items: baseline;
  padding: 6px 4px;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.prof-log li:last-child { border-bottom: none; }
.prof-log-source { color: var(--text-muted); }
.prof-log-amount { color: var(--accent); font-weight: 700; }
.prof-log-empty { text-align: center; color: var(--text-muted); padding: 18px; }

/* ── Reset button ───────────────────────────────────────────────────────── */
.prof-reset-btn {
  background: transparent;
  color: #e74c3c;
  border: 2px solid #e74c3c;
  border-radius: var(--radius-md, 10px);
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.prof-reset-btn:hover { background: #e74c3c; color: #fff; }

/* ── Avatar picker modal ────────────────────────────────────────────────── */
.prof-modal[hidden] { display: none; }
.prof-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.prof-modal-card {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg, 16px);
  padding: 22px;
  min-width: 320px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}
.prof-modal-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; color: var(--text-strong); }
.prof-avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.prof-avatar-grid button {
  font-size: 28px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 0;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.prof-avatar-grid button:hover  { transform: scale(1.1); border-color: var(--accent); }
.prof-avatar-grid button.active { border-color: var(--accent); background: var(--accent-soft); }
.prof-avatar-grid button.locked { opacity: 0.35; cursor: not-allowed; }
.prof-modal-close {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 10px);
  padding: 10px;
  font-weight: 700;
  cursor: pointer;
}
