:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --ink: #1f2528;
  --muted: #687176;
  --panel: #ffffff;
  --line: #d8ddd9;
  --accent: #2f6f68;
  --accent-2: #b74f37;
  --soft: #e8efed;
  --shadow: 0 18px 50px rgba(38, 45, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(520px, 1.08fr) minmax(420px, 0.92fr);
  gap: 24px;
  width: min(1440px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
}

.search-panel,
.deck-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel-head,
.score-board,
.button-row,
.add-row,
.score-meta,
.tabs {
  display: flex;
  align-items: center;
}

.panel-head,
.score-board {
  justify-content: space-between;
  gap: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 0;
  font-size: 46px;
}

h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.icon-button,
.primary-button,
.secondary-button,
.ghost-button,
.tab,
.add-row button,
.deck-card button,
.modal-close {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--soft);
}

.settings-button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.language-select {
  width: auto;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: var(--soft);
  color: var(--ink);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.settings {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.developer-control {
  display: none !important;
}

.developer-controls-available .developer-control {
  display: flex !important;
}

.storage-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.storage-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.developer-only {
  display: none !important;
}

.tag-editor-enabled-only {
  display: none !important;
}

.developer-mode .developer-only {
  display: grid !important;
}

.tag-editor-enabled .tag-editor-enabled-only {
  display: grid !important;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 104, 0.15);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.toggle-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--accent);
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 22px 0 8px;
}

.status-line {
  min-height: 22px;
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}

.status-line[data-type="success"] {
  background: #e6f4ec;
  color: #237248;
}

.status-line[data-type="error"] {
  background: #fae9e7;
  color: #ad332a;
}

.card-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.card-art {
  width: 100%;
  aspect-ratio: 63 / 88;
  min-height: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  background-size: cover;
  background-position: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.no-card-image {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0)),
    linear-gradient(140deg, #dfe9e6, #f2d8c9);
  color: var(--ink);
  text-align: center;
}

.no-card-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(47, 111, 104, 0.35);
  border-radius: 999px;
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.no-card-name {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.card-art:hover,
.card-art:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(38, 45, 48, 0.16);
  transform: translateY(-2px);
  outline: none;
}

.card-info {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  overflow: hidden;
}

