/* ==========================================================================
   메이플 레코드 - 업적 기록 (/Ach/1/achievement.css)
   심플 · 클린 다크 대시보드 + 2열 컴팩트 카드 그리드 & SVG 아이콘 시스템
   ========================================================================== */

.ach-page {
  --ach-bg-panel: #131823;
  --ach-bg-card: #161c29;
  --ach-bg-card-hover: #1b2233;
  --ach-bg-inset: #0e131d;
  --ach-border: rgba(148, 163, 184, 0.14);
  --ach-border-strong: rgba(148, 163, 184, 0.28);
  --ach-text-main: #f1f5f9;
  --ach-text-sub: #94a3b8;
  --ach-text-dim: #64748b;
  --ach-accent: var(--primary, #f0883e);
  --ach-sky: #38bdf8;
  --ach-emerald: #34d399;
  --ach-rose: #fb7185;
  --ach-amber: #fbbf24;
  --ach-violet: #c084fc;
}

.ach-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-block;
}

/* ==========================================================================
   1. 상단 대시보드 패널
   ========================================================================== */
.ach-hero-panel {
  background: linear-gradient(180deg, #161d2b 0%, #121722 100%);
  border: 1px solid var(--ach-border);
  border-radius: 16px;
  padding: 22px 24px 18px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ach-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.ach-title-group {
  min-width: 0;
}

.ach-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ach-pill-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(240, 136, 62, 0.12);
  border: 1px solid rgba(240, 136, 62, 0.28);
  color: #ff9c59;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.ach-pill-brand .ach-svg {
  width: 13px;
  height: 13px;
}

.ach-pill-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.24);
  color: var(--ach-emerald);
  font-size: 0.72rem;
  font-weight: 700;
}

.ach-pill-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ach-emerald);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.ach-heading {
  font-size: 1.55rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 4px 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.ach-subtitle {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ach-text-sub);
  line-height: 1.45;
}

.ach-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ach-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 9px;
  background: var(--ach-bg-inset);
  border: 1px solid var(--ach-border);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
  font-family: inherit;
}

.ach-btn-ghost:hover {
  border-color: var(--ach-border-strong);
  color: #ffffff;
  background: #182030;
}

.ach-btn-ghost.is-loading .ach-svg {
  animation: achSpin 0.8s linear infinite;
}

/* 1줄 6대 핵심 통계 스트립 */
.ach-stats-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.ach-stat-card {
  background: var(--ach-bg-inset);
  border: 1px solid var(--ach-border);
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 82px;
  box-sizing: border-box;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.ach-stat-card:hover {
  border-color: var(--ach-border-strong);
  background: #111826;
}

.ach-stat-card.is-tier {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 13px;
  background: linear-gradient(135deg, rgba(240, 136, 62, 0.08) 0%, #0e131d 70%);
  border-color: rgba(240, 136, 62, 0.22);
}

.ach-tier-emblem-wrap {
  width: 52px;
  height: 52px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ach-tier-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.55));
}

.ach-stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.ach-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ach-stat-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ach-text-sub);
  white-space: nowrap;
}

.ach-stat-icon {
  width: 15px;
  height: 15px;
  color: var(--ach-text-dim);
  flex-shrink: 0;
}

.ach-stat-value {
  font-size: 1.24rem;
  font-weight: 900;
  color: var(--ach-text-main);
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tone-sky { color: var(--ach-sky) !important; }
.tone-emerald { color: var(--ach-emerald) !important; }
.tone-rose { color: var(--ach-rose) !important; }
.tone-amber { color: var(--ach-amber) !important; }

/* 연동 캐릭터 바 */
.ach-chars-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  flex-wrap: wrap;
}

.ach-chars-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ach-text-sub);
  white-space: nowrap;
}

.ach-char-pills-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.ach-muted-note {
  font-size: 0.8rem;
  color: var(--ach-text-dim);
}

.ach-char-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--ach-bg-inset);
  border: 1px solid var(--ach-border);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.ach-char-pill .ach-svg {
  width: 13px;
  height: 13px;
  color: var(--ach-text-dim);
}

