/* ======== Achievements and player level (js/achievements.js) ======== */

/* Menu: the level chip beside "?" (a ring of XP toward the next level around the level number) */
#lvl-chip {
  position: relative; width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--primary); display: flex; align-items: center; justify-content: center;
}
#lvl-chip[hidden] { display: none; }
#lvl-chip svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#lvl-chip .lc-track { fill: var(--surface); stroke: rgba(var(--fg-rgb), 0.14); stroke-width: 3.5; }
#lvl-chip .lc-fill { fill: none; stroke: var(--c-green); stroke-width: 3.5; stroke-linecap: round; }
#lvl-chip b { position: relative; font-family: var(--font-display); font-size: 17px; font-weight: 800; line-height: 1; }
#lvl-chip .lc-new {
  position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center;
}
#lvl-chip .lc-new[hidden] { display: none; }

/* Profile screen */
#screen-profile { justify-content: flex-start; }
#achv-body {
  flex: 1; width: min(100%, 560px); box-sizing: border-box; overflow-y: auto;
  padding: 6px 16px 28px; display: flex; flex-direction: column; gap: 12px;
}
.achv-bar { display: block; height: 10px; border-radius: 5px; background: rgba(var(--fg-rgb), 0.1); overflow: hidden; }
.achv-bar.thin { height: 6px; border-radius: 3px; }
.achv-bar i { display: block; height: 100%; border-radius: inherit; background: var(--c-green); }

