/* Member profile â game_tgn_0016 */

.g16-profile-page button,
.g16-profile-page .g16-stat-badge,
.g16-profile-page .g16-profile-nav-item,
.g16-profile-page .g16-btn-secondary,
.g16-profile-page .g16-btn-remove,
.g16-profile-page .g16-btn-load-more,
.g16-profile-page .g16-btn-clear {
  text-transform: none;
}

.g16-profile-page {
  flex: 1;
  padding: calc(var(--g16-header-h) + 20px) 0 48px;
}

.g16-profile-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.g16-profile-sidebar {
  flex: 0 0 260px;
  background: var(--space-blue);
  border: var(--g16-border);
  border-top: 4px solid var(--comet-cyan);
  border-radius: var(--g16-radius);
  box-shadow: var(--g16-shadow);
  padding: 1.25rem 1rem 1rem;
  position: sticky;
  top: calc(var(--g16-header-h) + 12px);
}

.g16-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--g16-radius);
  overflow: hidden;
  margin-bottom: 12px;
  border: var(--g16-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--g16-cream);
  background: var(--g16-red);
}

.g16-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.g16-profile-name {
  margin: 0 0 4px;
  font-family: var(--g16-display);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--star-white);
  line-height: 1.25;
  word-break: break-word;
}

.g16-profile-email {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--g16-muted);
  word-break: break-all;
  line-height: 1.35;
}

.g16-profile-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
  border-top: var(--g16-border);
}

.g16-profile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.g16-profile-nav-item i {
  width: 1.125rem;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
}

.g16-profile-nav-item:hover {
  color: var(--star-white);
  background: rgba(249, 115, 22, 0.08);
}

.g16-profile-nav-item.active {
  color: var(--nebula-pink);
  border-left-color: var(--nebula-pink);
  background: rgba(249, 115, 22, 0.12);
}

.g16-profile-main {
  flex: 1;
  min-width: 0;
}

.g16-profile-panel { display: none; }
.g16-profile-panel.active { display: block; width: 100%; }

.g16-profile-card {
  background: var(--space-blue);
  border: var(--g16-border);
  border-radius: var(--g16-radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1rem;
}

.g16-profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 1.25rem;
  padding-bottom: 12px;
  border-bottom: var(--g16-border);
}

.g16-profile-card-title {
  margin: 0;
  font-family: var(--g16-font);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--star-white);
  letter-spacing: 0.02em;
}

.g16-stat-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--nebula-pink);
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.35);
  border-radius: var(--g16-radius);
  white-space: nowrap;
}

.g16-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.g16-profile-card .g16-game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--space-dark);
  border: var(--g16-border);
  border-radius: var(--g16-radius);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.g16-profile-card .g16-game-card:hover {
  border-color: var(--nebula-pink);
  box-shadow: 3px 3px 0 var(--line-soft);
  transform: translate(-2px, -2px);
}

.g16-profile-card .g16-game-card-thumb {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--space-blue);
  border-bottom: var(--g16-border);
  text-decoration: none;
}

.g16-profile-card .g16-game-card-thumb img,
.g16-profile-card .g16-game-card-thumb .g16-img-ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--transition-fast);
}

.g16-profile-card .g16-game-card:hover .g16-game-card-thumb img {
  transform: scale(1.03);
}

.g16-profile-card .g16-game-card-body,
.g16-profile-card .special-card-content.g16-game-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
}

