.profile-container { max-width: 800px; margin: 40px auto; padding: 0 20px; }
    .profile-card {
      background: var(--surface); border-radius: var(--radius-xl);
      padding: 36px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
    }
    .profile-header {
      display: flex; align-items: center; gap: 24px;
      border-bottom: 1px solid var(--border);
      padding-bottom: 28px; margin-bottom: 28px;
    }
    .avatar {
      width: 80px; height: 80px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 56px; background: transparent; color: var(--text);
      transition: transform var(--transition);
    }
    .avatar:hover { transform: scale(1.05); }
    .profile-title h2 { margin: 0 0 8px; font-size: 24px; font-weight: 600; }
    .profile-title p { margin: 0; color: var(--text-secondary); }
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 16px; margin-bottom: 28px;
    }
    .stat-card {
      background: var(--bg); border-radius: var(--radius-md);
      padding: 20px 16px; text-align: center;
      border: 1px solid var(--border);
      transition: transform var(--transition), box-shadow var(--transition);
    }
    .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
    .stat-number { font-size: 28px; font-weight: 700; color: var(--primary); }
    .stat-label { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
    .practice-stats {
      background: var(--primary-light); border-radius: var(--radius-md);
      padding: 22px 24px; margin-bottom: 28px;
    }
    .practice-stats h3 { margin: 0 0 12px; font-size: 18px; color: var(--primary); }
    .role-badge {
      display: inline-block; padding: 4px 12px; border-radius: var(--radius-pill);
      font-size: 12px; font-weight: 500;
    }
    .role-admin { background: var(--color-error); color: #fff; }
    .role-premium { background: var(--color-warning); color: #fff; }
    .role-user { background: var(--text-muted); color: #fff; }
    .avatar-selector-section h3 { margin: 24px 0 14px; font-size: 18px; font-weight: 600; }
    .logout-btn { margin-top: 32px; text-align: center; }
    .history-section { margin-top: 28px; }
    .history-section h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
    .history-list { list-style: none; padding: 0; margin: 0; }
    .history-item {
      display: flex; justify-content: space-between; align-items: center;
      padding: 10px 14px; border-bottom: 1px solid var(--border);
      cursor: pointer; transition: background 0.15s;
    }
    .history-item:hover { background: var(--bg); }
    .history-item:first-child { border-top: 1px solid var(--border); }
    .history-word { font-weight: 600; color: var(--primary); }
    .history-word:hover { text-decoration: underline; }
    .history-time { font-size: 12px; color: var(--text-muted); }
    .history-clear { margin-bottom: 12px; font-size: 13px; color: var(--text-muted); cursor: pointer; background: none; border: none; padding: 4px 0; }
    .history-clear:hover { color: var(--color-error); }
    .history-empty { color: var(--text-muted); font-size: 14px; padding: 20px 0; text-align: center; }
    .history-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:10px; }
    .history-count { font-size:12px; color:var(--text-muted); }
    .profile-pager { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:16px; }
    .profile-page-btn { min-width:72px; padding:7px 12px; border:1px solid var(--border); border-radius:var(--radius-pill); background:var(--surface); color:var(--text-secondary); cursor:pointer; }
    .profile-page-btn:hover:not(:disabled) { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }
    .profile-page-btn:disabled { opacity:.45; cursor:default; }
    .profile-page-info { min-width:54px; text-align:center; font-size:13px; color:var(--text-muted); }

.profile-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 18px; padding: 4px; border-radius: var(--radius-lg); background: var(--surface); }
.profile-tab { flex: 1; min-width: 100px; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; cursor: pointer; }
.profile-tab.active, .profile-tab[aria-selected="true"] { background: var(--primary-light); color: var(--primary); font-weight: 650; }
.profile-panel[hidden] { display: none !important; }
.profile-overview-actions, .profile-settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile-overview-actions .btn { text-decoration: none; }
#study-heatmap-card p { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.avatar-selector-section { margin-bottom: 24px; }
.avatar-selector-section summary { min-height: 44px; padding: 10px 0; color: var(--primary); font-weight: 600; cursor: pointer; }
.profile-password-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.profile-password-form .modal-input { margin-bottom: 0; font-size: 16px; }
.profile-password-form .btn { align-self: flex-start; }
.emoji-option { border: 0; background: transparent; cursor: pointer; }
@media (max-width: 768px) {
  .profile-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; margin: 0 0 16px; }
  .profile-tab { min-width: 0; padding: 10px 2px; font-size: 13px; white-space: nowrap; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
.profile-memory-description { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.memory-preference-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 6px; font-size: 14px; cursor: pointer; }
.memory-preference-toggle input { width: 18px; height: 18px; }
#memory-preference-status { margin: 0 0 12px; }
.memory-status { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.memory-item { cursor: default; }
.memory-fact { flex: 1; }
.mem-delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; min-width: 44px; min-height: 44px; }
.stat-detail { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
