/* Responsive presentation for the original Progress Knight. No remote CSS. */
:root {
  color-scheme: light;
  --page: #f3f3f3;
  --panel: #ffffff;
  --panel-soft: #f6f7f8;
  --text: #24282d;
  --muted: #5c626c;
  --border: #d1d6dd;
  --button: #f9fafb;
  --button-hover: #e4e9ef;
  --focus: #006ba8;
  --link: #146294;
  --danger: #a32131;
  --gold: #8b5a0c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: auto;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
}
button,
input,
textarea {
  font: inherit;
}
button,
summary,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}
button,
input,
textarea,
summary {
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[hidden],
.hidden,
.hiddenTask {
  display: none !important;
}
p,
h1,
h2,
h3,
h4,
dl {
  margin: 0;
}
h1 {
  font-size: clamp(1.65rem, 3.2vw, 2.15rem);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin-bottom: 0.4rem;
}
h3 {
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
}
h4 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}
a {
  color: var(--link);
}
.muted,
.section-help {
  color: var(--muted);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.mobile-only {
  display: none;
}
.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
  z-index: 10;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border: 2px solid var(--focus);
}
.skip-link:focus {
  top: 0.5rem;
}

.game-shell {
  width: min(100%, 1360px);
  margin-inline: auto;
  padding: clamp(0.75rem, 2.2vw, 1.5rem);
}
.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 0.75rem;
}
.edition-label {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  font-weight: 650;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.game-intro {
  max-width: 29rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.save-status {
  padding: 0.55rem 0.8rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 0.83rem;
  overflow-wrap: anywhere;
}
.save-status:empty {
  display: none;
}
.game-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "character navigation" "character content";
  gap: 1rem;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  min-width: 0;
}
.character-panel {
  grid-area: character;
  display: grid;
  gap: 1.2rem;
  padding: 1rem;
}
.stat-heading {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.age-line {
  font-size: 1.1rem;
}
.age-line strong {
  font-size: 1.5rem;
}
.day-label {
  color: var(--muted);
  margin-left: 0.65rem;
  font-size: 0.88rem;
  white-space: nowrap;
}
.character-age > .muted,
.character-mood .muted,
.time-warp .muted {
  font-size: 0.8rem;
}
.character-controls {
  display: flex;
  align-items: start;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.automation-controls {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
}
.automation-controls label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 32px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #1f7bb4;
  flex-shrink: 0;
}
.balance {
  min-height: 1.7rem;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.coin-value {
  font-variant-numeric: tabular-nums;
}
.coin-value > span {
  white-space: nowrap;
}
.coin-value > span:nth-child(1) {
  color: #236b7a !important;
}
.coin-value > span:nth-child(2) {
  color: #806000 !important;
}
.coin-value > span:nth-child(3) {
  color: #555e6a !important;
}
.coin-value > span:nth-child(4) {
  color: #8f4c26 !important;
}
.money-breakdown {
  font-size: 0.82rem;
  display: grid;
  gap: 0.3rem;
}
.money-breakdown > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 0.4rem;
}
.money-breakdown dt {
  color: var(--muted);
}
.money-breakdown dd {
  margin: 0;
}
#signDisplay {
  color: inherit !important;
}
.skill-heading {
  margin-top: 0.65rem;
}
.stat-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.5rem;
  font-size: 0.95rem;
}
.secondary-stat {
  margin-top: 0.65rem;
}
.time-warp .button {
  margin-top: 0.5rem;
}
.death-notice {
  grid-column: 1 / -1;
  padding: 0.8rem;
  border: 1px solid var(--danger);
  border-radius: 3px;
  color: var(--danger);
  font-size: 0.85rem;
}
.death-notice p {
  margin-top: 0.3rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--button);
  color: var(--text);
  line-height: 1.35;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}
