/* ============================================================
   CHARACTER CODEX — TACTICAL HUD THEME (style.css)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root{
  --bg: #0a0c0f;
  --bg-grid: #0e1114;
  --panel: #14171c;
  --panel-raised: #1a1e24;
  --line: #262b32;
  --line-bright: #3a414b;
  --text: #f3f5f8;
  --text-dim: #a4acb8;
  --text-faint: #626a76;

  /* UI accent (interactive / structural) */
  --cyan: #35e0d0;
  --cyan-dim: #0f3a3a;

  /* ability-type accents */
  --steel: #9aa4b2;
  --skill: #35e0d0;
  --amber: #ffb648;
  --amber-dim: #4a3417;

  --red: #ff4d63;
  --red-dim: #4a1620;
  --violet: #9d7dff;
  --violet-dim: #241b45;
  --green: #4fd482;

  /* fallback role color when JS doesn't supply one */
  --role-color: var(--cyan);

  --font-display: 'Rajdhani', 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
  --font-mono: 'JetBrains Mono', 'Noto Sans KR', monospace;

  --radius: 5px;
}

*{ box-sizing:border-box; margin:0; padding:0; }

html{ scroll-behavior:smooth; }

body{
  background:
    radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(53,224,208,0.06), transparent 60%),
    repeating-linear-gradient(0deg, var(--bg-grid) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, var(--bg-grid) 0 1px, transparent 1px 44px),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}

