:root {
  color-scheme: light;
  --bg: #eef1ef;
  --bg-track: rgba(32, 70, 66, 0.06);
  --surface: #ffffff;
  --surface-2: #f5f7f4;
  --surface-3: #f7efe8;
  --surface-4: #eef4f7;
  --ink: #17201f;
  --muted: #63706d;
  --line: #d6ded9;
  --line-strong: #b8c7c0;
  --accent: #096963;
  --accent-2: #b74f32;
  --accent-3: #275e96;
  --gold: #b38624;
  --danger: #b7333a;
  --shadow: 0 18px 42px rgba(23, 32, 31, 0.1);
  --shadow-soft: 0 8px 24px rgba(23, 32, 31, 0.07);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(9, 105, 99, 0.22);
  font-family:
    Pretendard,
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111716;
  --bg-track: rgba(173, 199, 191, 0.08);
  --surface: #202726;
  --surface-2: #182422;
  --surface-3: #2b211d;
  --surface-4: #17242d;
  --ink: #f4f1eb;
  --muted: #aab5b1;
  --line: #394742;
  --line-strong: #52635d;
  --accent: #5ac9bf;
  --accent-2: #e08364;
  --accent-3: #84b6ed;
  --gold: #d9b34e;
  --danger: #ff858c;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.24);
  --focus: 0 0 0 3px rgba(90, 201, 191, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, var(--bg-track) 1px, transparent 1px) 0 0 / 44px 44px,
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(183, 79, 50, 0.06) 42px 44px),
    linear-gradient(180deg, #fbfaf6 0, var(--bg) 42%);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(90deg, var(--bg-track) 1px, transparent 1px) 0 0 / 44px 44px,
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(224, 131, 100, 0.07) 42px 44px),
    linear-gradient(180deg, #151d1b 0, var(--bg) 42%);
}

button,
input,
select,
textarea {
  min-width: 0;
  font: inherit;
}

button,
.import-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

button:hover,
.import-button:hover {
  border-color: var(--accent);
  box-shadow: 0 5px 14px rgba(9, 105, 99, 0.11);
}

button:active,
.import-button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.import-button:focus-within {
  outline: none;
  box-shadow: var(--focus);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--surface);
}

textarea {
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(286px, 350px) minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.sidebar,
.workspace {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  background:
    linear-gradient(90deg, rgba(9, 105, 99, 0.12), transparent 58%),
    repeating-linear-gradient(90deg, transparent 0 16px, rgba(179, 134, 36, 0.12) 16px 18px),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.brand::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 13px;
  width: 96px;
  height: 28px;
  border: 2px solid rgba(9, 105, 99, 0.28);
  border-right: 0;
  border-radius: 999px 0 0 999px;
  pointer-events: none;
}

.brand h1,
.toolbar h1,
.section-header h2,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 30px;
  line-height: 1.08;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.brand-badges span {
  border: 1px solid rgba(9, 105, 99, 0.18);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--accent);
  background: rgba(9, 105, 99, 0.08);
  font-size: 11px;
  font-weight: 800;
}

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

.icon-button {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  place-items: center;
  padding: 0;
  color: var(--accent);
}

.panel,
.toolbar,
.tab-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .tab-panel {
  background: rgba(32, 39, 38, 0.9);
}

.panel {
  padding: 14px;
}

.panel-heading,
.section-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2,
.section-header h2 {
  font-size: 16px;
}

.section-header p,
.sync-copy {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.data-sources {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.source-title {
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.source-link,
.source-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--muted);
  text-decoration: none;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.source-link {
  min-height: 0;
  font-size: 12px;
  box-shadow: none;
}

.source-link:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.derived-field {
  align-content: end;
}

.tag-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

.tag-chip {
  border: 1px solid rgba(9, 105, 99, 0.14);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent);
  background: rgba(9, 105, 99, 0.1);
  font-weight: 800;
}

.search-field {
  margin: 12px 0;
}

.runner-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 390px);
  overflow: auto;
  padding-right: 2px;
}

.runner-item {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 10px 10px 10px 13px;
  text-align: left;
  background: var(--surface);
}

.runner-item::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.runner-item.active {
  border-color: rgba(9, 105, 99, 0.36);
  background: linear-gradient(90deg, rgba(9, 105, 99, 0.1), transparent), var(--surface);
}

.runner-item.active::before {
  background: var(--accent);
}

