/* Achievement Tracker: dark HUD theme. Original styling, no game assets. */

@font-face { font-family: 'Chakra Petch'; font-weight: 400; font-display: swap; src: url('/assets/fonts/chakra-petch-400.woff2') format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 600; font-display: swap; src: url('/assets/fonts/chakra-petch-600.woff2') format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 700; font-display: swap; src: url('/assets/fonts/chakra-petch-700.woff2') format('woff2'); }

:root {
  --bg: #07090d;
  --bg-grid: rgba(46, 230, 240, 0.035);
  --panel: #0f131a;
  --panel-2: #151b25;
  --line: #243041;
  --line-bright: #3a4a60;
  --text: #dfe6ee;
  --muted: #7f8b9c;
  --faint: #4a5566;
  --yellow: #f7e93a;
  --yellow-dim: rgba(247, 233, 58, 0.14);
  --cyan: #2ee6f0;
  --cyan-dim: rgba(46, 230, 240, 0.12);
  --red: #ff3b5c;
  --green: #3dffa0;
  --q-common: #a3acb9;
  --q-uncommon: #4fdc7b;
  --q-rare: #4aa8ff;
  --q-epic: #c06bff;
  --q-legendary: #ffa53d;
  --cut: 12px;
  --font: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(ellipse at top, #10161f 0%, var(--bg) 60%) fixed;
  background-color: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  letter-spacing: 0.01em;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--yellow); }
img { max-width: 100%; display: block; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }
h1, h2, h3 { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: 1.15rem; color: var(--yellow); }
h3 { font-size: 0.95rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---------- layout ---------- */
.site-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.85);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--text); display: flex; align-items: center; gap: 0.6rem; }
.brand::before { content: ''; width: 10px; height: 22px; background: var(--yellow); clip-path: polygon(0 0, 100% 0, 100% 70%, 0 100%); }
.site-header nav { margin-left: auto; display: flex; gap: 1.2rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; }
.site-header nav a { color: var(--muted); }
.site-header nav a:hover { color: var(--yellow); }
main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 2.5rem) 4rem; }
.section { margin-top: 2.5rem; }
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-head::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-bright), transparent); min-width: 2rem; }
.crumbs { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.8rem; }

/* ---------- panels ---------- */
.panel {
  /* Cut corners are painted rather than clipped, so tooltips can overflow the panel. */
  background:
    linear-gradient(225deg, var(--bg) calc(var(--cut) - 1px), var(--line) calc(var(--cut) - 1px), var(--line) var(--cut), transparent var(--cut)) top right / 50% 50% no-repeat,
    linear-gradient(45deg, var(--bg) calc(var(--cut) - 1px), var(--line) calc(var(--cut) - 1px), var(--line) var(--cut), transparent var(--cut)) bottom left / 50% 50% no-repeat,
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
  position: relative;
}
.panel::before { content: ''; position: absolute; top: 0; left: 0; width: 42px; height: 2px; background: var(--yellow); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 0.15rem 0.55rem; border: 1px solid currentColor; color: var(--muted);
}
.badge.live { color: var(--green); }
.badge.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.6s infinite; }
.badge.iconic { color: var(--yellow); }
@keyframes pulse { 50% { opacity: 0.3; } }

.bar { height: 6px; background: #1b2230; position: relative; overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--cyan), var(--yellow)); box-shadow: 0 0 10px var(--cyan-dim); }

.stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; margin-top: 1rem; }
.stat { display: flex; flex-direction: column; }
.stat .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.stat .value.accent { color: var(--yellow); }