::selection{ background: var(--cyan); color:#04262b; }

a{ color:inherit; }

button{ font-family:inherit; color:inherit; cursor:pointer; background:none; border:none; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar{ width:12px; height:12px; }
::-webkit-scrollbar-track{ background-color:#0d0f12; border-radius:4px; }
::-webkit-scrollbar-thumb{ background-color:#333a42; border-radius:4px; border:3px solid #0d0f12; }
::-webkit-scrollbar-thumb:hover{ background-color:#454d57; }

/* ---------- header ---------- */
.site-header{
  position: sticky;
  top:0;
  z-index: 20;
  background: rgba(10,12,15,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(53,224,208,0.08);
}

.site-header__inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 28px 18px;
}

.brand{
  display:flex;
  align-items: baseline;
  gap:14px;
  margin-bottom: 5px;
}

.brand__mark{
  width:11px; height:11px;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(53,224,208,0.85), 0 0 2px rgba(53,224,208,1);
  transform: rotate(45deg);
  flex-shrink:0;
}

.brand__title{
  font-family: var(--font-display);
  font-weight:700;
  font-size: 27px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.brand__sub{
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  padding-left: 25px;
  position: relative;
}
.brand__sub::before{
  content: "//";
  position: absolute;
  left: 0;
  color: var(--cyan);
  opacity: 0.6;
}

.header-row{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ---------- sort tabs ---------- */
.sort-tabs{
  display:flex;
  gap:8px;
  background: transparent;
  border:none;
  padding:0;
}

.sort-tabs button{
  background: var(--panel-raised);
  border:1px solid var(--line-bright);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 9px 18px;
  border-radius: 4px;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.sort-tabs button:hover{
  color: var(--text);
  background: #232830;
  border-color: var(--cyan);
}

.sort-tabs button.active{
  background: var(--cyan);
  border-color: var(--cyan);
  color: #052624;
  font-weight:700;
  box-shadow: 0 0 16px rgba(53,224,208,0.35);
}

/* ---------- grid ---------- */
main{
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.group-divider{
  grid-column: 1 / -1;
  display:flex;
  align-items:center;
  gap:12px;
  margin: 6px 0 2px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-transform: uppercase;
}
.group-divider::before{
  content:"";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--role-color, var(--cyan));
  box-shadow: 0 0 8px var(--role-color, var(--cyan));
  flex-shrink: 0;
}
.group-divider:first-child{ margin-top:0; }
.group-divider::after{
  content:"";
  flex:1;
  height:1px;
  background: linear-gradient(to right, var(--line-bright), transparent);
}

.grid{
  display:grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 18px 14px;
}

@media (max-width: 1100px){
  .grid{ grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 780px){
  .grid{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 460px){
  .grid{ grid-template-columns: repeat(3, 1fr); }
}

/* ---------- card (작은 정사각형 아이콘형) ---------- */
.card{
  position:relative;
  width:100%;
  aspect-ratio: 1 / 1;
  background: var(--panel-raised);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  cursor:pointer;
  overflow:hidden;
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.card::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height:3px;
  background: var(--role-color, var(--line-bright));
  z-index:2;
  transition: opacity .25s ease;
}

.card:hover, .card:focus-visible{
  border-color: var(--role-color, var(--cyan));
  transform: translateY(-4px);
  box-shadow: 0 10px 22px -6px rgba(0,0,0,0.6), 0 0 0 1px var(--role-color, var(--cyan)) inset;
  outline:none;
}

.card:hover::before{
  height: 4px;
  box-shadow: 0 0 8px var(--role-color, var(--cyan));
}

.card:hover .card__portrait img{
  transform: scale(1.08);
}

.card__portrait{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
}

.card__portrait img{
  width:100%; height:100%;
  object-fit: cover;
  display:block;
  transition: transform 0.4s ease;
}

.card__noimg{
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  text-align:center;
  line-height:1.4;
}

.card__label{
  position:absolute;
  left:0; right:0; bottom:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 26px 8px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 55%, transparent 100%);
}

.card__id{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  max-width:100%;
}

.card__role-icon{
  width:13px;
  height:13px;
  flex-shrink:0;
  opacity:0.95;
  filter: drop-shadow(0 0 3px rgba(0,0,0,0.6));
}

.card__name{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.015em;
  color: var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* locked card */
.card--locked{
  background:
    repeating-linear-gradient(135deg, #0c0e11 0 6px, #131720 6px 12px);
}
.card--locked::before{ opacity: 0; }
.card--locked .card__name{ color: var(--text-faint); }
.card--locked{ transform:none; }
.card--locked:hover{ border-color: var(--line); transform:none; box-shadow:none; }

.lock-mark{
  font-family: var(--font-display);
  font-size: 24px;
  font-weight:700;
  color: var(--text-faint);
}

/* ---------- overlay + dossier modal (중앙, 컴팩트) ---------- */
.overlay{
  position:fixed; inset:0;
  background: rgba(3, 4, 5, 0.88);
  backdrop-filter: blur(8px);
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
  opacity:0;
  pointer-events:none;
  transition: opacity .35s ease;
}
.overlay.open{ opacity:1; pointer-events:auto; }

.dossier{
  width: min(1040px, 94%);
  max-height: 86vh;
  background: var(--bg);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  overflow-y:auto;
  transform: scale(0.94) translateY(16px);
  opacity:0;
  transition: transform .35s cubic-bezier(0.165, 0.84, 0.44, 1), opacity .35s ease;
  box-shadow: 0 24px 70px rgba(0,0,0,0.7), 0 0 60px -20px var(--role-color, transparent);
}
.overlay.open .dossier{ transform:scale(1) translateY(0); opacity:1; }

.dossier__head{
  position:relative;
  display:flex;
  align-items:stretch;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--role-color, var(--cyan)) 8%, transparent), transparent 40%),
    var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  text-align:left;
  overflow:hidden;
  border-top: 3px solid var(--role-color, var(--cyan));
}

.dossier__portrait{
  flex-shrink:0;
  width: 240px;
  overflow:hidden;
  background: transparent;
  border-right: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}
.dossier__portrait-frame{
  width: 240px;
  height: 240px;
  flex-shrink:0;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
.dossier__portrait img{
  width:100%; height:100%;
  object-fit:cover;
  display:block;
}
.dossier__noimg{
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  text-align:center;
  line-height:1.4;
}

.dossier__headtext{
  flex:1;
  min-width:0;
  padding: 26px 36px 24px 26px;
  background: transparent;
}

.dossier__close{
  position:absolute;
  top:12px; right:12px;
  width:34px; height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  color: var(--text);
  font-family: var(--font-body);
  font-size:18px;
  line-height:1;
  z-index:9999;
  transition: color .15s, border-color .15s, background .15s;
}
.dossier__close:hover{ color: var(--red); border-color: var(--red); background: rgba(255,77,99,0.1); }

.dossier__eyebrow{
  display:flex;
  align-items:center;
  gap:7px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.dossier__role-icon{
  width:15px;
  height:15px;
  filter: drop-shadow(0 0 4px currentColor);
}

.dossier__name{
  font-family: var(--font-display);
  font-weight:800;
  font-size: 32px;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.1;
}

.dossier__meta{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-start;
  gap: 6px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
}
.dossier__meta span b{ color: var(--text); font-weight:600; }

.keyword-hp-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.keywords{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-start;
  gap:7px;
}
.keyword{
  display:inline-flex;
  align-items:center;
  gap:5px;
  background: var(--panel-raised);
  border:1px solid var(--line-bright);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size:11px;
  padding: 5px 11px 5px 8px;
  letter-spacing: 0.02em;
  border-radius: 20px;
  transition: border-color .2s ease, color .2s ease;
}
.keyword:hover{ border-color: var(--role-color, var(--cyan)); color: var(--text); }
.keyword__emoji{
  font-size: 12px;
  line-height:1;
}

/* 체력 — HUD 스타일 바이탈 리드아웃 */
.hp-mini{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left:auto;
}
.hp-mini__label{
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  white-space:nowrap;
}
.hp-mini__value{
  font-family: var(--font-mono);
  font-weight:700;
  font-size: 14px;
  color: var(--role-color, var(--cyan));
  white-space:nowrap;
  min-width: 26px;
  text-align: right;
}

.dossier__body{ padding: 20px 26px 28px; }

.section{ margin-bottom: 18px; }
.section:last-child{ margin-bottom:0; }

.section__title{
  display:flex;
  align-items:center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.section__title::after{
  content:"";
  flex:1;
  height:1px;
  background: var(--line);
}

.story-text{
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
  white-space: pre-line;
}

.story-text--compact{
  margin-top: 0;
  padding-top: 6px;
  border-top: none;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* HP bar — 눈금이 있는 HUD 바이탈 바 */
.hp-bar-wrapper{
  height: 15px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-bright);
  border-radius: 3px;
  overflow:hidden;
  position: relative;
}
.hp-bar-wrapper--mini{
  width: 170px;
}
.hp-bar-wrapper::before{
  content:"";
  position:absolute;
  inset:0;
  background: repeating-linear-gradient(90deg, transparent 0 15px, rgba(0,0,0,0.35) 15px 16px);
  z-index: 2;
  pointer-events: none;
}

.hp-bar-fill{
  height:100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--role-color, var(--cyan)) 70%, black), var(--role-color, var(--cyan)));
  box-shadow: 0 0 10px var(--role-color, rgba(53,224,208,0.5));
  transition: width .4s ease;
}

/* ---- 기획표 스타일 능력 테이블 (기본무기 / 스킬1 / 스킬2 / 궁극기) ----
   가로는 항상 4열로 고정. 무기/궁극기가 더 있으면 해당 칸 아래로 줄이 추가되고,
   그 줄에서 데이터가 없는 칸(.ability-col--empty)은 테두리/배경 없이 완전히 비워둔다.
   타입별(무기/스킬/궁극기)로 좌측 악센트 색을 다르게 주어 한눈에 구분되게 한다. */
.ability-table{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.ability-col{
  display:flex;
  flex-direction:column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--steel);
  border-radius: 4px;
  overflow:hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.ability-col:hover{
  border-color: var(--line-bright);
  transform: translateY(-2px);
}

.ability-col--weapon{ border-left-color: var(--steel); }
.ability-col--skill{ border-left-color: var(--skill); }
.ability-col--ultimate{ border-left-color: var(--amber); }

.ability-col--empty{
  background: none;
  border: none;
}

.ability-col__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background: var(--panel-raised);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform:uppercase;
  text-align:left;
  padding: 8px 12px;
}

.ability-col__body{
  padding: 13px 12px 14px;
  flex: 1;
}

.ability-col__name{
  font-family: var(--font-display);
  font-weight:700;
  font-size: 15.5px;
  color: var(--text);
  text-align:left;
  margin-bottom: 3px;
  line-height:1.25;
}

.ability-col__tag{
  display:inline-block;
  text-align:left;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 10.5px;
  color: var(--steel);
  margin-left: 0;
  margin-bottom: 6px;
}
.ability-col--skill .ability-col__tag{ color: var(--skill); }
.ability-col--ultimate .ability-col__tag,
.ability-col__tag--teal{ color: var(--amber); }

.ability-col__desc{
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align:left;
}

.passive-block{
  border: 1px solid var(--violet-dim);
  background: color-mix(in srgb, var(--violet) 8%, var(--panel));
  border-left: 3px solid var(--violet);
  border-radius: 4px;
  padding: 12px 16px;
}
.passive-name{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 5px;
}
.passive-desc{
  font-size: 12.5px;
  line-height:1.6;
  color: var(--text-dim);
}

.passive-empty{
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 12px 14px;
  border: 1px dashed var(--line-bright);
  border-radius: 4px;
  text-align: center;
}

/* footer */
.site-footer{
  border-top: 1px solid var(--line);
  padding: 24px 28px 44px;
  text-align:center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
}

/* ---------- responsive ---------- */
@media (max-width: 640px){
  .site-header__inner{ padding: 16px 16px 12px; }
  main{ padding: 24px 16px 60px; }
  .dossier__name{ font-size: 22px; }
  .dossier__body{ padding: 18px 16px 22px; }
  .dossier__head{ flex-direction: column; }
  .dossier__portrait{ width: 100%; height: auto; border-right: none; }
  .dossier__portrait-frame{ width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .dossier__headtext{
    padding: 18px 16px 18px 16px;
  }
  .ability-table{ grid-template-columns: repeat(2, 1fr); }
  .header-row{ align-items:flex-start; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  *{ transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- focus visibility ---------- */
:focus-visible{
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