.runner-item strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runner-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-row,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-button {
  display: inline-flex;
  align-items: center;
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

.danger,
.remove-button {
  color: var(--danger);
}

.workspace {
  display: grid;
  align-content: start;
  gap: 14px;
}

.toolbar {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(39, 94, 150, 0.08), transparent 48%),
    var(--surface);
}

.toolbar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--accent-3));
}

.toolbar-main {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.toolbar-title {
  min-width: 0;
}

.runner-portrait {
  display: grid;
  position: relative;
  overflow: hidden;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 1px solid rgba(9, 105, 99, 0.24);
  border-radius: var(--radius);
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 12%, rgba(9, 105, 99, 0.18), transparent 52%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-soft);
  font-size: 26px;
  font-weight: 900;
}

.runner-portrait::after {
  content: "";
  position: absolute;
  inset: auto 8px 8px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  opacity: 0.42;
}

.runner-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.runner-portrait.has-image span {
  display: none;
}

.runner-portrait.empty {
  color: var(--muted);
  border-color: var(--line);
}

.toolbar-runner-name {
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-input {
  min-width: 0;
  max-width: 680px;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: 30px;
  font-weight: 850;
  line-height: 1.2;
  background: transparent;
}

.title-input:focus-visible {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.quick-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  min-width: 0;
}

.race-preset-field {
  grid-column: span 2;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(183, 79, 50, 0.2);
  border-radius: var(--radius);
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(183, 79, 50, 0.1), transparent 52%),
    linear-gradient(90deg, rgba(179, 134, 36, 0.12), transparent 38%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.race-preset-field::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 14px;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(183, 79, 50, 0.18);
  border-radius: 50%;
  pointer-events: none;
}

.preset-pair {
  grid-template-columns: minmax(0, 1fr) auto;
}

.preset-pair button {
  border-color: var(--accent-2);
  color: #fff;
  background: var(--accent-2);
}

.preset-info {
  margin: 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.preset-info[data-status="confirmed"]::before,
.preset-info[data-status="estimated"]::before {
  display: inline-block;
  margin-right: 6px;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 800;
}

.preset-info[data-status="confirmed"]::before {
  content: "확정";
  color: var(--accent);
  background: rgba(9, 105, 99, 0.12);
}

.preset-info[data-status="estimated"]::before {
  content: "예상";
  color: var(--accent-2);
  background: rgba(183, 79, 50, 0.12);
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-soft);
}

:root[data-theme="dark"] .tabs {
  background: rgba(32, 39, 38, 0.82);
}

.tab {
  flex: 0 0 auto;
  min-width: 72px;
  border-color: transparent;
  background: transparent;
}

.tab:hover {
  box-shadow: none;
  background: rgba(9, 105, 99, 0.08);
}

.tab.active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(9, 105, 99, 0.2);
}

:root[data-theme="dark"] .tab.active {
  color: #071514;
}

.tab-panel {
  display: none;
  padding: 18px;
}

.tab-panel.active {
  display: grid;
  gap: 16px;
}

.lineage-board {
  position: relative;
  display: grid;
  gap: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(9, 105, 99, 0.06), transparent 34%),
    var(--surface-2);
}

.lineage-board::before {
  content: "";
  position: absolute;
  inset: 100px 10% auto;
  height: 180px;
  border-top: 1px dashed rgba(9, 105, 99, 0.24);
  border-bottom: 1px dashed rgba(9, 105, 99, 0.2);
  pointer-events: none;
}

.lineage-generation {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  justify-content: center;
}

.lineage-generation.grandparents {
  grid-template-columns: repeat(4, minmax(128px, 154px));
}

.lineage-generation.parents {
  grid-template-columns: repeat(2, minmax(142px, 172px));
}

.lineage-generation.target {
  grid-template-columns: minmax(154px, 184px);
}

.lineage-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 196px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-soft);
}

.lineage-card.filled {
  border-color: rgba(9, 105, 99, 0.28);
}

.lineage-card[data-grade="◎"] {
  border-color: rgba(179, 134, 36, 0.55);
  background:
    linear-gradient(180deg, rgba(179, 134, 36, 0.12), transparent 44%),
    var(--surface);
}

.lineage-card[data-grade="🌕"] {
  border-color: rgba(9, 105, 99, 0.38);
}

