* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #10131b;
  color: #e8edf5;
  font-family: "Noto Sans SC", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.site-footer {
  padding: 0 16px 28px;
  color: #91a0b8;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #c7d3e6;
  text-decoration: underline;
}

.changelog-widget {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 20;
}

.changelog-widget > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  max-width: min(420px, calc(100vw - 28px));
}

.changelog-widget small {
  color: #91a0b8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.changelog-toggle {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.changelog-panel {
  width: min(420px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 76px));
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #171c27;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  padding: 16px;
}

.changelog-panel[hidden] {
  display: none;
}

.changelog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.changelog-close {
  padding: 7px 10px;
  font-size: 12px;
}

.data-load-notice {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  display: grid;
  width: min(460px, calc(100vw - 28px));
  gap: 14px;
  border: 1px solid #9d5a36;
  border-radius: 8px;
  background: #251913;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  padding: 16px;
}

.data-load-notice[hidden] {
  display: none;
}

.data-load-notice strong {
  color: #ffd4b8;
  font-size: 16px;
}

.data-load-notice p {
  margin: 6px 0 0;
  color: #e8c8b4;
  font-size: 13px;
  line-height: 1.6;
}

.data-load-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#changelogContent,
.changelog-section {
  display: grid;
  gap: 12px;
}

.changelog-section-title {
  margin: 0;
  color: #9fb0cc;
  font-size: 12px;
  font-weight: 900;
}

.changelog-entry {
  display: grid;
  gap: 10px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 14px;
}

.changelog-roadmap {
  border-color: #5f4938;
  background: #19151a;
}

.changelog-meta {
  color: #ffbf9f;
  font-size: 12px;
  font-weight: 900;
}

.changelog-entry h2 {
  margin-top: 4px;
  color: #fff4d6;
  font-size: 18px;
}

.changelog-entry ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: #dce5f4;
  line-height: 1.65;
}

.panel {
  background: #171c27;
  border: 1px solid #283042;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.panel:empty {
  display: none;
}

.setup-panel {
  display: grid;
  gap: 18px;
}

.setup-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.setup-heading-group {
  min-width: 0;
}

.setup-heading-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.legend-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #49546c;
  padding: 7px 11px;
  color: #cbd5e5;
  font-size: 13px;
  line-height: 1;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.legend-mode-toggle-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #79869b;
  box-shadow: 0 0 0 3px rgba(121, 134, 155, 0.14);
}

.legend-mode-toggle.is-active {
  border-color: #e9a366;
  background: #64351f;
  color: #fff4d6;
  box-shadow: 0 0 0 3px rgba(230, 95, 47, 0.15);
}

.legend-mode-toggle.is-active .legend-mode-toggle-indicator {
  background: #ffbf83;
  box-shadow: 0 0 0 3px rgba(255, 191, 131, 0.18);
}

.legend-mode-toggle:focus-visible,
.legend-intro-dialog button:focus-visible,
.legend-intro-preference:has(input:focus-visible) {
  outline: 3px solid rgba(255, 191, 131, 0.5);
  outline-offset: 2px;
}

.legend-intro-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  margin: auto;
  border: 1px solid #8f5d3e;
  border-radius: 12px;
  background: #171c27;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
  color: #e8edf5;
  padding: 22px;
}

.legend-intro-dialog:not([open]) {
  display: none;
}

.legend-intro-dialog::backdrop {
  background: rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(3px);
}

.legend-intro-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.legend-intro-header .eyebrow {
  color: #ffbf9f;
}

.legend-intro-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

#legendIntroSummary {
  margin: 18px 0 0;
  color: #cbd5e5;
  line-height: 1.7;
}

.legend-intro-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding-left: 22px;
  color: #dce5f4;
  line-height: 1.65;
}

.legend-intro-list strong {
  color: #ffd2ad;
}

.legend-intro-preference {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  border-radius: 6px;
  color: #cbd5e5;
  cursor: pointer;
}

.legend-intro-preference input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.legend-intro-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

.muted {
  color: #91a0b8;
  margin: 6px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label,
.field-block {
  display: grid;
  gap: 6px;
  color: #b7c2d6;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
  color: #f5f7fb;
  padding: 10px 12px;
}

input[type="checkbox"] {
  width: auto;
}

input[type="range"] {
  padding: 0;
}

output {
  color: #f5f7fb;
  font-weight: 800;
}

button {
  border: 0;
  border-radius: 6px;
  background: #e65f2f;
  color: white;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: #30394e;
}

.primary {
  width: fit-content;
}

.help-toggle {
  flex: 0 0 auto;
}

.save-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #111722;
  padding: 14px 16px;
}

.save-panel .eyebrow {
  margin-bottom: 4px;
}

.save-panel .muted {
  margin: 0;
}

.save-clear {
  flex: 0 0 auto;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.jockey-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.filter-checkbox {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  width: fit-content;
  gap: 8px;
  color: #dce5f4;
  font-size: 12px;
}

.icon-help-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  line-height: 1;
}

.help-panel {
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #111722;
  padding: 18px;
}

.help-panel[hidden] {
  display: none;
}

.help-panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.help-panel-close {
  min-width: 88px;
}

.help-content {
  display: grid;
  gap: 18px;
}

.trainer-help-panel {
  margin-top: -6px;
}

.sire-help-panel {
  margin-top: -6px;
}

.dam-help-panel {
  margin-top: -6px;
}

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

.sire-help-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sire-help-list-grid .help-section {
  border-bottom: 0;
  padding-bottom: 0;
}

.help-section {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid #283042;
  padding-bottom: 16px;
}

.help-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.help-section h2 {
  color: #fff4d6;
  font-size: 18px;
}

.help-section p {
  margin: 0;
  color: #dce5f4;
  line-height: 1.75;
}

.help-section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: #ccd5e4;
  line-height: 1.65;
}

.help-section .formula {
  border-left: 4px solid #e65f2f;
  background: #1d1410;
  color: #ffe1d4;
  padding: 10px 12px;
  font-weight: 800;
}

.debug-toggle {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  justify-self: start;
  gap: 8px;
}

.debug-panel {
  display: grid;
  gap: 16px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #111722;
  padding: 16px;
}

.debug-panel[hidden] {
  display: none;
}

.debug-section {
  display: grid;
  gap: 10px;
}

.debug-section h3 {
  margin: 0;
  color: #d9e2f2;
  font-size: 15px;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.title-with-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: 10px;
}

.title-with-actions .eyebrow {
  margin: 0;
}

.history-record-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #dce5f4;
  font-size: 12px;
  font-weight: 900;
}

.history-record-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #3d4960;
  border-radius: 999px;
  background: #101722;
  padding: 4px 9px;
  line-height: 1.2;
  white-space: nowrap;
}

.history-record-summary span:first-child {
  border-color: #dd805f;
  background: #2b170d;
  color: #ffbf9f;
}

.history-toggle {
  flex: 0 0 auto;
}

.history-index-header {
  width: 88px;
}

.history-index-heading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.history-bulk-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.history-bulk-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: 1px solid #3d4960;
  border-radius: 6px;
  color: #dce5f4;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.history-bulk-toggle:disabled {
  cursor: default;
  opacity: 0.4;
}

.history-index-cell {
  white-space: nowrap;
}

.history-index-number {
  display: inline-block;
  min-width: 20px;
  color: #b7c2d6;
  font-weight: 900;
  text-align: center;
  vertical-align: middle;
}

.history-race-name-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.history-comment-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border: 1px solid #6bd3c2;
  border-radius: 6px;
  background: #10211f;
  color: #9ee7dc;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.history-comment-toggle[aria-expanded="true"] {
  background: #16302c;
  color: #e4f7f3;
}

