/* =====================================================================
   KAGEJIN — 影人
   Palette, spacing and type tokens all live in :root.
   Change the six colours below and the whole site changes.
   ===================================================================== */

:root {
  --void:      #08080a;
  --panel:     #101013;
  --panel-2:   #16161b;
  --line:      #26262d;
  --line-soft: #1b1b21;
  --ash:       #8b8d94;
  --ash-dim:   #5c5e66;
  --bone:      #e6e3dd;
  --crimson:   #c8102e;
  --ember:     #ff3b52;
  --gold:      #c9a227;

  --rail: 224px;
  --r: 2px;

  --f-ui: 'Zen Kaku Gothic New', system-ui, -apple-system, sans-serif;
  --f-jp: 'Shippori Mincho', 'Zen Kaku Gothic New', serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(900px 500px at 78% -10%, rgba(200,16,46,.10), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(120,124,132,.06), transparent 60%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 500; letter-spacing: .01em; }
p { margin: 0 0 .8em; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: #0c0c0f; }
::-webkit-scrollbar-thumb { background: #2a2a31; }
::-webkit-scrollbar-thumb:hover { background: var(--crimson); }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* ------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0b0b0e, #0a0a0d);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  z-index: 40;
}

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.brand .kanji { font-family: var(--f-jp); font-size: 26px; color: var(--crimson); line-height: 1; }
.brand .name  { font-size: 13px; letter-spacing: .34em; color: var(--ash); }

.rail-scroll { overflow-y: auto; flex: 1; padding: 14px 0 24px; }

.nav-group { margin-bottom: 18px; }
.nav-group > .label {
  font-size: 10.5px; letter-spacing: .22em; color: var(--ash-dim);
  padding: 0 20px 8px; font-family: var(--f-jp);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; color: var(--ash); font-size: 14px;
  border-left: 2px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
}
.nav-item:hover { color: var(--bone); background: rgba(255,255,255,.025); }
.nav-item.active { color: var(--bone); border-left-color: var(--crimson); background: rgba(200,16,46,.07); }
.nav-item .jp { font-family: var(--f-jp); font-size: 13px; color: var(--crimson); width: 22px; }
.nav-item .lv { margin-left: auto; font-size: 11px; color: var(--ash-dim); font-variant-numeric: tabular-nums; }

.rail-foot { border-top: 1px solid var(--line); padding: 12px 20px; font-size: 11.5px; color: var(--ash-dim); display:flex; justify-content:space-between; }

.main { flex: 1; min-width: 0; padding: 30px 34px 90px; max-width: 1500px; }

/* ------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; font-family: var(--f-jp); letter-spacing: .02em; }
.page-head .sub { color: var(--ash); font-size: 13.5px; margin-top: 2px; }
.page-head .jp-mark { font-family: var(--f-jp); color: var(--crimson); font-size: 15px; opacity: .85; }

/* ------------------------------------------------------ system panel */
.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(22,22,27,.94), rgba(14,14,17,.94));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px;
}
.panel::before, .panel::after {
  content: ''; position: absolute; width: 9px; height: 9px; pointer-events: none;
  border-color: var(--crimson); opacity: .75;
}
.panel::before { top: -1px; left: -1px; border-top: 1px solid; border-left: 1px solid; }
.panel::after  { bottom: -1px; right: -1px; border-bottom: 1px solid; border-right: 1px solid; }

.panel > h2, .panel-title {
  font-size: 13px; letter-spacing: .18em; color: var(--ash);
  display: flex; align-items: center; gap: 9px; margin-bottom: 16px;
}
.panel-title .jp { font-family: var(--f-jp); color: var(--crimson); letter-spacing: 0; font-size: 14px; }
.panel-title .right { margin-left: auto; font-size: 11.5px; letter-spacing: .04em; color: var(--ash-dim); }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-status { grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); align-items: start; }

/* --------------------------------------------------- the status card */
.status {
  padding: 0; overflow: hidden;
  background:
    linear-gradient(150deg, rgba(200,16,46,.13), transparent 46%),
    linear-gradient(160deg, rgba(24,24,29,.96), rgba(12,12,15,.96));
}
.status-body { display: flex; gap: 26px; padding: 26px 26px 22px; align-items: center; }

.level-block { text-align: center; min-width: 148px; position: relative; }
.level-block .word { font-size: 11px; letter-spacing: .3em; color: var(--ash-dim); }
.level-block .num {
  font-family: var(--f-jp); font-size: 84px; line-height: .95; font-weight: 600;
  color: var(--bone); text-shadow: 0 0 26px rgba(200,16,46,.5);
}
.level-block .rank {
  margin-top: 6px; display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--crimson); color: var(--ember);
  padding: 3px 11px; font-size: 12px; letter-spacing: .16em;
  background: rgba(200,16,46,.09);
}
.level-block .rank .jp { font-family: var(--f-jp); letter-spacing: 0; color: var(--bone); }

