/* Member profile — game_tgn_0040 Cassette Transport / Deck library */

.g40-body--profile {
  --g40-dossier: #161514;
  --g40-dossier-ink: #ebe4d4;
  --g40-dossier-muted: #7a756c;
  --g40-dossier-line: rgba(154, 149, 140, 0.35);
  --g40-dossier-inset: #1c1b19;
  --g40-dossier-card: #0f0e0d;
  display: flex;
  flex-direction: column;
}

.g40-profile-page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: calc(100vh - var(--g40-deck-h) - 48px);
  padding: 20px 0 40px;
  color: #ebe4d4;
}

@media (max-width: 767px) {
  .g40-profile-page {
    min-height: calc(100vh - var(--g40-deck-h) - var(--g40-mob-h) - 48px);
  }
}

.g40-profile-page button,
.g40-profile-page .g40-stat-badge,
.g40-profile-page .g40-profile-form label,
.g40-profile-page .g40-profile-nav-item,
.g40-profile-page .g40-btn-secondary {
  text-transform: none;
  letter-spacing: normal;
}

.g40-profile-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  flex: 1 1 auto;
}

@media (min-width: 900px) {
  .g40-profile-shell {
    grid-template-columns: 228px minmax(0, 1fr);
    gap: 16px;
  }
}

.g40-profile-aside,
.g40-profile-main {
  background: #161514;
  color: #ebe4d4;
  border: 2px solid #9a958c;
  border-radius: 0;
  box-shadow:
    inset 0 1px 0 rgba(235, 228, 212, 0.05),
    0 16px 40px rgba(0, 0, 0, 0.45);
  min-width: 0;
}

.g40-profile-aside {
  padding: 16px;
  position: relative;
  height: fit-content;
}

.g40-profile-aside::before,
.g40-profile-main::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #c0392b, transparent);
  opacity: 0.9;
  pointer-events: none;
}

.g40-profile-main {
  position: relative;
  padding: 18px 18px 20px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .g40-profile-aside {
    position: sticky;
    top: 16px;
  }
}

.g40-profile-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(154, 149, 140, 0.35);
}

.g40-profile-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 800;
  color: #ebe4d4;
  background: #c0392b;
  border: 2px solid #9a958c;
}

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

.g40-profile-identity {
  min-width: 0;
}

.g40-aside-label {
  margin: 0 0 4px;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c0392b;
}

.g40-profile-name {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  color: #ebe4d4;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g40-profile-email {
  margin: 0;
  font-size: 0.75rem;
  color: #7a756c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g40-profile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.g40-profile-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #7a756c;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.g40-profile-nav-item:hover {
  background: rgba(192, 57, 43, 0.12);
  color: #ebe4d4;
  border-color: rgba(154, 149, 140, 0.35);
}

.g40-profile-nav-item.active {
  background: #c0392b;
  color: #ebe4d4;
  border-color: #c0392b;
  font-weight: 700;
}

.g40-profile-nav-item .g40-nav-label {
  min-width: 0;
}

@media (max-width: 899px) {
  .g40-profile-aside {
    padding: 12px;
  }

  .g40-profile-user {
    padding-bottom: 12px;
    margin-bottom: 8px;
  }

  .g40-profile-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px 2px;
  }

  .g40-profile-nav::-webkit-scrollbar {
    display: none;
  }

  .g40-profile-nav-item {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 12px;
    background: #1c1b19;
    border-color: #9a958c;
    font-size: 0.8125rem;
    color: #9a958c;
  }

  .g40-profile-nav-item.active {
    background: #c0392b;
    color: #ebe4d4;
    border-color: #c0392b;
  }
}

.g40-profile-panel {
  display: none;
}

.g40-profile-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  width: 100%;
  min-height: 0;
}

.g40-profile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(154, 149, 140, 0.35);
}

.g40-profile-card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ebe4d4;
}

.g40-stat-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ebe4d4;
  background: #c0392b;
  border: 2px solid #c0392b;
  border-radius: 0;
}

.g40-profile-page .g40-game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  overflow: visible;
}

@media (min-width: 640px) {
  .g40-profile-page .g40-ranked-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .g40-profile-page .g40-ranked-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
  }
}

.g40-profile-page .g40-game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #0f0e0d;
  border: 2px solid #9a958c;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.g40-profile-page .g40-game-card:hover {
  transform: translateY(-2px);
  border-color: #c0392b;
}

.g40-profile-page .g40-card-index {
  display: none;
}

.g40-profile-page .g40-ranked-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #1c1b19;
  text-decoration: none;
}

.g40-profile-page .g40-ranked-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.g40-profile-page .g40-ranked-body,
.g40-profile-page .article-list .special-card-content {
  padding: 12px 14px 16px;
  min-width: 0;
}

.g40-profile-page .g40-game-card .game-title {
  display: block;
  max-width: 100%;
  min-width: 0;
  margin: 0 0 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ebe4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g40-profile-page .g40-game-card .game-title a {
  color: #ebe4d4;
  text-decoration: none;
}

.g40-profile-page .g40-game-card .game-title a:hover,
.g40-profile-page .g40-game-card:hover .game-title,
.g40-profile-page .g40-game-card:hover .game-title a {
  color: #c0392b;
}

.g40-profile-page .g40-game-card .game-star {
  margin: 0;
}

.g40-profile-page .g40-game-card .g40-card-tags,
.g40-profile-page .g40-game-card .brief-comment-game {
  display: none;
}

.g40-profile-page .g40-game-card .g40-btn-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  align-self: stretch;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: #9a958c;
  background: transparent;
  border: 2px solid #9a958c;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.g40-profile-page .g40-game-card .g40-btn-remove:hover {
  color: #ebe4d4;
  background: #c0392b;
  border-color: #c0392b;
  text-decoration: none;
}