.history-cell-subtext {
  display: block;
  margin-top: 5px;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.history-margin-text {
  color: #ffbf9f;
}

.history-record-expanded td {
  background: rgba(255, 255, 255, 0.015);
}

.history-comment-row td {
  background: rgba(107, 211, 194, 0.045);
}

.history-comment-card {
  border: 1px solid #6bd3c2;
  border-left-width: 5px;
  border-radius: 8px;
  background: #10211f;
  padding: 12px 14px;
}

.history-comment-card span {
  display: block;
  margin-bottom: 7px;
  color: #9ee7dc;
  font-size: 12px;
  font-weight: 900;
}

.history-comment-card p {
  margin: 0;
  color: #e4f7f3;
  line-height: 1.75;
}

.race-name-header,
.opponent-name-header {
  min-width: 190px;
}

.race-name-header > span,
.opponent-name-header > span {
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.race-name-header .name-language-toggle,
.opponent-name-header .name-language-toggle {
  vertical-align: middle;
}

.name-language-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
}

.name-language-button {
  min-width: 42px;
  min-height: 28px;
  border-radius: 0;
  background: transparent;
  color: #b7c2d6;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.name-language-button + .name-language-button {
  border-left: 1px solid #30394e;
}

.name-language-button.is-active {
  background: #e65f2f;
  color: #fff;
}

.debug-badge {
  background: #593221;
  color: #ffbf9f;
}

.legend-badge {
  background: #4b3610;
  color: #ffe08a;
}

.setup-mode-note {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}

.history-opponent-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.history-opponent-toggle:hover,
.history-opponent-toggle:focus-visible,
.history-opponent-toggle[aria-expanded="true"] {
  background: transparent;
  color: #9ee7dc;
}

.history-opponent-toggle span {
  color: #6bd3c2;
  font-size: 11px;
}

.opponent-roster-row td {
  background: #0d1718;
  padding: 10px 14px 14px;
}

.opponent-roster {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.opponent-roster-item {
  display: grid;
  gap: 5px;
  border: 1px solid #31534f;
  border-radius: 7px;
  background: #10211f;
  padding: 10px;
}

.opponent-roster-item strong {
  color: #e4f7f3;
  line-height: 1.4;
}

.opponent-roster-item span,
.opponent-roster-item em {
  color: #91a0b8;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.opponent-roster-item em {
  color: #ffbf9f;
}

.horse-head,
.race-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.race-row select {
  flex: 1;
}

.race-card-list {
  display: none;
}

.race-plan-card {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid #30394e;
  background: #0f131c;
  padding: 12px;
  text-align: left;
}

.race-plan-card strong {
  color: #f5f7fb;
  font-size: 15px;
  line-height: 1.35;
}

.race-plan-card span {
  color: #b7c2d6;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.race-plan-card .race-card-meta {
  color: #ffbf9f;
  font-weight: 900;
}

.race-plan-card em {
  justify-self: start;
  border-radius: 999px;
  background: #253956;
  color: #9cc7ff;
  padding: 4px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.race-plan-card.is-active {
  border-color: #e65f2f;
  background: #1d1410;
  box-shadow: inset 0 0 0 1px rgba(230, 95, 47, 0.28);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(170px, auto) auto;
  align-items: start;
  gap: 8px;
  margin-bottom: 12px;
}

.race-filter-menu {
  position: relative;
  min-width: 0;
}

.race-filter-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
  color: #f5f7fb;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.race-filter-menu summary::-webkit-details-marker {
  display: none;
}

.race-filter-menu summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-filter-menu summary b {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #253956;
  color: #9cc7ff;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.3;
}

.race-filter-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  display: grid;
  gap: 6px;
  width: min(260px, 80vw);
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #111722;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  padding: 10px;
}

.race-filter-menu:not([open]) > .race-filter-options {
  display: none;
}

.race-filter-option {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  color: #dce5f4;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 800;
}

.race-filter-option:hover {
  background: #182131;
}

.race-risk-filter {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
  color: #f5f7fb;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 900;
}

.race-risk-filter span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-clear-button {
  width: 100%;
  padding: 8px 10px;
  font-size: 12px;
}

.filter-clear-all {
  min-height: 42px;
  padding: 9px 12px;
  white-space: nowrap;
}

.filter-clear-button:disabled,
.filter-clear-all:disabled {
  cursor: default;
  opacity: 0.45;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  background: #253956;
  color: #9cc7ff;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.scheduled-race {
  border: 1px solid #31425b;
  border-radius: 8px;
  background: #101722;
  padding: 16px;
  margin-bottom: 12px;
}

.scheduled-race h2 {
  margin: 10px 0 6px;
  font-size: 22px;
}

.scheduled-race p {
  margin: 6px 0 0;
}

.race-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.race-name-mode-toggle .name-language-button {
  min-width: 48px;
}

.current-time-block {
  min-width: 172px;
  border: 1px solid #dd805f;
  border-radius: 8px;
  background: #2b170d;
  box-shadow: 0 0 0 1px rgba(255, 159, 128, 0.18), 0 10px 28px rgba(230, 95, 47, 0.12);
  padding: 12px 14px;
  text-align: right;
}

.current-time-block span {
  display: block;
  margin-bottom: 4px;
  color: #ffbf9f;
  font-size: 12px;
  font-weight: 900;
}

.current-time-block strong {
  display: block;
  color: #fff4d6;
  font-size: 26px;
  line-height: 1.15;
}

.current-time-block em {
  display: block;
  margin-top: 4px;
  color: #ffcfb7;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

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

.adaptation-title-row {
  align-items: flex-start;
}

.adaptation-title-row .muted {
  margin: 6px 0 0;
}

.adaptation-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.adaptation-board[hidden] {
  display: none;
}

.adaptation-toggle-row {
  margin-top: 12px;
  justify-content: flex-end;
}

.adaptation-section {
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 13px;
}

.adaptation-section h3 {
  margin: 0 0 10px;
  color: #f5f7fb;
  font-size: 15px;
}

.adaptation-list {
  display: grid;
  gap: 8px;
}

.adaptation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
}

.adaptation-item span {
  color: #ccd5e4;
  font-size: 13px;
  line-height: 1.35;
}

.adaptation-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  min-width: 74px;
  border: 1px solid #3d4960;
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
}

