@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@400;500;600&family=Newsreader:opsz,wght@6..72,500;6..72,600&display=swap");

:root {
  --bg0: #0e0d0c;
  --bg1: #161411;
  --panel: #1c1a17;
  --panel-edge: #2a2621;
  --text: #ece7de;
  --muted: #9a9286;
  --line: #322e28;
  --accent: #c9a66b;
  --accent-dim: #8a7349;
  --accent-soft: rgba(201, 166, 107, 0.14);
  --warn: #d4a27f;
  --ok: #7d9b84;
  --shadow: rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --font-ui: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --font-display: "Newsreader", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  color-scheme: dark;
}

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(ellipse 90% 55% at 15% -10%, rgba(201, 166, 107, 0.08), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(90, 70, 50, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

header,
main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1rem 1.15rem 1.4rem;
}

header h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

header h1 small,
#uiBuild {
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 0.7em;
  color: var(--muted);
}

header p,
#hostBadge {
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  vertical-align: -0.2rem;
  margin-right: 0.25rem;
}

.brand-tagline {
  margin: 0.35rem 0 0.15rem !important;
  font-family: var(--font-display);
  font-size: 1.05rem !important;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text) !important;
}

.brand-description {
  margin: 0.1rem 0 0.35rem !important;
  font-size: 0.88rem !important;
  color: var(--gold-soft, #c9a66b) !important;
}

.lang-switch {
  display: inline-flex;
  gap: 0.25rem;
}

.lang-switch button {
  border: 1px solid var(--panel-edge);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-switch button.is-active {
  color: var(--text);
  border-color: var(--accent-dim);
  background: var(--accent-soft);
}

button.compact {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}

body.is-public .dev-only,
body.is-public .public-hide {
  display: none !important;
}

/* PUBLIC: compact card-pick chart surface */
body.is-site-public header,
body.is-site-public main {
  padding: 0.75rem 1rem 1rem;
}

body.is-site-public header h1 {
  margin-bottom: 0.15rem;
  font-size: 1.45rem;
}

body.is-site-public .brand-tagline {
  margin: 0.15rem 0 0.1rem !important;
  font-size: 0.95rem !important;
}

body.is-site-public .flow-steps {
  margin: 0.45rem 0 0.2rem;
  font-size: 0.82rem;
}

body.is-site-public .panel {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 6px 18px var(--shadow);
}

body.is-site-public .panel h2 {
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

body.is-site-public .graph-controls-title {
  margin-top: 0.35rem;
}

body.is-site-public .site-footer {
  padding: 0.25rem 1rem 1.35rem;
  font-size: 0.72rem;
}

body.is-site-public .empty-state {
  margin: 0 1rem 1rem;
}

body.is-site-public .fallback-folder {
  margin-top: 0.35rem;
}

.empty-state {
  margin: 0 1.15rem 1.25rem;
}

.empty-cta {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  color: var(--text);
}

.empty-preview {
  display: block;
  width: min(100%, 720px);
  height: auto;
  margin-top: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  list-style: none;
  margin: 0.65rem 0 0.35rem;
  padding: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.flow-steps li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.flow-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.mobile-only-note[hidden] {
  display: none !important;
}

.site-footer {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.4rem 1.15rem 2rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.site-footer p {
  margin: 0.2rem 0;
}

.site-footer a {
  color: var(--accent-dim);
}

.panel {
  background: linear-gradient(180deg, #1f1c18 0%, var(--panel) 100%);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 28px var(--shadow);
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.3rem;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

.view-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.view-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.view-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(201, 166, 107, 0.35);
  box-shadow: inset 0 0 0 1px rgba(201, 166, 107, 0.12);
}

.view-tabpanel > h2 {
  margin-top: 0.15rem;
}

.panel h3 {
  margin: 1.1rem 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 550;
  color: var(--text);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

select,
input[type="number"],
input[type="range"],
button,
input[type="file"]::file-selector-button {
  font: inherit;
}

select,
input[type="number"] {
  min-width: 10rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #12100e;
  color: var(--text);
  color-scheme: dark;
}

#character {
  min-width: 12rem;
}

select option {
  background: #1c1a17;
  color: var(--text);
}

select:focus,
input[type="number"]:focus,
input[type="range"]:focus {
  outline: 1px solid var(--accent-dim);
  border-color: var(--accent-dim);
}

input[type="range"] {
  min-width: 12rem;
  width: min(18rem, 40vw);
  accent-color: var(--accent);
}

input[type="file"] {
  color: var(--muted);
}

button {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--accent-dim);
  background: linear-gradient(180deg, #3a3226, #2a241c);
  color: var(--accent);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

button:hover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #463b2c, #322b21);
}

button.secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

button.secondary:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#loadStatus {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 500;
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
  color: var(--accent);
}

th[data-sort]:hover {
  text-decoration: underline;
}

tbody tr:hover td {
  background: var(--accent-soft);
}

.table-scroll {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: min(70vh, 42rem);
}

.table-scroll table {
  margin: 0;
  min-width: 64rem;
  border-collapse: separate;
  border-spacing: 0;
}

.table-scroll th,
.table-scroll td {
  white-space: nowrap;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel, #1a1714);
  box-shadow: 0 1px 0 var(--line);
}

#rankingTable tbody tr[data-card-id] {
  cursor: pointer;
}

#rankingTable tbody tr[data-card-id]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.84em;
  color: #d2c4a8;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.05em 0.3em;
  border-radius: 4px;
}

.note {
  color: var(--warn);
  font-size: 0.88rem;
}

.note-details {
  margin: 0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.note-details summary {
  cursor: pointer;
  color: var(--accent);
  user-select: none;
}

.note-details summary:hover {
  text-decoration: underline;
}

.note-details .note {
  margin-top: 0.45rem;
}

.run-selection-meta {
  margin: 0.65rem 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

.run-selection-meta strong {
  color: var(--accent);
  font-weight: 600;
}

.run-selection-meta .run-meta-note {
  color: var(--muted);
  font-size: 0.86rem;
}

#dataStatus {
  color: var(--muted);
}

#dataStatus strong {
  color: var(--text);
}

#dataStatus ul {
  margin: 0.3rem 0 0.7rem;
  padding-left: 1.2rem;
}

.hidden {
  display: none;
}

.graph-controls {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.graph-controls-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 550;
  color: var(--text);
}

#dataStatusDetails summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}

#dataStatusDetails summary::-webkit-details-marker {
  display: none;
}

#dataStatusDetails summary::before {
  content: "▸ ";
  color: var(--accent);
}