.status-info { flex: 1; min-width: 0; }
.status-info .hname { font-family: var(--f-jp); font-size: 25px; }
.status-info .meta { color: var(--ash); font-size: 13px; margin-bottom: 14px; }

.vrule { width: 1px; align-self: stretch; background: linear-gradient(180deg, transparent, var(--line) 18%, var(--line) 82%, transparent); }

/* ------------------------------------------------------------ xp bar */
.xpbar { position: relative; height: 9px; background: #08080a; border: 1px solid var(--line); overflow: hidden; }
.xpbar > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #7d0a1d, var(--crimson) 55%, var(--ember));
  box-shadow: 0 0 14px rgba(255,59,82,.55);
  transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.xpbar.thin { height: 5px; }
.xpbar.ticks::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 13px, rgba(0,0,0,.65) 13px 15px);
}
.xp-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ash); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- stat list */
.stats-list { display: flex; flex-direction: column; gap: 11px; }
.stat-row { display: grid; grid-template-columns: 26px 1fr 34px; align-items: center; gap: 12px; }
.stat-row .jp { font-family: var(--f-jp); color: var(--crimson); font-size: 15px; }
.stat-row .nm { font-size: 12.5px; color: var(--ash); }
.stat-row .vl { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }

/* ------------------------------------------------------------- cards */
.kpi { display: flex; flex-direction: column; gap: 3px; }
.kpi .v { font-family: var(--f-jp); font-size: 34px; line-height: 1.1; }
.kpi .k { font-size: 11.5px; letter-spacing: .16em; color: var(--ash-dim); }
.kpi .d { font-size: 12px; color: var(--ash); }
.kpi.red .v { color: var(--ember); }

.class-card { display: block; position: relative; }
.class-card:hover { border-color: #3a3a44; }
.class-card .top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.class-card .jp { font-family: var(--f-jp); font-size: 19px; color: var(--crimson); }
.class-card .nm { font-size: 15px; }
.class-card .lv { margin-left: auto; font-size: 12px; color: var(--ash); font-variant-numeric: tabular-nums; }
.class-card .desc { font-size: 12.5px; color: var(--ash-dim); min-height: 34px; margin-bottom: 12px; }
.class-card .foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ash-dim); margin-top: 7px; }

/* ------------------------------------------------------------ chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel-2);
  padding: 2px 9px; font-size: 11px; color: var(--ash); border-radius: var(--r);
}
.chip.rank-E { border-color:#3c3c44; color:#9aa0a8 }
.chip.rank-D { border-color:#4a4a54; color:#b6bcc4 }
.chip.rank-C { border-color:#6b5560; color:#d0b8bd }
.chip.rank-B { border-color:#8a3346; color:#e8a8b2 }
.chip.rank-A { border-color:var(--crimson); color:var(--ember) }
.chip.rank-S,.chip.rank-N,.chip.rank-M { border-color:var(--gold); color:var(--gold); box-shadow:0 0 12px rgba(201,162,39,.25) }
.chip.ok { border-color:#2f6b45; color:#7fd6a2 }
.chip.warn { border-color:#7a5a1e; color:var(--gold) }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--bone);
  padding: 8px 15px; cursor: pointer; border-radius: var(--r);
  transition: border-color .13s, background .13s, color .13s;
}
.btn:hover { border-color: var(--crimson); background: rgba(200,16,46,.1); }
.btn.primary { border-color: var(--crimson); background: rgba(200,16,46,.16); color: #ffd9de; }
.btn.primary:hover { background: rgba(200,16,46,.3); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger:hover { border-color: #e01e37; color: #ff8d9c; background: rgba(224,30,55,.12); }
.btn[disabled] { opacity: .42; cursor: not-allowed; }

/* ----------------------------------------------------------- actions */
.act-list { display: flex; flex-direction: column; gap: 8px; }
.act {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line-soft); background: #0e0e12;
  padding: 10px 13px; border-radius: var(--r);
  transition: border-color .13s, transform .13s;
}
.act:hover { border-color: #33333c; }
.act.done { opacity: .5; }
.act.done .aname { text-decoration: line-through; text-decoration-color: var(--crimson); }
.act .aname { font-size: 14px; }
.act .ahint { font-size: 11.5px; color: var(--ash-dim); }
.act .axp { margin-left: auto; color: var(--ember); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act .tick {
  width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer; background: #0a0a0d;
  color: var(--ash-dim); font-size: 13px; transition: all .13s;
}
.act .tick:hover { border-color: var(--crimson); color: var(--ember); }
.act.done .tick { border-color: var(--crimson); color: var(--ember); background: rgba(200,16,46,.14); }

/* ------------------------------------------------------------ tables */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--ash-dim); font-size: 11px;
  letter-spacing: .14em; padding: 0 12px 9px; border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(255,255,255,.018); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- forms */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 11.5px; letter-spacing: .1em; color: var(--ash-dim); margin-bottom: 5px; }