.adaptation-confidence {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.adaptation-confidence-certain {
  background: #1b4a25;
  color: #b8f2bd;
}

.adaptation-confidence-suspected {
  background: #4d3f13;
  color: #f7d76b;
}

.adaptation-status-fit {
  border-color: #6fbf73;
  background: #132417;
  color: #a8e6ad;
}

.adaptation-status-possible {
  border-color: #d6b45c;
  background: #241f12;
  color: #f2d88a;
}

.adaptation-status-unfit {
  border-color: #ff9f80;
  background: #241610;
  color: #ffbf9f;
}

.adaptation-status-unknown {
  border-color: #3d4960;
  background: #151b27;
  color: #91a0b8;
}

.post-race-comment-card {
  border: 1px solid #6bd3c2;
  border-left-width: 5px;
  border-radius: 8px;
  background: #10211f;
  padding: 15px 16px;
}

.post-race-comment-card span {
  display: block;
  margin-bottom: 8px;
  color: #9ee7dc;
  font-size: 12px;
  font-weight: 900;
}

.post-race-comment-card p {
  margin: 0;
  color: #e4f7f3;
  line-height: 1.75;
}

.trainer-card-grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.trainer-card {
  min-height: 86px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 14px;
}

.trainer-card span,
.trainer-comment span {
  display: block;
  margin-bottom: 8px;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 900;
}

.trainer-card h2 {
  color: #fff4d6;
}

.trainer-card strong {
  color: #f5f7fb;
  font-size: 16px;
  line-height: 1.5;
}

.trainer-card-name {
  border-color: #d7a647;
  background: #201a10;
}

.trainer-card-basic {
  border-color: #5e8fd9;
  background: #111a2a;
}

.trainer-card-bloodline {
  border-color: #7dbb7a;
  background: #111f17;
}

.trainer-card-jockey {
  border-color: #b987d9;
  background: #1d1428;
}

.trainer-card-trainer {
  border-color: #6bd3c2;
  background: #10211f;
}

.trainer-comments {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.trainer-comments[hidden] {
  display: none;
}

.trainer-comments-toggle-row {
  margin-top: 10px;
  justify-content: flex-end;
}

.trainer-comment {
  border: 1px solid #30394e;
  border-left-width: 5px;
  border-radius: 8px;
  background: #0f131c;
  padding: 13px 14px;
}

.trainer-comment p {
  margin: 0;
  color: #dce5f4;
  line-height: 1.75;
}

.comment-tone-1 {
  border-color: #64b5f6;
  background: #101b29;
}

.comment-tone-2 {
  border-color: #81c784;
  background: #101f18;
}

.comment-tone-3 {
  border-color: #ffd166;
  background: #211d10;
}

.comment-tone-4 {
  border-color: #ba8ee8;
  background: #1d1529;
}

.comment-tone-5 {
  border-color: #ff9f80;
  background: #241610;
}

.comment-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: #ccd5e4;
  line-height: 1.8;
}

.notice {
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
  padding: 14px;
  margin-bottom: 12px;
}

.notice h2 {
  font-size: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-mobile-display-controls,
.history-card-list {
  display: none;
}

.history-card {
  display: grid;
  gap: 12px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 13px;
}

.history-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-card-kicker {
  display: block;
  margin-bottom: 5px;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 900;
}

.history-card h3 {
  margin: 0;
  color: #f5f7fb;
  font-size: 16px;
  line-height: 1.4;
}

.history-card-title-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.history-card-title-line h3 {
  min-width: 0;
}

.history-card-action[aria-expanded="true"] {
  border-color: #e65f2f;
  background: #2b170d;
  color: #ffbf9f;
}

.history-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.history-card-stats span {
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #111722;
  color: #dce5f4;
  padding: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.history-card-stats em {
  display: block;
  margin-top: 4px;
  color: #ffbf9f;
  font-style: normal;
}

.history-card-opponent {
  display: grid;
  gap: 4px;
  border-left: 4px solid #6bd3c2;
  background: #10211f;
  padding: 10px 12px;
}

.history-card-opponent span,
.history-card-opponent em,
.history-card-score {
  color: #91a0b8;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.history-card-opponent strong {
  color: #e4f7f3;
  line-height: 1.45;
}

.history-card-detail,
.history-card-score {
  margin: 0;
  color: #91a0b8;
  line-height: 1.55;
}

.history-card-comment {
  margin-top: 0;
}

.history-empty-card {
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  color: #91a0b8;
  padding: 14px;
}

th,
td {
  border-bottom: 1px solid #283042;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #91a0b8;
  font-size: 12px;
}

.reveal {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #283042;
}

.achievement-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.achievement-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.achievement-group {
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 12px;
}

.achievement-group h3 {
  margin: 0 0 9px;
  color: #d9e2f2;
  font-size: 14px;
}

.achievement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.achievement-chip {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border: 1px solid #3d4960;
  border-radius: 999px;
  background: #151b27;
  color: #dce5f4;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.achievement-chip-base {
  border-color: #dd805f;
  background: #2b170d;
  color: #ffbf9f;
}

.achievement-chip-combo {
  border-color: #d7a647;
  background: #201a10;
  color: #ffe09b;
}

.achievement-chip-repeat {
  border-color: #6bd3c2;
  background: #10211f;
  color: #9ee7dc;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat-grid span {
  display: block;
  border: 1px solid #30394e;
  border-radius: 6px;
  padding: 10px;
  color: #91a0b8;
}

.stat-grid b {
  color: #f5f7fb;
}

.aptitude-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.aptitude-grid h3 {
  margin: 0 0 8px;
  color: #d9e2f2;
  font-size: 15px;
}

.grade-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grade-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #30394e;
  border-radius: 6px;
  background: #0f131c;
  color: #b7c2d6;
  padding: 7px 9px;
  font-size: 13px;
}

.grade-chip b {
  color: #f5f7fb;
}

.grade-S b {
  color: #ffd166;
}

.grade-A b {
  color: #73d2ff;
}

.grade-B b {
  color: #8ee6a4;
}

.grade-C b {
  color: #ffb86b;
}

.grade-G b {
  color: #ff7b7b;
}

@media (max-width: 760px) {
  .data-load-notice {
    top: 76px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .app-shell.app-has-career #feedbackPanel {
    order: 1;
  }

  .app-shell.app-has-career #racePanel {
    order: 2;
  }

  .app-shell.app-has-career #historyPanel {
    order: 3;
  }

  .app-shell.app-has-career #horsePanel {
    order: 4;
  }

  .app-shell.app-has-career .setup-panel {
    order: 5;
  }

  button,
  input:not([type="checkbox"]):not([type="range"]),
  select {
    min-height: 44px;
  }

  .changelog-widget {
    position: static;
    width: min(1080px, calc(100% - 32px));
    margin: 14px auto 0;
  }

  .changelog-widget > div {
    max-width: none;
    width: 100%;
  }

  .changelog-widget small {
    display: block;
    width: 100%;
  }

  .changelog-panel {
    width: 100%;
    max-height: min(560px, calc(100vh - 120px));
  }

  .filter-checkbox {
    min-height: 40px;
    padding: 4px 0;
  }

  .filter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .icon-help-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .form-grid,
  .debug-grid,
  .sire-help-list-grid,
  .trainer-help-content,
  .trainer-card-grid,
  .adaptation-board,
  .achievement-board,
  .stat-grid,
  .aptitude-grid {
    grid-template-columns: 1fr;
  }

  .horse-head,
  .race-row,
  .race-panel-header,
  .setup-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-heading-line {
    align-items: flex-start;
  }

  .legend-mode-toggle {
    min-height: 40px;
  }

  .legend-intro-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .legend-intro-actions button {
    width: 100%;
  }

  #racePanel {
    padding: 16px;
  }

  #racePanel .race-panel-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
  }

  #racePanel .race-panel-header .eyebrow {
    margin: 0;
  }

  #racePanel .filter-row {
    gap: 6px;
    margin-bottom: 10px;
  }

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

  #racePanel .race-row .race-card-list,
  #racePanel .race-row #registerRaceBtn {
    grid-column: 1 / -1;
  }

  #racePanel > .muted {
    display: none;
  }

  .current-time-block {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    text-align: left;
  }

  .current-time-block strong {
    font-size: 22px;
  }

  #racePanel .current-time-block {
    width: auto;
    padding: 7px 9px;
    text-align: right;
  }

  #racePanel .current-time-block span {
    display: none;
  }

  #racePanel .current-time-block strong {
    font-size: 18px;
  }

  #racePanel .current-time-block em {
    overflow: hidden;
    margin-top: 2px;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .save-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .save-clear {
    width: 100%;
  }

  .filter-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .race-filter-menu summary,
  .race-risk-filter,
  .filter-clear-all {
    min-height: 36px;
    padding: 6px;
    font-size: 11px;
  }

  .race-filter-menu summary {
    gap: 4px;
  }

  .race-filter-menu summary b {
    display: none;
  }

  .race-risk-filter {
    gap: 5px;
  }

  .race-risk-filter input[type="checkbox"] {
    width: 16px;
    height: 16px;
  }

  .race-row .race-select {
    display: none;
  }

  .race-card-list {
    display: grid;
    gap: 8px;
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .race-plan-card {
    min-height: 76px;
    gap: 4px;
    padding: 9px 10px;
  }

  .race-plan-card strong {
    font-size: 14px;
    line-height: 1.25;
  }

  .race-plan-card span {
    font-size: 11px;
    line-height: 1.3;
  }

  .race-plan-card em {
    padding: 3px 7px;
    font-size: 10px;
  }

  .race-filter-options {
    position: static;
    width: 100%;
    margin-top: 6px;
  }

  .history-table-wrap {
    display: none;
  }

  .history-mobile-display-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
  }

  .history-mobile-display-controls > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    border: 1px solid #30394e;
    border-radius: 8px;
    background: #0f131c;
    padding: 4px 5px;
  }

  .history-mobile-display-controls > div > span {
    flex: 0 0 auto;
    color: #91a0b8;
    font-size: 10px;
    font-weight: 900;
  }

  .history-mobile-display-controls .name-language-toggle {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: 3px;
  }

  .history-mobile-display-controls .name-language-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 28px;
    padding: 3px 5px;
    font-size: 10px;
  }

  .history-card-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
  }

  #historyPanel {
    padding: 14px;
  }

  #historyPanel .section-title-row {
    min-height: 34px;
  }

  #historyPanel .history-record-summary {
    display: none;
  }

  .history-card {
    gap: 8px;
    padding: 10px;
  }

  .history-card-head {
    flex-direction: row;
  }

  .history-card-kicker {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .history-card h3 {
    font-size: 14px;
    line-height: 1.3;
  }

  .history-card-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .history-card-stats span {
    padding: 6px;
    font-size: 11px;
    line-height: 1.3;
  }

  .history-card-opponent {
    padding: 8px 10px;
  }

  .opponent-roster {
    grid-template-columns: 1fr;
  }

  .history-card-detail,
  .history-card-score {
    line-height: 1.45;
  }

  .primary,
  .help-toggle,
  .race-row button {
    width: 100%;
  }

  .filter-clear-all {
    width: 100%;
  }
}

/* Roguelike challenge mode */
.home-rogue-feature {
  position: relative;
  display: grid;
  min-height: 390px;
  overflow: hidden;
  border: 1px solid #52643f;
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 18%, rgba(179, 208, 112, 0.17), transparent 34%),
    linear-gradient(135deg, #1b241a, #171c27 62%);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

.home-rogue-feature h2,
.home-rogue-feature p {
  max-width: none;
}

.home-rogue-copy {
  position: relative;
  z-index: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.home-rogue-feature h2 {
  margin: 10px 0;
  color: #eef9d5;
  font-size: clamp(28px, 2.15vw, 34px);
  line-height: 1.22;
}

.home-rogue-copy > p:not(.home-save-note) {
  margin: 0;
  color: #bdc9b3;
  font-size: 13px;
  line-height: 1.65;
}

.home-rogue-kicker,
.home-rogue-actions,
.rogue-page-heading,
.rogue-heading-actions,
.rogue-final-actions,
.rogue-adaptation-actions,
.rogue-settlement-heading,
.rogue-settlement-challenge,
.rogue-vet-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-rogue-kicker span {
  border-radius: 999px;
  background: #b7d56e;
  color: #17200f;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
}

.home-rogue-kicker .eyebrow {
  margin: 0;
}

.home-rogue-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.home-rogue-actions button {
  width: 100%;
  min-height: 44px;
}

.home-rogue-action,
.rogue-select-candidate {
  background: #a7c861;
  color: #14200c;
}

.rogue-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  overflow-y: auto;
  background: #10131b;
  padding: 48px max(16px, calc((100vw - 1180px) / 2)) 32px;
}

.rogue-overlay[hidden] {
  display: none;
}

.rogue-panel {
  width: 100%;
  min-height: calc(100dvh - 112px);
}

.rogue-page-heading {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.rogue-page-heading h1,
.rogue-page-heading p,
.rogue-section h2,
.rogue-section p {
  margin-top: 0;
}

.rogue-balance {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  border: 1px solid #53643f;
  border-radius: 12px;
  background: #1b241a;
  padding: 12px 18px;
}

.rogue-balance strong {
  color: #cce994;
  font-size: 30px;
}

.rogue-store-shell {
  display: grid;
  gap: 14px;
}

.rogue-store-tabs,
.rogue-product-details,
.rogue-mobile-dock-balance,
.rogue-candidate-tabs,
.rogue-candidate-dock {
  display: none;
}

.rogue-store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #415137;
  border-radius: 14px;
  background:
    radial-gradient(circle at 86% 20%, rgba(179, 208, 112, 0.14), transparent 34%),
    linear-gradient(135deg, #1b241a, #171c27 62%);
  padding: 14px 18px;
}

.rogue-store-header h1 {
  margin: 4px 0 6px;
}

.rogue-store-header p {
  margin: 0;
}

.rogue-store-header > div:first-child > p:last-child {
  color: #aeb9ca;
  font-size: 13px;
}

.rogue-store-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 10px;
}

.rogue-store-header-actions > button {
  min-height: 44px;
}

.rogue-store-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rogue-store-steps li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  border: 1px solid #30394e;
  border-radius: 10px;
  background: #151a24;
  padding: 8px 11px;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 800;
}

