:root {
  --bg: #f3f1eb;
  --bg-soft: #ece7df;
  --card: rgba(252, 250, 246, 0.96);
  --card-strong: #f8f4ee;
  --text: #1f2a28;
  --subtle: #5c6a64;
  --line: #d5d6cc;
  --line-strong: #b8beb4;
  --accent: #355c52;
  --accent-dark: #27463e;
  --accent-soft: #dce7e0;
  --shadow-soft: 0 18px 42px rgba(54, 63, 58, 0.08);
  --shadow-card: 0 8px 24px rgba(42, 48, 44, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(223, 228, 218, 0.85) 0, transparent 34%),
    radial-gradient(circle at top right, rgba(232, 226, 216, 0.9) 0, transparent 28%),
    linear-gradient(180deg, #f7f4ee 0%, var(--bg) 52%, #efebe3 100%);
  color: var(--text);
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 100% 32px;
  opacity: 0.16;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.6vw, 28px);
}

.card {
  width: min(720px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(18px, 2.4vw, 30px);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.card.wide {
  width: min(1160px, 100%);
}

.home-shell {
  width: min(1280px, 100%);
  position: relative;
  overflow: hidden;
  padding-top: clamp(28px, 4vw, 46px);
}

.home-shell::after {
  content: "";
  position: absolute;
  top: 20px;
  right: 28px;
  width: min(24vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0) 58%),
    linear-gradient(135deg, rgba(164, 182, 170, 0.3), rgba(102, 124, 112, 0.08));
  opacity: 0.8;
  pointer-events: none;
  filter: blur(2px);
}

.home-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  align-items: start;
  margin-top: 12px;
}

.home-entry-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 320px));
  gap: 16px;
  margin: 14px 0 20px;
  align-items: stretch;
}

.entry-choice-banner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(244, 241, 234, 0.92) 100%);
  color: var(--text);
  padding: 16px 18px;
  min-height: 106px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
  box-shadow: var(--shadow-card);
  position: relative;
  text-align: left;
}

.entry-choice-banner::after {
  content: "";
  width: 42px;
  height: 1px;
  margin-top: auto;
  background: rgba(53, 92, 82, 0.35);
  transition: width 180ms ease, background 180ms ease;
}

.entry-choice-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(43, 51, 47, 0.1);
  border-color: var(--line-strong);
}

.entry-choice-banner:hover::after {
  width: 68px;
  background: rgba(39, 70, 62, 0.6);
}

.entry-choice-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.entry-choice-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-dark);
  background: #e4ece7;
  border: 1px solid #bfd0c7;
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-choice-desc {
  font-size: 13px;
  color: var(--subtle);
  line-height: 1.3;
}

.entry-back-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.feature-banner {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(18px, 2vw, 24px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84) 0%, rgba(248, 244, 237, 0.92) 100%);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.feature-banner::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(53, 92, 82, 0.95), rgba(53, 92, 82, 0));
  opacity: 0.9;
}

.feature-banner h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 2vw, 32px);
  line-height: 1.08;
  position: relative;
}

.feature-banner-primary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(243, 241, 234, 0.98) 100%);
}

.feature-banner-secondary {
  background: linear-gradient(180deg, rgba(252, 250, 246, 0.96) 0%, rgba(241, 239, 233, 0.98) 100%);
}

h1 {
  margin: 0 0 10px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(32px, 3vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 12ch;
}

h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  letter-spacing: -0.01em;
}

.home-subtitle {
  margin: 0 0 12px;
  color: var(--subtle);
  font-size: 17px;
  max-width: 42rem;
  text-wrap: balance;
}

.home-trust-line {
  margin: 0 0 20px;
  color: #62716a;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.home-shell > .hint-inline:last-child {
  margin-top: 18px;
}

.home-shell > .hint-inline:last-child a {
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(39, 70, 62, 0.2);
  padding-bottom: 2px;
}

.home-shell > .hint-inline:last-child a:hover {
  border-bottom-color: rgba(39, 70, 62, 0.45);
}

.hint {
  margin: 0 0 16px;
  color: var(--subtle);
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--subtle);
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #d2d7cf;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none;
}

.row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.import-row {
  align-items: center;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(213, 214, 204, 0.55);
}