.button:hover:not(:disabled) {
  background: var(--button-hover);
}
.danger-button {
  color: var(--danger);
  border-color: var(--danger);
}
.game-nav {
  grid-area: navigation;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.3rem;
}
.tabButton {
  flex: 1 1 65px;
  min-height: 44px;
  padding: 0.6rem 0.65rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-align: center;
}
.tabButton:hover {
  color: var(--text);
  background: var(--button-hover);
}
.tabButton.w3-blue-gray {
  background: #435b69;
  color: #fff;
}
.content-panel {
  grid-area: content;
  padding: 1rem;
}
.section-help {
  font-size: 0.83rem;
  margin-bottom: 1rem;
  max-width: 45rem;
}
.tab {
  display: none;
}
.game-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.85rem;
}
.game-table th,
.game-table td {
  padding: 0.6rem 0.45rem;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.game-table th {
  font-size: 0.75rem;
  font-weight: 650;
}
.game-table .task-name-cell {
  width: 32%;
  min-width: 170px;
}
.game-table .task-row,
.game-table .item-row {
  border-bottom: 1px solid var(--border);
}
.game-table td:not(:first-child) {
  font-variant-numeric: tabular-nums;
}
.headerRow {
  color: #fff;
}
.headerRow.Commonwork {
  background: #36711e !important;
}
.headerRow.Military {
  background: #b52535 !important;
}
.headerRow.TheArcaneAssociation {
  background: #a91170 !important;
}
.headerRow.Fundamentals {
  background: #4a4e69 !important;
}
.headerRow.Combat {
  background: #a93620 !important;
}
.headerRow.Magic {
  background: #754c87 !important;
}
.headerRow.Darkmagic {
  background: #73000f !important;
}
.headerRow.Properties {
  background: #126d85 !important;
}
.headerRow.Misc {
  background: #864453 !important;
}
.progress-bar {
  position: relative;
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #286490;
  border-radius: 3px;
  background: #153c5a;
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.3;
  text-align: left;
}
.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  max-width: 100%;
  background: #195e91;
  pointer-events: none;
}
.progress-fill.current {
  background: #85580b;
}
.progress-text {
  position: relative;
  display: block;
  padding: 0.65rem 0.65rem;
  color: #fff;
  font-weight: 600;
  overflow-wrap: anywhere;
}
button.progress-bar:hover {
  border-color: #81bddf;
}
button.progress-bar[aria-pressed="true"] {
  outline: 2px solid #bd8527;
  outline-offset: -2px;
}
button.progress-bar:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.quick-task .progress-bar {
  cursor: default;
  min-height: 37px;
}
.quick-task .progress-text {
  padding: 0.55rem 0.6rem;
  font-size: 0.8rem;
}
.task-help {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.76rem;
}
.task-help summary {
  cursor: pointer;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 0.2rem 0.15rem;
  color: var(--link);
}
.task-help .tooltipText {
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 0.2rem 0 0.3rem;
  overflow-wrap: anywhere;
}
.task-help[open] {
  padding-bottom: 0.2rem;
}
.skip-skill-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
}
.item-button {
  width: 100%;
}
.active-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
}
.active {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}
.requirement-cell {
  padding: 0.65rem 0.5rem 1.2rem !important;
  color: var(--muted);
  font-size: 0.8rem;
}
.requirement-cell .evil {
  color: var(--danger);
}
.story-list {
  padding-left: 1.25rem;
  margin: 1rem 0 0;
}
.story-list li {
  padding-left: 0.2rem;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
}
.story-list p {
  margin-bottom: 0.75rem;
}
.rebirth-explanation {
  color: var(--muted);
}
.settings-group {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}
.settings-group p {
  font-size: 0.87rem;
  max-width: 48rem;
  margin-bottom: 0.8rem;
}
.field-label {
  display: block;
  margin: 0.8rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
}
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  resize: vertical;
  min-height: 100px;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--page);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
}
#saveTextHelp {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.recovery-panel,
.reset-confirmation {
  padding: 1rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-soft);
}
.reset-confirmation {
  border-color: var(--danger);
}
.game-credit {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}
.game-credit span {
  display: inline-block;
}

@media (max-width: 1050px) {
  .game-layout {
    grid-template-columns: 225px minmax(0, 1fr);
    gap: 0.75rem;
  }
  .character-panel,
  .content-panel {
    padding: 0.8rem;
  }
  .game-table {
    font-size: 0.8rem;
  }
  .game-table th,
  .game-table td {
    padding-inline: 0.3rem;
  }
  .game-table .task-name-cell {
    min-width: 145px;
  }
}