.rogue-store-steps b {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #252d3d;
}

.rogue-store-steps .is-active {
  border-color: #53643f;
  background: #1b241a;
  color: #dff3b3;
}

.rogue-store-steps .is-active b {
  background: #a7c861;
  color: #14200c;
}

.rogue-store-section {
  border: 1px solid #30394e;
  border-radius: 14px;
  background: rgba(19, 24, 34, 0.72);
  padding: 16px;
}

.rogue-store-section.is-primary {
  border-color: #46563a;
  background: rgba(25, 33, 25, 0.7);
}

.rogue-store-section .section-title-row {
  margin-bottom: 12px;
}

.rogue-store-section h2 {
  margin: 3px 0 0;
  font-size: 21px;
}

.rogue-section {
  margin-top: 20px;
  border-top: 1px solid #30394e;
  padding-top: 20px;
}

.rogue-shop-grid,
.rogue-candidate-grid,
.rogue-challenge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rogue-shop-card,
.rogue-candidate-card,
.rogue-challenge-option,
.rogue-start-card,
.rogue-selected-summary,
.rogue-final-grid > div {
  border: 1px solid #30394e;
  border-radius: 12px;
  background: #171c27;
  padding: 16px;
}

.rogue-shop-card {
  display: grid;
  min-height: 118px;
  grid-template-columns: minmax(0, 1fr) 124px;
  align-items: end;
  gap: 6px;
  padding: 12px;
}

.rogue-consumable-card .rogue-product-heading {
  grid-column: 1 / -1;
}

.rogue-shop-card > div:not(.rogue-product-heading) {
  align-self: center;
}

.rogue-shop-card.is-owned {
  border-color: #53643f;
  background: #1b241a;
}