#dataStatusDetails[open] summary::before {
  content: "▾ ";
}

#dataStatusDetails #dataStatus {
  margin-top: 0.65rem;
}

.graph-panel {
  margin: 0.4rem 0 0.2rem;
  overflow: hidden;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  background: #0c0b0a;
  width: 100%;
  box-shadow: inset 0 0 0 1px rgba(201, 166, 107, 0.08), 0 12px 32px var(--shadow);
}

.graph-panel canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.graph-panel.is-portrait {
  display: flex;
  justify-content: center;
  background: #090807;
}

.graph-panel.is-portrait canvas {
  width: auto;
  max-width: 100%;
}

.inline-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
  min-height: 2.1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.inline-check input {
  accent-color: var(--accent);
}

.fallback-folder {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.fallback-folder summary {
  cursor: pointer;
  color: var(--muted);
}

.fallback-folder summary:hover {
  color: var(--text);
}

#folderStatus {
  margin: 0.45rem 0 0;
}

.range-with-value {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 11.5rem;
}

.range-with-value .range-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.range-with-value input[type="range"] {
  width: 7.5rem;
  accent-color: var(--accent);
}

.range-with-value output {
  min-width: 2.6rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 0.88rem;
}

.graph-save-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.graph-save-modal[hidden] {
  display: none;
}

.graph-save-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 4, 0.78);
  backdrop-filter: blur(3px);
}

.graph-save-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(960px, 100%);
  max-height: min(92vh, 980px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background:
    linear-gradient(165deg, rgba(201, 166, 107, 0.07), transparent 42%),
    var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 1.15rem 1.25rem 1.25rem;
}

.graph-save-title {
  margin: 0 2rem 0 0;
  font-family: Newsreader, "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--title, var(--text));
}

.graph-save-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.graph-save-size-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  align-items: center;
}

.graph-save-size-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
}

.graph-save-size-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.graph-save-preview-wrap {
  flex: 0 0 auto;
  width: 100%;
  min-height: min(42vh, 360px);
  overflow: visible;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background:
    repeating-conic-gradient(
        rgba(255, 255, 255, 0.04) 0% 25%,
        transparent 0% 50%
      )
      0 0 / 18px 18px,
    rgba(0, 0, 0, 0.35);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-save-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(56vh, 620px);
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.2);
}

.graph-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.graph-save-custom-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  width: 100%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.card-detail-brand-footer {
  margin: 0.65rem 0 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.72rem;
  opacity: 0.85;
}

.card-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.card-detail-modal[hidden] {
  display: none;
}

.card-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 4, 0.72);
  backdrop-filter: blur(3px);
}

.card-detail-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(90vh, 880px);
  overflow: auto;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background:
    linear-gradient(165deg, rgba(201, 166, 107, 0.07), transparent 42%),
    var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 1.25rem 1.35rem 1.4rem;
}

.card-detail-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 2rem 0.85rem 0;
}