.g16-profile-card .g16-game-card .game-title {
  display: block;
  margin: 0;
  font-family: var(--g16-font);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g16-profile-card .g16-game-card .game-title a {
  display: block;
  max-width: 100%;
  color: var(--star-white);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.g16-profile-card .g16-game-card .game-title a:hover {
  color: var(--nebula-pink);
}

/* Override global star track â profile cards use inline stars only */
.g16-profile-card .g16-game-card .game-star {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: 0.72rem;
  line-height: 1;
  align-self: flex-start;
}

.g16-profile-card .g16-game-card .game-star .star-rating,
.g16-profile-card .g16-game-card .game-star .detail-rating-visual {
  padding: 0;
  background: none;
  border: none;
}

.g16-profile-card .g16-game-card .g16-btn-remove {
  margin-top: auto;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.g16-btn-remove,
.g16-btn-clear,
.g16-btn-load-more,
.g16-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: var(--g16-radius);
  border: var(--g16-border);
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.g16-btn-remove {
  width: 100%;
  color: var(--ink-muted);
  background: transparent;
}

.g16-btn-remove:hover {
  color: #0f172a;
  background: var(--nebula-pink);
  border-color: var(--nebula-pink);
  box-shadow: 2px 2px 0 var(--line-soft);
  transform: translate(-1px, -1px);
}

.g16-btn-clear {
  color: var(--nebula-pink);
  background: transparent;
  border-color: rgba(249, 115, 22, 0.45);
}

.g16-btn-clear:hover {
  color: #0f172a;
  background: var(--nebula-pink);
  border-color: var(--nebula-pink);
  box-shadow: 2px 2px 0 var(--line-soft);
}

.g16-btn-load-more {
  width: 100%;
  max-width: 240px;
  margin: 1rem auto 0;
  color: #0f172a;
  background: var(--nebula-pink);
  border-color: var(--nebula-pink);
  font-weight: 700;
}

.g16-btn-load-more:hover {
  color: #0f172a;
  background: var(--sun-gold);
  border-color: var(--sun-gold);
  box-shadow: 3px 3px 0 var(--line-soft);
  transform: translate(-2px, -2px);
}

.g16-loading[hidden],
.g16-empty-state[hidden],
.g16-btn-load-more[hidden] {
  display: none !important;
}

.g16-btn-secondary {
  color: var(--star-white);
  background: var(--space-dark);
  border-color: var(--line-soft);
}

.g16-btn-secondary:hover {
  color: var(--nebula-pink);
  border-color: var(--nebula-pink);
  background: rgba(249, 115, 22, 0.08);
}

.g16-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-muted);
  border: 1px dashed var(--line-soft);
  border-radius: var(--g16-radius);
  background: var(--space-dark);
}

.g16-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
  color: var(--nebula-pink);
  opacity: 0.55;
}

.g16-loading {
  text-align: center;
  padding: 2rem;
  color: var(--ink-muted);
}

.g16-loading-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-soft);
  border-top-color: var(--nebula-pink);
  border-radius: 50%;
  animation: g16-profile-spin 0.7s linear infinite;
  margin-bottom: 10px;
}

@keyframes g16-profile-spin {
  to { transform: rotate(360deg); }
}

/* Avatar upload */
.g16-avatar-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: var(--g16-border);
}

.g16-avatar-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--g16-radius);
  overflow: hidden;
  border: var(--g16-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  background: var(--nebula-pink);
}

.g16-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.g16-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g16-avatar-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* Toast */
.g16-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 40000;
  max-width: min(420px, 90vw);
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  border: 2px solid transparent;
  box-shadow: 4px 4px 0 rgba(26, 26, 26, 0.12);
  transition: transform 0.28s ease;
  pointer-events: none;
}

.g16-toast.show {
  transform: translateX(-50%) translateY(0);
}

.g16-toast.success {
  color: #1e5631;
  background: #e8f5e9;
  border-color: #27ae60;
}

.g16-toast.error {
  color: #7b1e1e;
  background: #fdecea;
  border-color: var(--nebula-pink);
}

.g16-toast.warning {
  color: #7a5c00;
  background: #fff8e1;
  border-color: #f9a825;
}

.g16-profile-card-title--section {
  margin: 0 0 1rem;
  padding-bottom: 10px;
  border-bottom: var(--g16-border);
}

.g16-profile-form {
  width: 100%;
  max-width: 100%;
}

.g16-btn-remove--inline {
  width: auto;
  align-self: flex-start;
}

.g16-profile-form .g16-btn-load-more {
  width: auto;
  min-width: 160px;
  margin: 0.5rem 0 0;
}

.g16-profile-form .g16-form-group { margin-bottom: 1rem; }

.g16-profile-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.g16-profile-form .g16-form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--star-white);
  background: var(--space-dark);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.g16-profile-form .g16-form-input:focus {
  border-color: var(--nebula-pink);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.g16-profile-form .g16-form-input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Confirm modal */
.g16-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: rgba(15, 23, 42, 0.72);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.g16-confirm-overlay.show { display: flex; }

.g16-confirm-modal {
  width: 100%;
  max-width: 380px;
  padding: 1.75rem;
  background: var(--space-blue);
  border: var(--g16-border);
  border-top: 2px solid var(--nebula-pink);
  border-radius: var(--g16-radius);
  text-align: center;
}

.g16-confirm-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--g16-radius);
  background: rgba(249, 115, 22, 0.12);
  color: var(--nebula-pink);
  font-size: 1.25rem;
  border: var(--g16-border);
}

.g16-confirm-title {
  margin: 0 0 8px;
  font-family: var(--g16-font);
  font-size: 1.125rem;
}