.ach-char-pill:hover {
  border-color: var(--ach-border-strong);
  color: #ffffff;
}

.ach-char-pill.active {
  background: rgba(240, 136, 62, 0.15);
  border-color: rgba(240, 136, 62, 0.5);
  color: #ffb178;
}

.ach-char-pill.active .ach-svg {
  color: #ff9854;
}

/* ==========================================================================
   2. 필터 · 검색 · 정렬 · 보기 전환 툴바
   ========================================================================== */
.ach-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ach-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--ach-bg-panel);
  border: 1px solid var(--ach-border);
  border-radius: 11px;
  flex-wrap: wrap;
}

.ach-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ach-text-sub);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
  font-family: inherit;
}

.ach-tab .ach-svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.ach-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}

.ach-tab.active {
  background: var(--ach-accent);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(240, 136, 62, 0.3);
}

.ach-tab.active .ach-svg {
  opacity: 1;
}

.ach-tab-cnt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.ach-tab.active .ach-tab-cnt {
  background: rgba(0, 0, 0, 0.22);
  color: #ffffff;
}

.ach-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
  min-width: 260px;
}

.ach-search-box {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.ach-search-ico {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--ach-text-dim);
  pointer-events: none;
}

.ach-search-box input {
  width: 100%;
  height: 38px;
  background: var(--ach-bg-panel);
  border: 1px solid var(--ach-border);
  border-radius: 9px;
  color: var(--ach-text-main);
  padding: 0 32px 0 34px;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ach-search-box input::placeholder {
  color: var(--ach-text-dim);
}

.ach-search-box input:focus {
  border-color: rgba(240, 136, 62, 0.65);
  box-shadow: 0 0 0 3px rgba(240, 136, 62, 0.12);
}

.ach-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ach-text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ach-search-clear svg {
  width: 13px;
  height: 13px;
}

.ach-search-clear:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.ach-btn-control {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--ach-bg-panel);
  border: 1px solid var(--ach-border);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
  font-family: inherit;
}

.ach-btn-control:hover {
  border-color: var(--ach-border-strong);
  color: #ffffff;
  background: #1a2130;
}

.ach-view-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  height: 38px;
  box-sizing: border-box;
  background: var(--ach-bg-panel);
  border: 1px solid var(--ach-border);
  border-radius: 9px;
  gap: 2px;
}

.ach-view-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ach-text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.ach-view-btn svg {
  width: 15px;
  height: 15px;
}

.ach-view-btn:hover {
  color: #e2e8f0;
}

.ach-view-btn.active {
  background: #232d42;
  color: #ffffff;
}

/* 결과 메타 바 */
.ach-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
  flex-wrap: wrap;
}

.ach-result-summary {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ach-text-sub);
}

.ach-result-summary strong {
  color: var(--ach-text-main);
  font-variant-numeric: tabular-nums;
}

.ach-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.ach-legend-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--ach-text-dim);
  font-weight: 600;
}

.ach-legend-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-rare { background: var(--ach-amber); }
.dot-destiny { background: var(--ach-sky); }
.dot-liberation { background: var(--ach-violet); }
.dot-boss { background: var(--ach-rose); }

/* ==========================================================================
   3. 업적 카드 그리드 & 1열 리스트
   ========================================================================== */
.ach-content-wrap {
  padding-bottom: 36px;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ach-grid.is-list {
  grid-template-columns: 1fr;
  gap: 8px;
}

.ach-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--ach-bg-card);
  border: 1px solid var(--ach-border);
  border-left-width: 3px;
  border-radius: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
  min-width: 0;
}