.card-info h3 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-type,
.card-text {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.card-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-text {
  display: -webkit-box;
  min-height: 34px;
  margin-bottom: 10px;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.add-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.add-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
  background: #eef1f0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
  white-space: nowrap;
  text-align: center;
  line-height: 1;
}

.add-row button.action-success,
.add-row button.action-success:hover {
  border-color: #2f8f5b;
  background: #2f8f5b;
  color: white;
}

.add-row button.action-error,
.add-row button.action-error:hover {
  border-color: #c23b3b;
  background: #c23b3b;
  color: white;
  font-size: 12px;
  padding-inline: 6px;
}

.score-board {
  position: relative;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.score-block {
  position: relative;
  min-width: 120px;
  outline: none;
}

.score-note {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 5;
  width: min(330px, calc(100vw - 48px));
  border: 1px solid rgba(47, 111, 104, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(38, 45, 48, 0.16);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.score-block:hover .score-note,
.score-block:focus-within .score-note {
  opacity: 1;
  transform: translateY(0);
}

.dimension-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
}

.dimension-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfa;
  font-size: 12px;
}

.dimension-row span {
  display: grid;
  min-width: 0;
  color: var(--muted);
}

.dimension-row em,
.dimension-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.dimension-row em {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.dimension-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.dimension-row strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.score-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.score-meta span {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.deck-tools {
  margin: 18px 0;
}

.deck-tools-toggle {
  width: 100%;
}

.deck-tools-body {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.deck-tools-body[hidden] {
  display: none;
}

.score-import,
.deck-library {
  display: grid;
  gap: 12px;
}

.share-code-grid {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.share-code-grid textarea {
  min-height: 74px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  word-break: break-all;
}

.score-import {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.auto-score-preview {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.ai-score-pack-text {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.auto-score-preview[hidden] {
  display: none;
}

.auto-score-preview-head,
.auto-score-card-head,
.auto-score-dim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auto-score-preview-head strong,
.auto-score-card-head strong {
  color: var(--ink);
  font-size: 13px;
}

.auto-score-preview-head span,
.auto-score-card-head span,
.auto-score-empty {
  color: var(--muted);
  font-size: 12px;
}

.auto-score-preview-list {
  display: grid;
  gap: 8px;
}

.auto-score-card {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.auto-score-dims {
  display: grid;
  gap: 4px;
}

.auto-score-dim {
  border-radius: 6px;
  padding: 5px 7px;
  background: #fbfcfa;
  font-size: 12px;
}

.auto-score-dim span {
  color: var(--muted);
}

.auto-score-dim strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.deck-library textarea {
  min-height: 180px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.deck-stats {
  margin: 18px 0;
}

.deck-stats-toggle {
  width: 100%;
}

.deck-stats-body {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.deck-stats-body[hidden] {
  display: none;
}

.stats-toggle-row {
  margin-bottom: 12px;
}

.deck-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.deck-stats h3 {
  margin-bottom: 0;
}

.stats-summary {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.radar-stats {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.radar-layout {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(210px, 0.8fr);
  gap: 12px;
}

.dimension-radar,
.radar-insight {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.dimension-radar {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 278px;
  overflow: hidden;
}

.radar-insight {
  align-self: stretch;
  padding: 12px;
}

.dimension-radar svg {
  width: 100%;
  max-width: 420px;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: #d9ded8;
  stroke-width: 1;
}

.radar-axis {
  stroke: #d9ded8;
  stroke-width: 1;
}

.radar-shape {
  fill: rgba(47, 111, 104, 0.22);
  stroke: var(--accent);
  stroke-width: 2;
}

.radar-dot {
  fill: var(--accent);
  stroke: white;
  stroke-width: 1.5;
}

.radar-label {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.radar-label-score {
  font-size: 12px;
  font-weight: 800;
}

.radar-hotspot {
  fill: transparent;
  stroke: transparent;
  cursor: help;
  pointer-events: all;
}

.radar-hotspot:focus-visible {
  stroke: var(--accent);
  stroke-width: 2;
  outline: none;
}

.radar-tooltip-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.radar-tooltip-title strong {
  color: var(--ink);
  font-size: 12px;
}

.radar-tooltip-title span,
.radar-tooltip-empty {
  color: var(--muted);
  font-size: 11px;
}

.radar-tooltip-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.radar-tooltip-card {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 63 / 88;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  background-size: cover;
  background-position: center;
  color: var(--muted);
}

.radar-tooltip-card:hover,
.radar-tooltip-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.radar-card-count {
  position: absolute;
  min-width: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.radar-card-count {
  right: 4px;
  bottom: 4px;
  padding: 3px 4px;
}

.radar-card-fallback {
  padding: 3px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.cost-curve {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 170px;
  padding-top: 10px;
}

.cost-row {
  display: grid;
  grid-template-rows: minmax(112px, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
}

.cost-label {
  order: 2;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.cost-track {
  position: relative;
  display: flex;
  align-items: end;
  height: 124px;
  border-radius: 8px;
  background: #ecefe9;
}

.cost-bar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 0;
  min-width: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #f4c981, #9fd4c7);
  transition: height 160ms ease;
}

.cost-row strong {
  position: absolute;
  bottom: calc(var(--bar-height, 0%) + 5px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.tag-stats {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.tag-stats-head,
.tag-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tag-stats-head {
  margin-bottom: 12px;
}

.tag-stats h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.tag-groups {
  display: grid;
  gap: 12px;
}

.tag-group {
  display: grid;
  gap: 8px;
}

.tag-group-title strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
}

.tag-group-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tag-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.tag-card-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 63 / 88;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  background-size: cover;
  background-position: center;
  color: var(--muted);
  box-shadow: 0 6px 12px rgba(38, 45, 48, 0.1);
}

.tag-card-thumb:hover,
.tag-card-thumb:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.tag-card-count {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.tag-card-name {
  padding: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.tag-empty {
  padding: 10px;
}

.button-row,
.tabs {
  gap: 10px;
}

.tabs {
  border-bottom: 1px solid var(--line);
}

.tab {
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  border-color: var(--line);
  border-bottom-color: white;
  color: var(--ink);
  background: white;
}

.deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.deck-card {
  position: relative;
  min-width: 0;
}

.deck-card-open {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 63 / 88;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  background-size: cover;
  background-position: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(38, 45, 48, 0.12);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.deck-card-open .no-card-mark,
.tag-card-thumb .no-card-mark,
.radar-tooltip-card .no-card-mark {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.deck-card-open .no-card-name,
.tag-card-thumb .no-card-name,
.radar-tooltip-card .no-card-name {
  font-size: 9px;
}

.deck-card-open:hover,
.deck-card-open:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(38, 45, 48, 0.18);
  transform: translateY(-2px);
  outline: none;
}

.deck-card-score-excluded .deck-card-open {
  filter: grayscale(0.45) saturate(0.75);
  opacity: 0.72;
}

.deck-card-count,
.deck-card-step {
  position: absolute;
  z-index: 2;
  box-shadow: 0 6px 14px rgba(38, 45, 48, 0.2);
}

.deck-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  top: 8px;
  right: 8px;
  min-width: max-content;
  height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(31, 37, 40, 0.84);
  color: white;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
}

.deck-card .deck-card-step {
  display: flex;
  align-items: center;
  justify-content: center;
  bottom: 44px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0;
  font-weight: 800;
  line-height: 0;
  text-align: center;
}

.deck-card-step::before {
  display: block;
  height: 20px;
  font-size: 22px;
  line-height: 18px;
  transform: translateY(-1px);
}

.deck-card-minus::before {
  content: "-";
}

.deck-card-plus::before {
  content: "+";
}

.deck-card-minus {
  left: 8px;
}

.deck-card-move {
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px !important;
  line-height: 1 !important;
}

.deck-card-move::before {
  content: none;
}

.deck-card-plus {
  right: 8px;
}

.deck-card-step:hover,
.deck-card-step:focus-visible {
  background: var(--accent);
  color: white;
  outline: none;
}

.deck-card-meta {
  display: grid;
  gap: 2px;
  padding-top: 8px;
}

.deck-card-meta strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-card-meta span {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-card-score-excluded .deck-card-meta span {
  color: #9b4c4c;
  font-weight: 700;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.consent-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(760px, calc(100vw - 32px));
  border: 1px solid rgba(47, 111, 104, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(38, 45, 48, 0.22);
  transform: translateX(-50%);
}

.consent-banner[hidden] {
  display: none;
}

.consent-banner p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(31, 37, 40, 0.62);
}

.modal-backdrop[hidden] {
  display: none;
}

.card-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(320px, 480px);
  gap: 22px;
  width: min(900px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  padding: 0;
  background: var(--soft);
  color: var(--ink);
}

.modal-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 63 / 88;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  background-size: cover;
  background-position: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-art-stack {
  display: grid;
  align-content: start;
  gap: 14px;
}

.modal-copy {
  min-width: 0;
  padding: 24px 34px 6px 0;
}

.modal-copy h2 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.12;
}

.modal-type {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.modal-text {
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-line;
}

.modal-other-faces {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.modal-other-face {
  display: block;
}

.modal-face-image {
  display: grid;
  place-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(140deg, #d7e4df, #f3d6c9);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
}

.modal-face-image img {
  display: block;
  width: 100%;
  height: auto;
}

.modal-face-copy {
  min-width: 0;
}

.modal-face-copy h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
}

.modal-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.modal-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}

.modal-stats .tag-pill {
  background: #edf3f1;
  color: var(--accent);
}

.score-mode-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 29px;
  border: 0;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.score-mode-pill.score-included {
  background: #e6f4ea;
  color: #1f6f3a;
}

.score-mode-pill.score-excluded {
  background: #fde8e8;
  color: #a33636;
}

.tag-pill button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-height: 18px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: rgba(47, 111, 104, 0.16);
  color: var(--accent);
  font-size: 0;
  line-height: 0;
}

.tag-pill button::before {
  content: "x";
  display: block;
  height: 12px;
  font-size: 12px;
  line-height: 10px;
  transform: translateY(-1px);
}

.tag-pill button:hover,
.tag-pill button:focus-visible {
  background: var(--accent);
  color: white;
  outline: none;
}

.modal-rating-bars {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.modal-rating-row {
  display: grid;
  gap: 6px;
}

.modal-rating-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.modal-rating-label span {
  color: var(--muted);
  font-weight: 700;
}

.modal-rating-label strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.modal-rating-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.modal-rating-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--rating-color);
}

.modal-rating-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.feedback-link-button {
  justify-self: start;
  min-height: 34px;
  margin-top: 12px;
  padding: 0 12px;
  background: #fff7ed;
  color: #9b4b18;
  font-size: 13px;
}

.rating-editor {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.rating-dimensions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rating-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  align-items: center;
  gap: 8px;
}

.rating-row span {
  color: var(--muted);
  font-size: 12px;
}

.rating-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.rating-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 104, 0.15);
}

.rating-input-wrap input {
  border: 0;
  border-radius: 0;
  padding: 8px 9px;
  box-shadow: none;
}

.rating-input-wrap input:focus {
  box-shadow: none;
}

.rating-input-wrap em {
  padding-right: 9px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.rules-placeholder {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
}

.app-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  width: min(1680px, calc(100vw - 32px));
  margin: -10px auto 28px;
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(79, 129, 111, 0.42);
  border-radius: 8px;
  background: rgba(232, 248, 239, 0.82);
  color: #24463c;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.support-link:hover {
  border-color: rgba(79, 129, 111, 0.7);
  background: rgba(219, 243, 229, 0.96);
}

.footer-site-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.footer-site-link:hover {
  color: var(--ink);
}

.feedback-footer-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(31, 37, 40, 0.46);
}

.feedback-backdrop[hidden] {
  display: none;
}

.feedback-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.feedback-dialog h2 {
  margin: -4px 42px 2px 0;
  font-size: 22px;
  line-height: 1.2;
}

.release-notes-dialog {
  width: min(760px, 100%);
}

.release-notes-copy {
  display: grid;
  gap: 14px;
  color: var(--ink);
  line-height: 1.58;
}

.release-notes-copy h3,
.release-notes-copy h4,
.release-notes-copy p {
  margin: 0;
}

.release-notes-copy h3 {
  font-size: 18px;
}

.release-notes-copy h4 {
  margin-top: 14px;
  font-size: 14px;
}

.release-notes-copy ul {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding-left: 20px;
}

.feedback-dialog textarea[readonly] {
  min-height: 170px;
  background: #f7f9f8;
  color: var(--muted);
  font-size: 12px;
}

.feedback-actions {
  justify-content: end;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .radar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .app-shell {
    width: calc(100vw - 20px);
    margin: 10px auto;
  }

  .search-panel,
  .deck-panel {
    padding: 16px;
  }

  .mapping-grid,
  .search-box,
  .storage-panel,
  .consent-banner {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .card-results {
    grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  }

  .deck-list {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }

  .card-modal {
    grid-template-columns: 1fr;
  }

  .modal-copy {
    padding: 0;
  }
}