.rogue-consumable-card {
  border-color: #3f4d37;
  background: linear-gradient(145deg, #1b241a, #171c27 72%);
}

.rogue-product-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rogue-product-heading > strong {
  color: #cce994;
  font-size: 12px;
}

.rogue-product-details summary {
  cursor: pointer;
  color: #cce994;
  font-size: 11px;
  font-weight: 800;
}

.rogue-stock-type {
  background: #34452b;
  color: #dff3b3;
}

.rogue-shop-card p {
  color: #aeb9ca;
  font-size: 11px;
  line-height: 1.4;
}

.rogue-shop-card > button {
  grid-column: 2;
  width: 100%;
  min-height: 42px;
  padding: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.rogue-start-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-color: #53643f;
  background: linear-gradient(135deg, #1b241a, #171c27);
}

.rogue-start-card .eyebrow {
  margin: 0;
}

.rogue-start-card > button {
  min-width: 150px;
  min-height: 46px;
}

.rogue-shop-notice {
  min-height: 18px;
  margin: -4px 2px;
  color: #cce994;
  font-size: 12px;
  font-weight: 800;
}

.rogue-start-card h2,
.rogue-start-card p,
.rogue-shop-card h3,
.rogue-shop-card p,
.rogue-challenge-option h3 {
  margin: 4px 0;
}

.rogue-coin-pill {
  border: 1px solid #53643f;
  border-radius: 999px;
  background: #1b241a;
  color: #cce994;
  padding: 8px 12px;
  font-weight: 800;
}

.rogue-inventory-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.rogue-inventory-bar > span {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 7px;
  border: 1px solid #36412f;
  border-radius: 9px;
  background: #171f18;
  padding: 8px 9px;
}

.rogue-inventory-bar small {
  overflow: hidden;
  color: #aeb9ca;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rogue-inventory-bar b {
  color: #cce994;
  font-size: 13px;
}

.rogue-inventory-bar em {
  grid-column: 1 / -1;
  color: #d6a963;
  font-style: normal;
  font-size: 9px;
  font-weight: 900;
}

.rogue-inventory-bar .is-used {
  border-color: #554632;
  background: #211d18;
}

.rogue-inventory-disclosure > summary {
  display: none;
}

.rogue-inventory-disclosure > .rogue-inventory-bar {
  margin-bottom: 14px;
}

.rogue-candidate-note {
  margin: -4px 0 14px;
  color: #aeb9ca;
  font-size: 12px;
}

.rogue-shop-warning {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
  border-left: 3px solid #d6a963;
  background: #241f18;
  padding: 12px 14px;
}

.rogue-shop-warning span,
.rogue-candidate-heading em,
.rogue-vet-action span {
  color: #aeb9ca;
  font-style: normal;
  font-size: 12px;
}

.rogue-service-disclosure {
  margin-bottom: 16px;
  border: 1px solid #30394e;
  border-radius: 10px;
  background: #151b26;
  padding: 11px 14px;
}

.rogue-service-disclosure summary {
  cursor: pointer;
  color: #cce994;
  font-weight: 800;
}

.rogue-service-disclosure div {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rogue-service-disclosure p {
  margin: 0;
  color: #aeb9ca;
  font-size: 12px;
  line-height: 1.65;
}

.rogue-candidate-card {
  min-width: 0;
}

.rogue-candidate-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.rogue-candidate-heading > span {
  color: #a7c861;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.rogue-candidate-facts,
.rogue-progress-metrics,
.rogue-settlement-totals,
.rogue-final-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rogue-candidate-facts span,
.rogue-progress-metrics span,
.rogue-settlement-totals span,
.rogue-settlement-totals strong {
  display: grid;
  gap: 3px;
  border-radius: 8px;
  background: #111620;
  padding: 9px;
}

.rogue-candidate-facts small,
.rogue-progress-metrics small,
.rogue-final-grid span {
  color: #91a0b8;
  font-size: 11px;
}

.rogue-bloodline {
  margin-top: 9px;
  border: 1px solid #30394e;
  border-radius: 8px;
  padding: 9px 10px;
}

.rogue-bloodline-row {
  display: grid;
}

.rogue-bloodline summary {
  cursor: pointer;
}

.rogue-bloodline summary span {
  margin-right: 7px;
  color: #91a0b8;
}

.rogue-bloodline p {
  margin: 8px 0 0;
  color: #aeb9ca;
  font-size: 12px;
}

.rogue-comment-group {
  margin-top: 14px;
}

.rogue-comment-group.is-review {
  border-top: 1px dashed #53643f;
  padding-top: 12px;
}

.rogue-comment-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rogue-comment-group-heading .eyebrow {
  margin: 0;
}

.rogue-comment-group-heading button {
  display: none;
}

.rogue-comment {
  margin-top: 7px;
  border-left: 2px solid #53643f;
  background: #111620;
  padding: 8px 10px;
}

.rogue-comment span {
  color: #cce994;
  font-size: 11px;
  font-weight: 800;
}

.rogue-comment p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

.rogue-service-groups {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.rogue-item-use {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  background: #111620;
  padding: 8px;
}

.rogue-item-use > span {
  color: #91a0b8;
  font-size: 11px;
  font-weight: 800;
}

.rogue-item-use select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.rogue-item-use button {
  min-height: 38px;
  padding: 8px 11px;
}

.rogue-select-candidate {
  width: 100%;
  margin-top: 14px;
}

.rogue-selected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 16px;
}

.rogue-name-field {
  display: grid;
  gap: 7px;
  max-width: 520px;
  margin-top: 16px;
}

.rogue-adaptation-actions,
.rogue-final-actions {
  flex-wrap: wrap;
  margin-top: 14px;
}

.rogue-resolved {
  border-left: 3px solid #a7c861;
  background: #1b241a;
  padding: 12px 14px;
}

.rogue-challenge-option ol,
.rogue-progress-stages,
.rogue-achievement-payouts {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.rogue-challenge-option li,
.rogue-progress-stages li,
.rogue-achievement-payouts li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
  border-radius: 7px;
  background: #111620;
  padding: 8px;
  font-size: 12px;
}

.rogue-challenge-option li b {
  color: #d6a963;
}

.rogue-progress-stages li.is-complete {
  background: #1b2a1b;
}

.rogue-progress-stages li.is-failed {
  background: #2a1919;
  color: #d9a4a4;
}

.rogue-progress-stages em {
  color: #91a0b8;
  font-style: normal;
}

.rogue-progress-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rogue-badge {
  background: #40522c;
  color: #dff5ad;
}

.rogue-vet-action {
  justify-content: space-between;
  margin-top: 14px;
  border: 1px solid #53643f;
  border-radius: 10px;
  background: #1b241a;
  padding: 12px;
}

.rogue-vet-action div {
  display: grid;
  gap: 3px;
}

.rogue-settlement-heading,
.rogue-settlement-challenge {
  justify-content: space-between;
}

.rogue-total-income {
  color: #cce994;
  font-size: 30px;
}

.rogue-settlement-challenge {
  margin: 14px 0;
  border: 1px solid #53643f;
  border-radius: 10px;
  background: #1b241a;
  padding: 13px;
}

.rogue-settlement-challenge em {
  color: #cce994;
  font-style: normal;
  font-weight: 900;
}

.rogue-suppressed,
.rogue-invalid-note {
  display: grid;
  gap: 5px;
  border-radius: 8px;
  background: #241f18;
  padding: 12px;
  color: #d6c7ae;
}

.trainer-comment-group-title {
  margin: 12px 0 6px;
}

@media (max-width: 900px) {
  .rogue-shop-grid,
  .rogue-candidate-grid,
  .rogue-challenge-grid {
    grid-template-columns: 1fr;
  }

  .rogue-candidate-grid {
    max-width: 720px;
    margin-inline: auto;
  }

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

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

@media (max-width: 760px) {
  .home-rogue-feature {
    padding: 18px;
  }

  .rogue-overlay {
    top: 48px;
    padding: 10px;
  }

  .rogue-panel {
    min-height: calc(100dvh - 68px);
    padding: 14px;
  }

  .rogue-page-heading,
  .rogue-store-header,
  .rogue-store-header-actions,
  .rogue-start-card,
  .rogue-settlement-heading,
  .rogue-settlement-challenge,
  .rogue-vet-action {
    align-items: stretch;
    flex-direction: column;
  }

  .rogue-store-header-actions,
  .rogue-store-header-actions > button,
  .rogue-start-card > button {
    width: 100%;
  }

  .rogue-store-header {
    padding: 15px;
  }

  .rogue-store-section {
    padding: 12px;
  }

  .rogue-store-section .section-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .rogue-shop-card {
    display: flex;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .rogue-shop-card > button,
  .rogue-item-use button,
  .rogue-select-candidate,
  .rogue-adaptation-actions button {
    min-height: 44px;
  }

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

  .rogue-item-use {
    grid-template-columns: 1fr;
  }

  .rogue-item-use select,
  .rogue-item-use button {
    width: 100%;
  }

  .rogue-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rogue-candidate-facts,
  .rogue-final-grid,
  .rogue-settlement-totals {
    grid-template-columns: 1fr;
  }

  .rogue-progress-metrics {
    grid-template-columns: 1fr;
  }

  .rogue-challenge-option li,
  .rogue-progress-stages li {
    grid-template-columns: auto 1fr;
  }

  .rogue-progress-stages em {
    grid-column: 2;
  }

  .rogue-store-shell,
  .rogue-candidate-grid {
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .rogue-store-shell {
    gap: 9px;
  }

  .rogue-store-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 11px;
  }

  .rogue-store-header .eyebrow,
  .rogue-store-header > div:first-child > p:last-child,
  .rogue-start-card > div {
    display: none;
  }

  .rogue-store-header h1 {
    margin: 0;
    font-size: 22px;
  }

  .rogue-store-header-actions {
    display: grid;
    width: auto;
    grid-template-columns: auto auto;
    align-items: stretch;
    gap: 6px;
  }

  .rogue-store-header-actions > button {
    width: auto;
    min-height: 44px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .rogue-balance {
    display: grid;
    min-width: 58px;
    place-content: center;
    gap: 0;
    padding: 4px 8px;
    text-align: center;
  }

  .rogue-balance span {
    font-size: 9px;
  }

  .rogue-balance strong {
    font-size: 18px;
    line-height: 1;
  }

  .rogue-store-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .rogue-store-steps li {
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    font-size: 10px;
  }

  .rogue-store-steps b {
    width: 19px;
    height: 19px;
    font-size: 10px;
  }

  .rogue-store-tabs,
  .rogue-candidate-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    border-radius: 10px;
    background: #111620;
    padding: 4px;
  }

  .rogue-store-tabs button,
  .rogue-candidate-tabs button {
    min-height: 44px;
    border-color: transparent;
    background: transparent;
    color: #91a0b8;
    padding: 7px 9px;
  }

  .rogue-store-tabs button[aria-selected="true"],
  .rogue-candidate-tabs button[aria-selected="true"] {
    border-color: #53643f;
    background: #25311f;
    color: #dff3b3;
  }

  .rogue-store-section:not(.is-mobile-active) {
    display: none;
  }

  .rogue-store-section {
    padding: 9px;
  }

  .rogue-store-section .section-title-row {
    margin-bottom: 7px;
  }

  .rogue-store-section .section-title-row .eyebrow,
  .rogue-store-section .section-title-row .muted {
    display: none;
  }

  .rogue-store-section h2 {
    margin: 0;
    font-size: 17px;
  }

  .rogue-shop-grid {
    gap: 7px;
  }

  .rogue-shop-card {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 104px;
    align-items: center;
    gap: 4px 8px;
    padding: 9px 10px;
  }

  .rogue-shop-card .rogue-product-heading {
    grid-column: 1 / -1;
  }

  .rogue-shop-card h3 {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
  }

  .rogue-product-description {
    display: none;
  }

  .rogue-product-details {
    display: block;
    margin-top: 4px;
  }

  .rogue-product-details p {
    margin: 5px 0 0;
    font-size: 11px;
  }

  .rogue-shop-card > button {
    grid-column: 2;
    min-height: 44px;
    padding: 6px;
    font-size: 11px;
  }

  .rogue-start-card,
  .rogue-candidate-dock {
    position: fixed;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 90;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-color: #657c45;
    border-radius: 12px;
    background: rgba(23, 31, 24, 0.97);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.4);
    padding: 8px 10px;
    backdrop-filter: blur(12px);
  }

  .rogue-mobile-dock-balance,
  .rogue-candidate-dock > span {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: #aeb9ca;
    font-size: 11px;
    white-space: nowrap;
  }

  .rogue-mobile-dock-balance b,
  .rogue-candidate-dock > span b {
    color: #cce994;
    font-size: 18px;
  }

  .rogue-start-card > button,
  .rogue-candidate-dock > button {
    width: 100%;
    min-height: 44px;
  }

  .rogue-shop-notice {
    margin: 0 2px;
  }

  .rogue-page-heading {
    margin-bottom: 9px;
    gap: 8px;
  }

  .rogue-page-heading .eyebrow {
    margin-bottom: 3px;
  }

  .rogue-page-heading h1 {
    margin-bottom: 0;
    font-size: 21px;
    line-height: 1.25;
  }

  .rogue-heading-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px;
  }

  .rogue-heading-actions .rogue-coin-pill {
    display: grid;
    min-height: 44px;
    place-items: center;
    padding: 7px 10px;
    font-size: 11px;
  }

  .rogue-heading-actions button {
    min-height: 44px;
    padding: 7px 10px;
  }

  .rogue-inventory-disclosure {
    margin-bottom: 8px;
    border: 1px solid #36412f;
    border-radius: 9px;
    background: #171f18;
    padding: 0 9px;
  }

  .rogue-inventory-disclosure > summary {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    color: #aeb9ca;
    font-size: 11px;
  }

  .rogue-inventory-disclosure > summary strong {
    color: #cce994;
  }

  .rogue-inventory-disclosure > .rogue-inventory-bar {
    margin: 0 0 9px;
  }

  .rogue-candidate-note {
    margin: 0 1px 8px;
    font-size: 10px;
    line-height: 1.45;
  }

  .rogue-candidate-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 8px;
  }

  .rogue-candidate-tabs button {
    display: grid;
    gap: 1px;
    min-width: 0;
    padding-inline: 4px;
    font-size: 10px;
  }

  .rogue-candidate-tabs button strong {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rogue-candidate-card:not(.is-mobile-active) {
    display: none;
  }

  .rogue-candidate-card {
    padding: 11px;
  }

  .rogue-candidate-heading {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 8px;
  }

  .rogue-candidate-heading strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rogue-candidate-heading em {
    white-space: nowrap;
  }

  .rogue-candidate-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .rogue-candidate-facts span {
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 4px;
    padding: 6px;
  }

  .rogue-candidate-facts b {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rogue-bloodline-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .rogue-bloodline {
    min-width: 0;
    margin-top: 6px;
    padding: 7px;
  }

  .rogue-bloodline summary {
    display: grid;
    gap: 2px;
  }

  .rogue-bloodline summary strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rogue-bloodline p {
    margin-top: 5px;
    font-size: 10px;
    line-height: 1.45;
  }

  .rogue-comment-group {
    margin-top: 9px;
  }

  .rogue-comment-group.is-review {
    padding-top: 8px;
  }

  .rogue-comment-group-heading button {
    display: block;
    min-height: 36px;
    padding: 5px 8px;
    font-size: 10px;
  }

  .rogue-comment {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: baseline;
    gap: 7px;
    margin-top: 4px;
    padding: 6px 8px;
  }

  .rogue-comment p {
    overflow: hidden;
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rogue-comment-group.is-expanded .rogue-comment {
    align-items: start;
  }

  .rogue-comment-group.is-expanded .rogue-comment p {
    overflow: visible;
    white-space: normal;
  }

  .rogue-service-groups {
    gap: 6px;
    margin-top: 9px;
  }

  .rogue-item-use {
    grid-template-columns: 50px minmax(0, 1fr) 58px;
    gap: 5px;
    padding: 6px;
  }

  .rogue-item-use select,
  .rogue-item-use button {
    width: 100%;
    min-height: 44px;
    font-size: 11px;
  }

  .rogue-item-use button {
    padding-inline: 5px;
  }

  .rogue-card-select {
    display: none;
  }
}

@media (max-width: 360px) {
  .rogue-store-header {
    grid-template-columns: 1fr;
  }

  .rogue-store-header-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rogue-store-header h1 {
    font-size: 20px;
  }

  .rogue-shop-card {
    grid-template-columns: minmax(0, 1fr) 94px;
  }

  .rogue-item-use {
    grid-template-columns: 46px minmax(0, 1fr) 54px;
  }
}

/* Home screen and global release metadata */
.app-meta-widget {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 130;
}

.app-meta-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: 1px solid #3b465e;
  border-radius: 999px;
  background: rgba(18, 23, 34, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  padding: 7px 12px;
  backdrop-filter: blur(14px);
}

.app-meta-button:hover,
.app-meta-button:focus-visible {
  border-color: #dd805f;
  background: #20283a;
}

.app-meta-button strong {
  color: #ffbf9f;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.app-meta-button small {
  color: #9fb0cc;
  font-size: 11px;
  font-weight: 800;
}

.home-screen[hidden] {
  display: none !important;
}

.home-screen {
  display: grid;
  width: 100%;
  min-height: calc(100vh - 124px);
  gap: 14px;
  margin: 0 auto;
}

.home-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 18px;
}

.home-hero {
  position: relative;
  display: flex;
  min-height: 390px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid #3b465e;
  border-radius: 16px;
  background:
    radial-gradient(circle at 78% 18%, rgba(230, 95, 47, 0.18), transparent 32%),
    linear-gradient(145deg, #1b2130, #121722 68%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  padding: 28px;
}

.home-hero::after {
  position: absolute;
  right: -90px;
  bottom: -155px;
  width: 380px;
  height: 270px;
  border: 2px solid rgba(255, 159, 128, 0.16);
  border-radius: 50%;
  content: "";
  transform: rotate(-12deg);
}

.home-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  flex-direction: column;
  justify-content: flex-start;
}

.home-hero h1 {
  max-width: 620px;
  margin: 8px 0 16px;
  color: #fff4d6;
  font-size: clamp(30px, 2.15vw, 38px);
  line-height: 1.14;
  letter-spacing: -0.04em;
}

.home-lead {
  max-width: 680px;
  margin: 0;
  color: #aebad0;
  font-size: 13px;
  line-height: 1.65;
}

.home-primary-actions,
.home-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-primary-actions {
  margin-top: auto;
  padding-top: 20px;
}

.home-primary-actions button {
  min-width: 142px;
  min-height: 46px;
  font-weight: 900;
}

.home-save-note {
  margin: 12px 0 0;
  color: #91a0b8;
  font-size: 12px;
  font-weight: 800;
}

.home-play-card > span {
  color: #ff9f80;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.home-legend-feature {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 390px;
  gap: 18px;
  overflow: hidden;
  border: 1px solid #8e5138;
  border-radius: 16px;
  background:
    radial-gradient(circle at 87% 18%, rgba(255, 185, 112, 0.22), transparent 30%),
    linear-gradient(135deg, #321a16, #1d171c 58%, #161a24);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

.home-legend-feature::before {
  position: absolute;
  right: -60px;
  bottom: -115px;
  width: 330px;
  height: 220px;
  border: 1px solid rgba(255, 191, 131, 0.24);
  border-radius: 50%;
  content: "";
  transform: rotate(-10deg);
}

.home-legend-copy,
.home-legend-mark {
  position: relative;
  z-index: 1;
}

.home-legend-copy {
  display: flex;
  flex-direction: column;
}

.home-legend-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
}

.home-legend-kicker > span {
  border-radius: 999px;
  background: #ffbf83;
  color: #27130e;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.08em;
}

.home-legend-feature h2 {
  max-width: 580px;
  margin: 10px 0 10px;
  color: #fff0cf;
  font-size: clamp(28px, 2.15vw, 34px);
  line-height: 1.22;
}

.home-legend-copy > p {
  max-width: 730px;
  margin: 0;
  color: #d5bfb7;
  font-size: 13px;
  line-height: 1.65;
}

.home-legend-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.home-legend-facts span {
  border: 1px solid rgba(255, 191, 131, 0.3);
  border-radius: 999px;
  background: rgba(14, 17, 25, 0.42);
  color: #ffd0a8;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
}

.home-legend-action {
  align-self: flex-start;
  min-height: 44px;
  margin-top: auto;
  background: #d56a39;
  color: #fff7e9;
  padding: 10px 18px;
  font-weight: 900;
}

.home-legend-action:hover,
.home-legend-action:focus-visible {
  background: #eb7b47;
}

.home-legend-mark {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255, 191, 131, 0.24);
  color: #fff0cf;
  padding-top: 10px;
}

.home-legend-mark small {
  color: #d5a990;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.home-legend-mark strong {
  margin: -3px 0 -5px;
  color: #ffbf83;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  line-height: 1;
}

.home-legend-mark span {
  font-size: 14px;
  font-weight: 900;
}

.home-how-to {
  display: grid;
  grid-template-columns: minmax(210px, 0.7fr) minmax(0, 3fr);
  align-items: center;
  gap: 18px;
}

.home-section-heading h2 {
  margin: 5px 0 0;
  color: #f5f7fb;
  font-size: 24px;
}

.home-play-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-play-card {
  display: grid;
  min-height: 104px;
  grid-template-columns: 30px minmax(0, 1fr);
  align-content: center;
  gap: 4px 10px;
  border: 1px solid #283042;
  border-radius: 12px;
  background: #171c27;
  padding: 14px 16px;
}

.home-play-card > span {
  grid-row: 1 / 3;
  padding-top: 3px;
}

.home-play-card h3 {
  margin: 0;
  color: #fff4d6;
  font-size: 16px;
}

.home-play-card p {
  grid-column: 2;
  margin: 0;
  color: #9fb0cc;
  font-size: 12px;
  line-height: 1.55;
}

.home-support-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: stretch;
  gap: 12px;
}

.home-secondary-actions {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.home-secondary-actions button {
  width: 100%;
  min-width: 0;
  min-height: 48px;
}

.home-feedback-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, auto);
  align-items: center;
  gap: 20px;
  overflow: hidden;
  border: 1px solid #496174;
  border-radius: 14px;
  background:
    radial-gradient(circle at 90% 20%, rgba(111, 201, 218, 0.15), transparent 32%),
    linear-gradient(135deg, #17232d, #151a24 64%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
  padding: 16px 20px;
}

.home-feedback-card::before {
  position: absolute;
  top: -52px;
  right: 22%;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(126, 211, 224, 0.14);
  border-radius: 50%;
  content: "";
}

.home-feedback-copy,
.home-feedback-number {
  position: relative;
  z-index: 1;
}

.home-feedback-copy h2 {
  margin: 4px 0 5px;
  color: #edfaff;
  font-size: 20px;
}

.home-feedback-copy > p:last-child {
  max-width: 650px;
  margin: 0;
  color: #aebfd0;
  font-size: 13px;
  line-height: 1.5;
}

.home-feedback-number {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(126, 211, 224, 0.24);
  border-radius: 12px;
  background: rgba(10, 18, 25, 0.68);
  padding: 11px 12px;
}

.home-feedback-number > div {
  display: grid;
  min-width: 190px;
  gap: 3px;
}

.home-feedback-number span,
.home-feedback-number small {
  color: #8fa8b8;
  font-size: 10px;
  font-weight: 900;
}

.home-feedback-number strong {
  color: #9ee7ee;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1.2;
  user-select: all;
}

.home-feedback-number button {
  flex: 0 0 auto;
  min-height: 42px;
  background: #2d7b88;
  color: #f4ffff;
  padding: 9px 14px;
  font-weight: 900;
}

.home-feedback-number button:hover,
.home-feedback-number button:focus-visible {
  background: #3593a2;
}

.home-screen .site-footer {
  align-self: end;
  border-top: 1px solid #283042;
  padding: 10px 16px 0;
}

@media (max-width: 1080px) {
  .home-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-hero {
    grid-column: 1 / -1;
  }

  .home-how-to,
  .home-support-row {
    grid-template-columns: 1fr;
  }

  .home-hero,
  .home-legend-feature,
  .home-rogue-feature {
    min-height: 0;
  }

  .home-secondary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
}

.setup-overlay {
  width: min(1080px, 100%);
  margin: 0 auto;
}

@media (max-width: 760px) {
  .app-meta-widget {
    top: 8px;
    left: 8px;
  }

  .app-meta-button {
    min-height: 36px;
    gap: 7px;
    padding: 5px 9px;
  }

  .app-meta-button strong {
    font-size: 11px;
  }

  .app-meta-button small {
    font-size: 9px;
  }

  .app-shell {
    padding-top: 54px;
  }

  .app-shell.app-has-career {
    padding-top: 0;
  }

  .home-screen {
    width: calc(100% - 20px);
    min-height: calc(100vh - 70px);
    gap: 12px;
  }

  .home-mode-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .home-hero {
    grid-column: auto;
    min-height: 0;
    border-radius: 14px;
    padding: 22px 16px;
  }

  .home-hero h1 {
    font-size: clamp(30px, 9.6vw, 40px);
  }

  .home-lead {
    font-size: 14px;
    line-height: 1.7;
  }

  .home-primary-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 20px;
  }

  .home-primary-actions button {
    width: 100%;
    min-height: 44px;
  }

  .home-legend-feature {
    min-height: 0;
    gap: 16px;
    padding: 22px 16px 18px;
  }

  .home-rogue-feature {
    padding: 22px 16px 18px;
  }

  .home-legend-feature h2 {
    font-size: 26px;
  }

  .home-rogue-feature h2 {
    font-size: 26px;
  }

  .home-legend-copy > p {
    font-size: 13px;
    line-height: 1.65;
  }

  .home-legend-facts {
    margin-top: 12px;
  }

  .home-legend-mark {
    display: flex;
    min-height: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border-top: 1px solid rgba(255, 191, 131, 0.24);
    padding-top: 12px;
  }

  .home-legend-mark strong {
    margin: -3px 0 -5px;
    font-size: 42px;
  }

  .home-legend-mark span {
    font-size: 14px;
  }

  .home-legend-action {
    width: 100%;
    min-height: 44px;
  }

  .home-how-to {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-section-heading h2 {
    font-size: 20px;
  }

  .home-play-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .home-play-card {
    min-height: 0;
    padding: 14px;
  }

  .home-play-card h3 {
    margin: 0;
  }

  .home-support-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-secondary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }

  .home-secondary-actions button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .home-feedback-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 16px;
  }

  .home-feedback-copy h2 {
    font-size: 21px;
  }

  .home-feedback-number {
    align-items: stretch;
    flex-direction: column;
  }

  .home-feedback-number > div {
    min-width: 0;
  }

  .home-feedback-number strong {
    font-size: clamp(24px, 8vw, 30px);
    letter-spacing: 0.04em;
  }

  .home-feedback-number button {
    width: 100%;
    min-height: 44px;
  }

  .home-screen .site-footer {
    padding: 12px 10px 2px;
  }

  .setup-overlay,
  .app-has-career .setup-overlay {
    top: 48px;
  }

  .workspace-shell {
    height: 100dvh;
    padding-top: 48px;
  }

  .workspace-layout {
    height: calc(100dvh - 116px);
  }

  .workspace-content,
  .workspace-shell:not([data-active-view="action"]) .workspace-content {
    height: calc(100dvh - 180px);
  }

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

  .workspace-nav-button {
    font-size: 10px;
  }
}

/* Career workspace */
.app-shell {
  width: min(1360px, calc(100% - 40px));
  padding-top: 76px;
}

.workspace-shell[hidden],
.workspace-view[hidden],
.setup-overlay[hidden],
.race-result-overlay[hidden],
.workspace-drawer[hidden],
.workspace-aside[hidden] {
  display: none !important;
}

.setup-overlay {
  position: relative;
}

.app-has-career .setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow-y: auto;
  background: rgba(7, 9, 14, 0.88);
  padding: 32px 20px;
  backdrop-filter: blur(10px);
}

.app-has-career .setup-panel {
  width: min(1080px, 100%);
  margin: 0 auto;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
}

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

.workspace-status {
  position: sticky;
  top: 12px;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(120px, auto);
  align-items: center;
  gap: 20px;
  min-height: 74px;
  margin-bottom: 16px;
  border: 1px solid #3b465e;
  border-radius: 12px;
  background: rgba(18, 23, 34, 0.96);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34);
  padding: 12px 16px;
  backdrop-filter: blur(14px);
}