.input, input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; background: #0a0a0d; border: 1px solid var(--line); color: var(--bone);
  padding: 9px 11px; border-radius: var(--r);
}
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--crimson); outline: none; }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.row-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row-inline > * { flex: 1; min-width: 130px; }
.row-inline > .fit { flex: 0 0 auto; min-width: 0; }

/* ------------------------------------------------------------ quests */
.quest { display: flex; gap: 14px; align-items: flex-start; border-left: 2px solid var(--line); padding: 12px 0 12px 14px; }
.quest + .quest { border-top: 1px solid var(--line-soft); }
.quest.main { border-left-color: var(--crimson); }
.quest.urgent { border-left-color: var(--gold); }
.quest.completed { opacity: .48; }
.quest .qt { font-size: 14.5px; }
.quest .qd { font-size: 12.5px; color: var(--ash-dim); }
.quest .qmeta { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.quest .side { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }

/* ----------------------------------------------------------- rewards */
.reward { display: flex; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.reward:last-child { border-bottom: none; }
.reward .seal {
  width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center;
  border: 1px solid var(--line); font-family: var(--f-jp); font-size: 19px; color: var(--ash-dim);
}
.reward.ready .seal { border-color: var(--crimson); color: var(--ember); background: rgba(200,16,46,.12); box-shadow: 0 0 18px rgba(200,16,46,.25); }
.reward.claimed { opacity: .45; }
.reward .rmid { flex: 1; min-width: 0; }
.reward .rt { font-size: 15px; }
.reward .rd { font-size: 12.5px; color: var(--ash-dim); }
.reward .req { font-size: 11.5px; color: var(--ash); margin-top: 6px; }

/* ---------------------------------------------------------- heatmap */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.heat i { width: 12px; height: 12px; background: #131317; border: 1px solid #0d0d10; display: block; }
.heat i[data-l="1"] { background: #4a0f1c; }
.heat i[data-l="2"] { background: #7e1526; }
.heat i[data-l="3"] { background: #b31432; }
.heat i[data-l="4"] { background: var(--ember); box-shadow: 0 0 7px rgba(255,59,82,.5); }

/* ------------------------------------------------------ system toast */
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.toast {
  border: 1px solid var(--crimson); background: rgba(14,14,17,.97);
  padding: 13px 16px; border-radius: var(--r);
  box-shadow: 0 0 30px rgba(200,16,46,.28);
  animation: toastIn .28s cubic-bezier(.2,.9,.25,1);
}
.toast .th { font-size: 11px; letter-spacing: .24em; color: var(--ember); margin-bottom: 3px; }
.toast .tb { font-size: 13.5px; color: var(--bone); }
.toast.grey { border-color: var(--line); box-shadow: none; }
.toast.grey .th { color: var(--ash); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------- level up */
#levelup {
  position: fixed; inset: 0; z-index: 300; display: none;
  place-items: center; background: rgba(4,4,6,.86); backdrop-filter: blur(3px);
}
#levelup.on { display: grid; }
#levelup .card {
  border: 1px solid var(--crimson); background: linear-gradient(160deg, #17171c, #0c0c10);
  padding: 46px 60px; text-align: center; box-shadow: 0 0 70px rgba(200,16,46,.35);
  animation: lu .4s cubic-bezier(.2,.9,.25,1);
}
#levelup .jp { font-family: var(--f-jp); font-size: 42px; color: var(--ember); margin-bottom: 6px; }
#levelup .t { font-size: 13px; letter-spacing: .35em; color: var(--ash); }
#levelup .n { font-family: var(--f-jp); font-size: 76px; line-height: 1.1; }
@keyframes lu { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- misc */
.empty { color: var(--ash-dim); font-size: 13.5px; padding: 20px 0; text-align: center; }
.muted { color: var(--ash-dim); }
.sep { height: 1px; background: var(--line-soft); margin: 18px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 9px 15px; color: var(--ash); font-size: 13.5px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--bone); border-bottom-color: var(--crimson); }
.tabs a:hover { color: var(--bone); }
.mono { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .kanji-big { font-family: var(--f-jp); font-size: 58px; color: var(--crimson); text-align: center; line-height: 1; }
.login-card .tag { text-align: center; color: var(--ash-dim); font-size: 11.5px; letter-spacing: .3em; margin: 8px 0 26px; }

/* ------------------------------------------------------- mobile nav */
.mobile-bar { display: none; }

@media (max-width: 1080px) {
  .g-status, .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.7);
  }
  .rail.open { transform: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 50;
    background: rgba(8,8,10,.94); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); padding: 12px 16px;
  }
  .mobile-bar .kanji { font-family: var(--f-jp); color: var(--crimson); font-size: 20px; }
  .main { padding: 20px 16px 80px; }
  .g-2, .g-3, .g-4, .g-status { grid-template-columns: 1fr; }
  .status-body { flex-direction: column; gap: 18px; align-items: stretch; text-align: center; }
  .vrule { display: none; }
  .level-block .num { font-size: 66px; }
  #toasts { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