/* ---------- cards (game list, characters) ---------- */
.card { display: block; color: var(--text); transition: transform 0.15s; }
.card:hover { color: var(--text); transform: translateY(-2px); }
.card:hover .panel { border-color: var(--yellow); }
.card .panel .live { float: right; }
.card .title { font-size: 1.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.card .meta { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0.8rem; }
.card .row { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }

/* ---------- character hero ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2rem; }
.hero .sub { color: var(--cyan); text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem; margin-bottom: 0.3rem; }

/* ---------- attribute panels and perk trees ---------- */
.attr-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.attr-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.8rem; }
.attr-value {
  width: 48px; height: 48px; display: grid; place-items: center; flex: none;
  font-size: 1.5rem; font-weight: 700; color: #0b0d12; background: var(--yellow);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.attr-name { font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.attr-skill { font-size: 0.78rem; color: var(--muted); display: flex; gap: 0.6rem; align-items: center; }
.attr-skill .bar { flex: 1; min-width: 80px; }
.attr-count { margin-left: auto; text-align: right; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.attr-count b { display: block; color: var(--cyan); font-size: 1.1rem; }

.tree { display: flex; flex-direction: column; gap: 6px; }
.tier { display: grid; grid-template-columns: 26px 1fr 18px 1fr 18px 1fr; gap: 4px; align-items: start; padding: 6px 0; border-top: 1px dashed var(--line); }
.tier.master { grid-template-columns: 26px 1fr; }
.tier.locked .cell, .tier.locked .master-row { opacity: 0.45; }
.tier-req { font-size: 0.7rem; color: var(--muted); font-weight: 700; text-align: center; padding-top: 6px; }
.tier:not(.locked) .tier-req { color: var(--yellow); }
.cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cell.between { padding-top: 14px; }
.perks { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.master-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* .node is an unclipped wrapper (so its .tip can overflow); .face carries the shape. */
.node { position: relative; outline: none; cursor: default; display: inline-flex; justify-content: center; }
.node.milestone { width: 100%; }
.node .face { display: block; border: 1px solid var(--line-bright); background: #0c1017; }
.node.milestone .face {
  width: 100%; min-height: 40px; padding: 5px 6px;
  font-size: 0.7rem; line-height: 1.15; text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--muted); display: flex; flex-direction: column; justify-content: center;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.node.milestone .rank { font-family: var(--mono); font-size: 0.65rem; color: var(--faint); margin-top: 2px; }
.node.small { width: 20px; height: 20px; align-items: center; }
.node.small .face { width: 13px; height: 13px; transform: rotate(45deg); }
.node.master .face { width: 34px; height: 34px; border: 0; background: var(--line-bright); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); position: relative; }
.node.master .face::after { content: ''; position: absolute; inset: 1px; background: #0c1017; clip-path: inherit; }
.node.owned.milestone .face { color: #0b0d12; background: var(--yellow); border-color: var(--yellow); }
.node.owned.milestone .rank { color: #3a3510; }
.node.owned.small .face { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.node.owned.master .face, .node.owned.master .face::after { background: var(--yellow); }
.node.partial.milestone .face { background: linear-gradient(90deg, var(--yellow-dim), #0c1017); color: var(--yellow); border-color: var(--yellow); }

.tip {
  display: none; position: absolute; z-index: 30; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 250px; padding: 0.7rem 0.8rem; background: #05070a; border: 1px solid var(--cyan);
  text-align: left; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.8rem; line-height: 1.4; color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: pre-line;
}
.tip .next { display: block; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line-bright); color: var(--muted); }
.tip b { display: block; color: var(--yellow); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }
.tip .r { color: var(--cyan); font-family: var(--mono); font-size: 0.72rem; display: block; margin-bottom: 0.3rem; }
.node:hover .tip, .node:focus .tip { display: block; }
/* Lift the hovered node (and its tooltip) above later panels, whose nodes would otherwise paint on top. */
.node:hover, .node:focus { z-index: 40; }
.node:hover .face, .node:focus .face { border-color: var(--cyan); }
.node.master:hover .face, .node.master:focus .face { background: var(--cyan); }

.relic { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.relic .branch { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.note { border-left: 2px solid var(--yellow); padding: 0.5rem 0.9rem; background: var(--yellow-dim); font-size: 0.85rem; margin-bottom: 1rem; }

/* ---------- gear ---------- */
.gear-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.item { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .name { font-weight: 600; }
.item .quality { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.q-Common, .q-CommonPlus { color: var(--q-common); }
.q-Uncommon, .q-UncommonPlus { color: var(--q-uncommon); }
.q-Rare, .q-RarePlus { color: var(--q-rare); }
.q-Epic, .q-EpicPlus { color: var(--q-epic); }
.q-Legendary, .q-LegendaryPlus, .q-LegendaryPlusPlus { color: var(--q-legendary); }
.parts { list-style: none; margin: 0.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.parts li { font-size: 0.75rem; padding: 0.1rem 0.5rem; border: 1px solid var(--line-bright); color: var(--text); }
.parts li span { color: var(--cyan); text-transform: uppercase; font-size: 0.65rem; letter-spacing: 0.1em; margin-right: 0.35rem; }
.cw-area { margin-bottom: 0.7rem; }
.cw-area h3 { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.16em; margin-bottom: 0.15rem; }

/* ---------- achievements ---------- */
.ach-grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.ach { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.9rem 1rem; }
.ach .t { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.ach .d { font-size: 0.85rem; color: var(--muted); }
.ach .proof { display: block; position: relative; border: 1px solid var(--line-bright); }
.ach .proof:hover { border-color: var(--yellow); }
.ach .proof img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.ach .proof-meta { font-size: 0.7rem; color: var(--faint); word-break: break-all; }
.ach .no-proof { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.ach.locked { opacity: 0.4; }
.ach.locked .panel::before, .ach.locked::before { background: var(--faint); }

/* ---------- forms and tables (admin) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
input, button {
  font: inherit; color: var(--text); background: #0a0e14; border: 1px solid var(--line-bright); padding: 0.45rem 0.7rem;
}
input:focus { outline: none; border-color: var(--cyan); }
button {
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; font-size: 0.8rem;
  background: var(--yellow); color: #0b0d12; border-color: var(--yellow);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
button:hover { background: var(--cyan); border-color: var(--cyan); }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
form.inline { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.form-stack { display: flex; flex-direction: column; gap: 0.8rem; max-width: 360px; }
.form-stack label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.alert { border-left: 2px solid var(--red); background: rgba(255, 59, 92, 0.1); padding: 0.6rem 0.9rem; }
.key-box { font-family: var(--mono); padding: 0.8rem; background: #05070a; border: 1px solid var(--yellow); color: var(--yellow); word-break: break-all; user-select: all; }

@media (max-width: 520px) {
  .tier { grid-template-columns: 22px 1fr 10px 1fr 10px 1fr; gap: 2px; }
  .node.milestone .face { font-size: 0.58rem; letter-spacing: 0; overflow-wrap: anywhere; hyphens: auto; padding: 4px 3px; }
  .tip { width: 200px; }
  .brand { letter-spacing: 0.08em; font-size: 0.9rem; }
  .site-header nav { gap: 0.8rem; }
}

/* ---------- shared: achievement pack headings ---------- */
.group-head { margin: 1.6rem 0 0.7rem; font-size: 0.85rem; color: var(--muted); letter-spacing: 0.16em; display: flex; gap: 0.6rem; align-items: baseline; }

/* ---------- Skyrim: skill constellations ---------- */
.sky-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.skill-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.skill-head .bar { margin-top: 0.35rem; }
.skill-level {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--yellow); color: var(--yellow); font-weight: 700; font-size: 1.1rem;
}
.constellation { position: relative; aspect-ratio: 4 / 5; margin: 0.4rem 0.2rem 0.2rem; }
.constellation svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.constellation line { stroke: var(--line-bright); stroke-width: 1.2; }
.constellation line.lit { stroke: var(--yellow); stroke-width: 1.6; }
.node.star { position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; align-items: center; justify-content: center; }
.node.star .face { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line-bright); background: var(--panel); }
.node.star.owned .face { width: 12px; height: 12px; background: var(--yellow); border-color: var(--yellow); box-shadow: 0 0 10px var(--yellow), 0 0 22px var(--yellow-dim); }
.node.star.partial .face { background: var(--panel); border: 2px solid var(--yellow); box-shadow: 0 0 8px var(--yellow-dim); }
.node.star:hover .face, .node.star:focus .face { border-color: var(--cyan); }
.node.star .tip { bottom: calc(100% + 6px); }
/* Perks near a tree's edge open their tooltip inwards so it stays on the page. */
.node.star.tip-start .tip { left: 0; transform: none; }
.node.star.tip-end .tip { left: auto; right: 0; transform: none; }

/* ---------- per-game themes ---------- */
@font-face { font-family: 'Cinzel'; font-weight: 400; font-display: swap; src: url('/assets/fonts/cinzel-400.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('/assets/fonts/cinzel-700.woff2') format('woff2'); }

/* Skyrim: worn stone, parchment and gold, frost-blue highlights. Original styling, no game art. */
.theme-skyrimse {
  --bg: #0c0b09;
  --bg-grid: transparent;
  --panel: #15130f;
  --panel-2: #1c1914;
  --line: #352e22;
  --line-bright: #5b4f38;
  --text: #ece3cc;
  --muted: #a59a7d;
  --faint: #6b624e;
  --yellow: #d8b56a;
  --yellow-dim: rgba(216, 181, 106, 0.16);
  --cyan: #a9cde0;
  --cyan-dim: rgba(169, 205, 224, 0.14);
  --cut: 0px;
  --font: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --mono: Georgia, serif;
  background: radial-gradient(ellipse at top, #1a1712 0%, #0c0b09 65%) fixed;
  background-color: var(--bg);
}
.theme-skyrimse h1, .theme-skyrimse h2, .theme-skyrimse h3, .theme-skyrimse .brand, .theme-skyrimse .attr-name,
.theme-skyrimse .stat .label, .theme-skyrimse .ach .t, .theme-skyrimse .tip b { font-family: 'Cinzel', Georgia, serif; }
.theme-skyrimse h1 { letter-spacing: 0.08em; text-transform: none; }
.theme-skyrimse .brand::before { background: var(--yellow); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 14px; height: 14px; }
.theme-skyrimse .panel { border-color: var(--line); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35); }
.theme-skyrimse .panel::before { left: 50%; transform: translateX(-50%); width: 60px; height: 1px; }
.theme-skyrimse .bar { background: #2a251b; }
.theme-skyrimse .bar > span { background: linear-gradient(90deg, #8a6d35, var(--yellow)); box-shadow: none; }
.theme-skyrimse .site-header { background: rgba(12, 11, 9, 0.9); }
.theme-skyrimse .badge.live { color: var(--cyan); }
.theme-skyrimse .badge.live::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.theme-skyrimse .tip { border-color: var(--yellow); background: #0e0c09; }
.theme-skyrimse .stat .value.accent { color: var(--yellow); }