.ach-card:hover {
  transform: translateY(-1px);
  background: var(--ach-bg-card-hover);
  border-color: var(--ach-border-strong);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

/* 카테고리별 좌측 엣지 컬러 */
.ach-card.type-rare { border-left-color: var(--ach-amber); }
.ach-card.type-destiny { border-left-color: var(--ach-sky); }
.ach-card.type-liberation { border-left-color: var(--ach-violet); }
.ach-card.type-star22 { border-left-color: #eab308; }
.ach-card.type-boss { border-left-color: var(--ach-rose); }
.ach-card.type-general { border-left-color: #475569; }

.ach-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--ach-bg-inset);
  border: 1px solid rgba(148, 163, 184, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ach-card-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
}

.ach-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.ach-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ach-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.71rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.ach-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.ach-badge.badge-rare {
  background: rgba(251, 191, 36, 0.11);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.ach-badge.badge-destiny {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.ach-badge.badge-liberation {
  background: rgba(192, 132, 252, 0.12);
  color: #d8b4fe;
  border: 1px solid rgba(192, 132, 252, 0.28);
}

.ach-badge.badge-star22 {
  background: rgba(250, 204, 21, 0.11);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.26);
}

.ach-badge.badge-boss {
  background: rgba(251, 113, 133, 0.11);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.26);
}

.ach-badge.badge-general {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.ach-done-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ach-emerald);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.24);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ach-done-pill svg {
  width: 12px;
  height: 12px;
}

.ach-card-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ach-card-desc {
  font-size: 0.8rem;
  color: var(--ach-text-sub);
  line-height: 1.4;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 1열 컴팩트 리스트 모드 전용 최적화 */
.ach-grid.is-list .ach-card {
  padding: 11px 16px;
}

.ach-grid.is-list .ach-card-icon {
  width: 40px;
  height: 40px;
}

.ach-grid.is-list .ach-card-icon img {
  width: 30px;
  height: 30px;
}

.ach-grid.is-list .ach-card-body {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

.ach-grid.is-list .ach-card-top {
  order: 3;
  flex-shrink: 0;
}

.ach-grid.is-list .ach-card-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ach-grid.is-list .ach-card-desc {
  -webkit-line-clamp: 1;
}

/* ==========================================================================
   4. 로딩 / 빈 화면 / 오류 상태 박스
   ========================================================================== */
.ach-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  background: var(--ach-bg-panel);
  border: 1px dashed var(--ach-border-strong);
  border-radius: 14px;
}

.ach-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(240, 136, 62, 0.1);
  border: 1px solid rgba(240, 136, 62, 0.25);
  color: #ff9c59;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.ach-state-icon.is-error {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.28);
  color: var(--ach-rose);
}

.ach-state-icon.is-muted {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--ach-text-sub);
}

.ach-state-icon svg {
  width: 24px;
  height: 24px;
}

.ach-state-title {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.ach-state-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ach-text-sub);
  max-width: 460px;
  line-height: 1.55;
  word-break: keep-all;
}

.ach-state-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.ach-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  background: var(--ach-accent);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s ease;
  font-family: inherit;
}

.ach-btn-primary:hover {
  filter: brightness(1.08);
}

.ach-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(240, 136, 62, 0.18);
  border-top-color: var(--ach-accent);
  border-radius: 50%;
  animation: achSpin 0.75s linear infinite;
  margin-bottom: 14px;
}

@keyframes achSpin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   5. 반응형 최적화 (태블릿 / 모바일)
   ========================================================================== */
@media (max-width: 1080px) {
  .ach-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .ach-grid {
    grid-template-columns: 1fr;
  }
  .ach-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .ach-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    box-sizing: border-box;
  }
  .ach-controls-right {
    width: 100%;
    min-width: 0;
  }
  .ach-search-box {
    max-width: none;
  }
  .ach-grid.is-list .ach-card-body {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  .ach-grid.is-list .ach-card-top {
    order: 0;
  }
}

@media (max-width: 600px) {
  .ach-hero-panel {
    padding: 16px;
  }
  .ach-hero-top {
    flex-direction: column;
    gap: 12px;
  }
  .ach-heading {
    font-size: 1.32rem;
  }
  .ach-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .ach-stat-card {
    padding: 11px 12px;
    min-height: 74px;
  }
  .ach-stat-card.is-tier {
    grid-column: span 2;
  }
  .ach-stat-value {
    font-size: 1.12rem;
  }
  .ach-legend-row {
    display: none;
  }
  .ach-view-switch {
    display: none;
  }
  .ach-card {
    padding: 12px 13px;
    gap: 11px;
  }
  .ach-card-title {
    white-space: normal;
  }
}