.g16-confirm-desc {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.g16-confirm-actions {
  display: flex;
  gap: 10px;
}

.g16-confirm-cancel,
.g16-confirm-ok {
  flex: 1;
  min-height: 44px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: none;
  cursor: pointer;
  border-radius: var(--g16-radius);
  border: var(--g16-border);
}

.g16-confirm-cancel {
  background: var(--space-dark);
  color: var(--star-white);
}

.g16-confirm-cancel:hover {
  border-color: var(--nebula-pink);
  color: var(--nebula-pink);
}

.g16-confirm-ok {
  background: var(--nebula-pink);
  color: #0f172a;
  border-color: var(--nebula-pink);
  font-weight: 700;
}

.g16-confirm-ok:hover {
  box-shadow: 2px 2px 0 var(--line-soft);
  transform: translate(-1px, -1px);
}

@media (min-width: 1100px) {
  .g16-game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .g16-profile-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .g16-profile-sidebar {
    position: static;
  }

  .g16-profile-main {
    width: 100%;
    min-width: 0;
  }

  .g16-profile-panel.active {
    display: block;
    width: 100%;
  }

  .g16-profile-card {
    width: 100%;
    box-sizing: border-box;
  }

  .g16-profile-sidebar {
    width: 100%;
    flex: none;
    display: grid;
    grid-template-columns: 56px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    padding: 14px 14px 0;
    overflow: hidden;
  }

  .g16-profile-avatar {
    grid-row: 1 / 3;
    align-self: center;
    width: 56px;
    height: 56px;
    margin-bottom: 0;
    font-size: 1.25rem;
  }

  .g16-profile-name {
    align-self: end;
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
  }

  .g16-profile-email {
    align-self: start;
    margin: 2px 0 0;
    font-size: 0.75rem;
    word-break: break-all;
  }

  .g16-profile-nav {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    margin-top: 12px;
    padding-top: 0;
    border-top: 1px solid var(--line-soft);
  }

  .g16-profile-nav-item {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 10px 4px;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    font-size: 0.625rem;
    text-transform: none;
    letter-spacing: 0.02em;
  }

  .g16-profile-nav-item i {
    font-size: 1.05rem;
    line-height: 1;
  }

  .g16-profile-nav-item .g16-nav-label {
    display: block;
    line-height: 1.1;
  }

  .g16-profile-nav-item.active {
    border-left: none;
    border-bottom-color: var(--nebula-pink);
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  .g16-profile-page {
    flex-grow: 0;
    padding-top: calc(var(--g16-header-h) + env(safe-area-inset-top, 0px) + 12px);
    padding-bottom: 12px;
  }

  .g16-profile-sidebar {
    grid-template-columns: 44px 1fr;
    column-gap: 10px;
    padding: 12px 12px 0;
  }

  .g16-profile-avatar {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .g16-profile-name {
    font-size: 0.9375rem;
  }

  .g16-profile-email {
    margin-bottom: 0;
    font-size: 0.6875rem;
  }

  .g16-profile-nav {
    margin: 10px -12px 0;
  }

  .g16-profile-nav-item {
    padding: 10px 2px 12px;
    font-size: 0.625rem;
  }

  .g16-profile-card {
    padding: 1rem;
    border-radius: var(--g16-radius);
  }

  .g16-profile-card-head {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0.75rem;
    padding-bottom: 8px;
  }

  .g16-profile-card-title {
    font-size: 1.0625rem;
  }

  .g16-stat-badge {
    padding: 4px 10px;
    font-size: 0.6875rem;
  }

  .g16-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .g16-profile-card .g16-game-card:hover {
    transform: none;
  }

  .g16-profile-card .g16-game-card-body,
  .g16-profile-card .special-card-content.g16-game-card-body {
    padding: 8px 8px 10px;
  }

  .g16-profile-card .g16-game-card .game-title {
    font-size: 0.75rem;
    margin-bottom: 4px;
  }

  .g16-profile-card .g16-game-card .game-star {
    font-size: 0.65rem;
  }

  .g16-profile-card .g16-game-card .g16-btn-remove {
    min-height: 30px;
    font-size: 0.6875rem;
  }

  .g16-btn-remove {
    min-height: 32px;
    padding: 0 8px;
    font-size: 0.6875rem;
  }

  .g16-btn-clear {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.6875rem;
  }

  .g16-avatar-upload {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .g16-avatar-preview {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
  }

  .g16-empty-state {
    padding: 2rem 1rem;
  }

  .g16-empty-state i {
    font-size: 2rem;
  }
}