.feature-banner > .import-row:first-of-type,
.feature-banner > form.row,
.feature-banner > details.date-override + .row.import-row {
  border-top: 0;
  padding-top: 0;
}

.hint-inline {
  color: var(--subtle);
  font-size: 14px;
}

.type-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.type-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--subtle);
  padding: 7px 10px;
  border: 1px solid rgba(213, 214, 204, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  padding: 11px 13px;
  min-height: 46px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  padding: 12px 13px;
  resize: vertical;
  font-family: inherit;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

select {
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.72);
  min-height: 46px;
  color: var(--text);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
.button-link:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(53, 92, 82, 0.45);
  outline-offset: 2px;
}

button,
.button-link {
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 18px;
  text-decoration: none;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 8px 18px rgba(53, 92, 82, 0.16);
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(39, 70, 62, 0.18);
}

button:disabled,
.button-link-disabled {
  cursor: not-allowed;
  box-shadow: none;
}

.user-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(247, 244, 237, 0.92);
}

.user-chip button {
  font-size: 13px;
  padding: 4px 8px;
}

.user-overflow {
  width: 100%;
}

.user-overflow details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(247, 244, 237, 0.92);
  padding: 8px 10px;
}

.user-overflow summary {
  cursor: pointer;
  color: var(--subtle);
}

.overflow-list {
  margin-top: 8px;
}

.actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(213, 214, 204, 0.75);
}

.analysis-page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 18px;
  padding: 14px 0 0;
  border-top: 1px solid rgba(213, 214, 204, 0.72);
}

.analysis-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0 18px;
}

.analysis-columns {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(252, 251, 248, 0.98) 0%, rgba(243, 240, 233, 0.96) 100%);
  padding: 16px;
  margin: 18px 0 18px;
  box-shadow: var(--shadow-card);
}

.analysis-columns-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.analysis-columns-header h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.analysis-group-toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.analysis-group-toggle,
.secondary-button {
  border: 1px solid #c4cbc1;
  background: rgba(255, 255, 255, 0.82);
  color: #2d4941;
  box-shadow: none;
}

.analysis-group-toggle:hover,
.secondary-button:hover {
  background: #edf1eb;
}

.analysis-group-toggle[data-state="on"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.analysis-group-toggle[data-state="partial"] {
  background: var(--accent-soft);
  border-color: #a6bbb1;
  color: var(--accent-dark);
}

.analysis-group-toggle:disabled {
  cursor: default;
  opacity: 0.5;
  background: #f8fafc;
}

.analysis-columns-details {
  margin-top: 12px;
  border-top: 1px solid #d9ddd4;
  padding-top: 12px;
}

.analysis-columns-details summary {
  cursor: pointer;
  color: var(--subtle);
  font-weight: 600;
}

.analysis-columns-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.analysis-columns-group {
  margin: 0;
  border: 1px solid #d9ddd4;
  border-radius: 12px;
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.78);
}

.analysis-columns-group legend {
  padding: 0 6px;
  color: #44514c;
  font-size: 13px;
  font-weight: 700;
}

.analysis-columns-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--subtle);
  font-size: 14px;
}

.analysis-columns-option input {
  min-height: auto;
  flex: 0 0 auto;
}