@media (max-width: 960px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "character" "navigation" "content";
    grid-template-rows: auto auto 1fr;
  }
  .character-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
  .character-controls {
    grid-column: 1;
    grid-row: 2;
  }
  .character-money {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .quick-task {
    grid-column: 3;
    grid-row: 1 / 3;
  }
  .character-mood {
    grid-column: 1 / 3;
    display: flex;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
    align-items: baseline;
  }
  .character-mood .stat-line {
    gap: 0.65rem;
  }
  .character-mood .secondary-stat {
    margin-top: 0;
  }
  .game-nav {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 2px 0 var(--page);
  }
}

@media (max-width: 700px) {
  .game-shell {
    padding: 0.75rem;
  }
  .game-heading {
    display: block;
    padding-bottom: 0.65rem;
  }
  .game-intro {
    margin-top: 0.5rem;
    font-size: 0.82rem;
  }
  .save-status {
    margin-bottom: 0.75rem;
    font-size: 0.76rem;
    padding: 0.45rem 0.6rem;
  }
  .character-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }
  .character-age {
    grid-column: 1;
    grid-row: 1;
  }
  .character-controls {
    grid-column: 1;
    grid-row: 2;
  }
  .character-money {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .quick-task {
    grid-column: 1 / -1;
    grid-row: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.65rem;
  }
  .quick-task .stat-heading:first-child {
    grid-column: 1;
    grid-row: 1;
  }
  .quick-task .job {
    grid-column: 1;
    grid-row: 2;
  }
  .quick-task .skill-heading {
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }
  .quick-task .skill {
    grid-column: 2;
    grid-row: 2;
  }
  .character-mood {
    grid-column: 1 / -1;
    font-size: 0.8rem;
  }
  .character-mood .stat-line {
    font-size: 0.85rem;
  }
  .time-warp {
    grid-column: 1 / -1;
  }
  .game-nav {
    gap: 0;
    padding: 0.2rem;
  }
  .tabButton {
    flex-basis: 54px;
    padding: 0.6rem 0.35rem;
    font-size: 0.8rem;
  }
  .content-panel {
    padding: 0.75rem;
  }
  .section-help {
    margin-bottom: 0.8rem;
    font-size: 0.8rem;
  }
  .mobile-only {
    display: inline;
  }
  .game-table,
  .game-table tbody {
    display: block;
  }
  .game-table .headerRow {
    display: block;
    margin-top: 1rem;
    border-radius: 3px;
  }
  .game-table .headerRow:first-of-type {
    margin-top: 0;
  }
  .game-table .headerRow th {
    display: none !important;
  }
  .game-table .headerRow .category {
    display: block !important;
    padding: 0.6rem 0.65rem;
    font-size: 0.86rem;
  }
  .game-table .task-row,
  .game-table .item-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 0.9rem;
    padding: 0.85rem 0.2rem;
  }
  .game-table td {
    display: block;
    padding: 0;
    min-width: 0;
    font-size: 0.85rem;
  }
  .game-table .task-name-cell {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .game-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 500;
  }
  .task-help {
    font-size: 0.8rem;
  }
  .task-help summary {
    min-height: 32px;
  }
  .task-help .tooltipText {
    max-width: none;
  }
  .game-table .requiredRow {
    display: block;
  }
  .game-table .requirement-cell {
    padding: 0.65rem 0.2rem 1rem !important;
  }
  .game-table .skipSkill {
    min-height: 0;
  }
  .story-list {
    padding-left: 1rem;
  }
  .story-list li {
    font-size: 0.85rem;
  }
  .recovery-panel,
  .reset-confirmation {
    padding: 0.7rem;
  }
}

@media (max-width: 370px) {
  .game-shell {
    padding: 0.5rem;
  }
  .character-panel {
    padding: 0.65rem;
    gap: 0.75rem 0.5rem;
  }
  .age-line {
    font-size: 0.95rem;
  }
  .day-label {
    margin-left: 0.3rem;
    font-size: 0.8rem;
  }
  .balance {
    font-size: 1.15rem;
  }
  .money-breakdown {
    font-size: 0.75rem;
  }
}
