:root {
  color-scheme: dark;
  --ink: #0b0607;
  --panel: rgba(20, 11, 11, 0.94);
  --raised: #1f1212;
  --line: #3d2222;
  --red: #e3141e;
  --red-hot: #ff3b3b;
  --red-soft: rgba(227, 20, 30, 0.55);
  --acid: #d6ef3a;
  --paper: #f4ede6;
  --muted: #b5a19e;
  --grid: rgba(255, 255, 255, 0.07);
  --common: #9d918c;
  --uncommon: #58a8e8;
  --rare: #e9b949;
  --basic: #6f625e;
  --ancient: #b777f0;
  --special: #d8723e;
  --upgrade: #7fd46a;
  --display: Impact, "Arial Black", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --cut: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--paper);
  background: #000 url("./assets/background.jpg") right top / min(1600px, 150vw) fixed no-repeat;
  font: 15px/1.65 "Hiragino Kaku Gothic Pro", Meiryo, "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: wait; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
a { color: var(--paper); text-decoration-color: var(--red); text-underline-offset: 4px; }
a:hover { color: var(--red-hot); }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
select, input[type="search"] {
  background: var(--ink);
  border: 1px solid var(--line);
  padding: 7px 10px;
  min-height: 38px;
}
select:hover, input[type="search"]:hover { border-color: var(--red); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 28px;
  background: rgba(6, 3, 3, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--red);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 118px; height: auto; display: block; }
.brand span { font-weight: 900; font-size: 18px; letter-spacing: 0.2em; white-space: nowrap; }
.site-nav { display: flex; gap: 4px; margin-right: auto; overflow-x: auto; }
.nav-item {
  position: relative;
  border: 0;
  background: transparent;
  padding: 9px 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  white-space: nowrap;
  clip-path: var(--cut);
}
.nav-item:hover { background: var(--raised); }
.nav-item.active { background: var(--red); }
.nav-item.active::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 8px;
  vertical-align: -1px;
  background: url("./assets/shuriken.png") center / contain no-repeat;
}
.nav-count { margin-left: 6px; font-size: 11px; font-weight: 400; opacity: 0.75; }
.language { min-height: 34px; font-size: 13px; }

/* Hero */
main { max-width: 1320px; margin: 0 auto; padding: 0 28px; }
.hero {
  overflow: clip;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  min-height: 380px;
  padding: 44px 0 36px;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  right: 4%;
  top: 30px;
  width: 30%;
  height: calc(100% - 70px);
  background: linear-gradient(160deg, var(--red), #7c0a10);
  transform: skewX(-16deg);
}
.hero::after {
  content: "忍殺";
  position: absolute;
  z-index: -3;
  right: -2%;
  bottom: -40px;
  font: 900 min(260px, 22vw) / 1 var(--display);
  color: rgba(255, 255, 255, 0.035);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; }
.kicker { color: var(--acid); font: 700 12px/1 var(--display); letter-spacing: 0.35em; margin-bottom: 18px; }
#page-title {
  font: 900 clamp(34px, 5.2vw, 66px) / 1.12 var(--display);
  letter-spacing: 0.02em;
  text-shadow: 4px 4px 0 var(--red);
}
#page-subtitle { max-width: 38em; margin-top: 16px; font-size: 17px; color: var(--muted); }
.hero-ninja {
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: -36px;
  height: 430px;
  width: auto;
  pointer-events: none;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.7));
}
.metrics { display: flex; flex-wrap: wrap; gap: 14px 38px; margin-top: 30px; }
.metrics article { border-left: 4px solid var(--red); padding-left: 14px; }
.metrics strong { display: block; font: 900 38px/1.1 var(--display); letter-spacing: 0.02em; }
.metrics span { color: var(--muted); font-size: 13px; letter-spacing: 0.1em; }