.achv-hero { background: var(--surface); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ah-top { display: flex; align-items: center; gap: 14px; }
.ah-ring { position: relative; width: 84px; height: 84px; flex: none; display: flex; align-items: center; justify-content: center; }
.ah-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ah-ring .ah-track { fill: var(--surface-2); stroke: rgba(var(--fg-rgb), 0.1); stroke-width: 7; }
.ah-ring .ah-fill { fill: none; stroke: var(--c-green); stroke-width: 7; stroke-linecap: round; }
.ah-ring > span { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ah-ring b { font-family: var(--font-display); font-size: 34px; font-weight: 800; color: var(--primary); }
.ah-ring small { font-size: 10px; font-weight: 900; letter-spacing: 1px; opacity: 0.75; }
.ah-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ah-info > b { font-size: 18px; font-weight: 900; }
.ah-info > span, .ah-info > small { font-size: 13px; font-weight: 700; opacity: 0.75; }
.ah-info > small { font-size: 12px; }
.ah-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ah-tile {
  position: relative; background: var(--surface-2); border: none; border-radius: 14px; padding: 10px 6px; font: inherit; color: var(--fg);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ah-tile.on { box-shadow: inset 0 0 0 3px currentColor; }
.ah-tile.on.c1 { color: var(--primary); } .ah-tile.on.c2 { color: var(--c-teal); } .ah-tile.on.c3 { color: var(--c-orange); }
.ah-tiles b { font-family: var(--font-display); font-size: 21px; font-weight: 800; line-height: 1.1; }
.ah-tiles b.c1 { color: var(--primary); } .ah-tiles b.c2 { color: var(--c-teal); } .ah-tiles b.c3 { color: var(--c-orange); }
.ah-tiles small { font-size: 12px; font-weight: 800; opacity: 0.75; text-align: center; line-height: 1.2; color: var(--fg); }
.ah-i {
  position: absolute; top: 5px; right: 5px; width: 16px; height: 16px; border-radius: 50%; background: rgba(var(--fg-rgb), 0.1);
  color: var(--fg); font-size: 11px; font-weight: 900; line-height: 16px; text-align: center; opacity: 0.8;
}
/* A stat's explanation: a light card in the stat's colour under the boxes (never a dark tooltip) */
.ah-tip {
  display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 700; line-height: 1.4;
  background: color-mix(in srgb, var(--tipc) 10%, var(--surface)); box-shadow: inset 0 0 0 2px var(--tipc);
}
.ah-tip.c1 { --tipc: var(--primary); } .ah-tip.c2 { --tipc: var(--c-teal); } .ah-tip.c3 { --tipc: var(--c-orange); }
.ah-tip b { font-size: 15px; font-weight: 900; }
.ah-tip small { font-size: 13px; font-weight: 800; color: var(--tipc); }
.ah-xp {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: none; border-radius: 14px; font: inherit;
  background: color-mix(in srgb, var(--c-green) 14%, var(--surface)); color: var(--c-green); font-size: 14px; font-weight: 900; text-align: left;
}
.ah-xp span:nth-of-type(1) { flex: 1; }
.ah-xp svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

.achv-h { margin: 6px 0 0; font-size: 13px; font-weight: 900; letter-spacing: 1.2px; text-transform: uppercase; opacity: 0.75; }
.achv-h-row { display: flex; align-items: baseline; justify-content: space-between; }
.achv-h-row small { font-size: 13px; font-weight: 800; opacity: 0.75; }

.achv-goal {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; border-radius: 16px;
  background: var(--surface); color: var(--fg); text-align: left; font: inherit;
}
.achv-goal img { width: 52px; height: 52px; flex: none; }
.ag-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ag-row { display: flex; justify-content: space-between; gap: 8px; }
.ag-row b { font-size: 15px; font-weight: 900; }
.ag-row small, .ag-desc { font-size: 13px; font-weight: 700; opacity: 0.75; }
.ag-tier { font-weight: 800; opacity: 0.8; }
.achv-best { align-self: flex-start; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); font-size: 12px; font-weight: 800; }

.achv-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.achv-filter {
  height: 34px; padding: 0 12px; border: none; border-radius: 999px; background: var(--surface-2); color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 800;
}
.achv-filter.on { background: var(--primary); color: var(--on-primary); }

.achv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.achv-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px;
  border: none; border-radius: 16px; background: var(--surface); color: var(--fg); font: inherit;
}
.achv-card img { width: 70px; height: 70px; }
.achv-card b { font-size: 12px; font-weight: 900; text-align: center; line-height: 1.2; min-height: 29px; display: flex; align-items: center; }
.achv-tierlabel { font-size: 11px; font-weight: 800; opacity: 0.75; }
.achv-card.locked b { opacity: 0.7; }
.achv-new {
  position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 6px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 900;
}

/* Detail window: the badge big, then the group's tiers */
#achv-sheet { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-height: 86dvh; overflow-y: auto; }
#achv-sheet .ad-badge { width: 120px; height: 120px; }
#achv-sheet h3 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 800; line-height: 1.1; }
#achv-sheet p { margin: 0; font-size: 15px; font-weight: 700; opacity: 0.8; }
#achv-sheet .menu-btn { width: 100%; }
.ad-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ad-tag { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; font-weight: 900; }
.ad-tag.t1 { background: #f7e1cf; color: #7a3f14; } .ad-tag.t2 { background: #e6ebf0; color: #3b4652; }
.ad-tag.t3 { background: #fff1c2; color: #7a4d00; } .ad-tag.t4 { background: #ebe7fa; color: #4a4280; } .ad-tag.t5 { background: #d8f2fc; color: #0f5b87; }
/* "XP nasıl kazanılır?" */
.ax-group { width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-soft); text-align: left; }
.ax-group > b { font-size: 14px; font-weight: 900; }
.ax-group.g1 > b { color: #5b3fd9; } .ax-group.g2 > b { color: #2563d9; } .ax-group.g3 > b { color: var(--c-orange); }
.ax-group.g4 > b { color: var(--c-teal); } .ax-group.g5 > b { color: var(--c-green); }
.ax-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; }
.ax-row span { opacity: 0.8; } .ax-row b { white-space: nowrap; }
#achv-sheet .ax-note { font-size: 13px; }
.ad-rows { width: 100%; display: flex; flex-direction: column; text-align: left; background: var(--surface); border-radius: 16px; padding: 4px 12px; box-sizing: border-box; }
.ad-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ad-row + .ad-row { border-top: 1px solid var(--line-soft); }
.ad-row img { width: 42px; height: 42px; flex: none; }
.ad-note { font-size: 12px; font-weight: 800; opacity: 0.75; }
.ad-note.ok { color: var(--c-green); opacity: 1; } .ad-note.next { color: var(--primary); opacity: 1; }
.ad-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ad-line { display: flex; justify-content: space-between; gap: 8px; }
.ad-line b { font-size: 14px; font-weight: 900; }
.ad-line small, .ad-prog small { font-size: 12px; font-weight: 800; opacity: 0.75; white-space: nowrap; }
.ad-prog { display: flex; align-items: center; gap: 8px; }
.ad-prog .achv-bar { flex: 1; }

/* "Başarım açıldı" / "Seviye atladın": slides in from the top, over everything, never blocks a tap for long */
#achv-toast {
  position: fixed; top: 12px; left: 12px; right: 12px; max-width: 520px; margin: 0 auto; z-index: 2000;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; border-radius: 20px;
  background: #1f2b3a; color: #fff; box-shadow: 0 10px 24px rgba(31,43,58,0.3);
  transform: translateY(-160%); transition: transform 0.35s ease; pointer-events: none; cursor: pointer;
}
#achv-toast.show { transform: translateY(0); pointer-events: auto; } /* a tap closes it */
#achv-toast .at-stack { display: flex; flex: none; }
#achv-toast .at-stack img { width: 44px; height: 44px; }
#achv-toast .at-stack img + img { margin-left: -18px; }
#achv-toast:empty { display: none; }
#achv-toast img { width: 56px; height: 56px; flex: none; }
#achv-toast .at-level {
  width: 56px; height: 56px; flex: none; border-radius: 50%; background: #3f8f57; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
}
#achv-toast .at-level b { font-family: var(--font-display); font-size: 24px; }
#achv-toast .at-level small { font-size: 8px; font-weight: 900; letter-spacing: 1px; }
#achv-toast .at-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#achv-toast .at-text small { font-size: 11px; font-weight: 900; letter-spacing: 1px; color: #f0b72f; }
#achv-toast .at-text b { font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1.1; }
#achv-toast .at-text span { font-size: 13px; font-weight: 700; color: #c9d3de; }
#achv-toast .at-reward { padding: 4px 10px; border-radius: 999px; background: #f0b72f; color: #1f2b3a; font-size: 13px; font-weight: 900; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { #achv-toast { transition: none; } }

/* The level chip sits first in the menu's top-left corner, before the sign-in chip */
.menu-topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* Gold regions on the profile (Tahtalı Yol, Nov 2026). */
.ah-gold { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; background: #ffe7a3; color: #7a5200;
  font: 800 12px var(--font-ui); }
