/* ════════════════════════════════════════
   components.css — panels, buttons, cards, sprites
   ════════════════════════════════════════ */

/* ── Panels ─────────────────────────────── */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
}
/* Cut top-right + bottom-left corners (game UI card) */
.cut {
  --c: 18px;
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c)));
  border: 0;
  background:
    linear-gradient(180deg, var(--panel-2), var(--panel)) padding-box;
  box-shadow: inset 0 0 0 1px var(--line);
}
/* HUD corner brackets */
.panel--hud { border-color: rgba(0,240,255,.25); background: rgba(17,15,32,.78); backdrop-filter: blur(4px); }
.panel__corners i {
  position: absolute; width: 18px; height: 18px;
  border: 2px solid var(--cyan);
  filter: drop-shadow(0 0 4px var(--cyan));
}
.panel__corners i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.panel__corners i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.panel__corners i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.panel__corners i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

.mini-title { font: 12px/1.4 var(--f-pixel); color: var(--cyan); margin-bottom: 16px; }

/* ── Buttons ────────────────────────────── */
.btn {
  --c: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 14px 22px;
  font: 12px/1.2 var(--f-pixel);
  clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, var(--c) 100%, 0 calc(100% - var(--c)));
  transition: transform .12s steps(2), background .15s, color .15s;
}
.btn--primary { background: var(--cyan); color: #04121a; box-shadow: var(--glow-c); }
.btn--primary:hover { background: var(--yellow); transform: translate(-2px, -2px); }
.btn--ghost { background: transparent; color: var(--magenta); box-shadow: inset 0 0 0 2px var(--magenta); }
.btn--ghost:hover { background: var(--magenta); color: #12010e; transform: translate(-2px, -2px); }
.btn:active { transform: translate(1px, 1px); }
.btn--lg { min-height: 56px; padding: 18px 28px; font-size: 13px; }

/* ── Hero readout ───────────────────────── */
.readout { margin: 0; display: grid; gap: 8px; }
.readout div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.readout dt { font: 20px/1.2 var(--f-hud); color: var(--ink-3); }
.readout dd { margin: 0; font-weight: 500; text-align: right; }

/* ── RPG dialogue box (bio) ─────────────── */
.profile__bio {
  padding: 32px 32px 40px;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--line);
  background: #0a0918;
}
.dialog__name { font: 13px/1 var(--f-pixel); color: var(--yellow); margin-bottom: 18px; }
.dialog__text { font-size: 19px; line-height: 1.65; color: var(--ink); }
.dialog__next { position: absolute; right: 22px; bottom: 14px; color: var(--cyan); animation: bob 0.9s steps(2) infinite; }

/* ── Stats ──────────────────────────────── */
.stat { padding: 18px 16px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 2px; }
.stat__num { font: 30px/1 var(--f-pixel); color: var(--cyan); text-shadow: var(--glow-c); }
.stat__plus { font: 18px/1 var(--f-pixel); color: var(--magenta); }
.stat__label { grid-column: 1 / -1; margin-top: 12px; font-size: 14.5px; color: var(--ink-2); line-height: 1.35; }

/* ── Meters (languages) ─────────────────── */
.langs { padding: 22px; }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-bottom: 14px; }
.meter:last-child { margin-bottom: 0; }
.meter__name { font-weight: 600; }
.meter__lvl { font: 19px/1.2 var(--f-hud); color: var(--magenta); }
.meter__bar { grid-column: 1 / -1; height: 12px; background: var(--bg); border: 1px solid var(--line); padding: 2px; }
.meter__bar i {
  display: block; height: 100%; width: var(--v);
  background: repeating-linear-gradient(90deg, var(--green) 0 8px, transparent 8px 10px);
  transform-origin: left;
}

/* ── Achievement badge ──────────────────── */
.badge { padding: 18px 22px; display: flex; align-items: center; gap: 18px; border-color: rgba(245,230,10,.4); }
.badge__kicker { font: 18px/1 var(--f-hud); color: var(--yellow); margin-bottom: 6px; }
.badge__title { font-weight: 600; line-height: 1.3; }
.badge__sub { font-size: 14px; color: var(--ink-3); margin-top: 2px; }

/* ── Abilities ──────────────────────────── */
.ability { padding: 28px 24px 30px; transition: transform .2s var(--ease), box-shadow .2s; }
.ability:hover { transform: translateY(-6px); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 30px rgba(0,240,255,.12); }
.ability__key {
  position: absolute; top: 18px; right: 26px;
  width: 34px; height: 34px; display: grid; place-items: center;
  font: 12px/1 var(--f-pixel); color: var(--bg); background: var(--yellow);
  box-shadow: 0 3px 0 #8f8505;
}
.ability__title { font-size: 18px; font-weight: 600; line-height: 1.3; margin: 18px 0 12px; }
.ability:hover .ability__title { color: var(--cyan); }
.ability p { font-size: 15.5px; color: var(--ink-2); }