.workspace-status-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.workspace-status-label,
.workspace-status-facts small {
  color: #91a0b8;
  font-size: 11px;
  font-weight: 900;
}

.workspace-status-identity strong {
  overflow: hidden;
  color: #fff4d6;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-status-identity .badge {
  padding: 4px 8px;
  font-size: 10px;
}

.workspace-status-facts {
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-status-facts > span {
  display: grid;
  min-width: 116px;
  gap: 2px;
  border-left: 1px solid #30394e;
  padding: 2px 14px;
}

.workspace-status-facts b {
  color: #f5f7fb;
  font-size: 13px;
}

.workspace-status-save {
  justify-self: end;
  border-radius: 999px;
  background: #10211f;
  color: #9ee7dc;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.workspace-nav {
  position: sticky;
  top: 102px;
  display: grid;
  gap: 7px;
  border: 1px solid #283042;
  border-radius: 12px;
  background: #151a24;
  padding: 8px;
}

.workspace-nav-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  min-height: 46px;
  background: transparent;
  color: #aebad0;
  padding: 10px 12px;
  text-align: left;
}

.workspace-nav-button:hover,
.workspace-nav-button:focus-visible {
  background: #20283a;
  color: #f5f7fb;
}

.workspace-nav-button.is-active {
  background: #64351f;
  color: #fff4d6;
  box-shadow: inset 3px 0 0 #ff9f80;
}