.analysis-summary-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(250, 247, 241, 0.96) 0%, rgba(244, 241, 233, 0.96) 100%);
  padding: 12px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.analysis-summary-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--subtle);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.analysis-summary-card p {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-side-line {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.metric-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #b4c2b7;
  background: #edf2ec;
  color: #365249;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}

.metric-info::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #253430;
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 30;
}

.metric-info:hover::after,
.metric-info:focus-visible::after {
  opacity: 1;
}

.secondary-link {
  background: rgba(238, 241, 234, 0.96);
  border-color: #cad1c7;
  color: #29453d;
  box-shadow: none;
}

.secondary-link:hover {
  background: #e4e9e1;
}

.small-links {
  margin-top: 16px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.small-links a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}

.small-links a:hover {
  text-decoration: underline;
}

.lang-corner {
  position: fixed;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(250, 248, 243, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  z-index: 1000;
  box-shadow: 0 8px 20px rgba(47, 53, 50, 0.08);
}

.lang-corner-label {
  color: var(--subtle);
  font-size: 12px;
}

.lang-corner-select {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 4px 8px;
  font-size: 12px;
}

.stack-form {
  display: grid;
  gap: 8px;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.table-wrap {
  overflow-x: auto;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(253, 251, 248, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  margin-top: 18px;
}

.table-wrap.scrollable-rows {
  max-height: min(65vh, 560px);
  overflow-y: auto;
}

.analysis-result-table {
  width: max(100%, 1180px);
  border-collapse: separate;
  border-spacing: 0;
}

.analysis-result-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f3efe8;
  box-shadow: inset 0 -1px 0 var(--line);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #607069;
}

.analysis-result-table th,
.analysis-result-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e4e4db;
  white-space: nowrap;
  background: rgba(255, 253, 250, 0.94);
}

.analysis-result-table tbody td {
  color: #22302d;
}

.analysis-result-table tbody tr:nth-child(even) td {
  background: rgba(246, 242, 235, 0.88);
}

.analysis-result-table .sticky-col {
  position: sticky;
  z-index: 15;
  box-shadow: 1px 0 0 #d7d8ce;
}

.analysis-result-table thead .sticky-col {
  z-index: 25;
}

.analysis-result-table .sticky-col-1 {
  left: 0;
  min-width: 90px;
}

.analysis-result-table .sticky-col-2 {
  left: 90px;
  min-width: 88px;
}

.analysis-result-table .sticky-col-3 {
  left: 178px;
  min-width: 132px;
}

.analysis-result-table .col-move-number {
  min-width: 90px;
}

.analysis-result-table .col-side {
  min-width: 88px;
}

.analysis-result-table .col-move {
  min-width: 132px;
}

.move-cell-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.move-cell-text {
  font-weight: 600;
}

.move-annotation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.move-annotation-book {
  background: #ece8df;
  border-color: #d3cdc0;
  color: #6d6757;
}

.move-annotation-brilliant {
  background: #dff4ea;
  border-color: #9dcdb2;
  color: #1f6a4b;
}

.move-annotation-good {
  background: #e6f1e8;
  border-color: #b7cbb8;
  color: #2f5c44;
}

.move-annotation-interesting {
  background: #edf2de;
  border-color: #cad3a3;
  color: #59652a;
}

.move-annotation-inaccuracy {
  background: #f6ead8;
  border-color: #ddbf93;
  color: #8a5a20;
}

.move-annotation-mistake {
  background: #f8dfd7;
  border-color: #deab9b;
  color: #9a4b3c;
}

.move-annotation-blunder {
  background: #f1cfc8;
  border-color: #cd9185;
  color: #7e2e26;
}

.analysis-result-table .col-bestmove,
.analysis-result-table .col-opening-name {
  min-width: 150px;
}

.analysis-result-table .col-bestmove-eval,
.analysis-result-table .col-opening-eco,
.analysis-result-table .col-white-clock,
.analysis-result-table .col-black-clock {
  min-width: 120px;
}

.analysis-result-table .col-eval-score,
.analysis-result-table .col-eval-gap,
.analysis-result-table .col-accuracy,
.analysis-result-table .col-is-book-move {
  min-width: 108px;
}

.raw-shell {
  display: block;
  min-height: 100vh;
  padding: clamp(12px, 2.6vw, 28px);
}

.raw-card {
  width: min(1240px, 100%);
  margin-left: 0;
  margin-right: auto;
}

.raw-table-wrap {
  direction: ltr;
  margin-right: auto;
}

.progress-modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 43, 39, 0.32);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 2000;
}

.progress-modal.hidden {
  display: none;
}

.progress-dialog {
  width: min(540px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(251, 248, 242, 0.97);
  box-shadow: 0 20px 40px rgba(33, 39, 36, 0.16);
  padding: 22px;
}

.progress-dialog h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #dfe5dd;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #355c52 0%, #52786e 100%);
  transition: width 180ms ease;
}

.progress-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.cookie-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2100;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(250, 248, 243, 0.98);
  box-shadow: 0 12px 32px rgba(35, 43, 39, 0.12);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cookie-banner-text {
  max-width: 820px;
}

.cookie-banner-text p {
  margin: 6px 0 0;
  color: var(--subtle);
}