/* ── Missions ───────────────────────────── */
.mission { overflow: hidden; display: flex; flex-direction: column; }
.mission__visual {
  position: relative; aspect-ratio: 16 / 8;
  display: grid; place-items: center;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 12px 12px,
    radial-gradient(circle at 50% 70%, var(--glow-bg, #08303a), #08071a 75%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.mission__visual[data-hue="magenta"] { --glow-bg: #3d0b36; }
.mission__visual[data-hue="yellow"]  { --glow-bg: #3a3304; }
.mission--wide .mission__visual { aspect-ratio: auto; min-height: 260px; border-bottom: 0; border-right: 1px solid var(--line); }
.mission__status {
  position: absolute; top: 14px; left: 14px;
  font: 19px/1 var(--f-hud); padding: 6px 10px;
  color: var(--green); background: rgba(0,0,0,.6); border: 1px solid var(--green);
}
.mission__status--active { color: var(--yellow); border-color: var(--yellow); }
.mission__status--active::first-letter { animation: blink 1s steps(1) infinite; }
.mission__body { padding: 26px 28px 30px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.mission__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font: 20px/1.1 var(--f-hud); }
.mission__meta span:first-child { color: var(--magenta); }
.mission__meta span:last-child { color: var(--ink-3); }
.mission__title { font-size: 21px; font-weight: 600; line-height: 1.28; }
.mission__body > p:not([class]) { color: var(--ink-2); font-size: 16px; }
.mission__reward {
  padding: 12px 14px; font-size: 15.5px; line-height: 1.45;
  background: rgba(245,230,10,.06); border-left: 3px solid var(--yellow);
}
.mission__reward span { display: block; font: 18px/1 var(--f-hud); color: var(--yellow); margin-bottom: 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.tags li { font: 18px/1 var(--f-hud); color: var(--cyan); padding: 5px 9px; border: 1px solid rgba(0,240,255,.35); }

/* ── Level map ──────────────────────────── */
.level { position: relative; }
.level__node {
  position: absolute; left: -96px; top: 22px;
  width: 66px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font: 11px/1 var(--f-pixel); color: var(--ink-3);
  background: var(--bg-2); border: 2px solid var(--line);
  transition: color .3s, border-color .3s, box-shadow .3s;
  z-index: 1;
}
.level__node::before { content: 'LV'; margin-right: 4px; font-size: 8px; }
.level.is-reached .level__node { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow-c); }
.level--current.is-reached .level__node { color: var(--yellow); border-color: var(--yellow); box-shadow: 0 0 14px rgba(245,230,10,.6); }
.level__card { padding: 24px 26px 26px; }
.level--current .level__card { border-color: rgba(245,230,10,.5); }
.level__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font: 20px/1.1 var(--f-hud); color: var(--ink-3); margin-bottom: 10px; }
.level__lv { color: var(--magenta); }
.level--current .level__lv { color: var(--yellow); }
.level__role { font-size: 21px; font-weight: 600; line-height: 1.3; }
.level__org { font-size: 15px; color: var(--cyan); margin: 4px 0 12px; }
.level__card > p:last-child { color: var(--ink-2); font-size: 16px; }

/* ── Inventory ──────────────────────────── */
.inv-group { padding: 24px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.slots li {
  min-height: 64px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 500; line-height: 1.3;
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.04), inset -2px -2px 0 rgba(0,0,0,.4);
  transition: border-color .15s, color .15s, transform .15s steps(2);
}
.slots li:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.inv-group--rare { border-color: rgba(245,230,10,.45); }
.inv-group--rare .mini-title { color: var(--yellow); }
.slots--rare li { border-color: rgba(245,230,10,.35); background: rgba(245,230,10,.05); }
.slots--rare li:hover { border-color: var(--yellow); color: var(--yellow); }

/* ── Sprites (inline SVG pixel art, drawn by main.js) ── */
.sprite svg { width: 100%; height: 100%; shape-rendering: crispEdges; image-rendering: pixelated; }
.sprite--avatar { position: absolute; inset: 10%; animation: idle 1.6s steps(2) infinite; }
.sprite--badge  { width: 52px; height: 52px; flex: none; }
.sprite--icon   { width: 44px; height: 44px; }
.sprite--scene  { width: 46%; max-width: 200px; aspect-ratio: 1; }
.sprite--tiny   { width: 26px; height: 26px; flex: none; }
.sprite--walker { width: 100%; height: 100%; filter: drop-shadow(0 0 6px rgba(0,240,255,.5)); }

/* Pixel-dissolve cover (blocks added by animations.js) */
.pixel-reveal { position: relative; }
.pixel-cover { position: absolute; inset: 0; display: grid; z-index: 3; pointer-events: none; }
.pixel-cover i { background: var(--bg); }

/* ── Glitch text ────────────────────────── */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  text-shadow: none;
  opacity: 0;
}
.glitch::before { color: var(--magenta); transform: translateX(-3px); }
.glitch::after  { color: var(--cyan);    transform: translateX(3px); }

/* ── Achievement toast ──────────────────── */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; align-items: center; gap: 14px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 14px 18px;
  background: #0c0b17; border: 2px solid var(--yellow);
  box-shadow: 0 0 24px rgba(245,230,10,.25), 6px 6px 0 #000;
  transform: translateY(140%); opacity: 0;
  transition: transform .35s var(--ease), opacity .35s;
}
.toast.is-on { transform: none; opacity: 1; }
.toast__kicker { font: 10px/1.3 var(--f-pixel); color: var(--yellow); margin-bottom: 6px; }
.toast__text { font-weight: 600; font-size: 15px; line-height: 1.3; }