.workspace-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  color: #ff9f80;
  font-size: 13px;
}

.workspace-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 16px;
  min-width: 0;
}

.workspace-shell:not([data-active-view="action"]) .workspace-content {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-primary,
.workspace-aside {
  min-width: 0;
}

.workspace-primary > .panel,
.horse-view > .panel,
.workspace-aside > .panel {
  margin-bottom: 16px;
  border-radius: 12px;
}

.workspace-aside {
  position: sticky;
  top: 102px;
  max-height: calc(100vh - 118px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.workspace-aside .panel {
  padding: 16px;
}

#racePanel .filter-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#racePanel .race-risk-filter {
  grid-column: 1 / span 3;
}

#racePanel .filter-clear-all {
  grid-column: 4 / span 2;
}

.summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.summary-heading h2 {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-link {
  flex: 0 0 auto;
  padding: 7px 9px;
  font-size: 11px;
}

.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.summary-stat-grid span,
.compact-adaptation-list span {
  display: grid;
  min-width: 0;
  gap: 4px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 9px;
}

.summary-stat-grid small,
.compact-adaptation-list small,
.race-result-facts small {
  color: #91a0b8;
  font-size: 10px;
  font-weight: 900;
}

.summary-stat-grid b,
.compact-adaptation-list b {
  overflow: hidden;
  color: #e8edf5;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-stat-wide {
  grid-column: 1 / -1;
}

.compact-adaptation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.compact-adaptation-list .adaptation-status {
  justify-self: start;
  padding: 3px 6px;
  font-size: 10px;
}

.workspace-aside .rogue-challenge-hint {
  overflow: hidden;
  padding: 0;
}

.rogue-challenge-hint-button {
  display: grid;
  width: 100%;
  min-height: 72px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 10px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, #1b241a, #171c27);
  padding: 12px 14px;
  text-align: left;
}

.rogue-challenge-hint-button > span {
  display: grid;
  min-width: 0;
  grid-row: 1 / 3;
  gap: 4px;
}

.rogue-challenge-hint-button small {
  color: #91a0b8;
  font-size: 10px;
  font-weight: 900;
}

.rogue-challenge-hint-button strong {
  overflow: hidden;
  color: #fff4d6;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rogue-challenge-hint-button > b {
  border-radius: 999px;
  background: #40522c;
  color: #dff5ad;
  padding: 4px 7px;
  font-size: 10px;
  white-space: nowrap;
}

.rogue-challenge-hint-button > em {
  justify-self: end;
  color: #aeb9ca;
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
}

.rogue-challenge-page {
  width: min(900px, 100%);
  margin-inline: auto;
}

.rogue-veterinarian-panel .rogue-vet-action {
  margin-top: 0;
}

.last-race-panel .post-race-comment-card {
  margin-top: 10px;
  padding: 12px;
}

.last-race-panel .post-race-comment-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.more-panel {
  display: grid;
  gap: 18px;
}

.more-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.more-action {
  display: grid;
  justify-items: start;
  min-height: 110px;
  gap: 6px;
  border: 1px solid #30394e;
  background: #0f131c;
  padding: 16px;
  text-align: left;
}

.more-action strong {
  color: #f5f7fb;
  font-size: 16px;
}

.more-action span {
  color: #91a0b8;
  font-size: 12px;
  line-height: 1.5;
}

.workspace-save-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #30394e;
  border-radius: 10px;
  background: #111722;
  padding: 16px;
}

.workspace-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
  margin: 0;
  border: 0;
  border-left: 1px solid #3d4960;
  border-radius: 0;
  background: #151a24;
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.5);
  padding: 0;
}

.workspace-drawer::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(7, 9, 14, 0.66);
  content: "";
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #30394e;
  padding: 18px 20px;
}

.drawer-scroll {
  height: calc(100vh - 82px);
  overflow-y: auto;
  padding: 20px;
}

body.drawer-open,
body.result-open {
  overflow: hidden;
}

body.has-career .changelog-widget > div {
  display: none;
}