.g40-btn-clear,
.g40-btn-load-more,
.g40-btn-secondary,
.g40-btn-remove--inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0;
  border: 2px solid #9a958c;
  background: transparent;
  color: #ebe4d4;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.g40-btn-clear:hover,
.g40-btn-load-more:hover,
.g40-btn-secondary:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.g40-btn-load-more {
  position: relative;
  width: 100%;
  margin-top: 16px;
}

.g40-btn-load-more.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.g40-btn-load-more:disabled {
  cursor: not-allowed;
  opacity: 0.85;
  filter: none;
}

.g40-btn-load-more.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: profile-load-more-spin 0.7s linear infinite;
}

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


.g40-btn-remove--inline {
  width: auto;
  color: #7a756c;
  border-color: rgba(154, 149, 140, 0.45);
}

.g40-btn-remove--inline:hover {
  color: #ebe4d4;
  border-color: #c0392b;
}

.g40-profile-page .g40-btn-outline {
  color: #ebe4d4;
  border-color: #9a958c;
  background: transparent;
}

.g40-profile-page .g40-btn-outline:hover {
  border-color: #c0392b;
  color: #c0392b;
}

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

.g40-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  min-height: 240px;
  text-align: center;
  padding: 40px 16px;
  color: #7a756c;
}

.g40-empty-state p {
  margin: 0 0 14px;
  color: #9a958c;
}

.g40-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  min-height: 240px;
  text-align: center;
  padding: 36px 12px;
  color: #7a756c;
}

.g40-loading-spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(192, 57, 43, 0.22);
  border-top-color: #c0392b;
  border-radius: 50%;
  animation: g40-profile-spin 0.7s linear infinite;
  margin-bottom: 8px;
}

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

.g40-profile-form-block {
  max-width: 480px;
}

.g40-avatar-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(154, 149, 140, 0.35);
}

.g40-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #ebe4d4;
  background: #c0392b;
  border: 2px solid #9a958c;
}

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

.g40-avatar-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.g40-avatar-hint {
  margin: 0;
  font-size: 0.75rem;
  color: #7a756c;
}

.g40-form-row {
  display: grid;
  gap: 12px;
}

@media (min-width: 560px) {
  .g40-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.g40-profile-form .g40-form-group {
  margin-bottom: 14px;
}

.g40-profile-form label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--g40-mono, ui-monospace, Menlo, Consolas, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a958c;
}

.g40-profile-form .g40-form-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9375rem;
  color: #ebe4d4;
  background: #1c1b19;
  border: 2px solid #9a958c;
  border-radius: 0;
  outline: none;
  box-sizing: border-box;
}

.g40-profile-form .g40-form-input:focus {
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.22);
}

.g40-profile-form .g40-form-input[disabled] {
  background: #0f0e0d;
  color: #7a756c;
  border-color: rgba(154, 149, 140, 0.35);
  cursor: not-allowed;
}

.g40-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  z-index: 40000;
  max-width: min(420px, 90vw);
  padding: 12px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  border-radius: 0;
  border: 2px solid transparent;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.28s ease;
  pointer-events: none;
}

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

.g40-toast.success {
  color: #d1fae5;
  background: #161514;
  border-color: rgba(107, 158, 74, 0.65);
}

.g40-toast.error {
  color: #fecaca;
  background: #161514;
  border-color: rgba(192, 57, 43, 0.75);
}

.g40-toast.warning {
  color: #fde68a;
  background: #161514;
  border-color: #c0392b;
}

.g40-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: rgba(8, 7, 6, 0.82);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.g40-confirm-modal {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: #161514;
  color: #ebe4d4;
  border: 2px solid #9a958c;
  border-radius: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
  position: relative;
}

.g40-confirm-modal::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #c0392b, transparent);
}

.g40-confirm-title {
  margin: 0 0 6px;
  font-size: 1.0625rem;
  color: #ebe4d4;
}

.g40-confirm-desc {
  margin: 0 0 18px;
  font-size: 0.875rem;
  color: #7a756c;
}

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

.g40-confirm-cancel,
.g40-confirm-ok {
  flex: 1;
  min-height: 42px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 0;
  border: 2px solid #9a958c;
}

.g40-confirm-cancel {
  background: transparent;
  color: #ebe4d4;
}

.g40-confirm-cancel:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.g40-confirm-ok {
  background: #c0392b;
  color: #ebe4d4;
  border-color: #c0392b;
}

.g40-confirm-ok:hover {
  filter: brightness(1.08);
}

@media (max-width: 767px) {
  .g40-profile-page {
    padding: 12px 0 24px;
  }

  .g40-profile-main {
    padding: 14px;
  }

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

@media (prefers-reduced-motion: reduce) {
  .g40-loading-spinner {
    animation: none;
  }

  .g40-toast {
    transition: none;
  }

  .g40-profile-page .g40-game-card {
    transition: none;
  }
}


.g40-confirm-ok {
  position: relative;
}

.g40-confirm-ok:disabled,
.g40-confirm-cancel:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.g40-confirm-ok.is-loading {
  color: transparent;
  pointer-events: none;
}

.g40-confirm-ok.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: g40-confirm-spin 0.7s linear infinite;
}

@keyframes g40-confirm-spin {
  to { transform: rotate(360deg); }
}
