:root {
  --primary: #6a4fa3;
  --primary-light: #7c68b3;
  --success: #1e7d34;
  --bg-body: #f4f6f8;
  --text-muted: #595959;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body {
  font-family:
    'Segoe UI',
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg-body);
  margin: 0;
  padding: 12px;
  color: #2c3e50;
  overflow-x: hidden;
}

main.container {
  max-width: 1400px;
  margin: 20px auto 0 auto;
  box-sizing: border-box;
}

header.profile-status-container {
  background: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 4px solid var(--primary);
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--card-shadow);
}

.profile-name-h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  color: #1a1a1a;
}
.avatar-img {
  width: 70px;
  height: 70px;
  min-width: 70px;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.status-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  border: 1px solid currentColor;
  text-transform: uppercase;
}
.status-online {
  background: #e8f5e9;
  color: #1b6e2e;
}
.status-ingame {
  background: #e3f2fd;
  color: #0d47a1;
}
.status-offline {
  background: #f8f9fa;
  color: #595959;
}

nav.global-filter-bar {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.filter-btn {
  font-size: 11px;
  padding: 8px 16px;
  border: 1px solid #dcdde1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-weight: bold;
  color: var(--text-muted);
}
.filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-recent.active {
  background: var(--success);
  border-color: var(--success);
}

.game-card {
  background: #fff;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}
.game-header {
  display: flex;
  gap: 20px;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.header-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-icon {
  width: 10px;
  height: 10px;
  border-right: 3px solid var(--primary);
  border-bottom: 3px solid var(--primary);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.collapsed-parent .toggle-icon {
  transform: rotate(-135deg);
}

.game-logo {
  display: block;
  width: 184px;
  height: 69px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #eee;
  flex-shrink: 0;
  background: #eee;
}
.game-title-h2 {
  margin: 0;
  font-size: 20px;
  color: #1a1a1a;
}
.game-meta-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
}

.progress-container {
  width: 200px;
  height: 8px;
  background: #eaeeef;
  border-radius: 5px;
  margin: 8px 0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
}
.has-recent .progress-fill {
  background: linear-gradient(90deg, var(--success), #2ecc71) !important;
}

.ach-responsive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* FIX: ADDED AUTO-HEIGHT AND FLEX CONSTRAINT FOR MARVEL ACHS */
.ach-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e1e4e8;
  border-left: 5px solid #bdc3c7;
  height: auto;
  min-height: 94px;
}

.ach-item:not(.locked) {
  border-left-color: var(--primary-light);
  background: #fcfcff;
}
.is-recent {
  border-left: 5px solid var(--success) !important;
  background: #f0fff4 !important;
}
.locked {
  filter: grayscale(1);
  opacity: 0.95;
  background: #fafafa;
}
.ach-icon {
  width: 70px;
  height: 70px;
  border-radius: 6px;
  flex-shrink: 0;
  background: #eee;
}

/* FIX: PREVENTS TEXT WRAP BURSTING */
.ach-info {
  flex: 1;
  min-width: 0;
}

.ach-name {
  font-weight: 700;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 2px;
}

/* FIX: ALLOWS LONG DESCRIPTIONS TO EXPAND CONTAINER */
.ach-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.ach-date {
  font-size: 10px;
  color: #595959;
  font-weight: 600;
  margin-top: 6px;
  display: block;
}

.badge-new {
  background: var(--success);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
}
.xml-btn {
  font-size: 10px;
  font-weight: bold;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #dcdde1;
  border-radius: 4px;
  background: #fff;
}

.ach-empty-state {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: #f9fafb;
  border: 2px dashed #e1e4e8;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 800;
}
.show-empty {
  display: block !important;
}
.collapsed {
  display: none !important;
}

/* Error Handling */
.error-header {
  border-bottom: 2px solid #d63031;
  width: 100%;
  display: flex;
  align-items: center;
}
.error-title {
  margin: 0;
  color: #d63031;
}
.error-body {
  padding: 20px;
}
.error-divider {
  border: 0;
  border-top: 1px solid #eee;
  margin: 20px 0;
}
.error-tip-title {
  margin-top: 0;
  color: #333;
}
.error-code-block {
  background: #f4f4f4;
  padding: 10px;
  border-radius: 4px;
  display: block;
  margin: 15px 0;
  border-left: 4px solid #d63031;
  font-family: monospace;
  font-size: 12px;
}