.changelog-panel:not([hidden]) {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  z-index: 95;
  width: min(520px, calc(100vw - 32px));
  max-height: none;
  margin: 0;
  border-radius: 0;
  padding: 20px;
}

.sire-help-panel:not([hidden]),
.dam-help-panel:not([hidden]),
.trainer-help-panel:not([hidden]) {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 95;
  width: min(620px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 48px));
  overflow-y: auto;
  margin: 0;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.54);
  transform: translate(-50%, -50%);
}

.race-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgba(7, 9, 14, 0.76);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.race-result-dialog {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid #4b5873;
  border-radius: 14px;
  background: #171c27;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
  padding: 22px;
}

.race-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.race-result-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  font-size: 22px;
}

.race-result-rank {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 12px;
  border: 1px solid #dd805f;
  border-radius: 10px;
  background: #2b170d;
  padding: 16px;
}

.race-result-rank span {
  color: #ffbf9f;
  font-size: 12px;
  font-weight: 900;
}

.race-result-rank strong {
  color: #fff4d6;
  font-size: 30px;
}

.race-result-rank em {
  color: #ffcfb7;
  font-style: normal;
  font-weight: 800;
}

.race-result-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.race-result-facts span {
  display: grid;
  gap: 4px;
  border: 1px solid #30394e;
  border-radius: 8px;
  background: #0f131c;
  padding: 10px;
}

.race-result-facts b {
  overflow: hidden;
  color: #e8edf5;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-result-comment {
  margin-top: 12px;
}

.race-result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 760px) {
  body.has-career {
    overflow: hidden;
  }

  body.has-career .site-footer {
    display: none;
  }

  .app-shell,
  .app-shell.app-has-career {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .workspace-shell {
    height: 100dvh;
    overflow: hidden;
  }

  .workspace-status {
    position: relative;
    top: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    height: 68px;
    min-height: 68px;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    padding: 8px 12px;
  }

  .workspace-status-identity {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 6px;
  }

  .workspace-status-label {
    grid-column: 1 / -1;
    font-size: 9px;
  }

  .workspace-status-identity strong {
    font-size: 16px;
  }

  .workspace-status-facts {
    gap: 4px;
  }

  .workspace-status-facts > span {
    min-width: 0;
    border: 0;
    padding: 2px 5px;
    text-align: right;
  }

  .workspace-status-facts > span:nth-child(3) {
    display: none;
  }

  .workspace-status-facts small {
    font-size: 8px;
  }

  .workspace-status-facts b {
    max-width: 84px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-status-save {
    display: none;
  }

  .workspace-layout {
    display: block;
    height: calc(100dvh - 68px);
  }

  .workspace-nav {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    height: 64px;
    border-width: 1px 0 0;
    border-radius: 0;
    background: rgba(18, 23, 34, 0.98);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    backdrop-filter: blur(14px);
  }

  .workspace-nav-button {
    flex-direction: column;
    justify-content: center;
    min-height: 54px;
    gap: 2px;
    border-radius: 8px;
    padding: 4px;
    font-size: 11px;
  }

  .workspace-nav-button.is-active {
    box-shadow: inset 0 3px 0 #ff9f80;
  }

  .workspace-nav-icon {
    height: 20px;
    font-size: 12px;
  }

  .workspace-content,
  .workspace-shell:not([data-active-view="action"]) .workspace-content {
    display: block;
    height: calc(100dvh - 132px);
    overflow: hidden;
  }

  .workspace-primary {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 10px 24px;
    scroll-padding-top: 10px;
  }

  .workspace-aside {
    display: none !important;
  }

  .workspace-primary > .panel,
  .horse-view > .panel {
    margin-bottom: 10px;
    border-radius: 10px;
  }

  #racePanel,
  #historyPanel,
  #horsePanel,
  #feedbackPanel,
  #morePanel {
    padding: 12px;
  }

  #racePanel .race-panel-header {
    position: sticky;
    top: -10px;
    z-index: 8;
    margin: -2px -2px 8px;
    background: #171c27;
    padding: 4px 2px 7px;
  }

  #racePanel .filter-row {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  #racePanel .filter-row::-webkit-scrollbar {
    display: none;
  }

  #racePanel .race-filter-menu,
  #racePanel .race-risk-filter,
  #racePanel .filter-clear-all {
    flex: 0 0 auto;
    width: auto;
  }

  #racePanel .race-filter-menu summary,
  #racePanel .race-risk-filter,
  #racePanel .filter-clear-all {
    min-height: 36px;
    white-space: nowrap;
  }

  #racePanel .race-filter-options {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: 72px;
    left: 8px;
    z-index: 75;
    width: auto;
    max-height: min(60vh, 440px);
    overflow-y: auto;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.58);
  }

  #racePanel .race-card-list {
    max-height: min(210px, 28vh);
  }

  #racePanel .race-row {
    align-items: stretch;
  }

  #racePanel .race-row button:not(.race-plan-card) {
    min-height: 42px;
  }

  .trainer-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .trainer-card {
    min-height: 70px;
    padding: 10px;
  }

  .trainer-card-bloodline {
    grid-column: 1 / -1;
  }

  .trainer-card span,
  .trainer-comment span {
    margin-bottom: 5px;
    font-size: 10px;
  }

  .trainer-card strong,
  .trainer-card h2 {
    font-size: 13px;
  }

  .adaptation-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .adaptation-section {
    padding: 9px;
  }

  .adaptation-section h3 {
    font-size: 12px;
  }

  #historyPanel .section-title-row {
    position: sticky;
    top: -10px;
    z-index: 7;
    background: #171c27;
    padding: 7px 0;
  }

  .more-action-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .more-action {
    min-height: 76px;
    padding: 12px;
  }

  .workspace-save-card {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-overlay,
  .app-has-career .setup-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    overflow-y: auto;
    background: #10131b;
    padding: 10px;
  }

  .setup-panel {
    padding: 14px;
  }

  .setup-title-actions {
    width: 100%;
  }

  .setup-title-actions button {
    flex: 1 1 0;
  }

  .workspace-drawer,
  .changelog-panel:not([hidden]) {
    width: 100vw;
    max-width: none;
    border-left: 0;
  }

  .drawer-scroll {
    padding: 14px;
  }

  .sire-help-panel:not([hidden]),
  .dam-help-panel:not([hidden]),
  .trainer-help-panel:not([hidden]) {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: 76vh;
    border-radius: 14px;
    transform: none;
  }

  .race-result-overlay {
    align-items: end;
    padding: 0;
  }

  .race-result-dialog {
    width: 100%;
    max-height: 88dvh;
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .race-result-rank {
    margin: 12px 0 8px;
    padding: 12px;
  }

  .race-result-rank strong {
    font-size: 25px;
  }

  .race-result-facts {
    gap: 5px;
  }

  .race-result-facts span {
    padding: 8px;
  }

  .race-result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Combined action and career history */
.workspace-content {
  display: block;
}

.action-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 16px;
}

.action-main-column {
  min-width: 0;
}

.action-main-column > .panel {
  margin-bottom: 16px;
  border-radius: 12px;
}

[data-action-anchor] {
  scroll-margin-top: 112px;
}

.history-index-header {
  width: 88px;
}

.history-comment-toggle.history-card-action {
  width: 30px;
  height: 30px;
  min-width: 30px;
  margin: 0;
  padding: 0;
  font-size: 11px;
}

@media (max-width: 760px) {
  .action-overview-grid {
    display: block;
  }

  .action-main-column > .panel {
    margin-bottom: 10px;
    border-radius: 10px;
  }

  [data-action-anchor] {
    scroll-margin-top: 0;
  }

  .history-comment-toggle.history-card-action,
  .history-card-title-line .history-card-action {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 11px;
  }
}

/* Keep global metadata clear of the final mobile workspace rules above. */
@media (max-width: 760px) {
  .home-how-to,
  .home-play-grid,
  .home-play-card {
    width: 100%;
    min-width: 0;
  }

  .app-shell {
    padding-top: 54px;
  }

  .app-shell.app-has-career {
    padding-top: 0;
  }

  .setup-overlay,
  .app-has-career .setup-overlay {
    top: 48px;
  }

  .workspace-shell {
    height: 100dvh;
    padding-top: 48px;
  }

  .workspace-layout {
    height: calc(100dvh - 116px);
  }

  .workspace-content,
  .workspace-shell:not([data-active-view="action"]) .workspace-content {
    height: calc(100dvh - 180px);
  }

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

  .workspace-shell.is-rogue-career .workspace-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .workspace-nav-button {
    font-size: 10px;
  }

  .rogue-challenge-hint {
    display: none !important;
  }

  #rogueChallengePanel,
  #rogueVeterinarianPanel {
    padding: 12px;
  }

  #rogueChallengePanel .rogue-progress-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #rogueChallengePanel .rogue-progress-metrics span {
    min-width: 0;
    padding: 8px;
  }

  #rogueChallengePanel .rogue-progress-metrics b {
    overflow-wrap: anywhere;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .workspace-shell.is-rogue-career .workspace-nav-button {
    gap: 1px;
    padding-inline: 2px;
    font-size: 9px;
  }

  .workspace-shell.is-rogue-career .workspace-nav-icon {
    font-size: 11px;
  }
}