.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  background: rgba(28, 34, 31, 0.42);
  display: grid;
  place-items: center;
  padding: 16px;
}

.cookie-modal.hidden {
  display: none;
}

.cookie-modal-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(251, 248, 242, 0.98);
  padding: 16px;
}

.cookie-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.cookie-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cookie-settings-open {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 2050;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(249, 246, 240, 0.96);
  color: var(--subtle);
  font-size: 12px;
  padding: 6px 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px;
  vertical-align: top;
  white-space: nowrap;
}

.raw-select-header,
.raw-select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.raw-select-header input,
.raw-select-cell input {
  width: 16px;
  height: 16px;
}

.raw-row-selected td {
  background: rgba(225, 235, 230, 0.82);
}

.raw-row-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.selected-pgn-list {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.selected-pgn-batch-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 18px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(243, 240, 233, 0.96) 100%);
  box-shadow: var(--shadow-card);
}

.selected-pgn-batch-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.selected-pgn-batch-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.selected-pgn-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(243, 240, 233, 0.96) 100%);
  box-shadow: var(--shadow-card);
}

.selected-pgn-card-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.selected-pgn-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.selected-pgn-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.selected-pgn-status-pending {
  background: rgba(232, 234, 229, 0.9);
  border-color: rgba(173, 180, 170, 0.8);
  color: #58635b;
}

.selected-pgn-status-running {
  background: rgba(230, 239, 233, 0.95);
  border-color: rgba(126, 154, 138, 0.9);
  color: #2e5746;
}

.selected-pgn-status-done {
  background: rgba(220, 238, 228, 0.95);
  border-color: rgba(111, 154, 128, 0.9);
  color: #1f5f3f;
}

.selected-pgn-status-failed {
  background: rgba(248, 223, 215, 0.95);
  border-color: rgba(210, 144, 131, 0.9);
  color: #8f3f32;
}

.selected-pgn-status-missing {
  background: rgba(244, 237, 228, 0.95);
  border-color: rgba(194, 173, 143, 0.8);
  color: #7b6645;
}

.selected-pgn-card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.selected-pgn-card-note {
  margin: 10px 0 0;
}

.selected-pgn-card-note-failed {
  color: #9a4b3c;
}

.button-link-disabled,
.button-link-disabled:hover {
  pointer-events: none;
  opacity: 0.55;
  background: #99a29b;
  border-color: #99a29b;
}

td small {
  color: var(--subtle);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1024px) {
  .card.wide {
    width: 100%;
  }

  .raw-card {
    width: 100%;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .analysis-summary {
    grid-template-columns: 1fr;
  }

  .selected-pgn-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .home-entry-chooser {
    grid-template-columns: 1fr;
    max-width: 480px;
  }

  th,
  td {
    padding: 8px;
    font-size: 14px;
  }
}

@media (max-width: 720px) {
  .shell {
    place-items: start center;
    padding-top: 56px;
  }

  .raw-shell {
    padding-top: 56px;
  }

  .card {
    border-radius: 14px;
    padding: 16px;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 12px;
  }

  .actions {
    justify-content: stretch;
    margin-top: 14px;
    padding-top: 14px;
  }

  button,
  .button-link {
    width: 100%;
    text-align: center;
  }

  .lang-corner {
    top: 6px;
    right: 6px;
    left: 6px;
    justify-content: flex-end;
    border-radius: 12px;
  }

  h1 {
    max-width: none;
    font-size: clamp(28px, 9vw, 40px);
  }

  .home-shell::after {
    width: 150px;
    right: -24px;
    top: 12px;
  }

  .analysis-columns-grid {
    grid-template-columns: 1fr;
  }

  .analysis-page-actions {
    padding-top: 12px;
  }

  .selected-pgn-batch-header {
    align-items: stretch;
  }

  .selected-pgn-card-header {
    align-items: flex-start;
  }

  .selected-pgn-card-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 12px;
  }

  h1 {
    font-size: 22px;
  }

  .hint,
  .hint-inline {
    font-size: 13px;
  }

  th,
  td {
    font-size: 13px;
    padding: 7px;
  }
}

details summary {
  cursor: pointer;
  color: var(--accent);
}

pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--subtle);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