.card-detail-save-actions button {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}

.card-detail-capture-root {
  /* Capture target: keeps dialog chrome (close / save buttons) out of PNG. */
  border-radius: 10px;
}

/* On-screen capture stage (off-screen nodes often render as solid black). */
.card-detail-export-stage {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 5, 4, 0.72);
  pointer-events: none;
}

/* Standalone share card for「絵＋効果」. */
.card-detail-export-card {
  position: relative;
  width: 300px;
  max-width: min(300px, 100%);
  margin: 0;
  padding: 1.2rem 1.25rem 1.3rem;
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  background:
    linear-gradient(165deg, rgba(201, 166, 107, 0.08), transparent 42%),
    var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-family: var(--font-ui);
}

.card-detail-export-card .card-detail-visual {
  width: 100%;
  gap: 0.85rem;
}

.card-detail-export-card .card-detail-art-frame {
  width: min(100%, 220px);
  margin: 0 auto;
  justify-self: center;
}

.card-detail-export-card .card-detail-effects {
  width: 100%;
}

.card-detail-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.card-detail-close::before {
  /* Optical center: × glyphs often sit heavy to the right in the em box. */
  content: "×";
  display: block;
  transform: translate(-0.04em, -0.02em);
}

.card-detail-close:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

.card-detail-body {
  display: grid;
  grid-template-columns: minmax(160px, 260px) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.card-detail-visual {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.card-detail-art-frame {
  /* Match graph frame width "標準" (~size * 0.028, alpha ~0.55). */
  --rarity-frame: #a2a2a1;
  padding: 6px;
  background: color-mix(in srgb, var(--rarity-frame) 55%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.card-detail-art-frame.has-game-shape {
  border-radius: 0;
}

/* Fallback when game silhouettes are not loaded yet. */
.card-detail-art-frame.is-skill {
  border-radius: 12px;
}

.card-detail-art-frame.is-power {
  border-radius: 50%;
}

.card-detail-art-frame.is-attack {
  /* Match game card-type filter icon (flat top → wide V tip). */
  clip-path: polygon(
    4% 0%,
    96% 0%,
    100% 6%,
    100% 58%,
    50% 100%,
    0% 58%,
    0% 6%
  );
  border-radius: 0;
}

.card-detail-art-wrap {
  aspect-ratio: 551 / 420;
  overflow: hidden;
  background: #0a0908;
}

.card-detail-art-frame.is-skill .card-detail-art-wrap {
  border-radius: 9px;
}

.card-detail-art-frame.is-power .card-detail-art-wrap {
  border-radius: 50%;
}

.card-detail-art-frame.is-attack .card-detail-art-wrap {
  clip-path: polygon(
    4% 0%,
    96% 0%,
    100% 6%,
    100% 58%,
    50% 100%,
    0% 58%,
    0% 6%
  );
}

.card-detail-art-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-detail-art-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 140px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-detail-meta h2 {
  margin: 0 0 0.35rem;
  padding-right: 2rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.25;
}

.card-detail-id {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.card-detail-rarity {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.92rem;
}

.card-detail-effects {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.card-detail-effect {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.card-detail-effect-label {
  display: block;
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-detail-effect-body {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.card-detail-diff {
  border-radius: 3px;
  padding: 0 0.12em;
  font-weight: 600;
}

.card-detail-diff.is-old {
  color: #e8a0a0;
  background: rgba(180, 72, 72, 0.22);
  text-decoration: underline;
  text-decoration-color: rgba(232, 160, 160, 0.55);
  text-underline-offset: 0.12em;
}

.card-detail-diff.is-new {
  color: #f0d48a;
  background: rgba(201, 166, 107, 0.28);
}

.card-detail-cost-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .card-detail-body {
    grid-template-columns: 1fr;
  }

  .card-detail-visual {
    max-width: 280px;
    justify-self: center;
    width: 100%;
  }

  .graph-save-modal {
    padding: 0.55rem;
    align-items: stretch;
  }

  .graph-save-dialog {
    width: 100%;
    max-height: 96vh;
    padding: 0.9rem 0.85rem 1rem;
  }

  .graph-save-preview-wrap {
    min-height: min(36vh, 280px);
  }

  .graph-save-preview {
    max-height: min(48vh, 420px);
  }

  .graph-save-actions {
    justify-content: stretch;
  }

  .graph-save-actions button {
    flex: 1 1 auto;
    min-height: 2.6rem;
  }

  .mobile-only-note {
    display: block;
  }
}

.card-detail-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.card-detail-stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.card-detail-stats dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
}

@media (max-width: 560px) {
  .card-detail-body {
    grid-template-columns: 1fr;
  }

  .card-detail-art-frame {
    max-width: 280px;
    margin: 0 auto;
  }
}