/* Filters and toolbars */
.filter-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  padding: 16px 18px;
  margin-bottom: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
}
.filter-bar label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.filter-bar select { min-width: 120px; color: var(--paper); }
.version-filter { display: grid; gap: 4px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.version-filter details { position: relative; }
.version-filter summary { cursor: pointer; min-width: 150px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); background: var(--ink); color: var(--paper); }
.version-filter summary:hover { border-color: var(--red); }
.version-menu { position: absolute; z-index: 5; top: 100%; left: 0; width: min(280px, 75vw); padding: 12px; background: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 24px #0009; }
#version-options { max-height: 280px; overflow-y: auto; }
#version-options label { display: flex; align-items: center; gap: 8px; padding: 7px 4px; cursor: pointer; color: var(--paper); }
#version-options input { accent-color: var(--red); width: 17px; height: 17px; margin: 0; }
.last-sync { margin-left: auto; align-self: center; font-size: 12px; color: var(--muted); }
.text-button { border: 0; background: none; color: var(--muted); padding: 8px 4px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--paper); }
.button { border: 1px solid var(--line); background: var(--raised); padding: 8px 16px; font-weight: 700; text-decoration: none; display: inline-block; }
.button:hover { border-color: var(--red); }
.button.primary { background: var(--red); border-color: var(--red); }
.button.wide { width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 0;
  background: var(--raised);
  padding: 7px 18px;
  font-weight: 700;
  font-size: 14px;
  clip-path: var(--cut);
}
.chip:hover { background: #33191a; }
.chip.active { background: var(--red); }
.search { flex: 1 1 200px; max-width: 320px; }
.search input { width: 100%; }
.view-toggle { display: flex; border: 1px solid var(--line); }
.view-toggle button { border: 0; background: none; padding: 7px 14px; color: var(--muted); }
.view-toggle button.active { background: var(--paper); color: var(--ink); font-weight: 700; }
.toolbar-note { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.toolbar-note span + span { margin-left: 6px; }
.notice { margin-bottom: 18px; padding: 12px 16px; border-left: 4px solid var(--acid); background: rgba(214, 239, 58, 0.08); }
.page-tip { margin-bottom: 18px; color: var(--muted); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); display: grid; gap: 6px; }
.empty strong { color: var(--paper); font-size: 18px; }

/* Card grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.card-grid > .empty { grid-column: 1 / -1; }
.card-tile {
  --rarity: var(--special);
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--rarity);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card-tile:hover, .card-tile:focus-within { transform: translateY(-4px); border-color: var(--red); border-top-color: var(--rarity); box-shadow: 0 12px 30px rgba(227, 20, 30, 0.22); }
.card-tile.common { --rarity: var(--common); }
.card-tile.uncommon { --rarity: var(--uncommon); }
.card-tile.rare { --rarity: var(--rare); }
.card-tile.basic { --rarity: var(--basic); }
.card-tile.ancient { --rarity: var(--ancient); }
.tile-open { display: grid; width: 100%; padding: 0 0 12px; border: 0; background: none; text-align: left; }
.tile-art { position: relative; display: block; aspect-ratio: 5 / 6; overflow: hidden; background: #000; }
.tile-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 28%; display: block; }
.tile-cost {
  position: absolute;
  left: 8px;
  top: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--ink);
  font: 900 16px/1 var(--display);
}
.tile-cost:empty { display: none; }
.tile-description {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
  background: linear-gradient(to top, rgba(8, 3, 3, 0.97) 55%, rgba(8, 3, 3, 0.55));
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card-tile:hover .tile-description, .card-tile:focus-within .tile-description { opacity: 1; }
.tile-name { padding: 10px 12px 0; font-weight: 800; font-size: 15px; line-height: 1.35; }
.tile-meta { padding: 0 12px; font-size: 12px; color: var(--muted); }
.tile-bar { height: 4px; margin: 10px 12px 0; background: #2d1b1b; }
.tile-bar::after { content: ""; display: block; height: 100%; width: var(--fill); background: var(--red); }
.tile-stats { display: flex; gap: 16px; padding: 8px 12px 0; }
.stat b { display: block; font: 900 17px/1.2 var(--display); }
.stat small { font-size: 11px; color: var(--muted); }
.thin .tile-stats, .thin .tile-bar { opacity: 0.4; }
.tile-upgrade {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.7);
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
}
.tile-upgrade:hover { border-color: var(--upgrade); }
.tile-upgrade[aria-pressed="true"] { background: var(--upgrade); color: var(--ink); border-color: var(--upgrade); }

/* Tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; background: rgba(0, 0, 0, 0.4); }
th button { border: 0; background: none; padding: 0; color: inherit; font-weight: inherit; }
th button.sorted { color: var(--paper); }
.number { text-align: right; font-variant-numeric: tabular-nums; }
tr.thin td.number { color: var(--muted); }
tbody tr:hover { background: rgba(227, 20, 30, 0.08); }
.card-link { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; font-weight: 700; }
.card-link:hover span { color: var(--red-hot); }
.card-thumbnail { width: 34px; height: 46px; object-fit: cover; border: 1px solid var(--line); }
.badge { display: inline-block; padding: 1px 9px; font-size: 12px; background: var(--raised); border-left: 3px solid var(--special); }
.badge.common { border-color: var(--common); }
.badge.uncommon { border-color: var(--uncommon); }
.badge.rare { border-color: var(--rare); }
.badge.basic { border-color: var(--basic); }
.badge.ancient { border-color: var(--ancient); }

/* Panels */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 22px 24px; }
.panel h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 900; letter-spacing: 0.06em; }
.panel h2::before { content: ""; width: 22px; height: 27px; background: url("./assets/heading.png") center / contain no-repeat; }
.panel-note { color: var(--muted); font-size: 13px; margin-top: 6px; }
.insight-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; margin-top: 36px; }
.legend { font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin: 0 5px 0 12px; }
.legend i:first-child { margin-left: 0; }
.legend .runs, .trend .runs { background: #5d4545; fill: #5d4545; }
.legend .wins, .trend .wins { background: var(--red); fill: var(--red); }
.trend svg { width: 100%; height: auto; display: block; }
.trend text { fill: var(--muted); font-size: 10px; }
.reading-note dl { display: grid; gap: 4px; margin-top: 14px; }
.reading-note dt { color: var(--red-hot); font-weight: 800; }
.reading-note dd { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* Charts */
.chart-tabs { margin-bottom: 18px; }
.chart-frame { position: relative; height: 430px; margin-top: 18px; }
.chart-frame .empty { position: absolute; inset: 0; place-content: center; }
.chart-panel + .panel { margin-top: 18px; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
summary:hover { color: var(--paper); }

/* Reports */
.report-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.report-list > .empty { grid-column: 1 / -1; }
.report-row {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
}
.report-row.won { border-left-color: var(--acid); }
.report-row:hover { border-color: var(--red); }
.report-row strong { font: 900 20px/1.2 var(--display); letter-spacing: 0.04em; }
.report-row.won strong { color: var(--acid); }
.report-row small { color: var(--muted); font-size: 12px; }
.report-detail { margin-top: 22px; display: grid; gap: 14px; }
.report-detail h2 { font-size: 22px; }
.replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.replay-controls input[type="range"] { flex: 1 1 220px; accent-color: var(--red); }
.current-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; background: var(--raised); border-left: 4px solid var(--red); }
.replay-state { display: grid; gap: 4px; }
.replay-state h3 { font-size: 15px; }
.replay-state details .button, .replay-route .button { margin: 4px 6px 0 0; font-size: 13px; padding: 4px 10px; }
.replay-route details { margin: 6px 0 0 14px; }
.replay-route > details { margin-left: 0; padding: 8px 12px; background: rgba(0, 0, 0, 0.3); border-left: 2px solid var(--line); }
.replay-route p { font-size: 13px; color: var(--muted); margin-left: 14px; }
.action-row { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 3px 0 3px 14px; font-size: 13px; color: var(--muted); }
.action-row:hover { color: var(--paper); }

/* Letters */
.letters { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.letters > .empty { grid-column: 1 / -1; }
.letter {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 18px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  position: relative;
}
.letter::after { content: ""; position: absolute; right: -1px; top: -1px; border-style: solid; border-width: 0 18px 18px 0; border-color: transparent var(--ink) var(--line) transparent; }
.letter:hover { border-color: var(--red); }
.letter strong { font-weight: 400; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.letter small { color: var(--muted); font-size: 12px; }
.tag { justify-self: start; padding: 1px 10px; font-size: 12px; font-weight: 700; background: var(--raised); color: var(--muted); }
.tag.bug { background: var(--red); color: var(--paper); }
.tag.balance { background: var(--rare); color: var(--ink); }

/* Footer */
.site-footer { margin-top: 90px; padding: 38px 28px 46px; text-align: center; border-top: 2px solid var(--red); background: rgba(0, 0, 0, 0.75); }
.motto { font: 900 30px/1.2 var(--display); letter-spacing: 0.3em; color: var(--red); }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 26px; margin: 16px 0 12px; }
.fine-print { font-size: 12px; color: var(--muted); }

/* Dialogs */
dialog {
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px 26px;
  color: var(--paper);
  background: #140b0b;
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 24px; font-weight: 900; letter-spacing: 0.04em; }
.close { width: 36px; height: 36px; border: 1px solid var(--line); background: none; font-size: 20px; }
.close:hover { border-color: var(--red); }
.preview-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; }
.game-card {
  position: relative;
  align-self: start;
  overflow: hidden;
  border: 2px solid #6d3a36;
  border-radius: 14px;
  background: linear-gradient(180deg, #2b1414, #120909);
}
.game-card img { display: block; width: 100%; aspect-ratio: 5 / 6; object-fit: cover; object-position: center 28%; }
.game-card h3 { padding: 10px 14px 0; font-size: 18px; font-weight: 900; }
.card-description { padding: 6px 14px 16px; font-size: 14px; white-space: pre-line; }
.energy-cost {
  position: absolute;
  left: 10px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--ink);
  font: 900 19px/1 var(--display);
}
.card-tips { display: flex; flex-wrap: wrap; align-content: start; gap: 8px; }
.card-tips section { flex: 1 1 100%; padding: 10px 14px; background: var(--raised); border-left: 3px solid var(--line); }
.card-tips h4 { font-size: 14px; color: var(--rare); }
.card-tips p { font-size: 13px; color: var(--muted); white-space: pre-line; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.feedback-description { white-space: pre-wrap; font-size: 16px; }
.detail-actions { display: flex; gap: 10px; margin: 18px 0; }
#feedback-screenshot { max-width: 100%; display: block; }
#connection-form { display: grid; gap: 12px; }
#connection-form label { display: grid; gap: 4px; }
#connection-form input { background: var(--ink); border: 1px solid var(--line); padding: 8px 10px; }
#connection-error { color: var(--red-hot); }
.key-note { color: var(--muted); }
.import-block { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.import-label input { display: none; }
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 12px 18px; background: var(--raised); border-left: 4px solid var(--red); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.spinning { display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pages */
body[data-page="feedback"] .hero { min-height: 260px; }

@media (max-width: 960px) {
  .site-header { flex-wrap: wrap; gap: 8px 16px; padding: 8px 16px; }
  .site-nav { order: 3; width: 100%; margin-right: 0; }
  .language { margin-left: auto; }
  main { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 32px 0 28px; }
  .hero::before { width: 42%; right: -6%; opacity: 0.55; }
  .hero-ninja { height: 300px; right: -30px; bottom: -20px; opacity: 0.45; }
  .insight-row, .preview-layout { grid-template-columns: 1fr; }
  .game-card { max-width: 260px; }
  .last-sync { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .brand img { width: 92px; }
  .brand span { font-size: 15px; letter-spacing: 0.1em; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .filter-bar select { min-width: 0; width: 100%; }
  .filter-bar label { flex: 1 1 40%; }
  .metrics strong { font-size: 30px; }
  .chart-frame { height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.feedback-author {border-top:1px solid var(--border,#555);margin-top:1.5rem;padding-top:1rem}.review-resolved {color:#d9e8a5}.review-unresolved {color:#ffd77d}