.lineage-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.lineage-portrait {
  display: grid;
  position: relative;
  overflow: hidden;
  width: 76px;
  height: 76px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  background:
    radial-gradient(circle at 50% 12%, rgba(9, 105, 99, 0.15), transparent 46%),
    var(--surface);
  font-size: 22px;
  font-weight: 900;
}

.lineage-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lineage-portrait.has-image span {
  display: none;
}

.lineage-portrait.empty {
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(99, 112, 109, 0.08), transparent),
    var(--surface);
}

.lineage-card input {
  min-height: 34px;
  padding: 7px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.lineage-card-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.lineage-card-footer strong {
  color: var(--accent);
  font-size: 12px;
}

.lineage-card .compat-picker {
  min-width: 58px;
}

.lineage-card .compat-picker summary {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.lineage-card .compat-candidates {
  max-height: 180px;
}

.target-card {
  min-height: 178px;
  text-align: center;
}

.target-card > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.lineage-grade {
  justify-self: center;
  min-width: 44px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--accent);
  background: rgba(9, 105, 99, 0.1);
  font-size: 18px;
  font-weight: 900;
}

.lineage-grade[data-grade="◎"] {
  color: var(--gold);
  background: rgba(179, 134, 36, 0.12);
}

.lineage-analysis {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.lineage-analysis-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(70px, 0.5fr) minmax(0, 1.4fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.lineage-analysis-row:last-child {
  border-bottom: 0;
}

.lineage-analysis-row span {
  color: var(--muted);
  font-weight: 800;
}

.lineage-analysis-row strong {
  color: var(--accent);
}

.lineage-analysis-row em {
  overflow: hidden;
  color: var(--ink);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-card,
.support-slot {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.ancestor-pair,
.record-main,
.skill-row,
.slot-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.record-card > .field,
.support-slot > .field {
  margin-top: 10px;
}

.field.compact input,
.field.compact select {
  min-width: 0;
}

.combo-pair {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(118px, 0.46fr);
  gap: 8px;
  min-width: 0;
}

.quick-meta .combo-pair {
  grid-template-columns: minmax(0, 1fr);
}

.support-slot .combo-pair {
  grid-template-columns: minmax(0, 1fr);
}

.quick-meta .preset-pair {
  grid-template-columns: minmax(0, 1fr) auto;
}

.combo-pair select {
  min-width: 0;
  max-height: 240px;
}

.picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.compat-picker {
  position: relative;
  min-width: 74px;
}

.compat-picker summary {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}

.compat-picker summary::-webkit-details-marker {
  display: none;
}

.compat-picker[open] summary {
  border-color: var(--accent);
}

.compat-picker .compat-search {
  margin-top: 8px;
}

.compat-candidates {
  display: grid;
  gap: 6px;
  max-height: 250px;
  overflow: auto;
  margin-top: 8px;
  padding-right: 2px;
}

.compat-candidate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  text-align: left;
}

.compat-candidate strong,
.compat-candidate span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compat-candidate span {
  color: var(--accent);
  font-weight: 800;
}

.item-list,
.support-grid,
.parsed-factor-grid,
.manual-factor-grid {
  display: grid;
  gap: 10px;
}

.parsed-factor-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.manual-factor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.parent-factor-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.manual-skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.skill-suggestions {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
  gap: 6px;
  max-height: 138px;
  overflow: auto;
  margin: -2px 0 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.skill-suggestions.active {
  display: grid;
}

.skill-suggestion {
  min-height: 30px;
  padding: 0 9px;
  border-color: transparent;
  color: var(--accent);
  background: rgba(9, 105, 99, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.quick-skill-suggestions {
  margin-top: -6px;
}

.parsed-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.parsed-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.support-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.record-card {
  position: relative;
}

.remove-button {
  margin-top: 10px;
}

.slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.slot-top select {
  max-width: 112px;
}

.support-slot {
  border-top: 4px solid var(--accent-3);
  box-shadow: var(--shadow-soft);
}

.skill-tools {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
}

.skill-card {
  position: relative;
  padding: 8px 9px 7px;
  box-shadow: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.skill-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.skill-card[data-source="support"] {
  border-left: 5px solid var(--accent-3);
}

.skill-card[data-source="inherit"] {
  border-left: 5px solid var(--accent-2);
}

.skill-card[data-source="target"] {
  border-left: 5px solid var(--accent);
}

.skill-card.recommended-skill {
  border-top-color: rgba(179, 134, 36, 0.42);
  border-right-color: rgba(179, 134, 36, 0.42);
  border-bottom-color: rgba(179, 134, 36, 0.42);
  background:
    linear-gradient(90deg, rgba(179, 134, 36, 0.12), transparent 28%),
    var(--surface);
}

.skill-card.recommended-skill[data-source="support"] {
  border-left-color: var(--accent-3);
}

.skill-card.recommended-skill[data-source="inherit"] {
  border-left-color: var(--accent-2);
}

.skill-card.recommended-skill[data-source="target"] {
  border-left-color: var(--accent);
}

.skill-card .skill-row {
  grid-template-columns: minmax(150px, 1.1fr) minmax(96px, 0.34fr) minmax(120px, 0.85fr) auto;
  align-items: center;
  gap: 6px;
}

.skill-card .field {
  gap: 0;
}

.skill-card .field span {
  display: none;
}

.skill-card input,
.skill-card select {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.skill-card[data-source="support"] select[data-field="source"] {
  color: var(--accent-3);
}

.skill-card[data-source="inherit"] select[data-field="source"] {
  color: var(--accent-2);
}

.skill-card[data-source="target"] select[data-field="source"] {
  color: var(--accent);
}

.skill-card .remove-button {
  min-height: 30px;
  margin-top: 0;
  padding: 0 9px;
  font-size: 12px;
}

.skill-meta-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.source-chip,
.auto-chip,
.recommend-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.source-chip {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.source-chip[data-source="support"] {
  color: var(--accent-3);
  background: color-mix(in srgb, var(--accent-3) 11%, var(--surface));
}

.source-chip[data-source="inherit"] {
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 11%, var(--surface));
}

.auto-chip {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, var(--surface));
}

.auto-chip[data-auto="true"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--line-strong) 32%, var(--surface));
}

.recommend-tag {
  margin: 0;
  border: 1px solid rgba(179, 134, 36, 0.22);
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
}

.recommend-tag input {
  width: 11px;
  height: 11px;
  min-height: 0;
  accent-color: var(--gold);
}

.skill-card:not(.recommended-skill) .recommend-tag {
  display: none;
}

.notes-area {
  min-height: 360px;
  line-height: 1.55;
}

.compact-notes {
  min-height: 190px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  border-radius: 7px;
  padding: 12px 14px;
  color: #fff;
  background: rgba(23, 32, 31, 0.94);
  box-shadow: var(--shadow);
}

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

  .runner-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 240px;
  }

  .support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lineage-generation.grandparents {
    grid-template-columns: repeat(2, minmax(128px, 170px));
  }
}

@media (max-width: 760px) {
  .app-shell {
    gap: 12px;
    padding: 12px;
  }

  .brand h1 {
    font-size: 24px;
  }

  .toolbar,
  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-main {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .runner-portrait {
    width: 64px;
    height: 64px;
    font-size: 20px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1 1 120px;
  }

  .title-input {
    font-size: 24px;
  }

  .quick-meta,
  .support-grid,
  .parsed-factor-grid,
  .manual-factor-grid,
  .record-main,
  .skill-row,
  .skill-tools {
    grid-template-columns: 1fr;
  }

  .skill-card .skill-row {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .skill-card .skill-name-field {
    grid-column: 1 / 2;
  }

  .skill-card .skill-row > .field.compact {
    grid-column: 2 / 3;
  }

  .skill-card .skill-memo-field {
    grid-column: 1 / 2;
  }

  .skill-card .remove-button {
    grid-column: 2 / 3;
  }

  .race-preset-field {
    grid-column: auto;
  }

  .ancestor-pair {
    grid-template-columns: 1fr;
  }

  .lineage-board {
    padding: 12px;
  }

  .lineage-board::before {
    display: none;
  }

  .lineage-generation.parents {
    grid-template-columns: repeat(2, minmax(128px, 1fr));
  }

  .runner-list {
    grid-template-columns: 1fr;
  }

  .tab {
    min-width: 82px;
  }
}

@media (max-width: 430px) {
  .ancestor-pair,
  .slot-meta {
    grid-template-columns: 1fr;
  }

  button,
  .import-button {
    padding-inline: 11px;
  }

  .combo-pair {
    grid-template-columns: 1fr;
  }

  .lineage-generation.grandparents,
  .lineage-generation.parents,
  .lineage-generation.target {
    grid-template-columns: 1fr;
  }

  .lineage-card {
    min-height: auto;
  }

  .lineage-analysis-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
