/* Rose & Sword · The quiet manor. Local type, vellum, ink and aged brass. */
:root,
body,
body[data-theme="rose"] {
  --bg: #eeece5;
  --ink: #273641;
  --muted: #657078;
  --line: #a18c6840;
  --rose: #946e75;
  --rose-dark: #77545d;
  --gold: #756345;
  --glass: #f8f5eef0;
  --soft: #e7dfe0;
  --paper: #f8f5ee;
  --paper-deep: #eae5da;
  --accent: #536a7a;
  --accent-dark: #3d5262;
  --accent-soft: #e1e7e8;
  --garden: #626f5b;
  --card-line: #a18c6850;
  --serif: LocalSerif, 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Noto Serif SC', Georgia, serif;
}

body[data-theme="ivory"] {
  --bg: #f1eee6;
  --paper: #fcf9f1;
  --paper-deep: #ece7da;
  --rose: #806762;
  --rose-dark: #765c58;
  --accent: #7a6f59;
  --accent-dark: #665b47;
  --accent-soft: #e9e5da;
  --gold: #786647;
}

body[data-theme="moon"] {
  --bg: #e9ebee;
  --paper: #f3f4f6;
  --paper-deep: #e1e4eb;
  --ink: #303848;
  --muted: #666d7e;
  --rose: #8b7f95;
  --rose-dark: #6c607a;
  --accent: #63738c;
  --accent-dark: #495d7b;
  --accent-soft: #e0e5ef;
  --line: #78819440;
  --card-line: #78819450;
  --gold: #6c667d;
}

body[data-theme="royal"] {
  --bg: #eee9de;
  --paper: #f8f3e7;
  --paper-deep: #e9e0cb;
  --rose: #94746b;
  --rose-dark: #75574e;
  --accent: #80724f;
  --accent-dark: #645535;
  --accent-soft: #e8dfc6;
  --gold: #786239;
  --line: #98804d48;
  --card-line: #98804d58;
}

* { scrollbar-width: thin; scrollbar-color: #a49f934a transparent; }
*::-webkit-scrollbar { display: block; width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: #a49f9366; border-radius: 6px; }
body {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.ambient {
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, #62717b03 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 5px, #94866b03 5px 6px),
    linear-gradient(110deg, #f6f3ebaa, transparent 45%, #dfe3e426);
}
button { font-weight: 500; }
button:disabled { opacity: .48; cursor: not-allowed; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 4px;
}
button:not(:disabled), a, input, select { transition: color .16s ease, background-color .16s ease, border-color .16s ease; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; }
h1 { font-size: 30px; line-height: 1.4; letter-spacing: 3px; }
h2 { letter-spacing: 1.2px; }
h3 { letter-spacing: .6px; }
.eyebrow, .dialog-eyebrow {
  color: var(--gold);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 9px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 2.1px;
}
.eyebrow { margin-bottom: 6px; }

/* Navigation and the compact estate ledger. */
.site-header {
  max-width: 1440px;
  padding: 21px 40px 19px;
  gap: 24px;
}
.brand { gap: 12px; }
.brand img { width: 34px; height: 43px; opacity: .8; }
.brand strong { color: var(--ink); font: 600 23px/1.45 var(--serif); letter-spacing: 5px; }
.brand small { color: var(--gold); font-size: 8px; letter-spacing: 3.2px; }
.glass-nav {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--card-line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px #fff4;
}
.glass-nav button {
  min-height: 44px;
  padding: 8px 19px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .8px;
}
.glass-nav button svg { display: none; }
.glass-nav button:not(:disabled):hover { color: var(--accent-dark); background: var(--accent-soft); }
.glass-nav .active, .glass-nav .active:not(:disabled):hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: #536a7a30;
  box-shadow: none;
}
.profile-button {
  min-width: 0;
  max-width: 180px;
  padding: 6px 4px 6px 11px;
  color: var(--ink);
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}
.profile-button #header-name { min-width: 0; max-width: 115px; }
.tiny-flower { color: var(--rose); font-size: 21px; }
.arrow { color: var(--gold); }
.status-bar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 0 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}
.connection:before { width: 5px; height: 5px; margin-right: 8px; background: #778771; box-shadow: none; }
.connection.offline:before { background: var(--rose); }
.resources { align-items: center; gap: 17px; }
.resources #date-small { color: var(--muted); }
.resource {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 1px 0 1px 14px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.resource:before { color: var(--gold); margin-right: 6px; }
#energy-small:before { content: '✧'; color: var(--garden); }
#coins-small:before { content: '◇'; }
main { max-width: 1360px; margin: 0 auto; padding: 26px 0 20px; min-height: 0; }
.page-heading { margin-bottom: 24px; align-items: center; }
.page-heading > div { min-width: 0; }
.season-caption { padding: 6px 0; color: var(--muted); font-size: 12px; letter-spacing: 1px; white-space: nowrap; }
.season-caption:before { content: '◇'; color: var(--gold); margin-right: 9px; }
.home-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 250px; align-items: start; gap: 28px; }
.home-grid > *, .activity-top > div, .activity-bottom > div { min-width: 0; }
.growth-column { grid-column: auto; }

/* Eleanor, framed as a portrait in the manor, never as a cut-out card. */
.character { display: block; min-width: 0; }
.portrait-wrap {
  position: relative;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--card-line);
  border-radius: 86px 86px 4px 4px;
  background: var(--paper-deep);
  box-shadow: none;
}
.portrait-wrap:before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid #f8f5ee99;
  border-radius: 78px 78px 1px 1px;
  background: linear-gradient(180deg, #f2eee535, #ecece260), url('/assets/scene-garden-v3.png') center / cover;
  opacity: .72;
  pointer-events: none;
}
.portrait-wrap:after {
  inset: 7px;
  border: 1px solid #fdfaf17a;
  border-radius: 78px 78px 1px 1px;
  box-shadow: inset 0 0 24px #f8f5ee70;
  pointer-events: none;
}
.portrait-interaction {
  display: block;
  position: relative;
  width: 100%;
  min-height: 0;
  height: 440px;
  padding: 22px 1px 0;
  border: 0;
  border-radius: 78px 78px 1px 1px;
  overflow: hidden;
  background: transparent;
  line-height: 0;
}
.portrait-wrap .portrait-interaction img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 5px 7px #37434c13);
  transition: transform .25s ease;
}
.portrait-interaction:not(:disabled):hover img { transform: translateY(-2px); }
.portrait-interaction:focus-visible { outline-offset: -3px; }
.portrait-tag {
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 9px;
  border: 0;
  border-radius: 0;
  background: #f8f5eedb;
  color: var(--accent-dark);
  font: 8px/1.3 Georgia, serif;
  letter-spacing: 2.2px;
  pointer-events: none;
}
.character-caption {
  position: relative;
  margin: -1px 0 0;
  padding: 15px 10px 12px;
  border: 1px solid var(--card-line);
  border-top-color: var(--line);
  border-radius: 0 0 4px 4px;
  background: var(--paper);
  box-shadow: inset 0 0 0 4px #fff4;
  text-align: center;
}
.character-caption h2 { color: var(--ink); font-size: 23px; line-height: 1.45; letter-spacing: 2px; overflow-wrap: anywhere; }
.character-caption span { color: var(--gold); font-size: 8px; line-height: 1.7; letter-spacing: 2.2px; }
.character-details { padding: 13px 0 4px; justify-content: center; gap: 11px; color: var(--muted); font-size: 10px; flex-wrap: wrap; }
.character-details i { color: var(--gold); }
.character-speech {
  position: relative;
  display: block;
  width: 100%;
  margin: 10px 0 0;
  min-height: 70px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: #f8f5ee90;
  font: 12px/1.8 var(--serif);
  text-align: left;
}
.character-speech:before { content: none; }
.character-speech:not(:disabled):hover { border-color: var(--rose); background: var(--paper); }
.speaker { display: block; color: var(--rose-dark); font: 10px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif; letter-spacing: 1px; margin-bottom: 4px; }
.character-actions { gap: 15px; margin-top: 4px; justify-content: center; flex-wrap: wrap; }
.text-link { min-height: 44px; padding: 5px 1px; font-size: 11px; color: var(--accent-dark); }
.text-link:not(:disabled):hover { color: var(--rose-dark); text-decoration: underline; text-underline-offset: 4px; }
.character-actions .text-link { min-height: 44px; font-size: 11px; }

/* The day is a readable ledger: scene, time, choices, then clear costs. */
.section-title { margin-bottom: 12px; gap: 10px; }
.section-title h2 { font-size: 22px; line-height: 1.4; }
.small-label { color: var(--muted); font-size: 10px; letter-spacing: .2px; }
.time-card {
  min-height: 63px;
  margin-bottom: 15px;
  padding: 12px 17px;
  border: 1px solid var(--card-line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: none;
}
.day-number { color: var(--accent-dark); font: 29px/1 Georgia, serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.day-number > span { color: var(--gold); font: 9px/1.5 Georgia, serif; letter-spacing: 1px; padding-right: 6px; }
.day-number .small-label { font-size: 10px; }
.time-slots { gap: 12px; align-items: center; }
.time-slot { font-size: 10px; color: #687170; gap: 4px; white-space: nowrap; }
.time-slot:before { content: '◇'; font-size: 12px; }
.time-slot.current { color: var(--accent-dark); font-weight: 600; }
.time-slot.current:before { content: '◆'; font-size: 9px; }
.time-slot.done { color: var(--garden); }
.time-slot.done:before { content: '✓'; font-size: 10px; }
.scene-card {
  display: grid;
  grid-template-columns: 44% minmax(0, 1fr);
  min-height: 138px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--card-line);
  border-radius: 4px;
  background: var(--paper);
}
.scene-art { position: relative; min-width: 0; min-height: 138px; overflow: hidden; background: var(--paper-deep); }
.scene-art:after { content: ''; position: absolute; inset: 0; border-right: 1px solid var(--line); background: #ede9df0c; pointer-events: none; }
.scene-art img { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center 55%; }
.scene-copy { align-self: center; min-width: 0; padding: 15px 17px; }
.scene-copy .eyebrow { font-size: 8px; letter-spacing: 1.8px; margin-bottom: 7px; }
.scene-copy h3 { margin: 0 0 7px; color: var(--ink); font-size: 19px; line-height: 1.5; }
.scene-copy p { color: var(--muted); font-size: 11px; line-height: 1.85; }
.route-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 15px;
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.route-tabs button {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 46px;
  padding: 8px 6px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .6px;
}
.route-tabs button:not(:disabled):hover { color: var(--accent-dark); background: #536a7a08; }
.route-tabs .active { color: var(--accent-dark); background: transparent; box-shadow: none; }
.route-tabs .active:after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 2px; background: var(--accent); }
.route-tabs svg { width: 16px; height: 16px; stroke-width: 1.3; vertical-align: -3px; margin-right: 6px; }
.activity-list { gap: 12px; }
.home-grid .activity-list > .activity-card:nth-child(n+3) { display: block; }
.activity-card, .home-grid .activity-card {
  padding: 15px 16px 13px;
  border: 1px solid var(--card-line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: none;
  transition: border-color .16s ease, background-color .16s ease;
}
.activity-card:hover { transform: none; border-color: var(--accent); background: #faf8f2; }
.activity-top { gap: 12px; align-items: flex-start; }
.activity-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 3px 3px;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}
.activity-icon svg { width: 21px; height: 21px; stroke-width: 1.2; }
.activity-card h3, .home-grid .activity-card h3 { color: var(--ink); font-size: 17px; line-height: 1.55; margin-top: 0; }
.activity-card p, .home-grid .activity-card p { color: var(--muted); font-size: 11px; line-height: 1.8; margin-top: 4px; }
.activity-kind { display: block; margin: 0 0 2px; color: var(--gold); font-size: 9px; line-height: 1.5; letter-spacing: .6px; }
.activity-bottom, .home-grid .activity-bottom { gap: 10px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.gain-tags { gap: 5px; color: var(--accent-dark); font-size: 10px; line-height: 1.7; }
.gain-tags span { display: inline-block; padding: 1px 5px; border: 1px solid #536a7a24; border-radius: 2px; color: var(--accent-dark); background: var(--accent-soft); }
.gain-tags .gain-negative { color: var(--rose-dark) !important; border-color: #946e7533; background: #ede1e1; }
.activity-costs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.activity-costs > span { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.activity-costs svg { width: 12px; height: 12px; color: var(--gold); stroke-width: 1.3; }
.activity-costs .cost-energy svg { color: var(--garden); }
.cost-line { color: var(--muted); font-size: 10px; line-height: 1.7; margin-top: 5px; }
.arrange-button {
  --arrange-fill: color-mix(in srgb, var(--accent-soft) 40%, var(--paper));
  --arrange-line: color-mix(in srgb, var(--accent) 45%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  position: relative;
  width: auto;
  min-width: 54px;
  min-height: 30px;
  padding: 3px 8px;
  border: 1px solid var(--arrange-line);
  border-radius: 3px;
  color: var(--accent-dark);
  background: var(--arrange-fill);
  box-shadow: none;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: .3px;
}
.arrange-button:not(:disabled):hover { --arrange-line: var(--accent); --arrange-fill: var(--accent-soft); }
.arrange-button:not(:disabled):active { transform: translateY(1px); }
.arrange-button:disabled { --arrange-line: var(--line); --arrange-fill: var(--paper-deep); color: var(--muted); opacity: .85; }
.all-schedules { margin-top: 9px; }
.all-schedules button { min-height: 44px; padding: 6px 12px; border: 0; border-radius: 2px; color: var(--accent-dark); background: transparent; font-size: 11px; letter-spacing: .5px; }
.all-schedules button:not(:disabled):hover { background: var(--accent-soft); }

/* Eight readable, clickable abilities, each opening its related courses. */
.ability-panel {
  display: block;
  padding: 19px 17px 17px;
  border: 1px solid var(--card-line);
  border-radius: 4px;
  background: var(--paper);
  box-shadow: inset 0 0 0 4px #fff3;
}
.ability-heading > .eyebrow { font-size: 8px; letter-spacing: 1.5px; }
.ability-panel h2 { color: var(--ink); font-size: 20px; line-height: 1.5; margin-bottom: 4px; }
.ability-sub { margin-bottom: 8px; padding-bottom: 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.home-grid .ability-bars { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.ability-row, .home-grid .ability-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 9px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 47px;
  margin: 0;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
}
.ability-row:not(:disabled):hover { background: var(--accent-soft); border-color: #536a7a26; }
.stat-icon { color: var(--accent); display: grid; place-items: center; }
.stat-icon svg { width: 21px; height: 21px; stroke-width: 1.15; }
.ability-content { display: block; min-width: 0; }
.ability-label { display: flex; gap: 6px; align-items: center; justify-content: space-between; margin-bottom: 5px; color: var(--ink); font-size: 11px; font-weight: 500; line-height: 1.3; letter-spacing: 1px; }
.ability-value { color: var(--accent-dark); font: 14px/1 Georgia, serif; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.stat-chevron { color: var(--gold); font-size: 13px; line-height: 1; }
.meter { display: block; width: 100%; height: 3px; overflow: hidden; border: 0; border-radius: 0; background: #d8d7cd; box-shadow: none; }
.meter > span, .ability-row:nth-of-type(3n) .meter > span, .ability-row:nth-of-type(3n+1) .meter > span { min-width: 2px; border-radius: 0; background: var(--accent); }
.meter > span:after { content: none; }
.track-section { grid-column: auto; grid-row: auto; margin-top: 17px; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); }
.track-section .eyebrow { margin-bottom: 9px; font-size: 8px; letter-spacing: 1.6px; }
.skill-profile-link { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; margin: -7px 0 11px; padding: 8px 0; color: var(--accent-dark); font-size: 11px; border-bottom: 1px solid var(--line); text-align: left; }
.skill-profile-link svg { width: 15px; height: 15px; }
.skill-profile-link:not(:disabled):hover { color: var(--rose-dark); }
.track { margin: 6px 0; color: var(--muted); font-size: 10px; }
.track b { color: var(--accent-dark); font: 14px Georgia, serif; }
.rest-button {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 6px;
  border: 1px solid #68756166;
  border-radius: 3px;
  color: #4f614b;
  background: #e5e9de;
  box-shadow: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .5px;
}
.rest-button small { margin-left: 6px; font-size: 10px; }
.rest-button:not(:disabled):hover { border-color: #687561; background: #dce3d3; }
.end-note { margin-top: 10px; color: var(--muted); font-size: 9px; line-height: 1.8; letter-spacing: 0; }
.chapter-strip { margin-top: 27px; padding: 17px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: none; gap: 18px; }
.chapter-strip p { color: var(--muted); font: 13px/1.9 var(--serif); letter-spacing: .3px; }
.chapter-strip svg { color: var(--gold); width: 24px; height: 24px; }
.chapter-strip .text-link { font-size: 10px; }
.site-footer { max-width: 1360px; margin: 0 auto; padding: 15px 0 22px; color: var(--muted); font-size: 9px; letter-spacing: 1px; }
.site-footer button { min-height: 44px; color: var(--muted); font-size: 10px; }

/* Shared paper controls and all secondary pages. */
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 18px; border-radius: 3px; font-size: 12px; font-weight: 500; letter-spacing: .7px; text-align: center; }
.primary { color: #fffdf5; background: var(--accent); border: 1px solid var(--accent); box-shadow: none; }
.primary:not(:disabled):hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary { color: var(--accent-dark); background: var(--paper); border: 1px solid var(--card-line); box-shadow: none; }
.secondary:not(:disabled):hover { background: var(--accent-soft); border-color: var(--accent); }
.pending-banner { padding: 16px 20px; margin-bottom: 24px; border: 1px solid #946e7560; border-radius: 4px; background: #ebe2df; box-shadow: none; }
.pending-banner h3 { color: var(--rose-dark); font-size: 18px; }
.pending-banner p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.ending-panel { padding: 29px; margin-bottom: 24px; border: 1px solid var(--card-line); border-radius: 4px; background: var(--paper); box-shadow: inset 0 0 0 5px #a18c680a; }
.ending-panel p { color: var(--muted); }
.loading-state, .empty-state { color: var(--muted); padding: 70px 20px; }
.loading-flower { color: var(--gold); }
.loading-state p { color: var(--accent-dark); }
.empty-state h3 { font-size: 20px; }
.empty-state p { margin-top: 9px; font-size: 12px; }
.error-panel { padding: 65px 20px; }
.error-panel p { color: var(--muted); }
.journal-layout { grid-template-columns: 265px minmax(0, 1fr); gap: 32px; }
.journal-intro, .journal-entry, .board-shell { background: var(--paper); border: 1px solid var(--card-line); border-radius: 4px; box-shadow: none; }
.journal-intro { padding: 23px; }
.journal-intro .large-number { color: var(--accent); font: 64px/1.5 Georgia, serif; }
.journal-intro p { color: var(--muted); font-size: 13px; }
.journal-intro .meter { margin: 20px 0 12px; }
.journal-list { gap: 13px; min-width: 0; }
.journal-entry { padding: 20px 24px; }
.journal-entry time { color: var(--gold); font-size: 10px; letter-spacing: .7px; }
.journal-entry h3 { margin-top: 5px; font-size: 19px; }
.journal-entry p { color: var(--muted); font-size: 12px; line-height: 1.95; }
.board-shell { max-width: 930px; padding: 25px 30px; }
.board-toolbar { gap: 16px; }
.board-toolbar .route-tabs { border: 0; margin-bottom: 0; }
.board-toolbar .route-tabs button { min-height: 44px; padding: 9px 15px; }
.board-toolbar .route-tabs .active { background: var(--accent-soft); }
.board-toolbar .route-tabs .active:after { content: none; }
.board-count, .rank-join p, .board-foot { color: var(--muted); }
.ranking-row { grid-template-columns: 60px minmax(0, 1fr) 80px; padding: 19px 10px; border-color: var(--line); }
.ranking-row.you { border: 0; border-radius: 3px; background: var(--accent-soft); }
.ranking-row .rank { color: var(--gold); font-size: 23px; }
.ranking-row .name { min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.ranking-row .score { color: var(--accent-dark); font-size: 21px; }
.ranking-row small { color: var(--rose-dark); }
.rank-join { border-color: var(--line); padding-top: 22px; }
.rank-join strong { color: var(--ink); font-size: 18px; }
.board-foot { font-size: 10px; line-height: 1.9; }
.shop-intro { max-width: 1150px; margin-bottom: 24px; }
.shop-intro p { color: var(--muted); font-size: 14px; }
.payment-status { color: var(--gold); border: 1px solid var(--line); border-radius: 3px; padding: 7px 12px; background: var(--paper); font-size: 10px; }
.shop-grid { max-width: 1150px; gap: 24px; }
.product, .product:nth-child(2), .product:nth-child(3) { padding: 27px 25px 23px; border: 1px solid var(--card-line); border-radius: 60px 60px 4px 4px; background: var(--paper); box-shadow: none; }
.product:nth-child(2) { background: #eef0f4; }
.product:nth-child(3) { background: #f0e9d8; }
.product .eyebrow { font-size: 8px; letter-spacing: 1.8px; }
.product-art { height: 145px; margin-bottom: 13px; }
.product-art:before { width: 113px; height: 113px; border: 1px solid var(--line); border-radius: 50%; background: transparent; box-shadow: 0 0 0 6px #fff4, 0 0 0 7px #a18c6820; }
.product-art svg { color: var(--rose); width: 61px; height: 61px; stroke-width: 1; }
.product:nth-child(2) .product-art svg { color: #71809a; }
.product:nth-child(3) .product-art svg { color: #927a49; }
.product h3 { margin: 8px 0 11px; font-size: 23px; }
.product p { color: var(--muted); font-size: 12px; }
.product .price { color: var(--accent-dark); font-size: 29px; margin-top: 20px; }
.product small { color: var(--muted); }
.product .primary { min-width: 145px; }
.shop-note { max-width: 960px; color: var(--muted); font-size: 11px; line-height: 2; }
.theme-choices { margin-top: 25px; gap: 9px; }
.theme-choices button { min-height: 44px; padding: 8px 13px; border: 1px solid var(--card-line); border-radius: 3px; color: var(--muted); background: var(--paper); font-size: 11px; }
.theme-choices .active { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }

/* Dialogues share the same paper and portrait language. */
dialog {
  width: min(660px, calc(100% - 40px));
  max-height: calc(100dvh - 40px);
  padding: 34px;
  overflow: auto;
  border: 1px solid var(--card-line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 70px #2736412e, inset 0 0 0 5px #fff3;
}
dialog::backdrop { background: #27364166; backdrop-filter: blur(3px); }
.close-button { top: 10px; right: 10px; width: 44px; height: 44px; border: 1px solid transparent; border-radius: 3px; color: var(--muted); font-size: 25px; }
.close-button:not(:disabled):hover { color: var(--ink); border-color: var(--line); background: var(--accent-soft); }
dialog h2 { padding-right: 15px; font-size: 25px; line-height: 1.5; }
.dialog-eyebrow { margin-bottom: 11px; padding-right: 20px; }
.dialog-text { margin: 21px 0 25px; color: var(--muted); font: 15px/2.1 var(--serif); }
.dialog-actions { gap: 10px; margin-top: 25px; }
.dialog-ornament { color: var(--gold); font-size: 30px; }
.dialog-character-strip { display: flex; align-items: center; gap: 13px; margin: 0 24px 23px 0; padding: 0 0 15px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
.portrait-avatar { display: block; flex: 0 0 52px; width: 52px; height: 60px; border: 1px solid var(--card-line); border-radius: 23px 23px 3px 3px; background: var(--paper-deep); }
.dialog-character-strip > div { min-width: 0; }
.dialog-character-strip p { color: var(--muted); font: 12px/1.8 var(--serif); }
.dialog-character-strip .speaker { margin-bottom: 2px; }
.talk-topics { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.talk-topic { min-height: 44px; padding: 9px 13px; border: 1px solid var(--card-line); border-radius: 3px; color: var(--muted); background: transparent; font-size: 12px; }
.talk-topic:not(:disabled):hover, .talk-topic.active { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }
.event-choices { gap: 11px; margin-top: 24px; }
.event-choice { min-height: 80px; padding: 15px 17px; border: 1px solid var(--card-line); border-radius: 3px; color: var(--ink); background: #fffaf280; box-shadow: none; }
.event-choice strong { color: var(--ink); font: 600 17px/1.6 var(--serif); }
.event-choice small { color: var(--muted); font-size: 11px; line-height: 1.8; }
.event-choice:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.result-gains { gap: 12px 20px; padding: 20px 0; }
.result-gains span { color: var(--accent-dark); font-size: 19px; }
.result-scene { margin: -1px -1px 23px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-deep); }
.result-scene img { display: block; width: 100%; height: 115px; object-fit: cover; object-position: center 57%; }
.field { color: var(--muted); font-size: 12px; }
.field input, .search-input, .catalog-stat-picker select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--card-line); border-radius: 3px; color: var(--ink); background: #fffdf7; font-size: 12px; }
.field input::placeholder, .search-input::placeholder { color: #7d827f; }
.profile-layout { grid-template-columns: 135px minmax(0, 1fr); gap: 22px; margin: 24px 0; }
.profile-layout img { display: block; width: 100%; max-height: 235px; padding: 7px; border: 1px solid var(--card-line); border-radius: 38px 38px 3px 3px; background: var(--paper-deep); object-fit: contain; object-position: center top; }
.profile-layout p { color: var(--muted); font-size: 13px; line-height: 2; }
.traits { flex-wrap: wrap; gap: 6px; }
.traits span { padding: 3px 7px; border: 1px solid #946e7533; border-radius: 2px; color: var(--rose-dark); background: #946e7509; font-size: 10px; }
.help-list { padding-top: 8px; }
.help-list summary { min-height: 44px; padding: 10px 0; color: var(--accent-dark); cursor: pointer; }
.help-list p { color: var(--muted); line-height: 1.95; }
.help-list strong { color: var(--ink); font-weight: 600; }
.dialog-card-preview { width: 240px; max-width: 80%; margin: 23px auto; border: 1px solid var(--card-line); border-radius: 3px; box-shadow: 0 5px 20px #27364115; }
.standalone-note { padding: 10px 0; color: var(--muted); font-size: 11px; line-height: 1.9; }
.core-skill-grid, .skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.skill-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: #fff8; font-size: 11px; }
.skill-item b { color: var(--accent-dark); font: 14px Georgia, serif; }
.skill-item strong { color: var(--accent-dark); font-size: 12px; font-weight: 500; }
.skill-item small { display: block; color: var(--muted); font-size: 10px; }
.skill-item.unlearned { background: transparent; border-style: dashed; color: var(--muted); }
.profile-skills { padding-top: 13px; border-top: 1px solid var(--line); margin-top: 20px; }
.profile-skills h3 { font-size: 18px; margin-bottom: 6px; }
.profile-skills > p { color: var(--muted); font-size: 11px; line-height: 1.8; }

/* Course catalogue and ability detail sheet. */
.catalog-filters { display: grid; gap: 12px; margin: 18px 0 14px; }
.catalog-route-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog-route-tabs button { flex: 1; min-height: 44px; padding: 8px 10px; border: 1px solid var(--card-line); border-radius: 3px; color: var(--muted); background: transparent; font-size: 12px; white-space: nowrap; }
.catalog-route-tabs button[aria-pressed="true"], .catalog-route-tabs button.active { color: var(--accent-dark); background: var(--accent-soft); border-color: var(--accent); }
.catalog-route-tabs button:not(:disabled):hover { border-color: var(--accent); }
.catalog-route-tabs svg { width: 15px; height: 15px; margin-right: 5px; vertical-align: -3px; }
.catalog-filters .search-input { margin: 0; width: 100%; }
.catalog-filter-fields { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 11px; align-items: end; }
.catalog-filter-fields .catalog-stat-picker { display: grid; gap: 5px; }
.catalog-intro { color: var(--muted); font-size: 11px; margin-top: 8px; line-height: 1.9; }
.catalog-stat-picker { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.catalog-stat-picker select { flex: 1; min-width: 0; width: 100%; }
.catalog-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 13px; color: var(--muted); font-size: 11px; }
.catalog-summary button { min-height: 44px; padding: 4px 0 4px 12px; color: var(--accent-dark); font-size: 11px; }
.catalog-summary button:not(:disabled):hover { text-decoration: underline; text-underline-offset: 3px; }
.catalog-list { display: grid; gap: 10px; max-height: none; overflow: visible; }
.catalog-list .activity-card { padding: 14px 15px; }
.stat-detail-head { display: flex; gap: 16px; align-items: center; margin: 2px 25px 21px 0; }
.stat-emblem { display: grid; place-items: center; flex: 0 0 62px; width: 62px; height: 68px; border: 1px solid var(--card-line); border-radius: 28px 28px 3px 3px; color: var(--accent); background: var(--accent-soft); }
.stat-emblem svg { width: 33px; height: 33px; stroke-width: 1.1; }
.stat-reading { min-width: 0; }
.stat-reading .eyebrow { margin-bottom: 4px; }
.stat-reading h2 { font-size: 26px; }
.stat-reading strong, .stat-reading b { color: var(--accent-dark); font: 28px/1.2 Georgia, serif; margin-left: 0; }
.stat-reading p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.stat-related-list { display: grid; gap: 8px; margin-top: 17px; }
.stat-related-item { display: flex; justify-content: space-between; gap: 15px; align-items: center; min-height: 52px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 3px; background: #fff7; }
.stat-related-item > span:first-child { color: var(--ink); font-size: 12px; }
.stat-related-item b, .stat-related-item strong { color: var(--accent-dark); font: 15px Georgia, serif; white-space: nowrap; }
.stat-related-item small { display: block; color: var(--muted); font-size: 10px; }
.stat-related-item svg { width: 19px; height: 19px; color: var(--accent); }
.stat-related-item > div { flex: 1; min-width: 0; }
.stat-related-item > div strong { display: block; color: var(--ink); font: 600 15px/1.7 var(--serif); white-space: normal; }
.related-heading { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink); font-size: 18px; }
.stat-related-gain { color: var(--accent-dark); font-size: 11px; white-space: nowrap; }
#toast { bottom: 26px; max-width: min(520px, calc(100% - 36px)); padding: 12px 22px; border: 1px solid var(--card-line); border-radius: 4px; color: var(--accent-dark); background: var(--paper); box-shadow: 0 6px 22px #2736411f; font-size: 12px; line-height: 1.8; }

@media (min-width: 1500px) {
  .site-header { max-width: 1480px; }
  main, .status-bar, .site-footer { max-width: 1400px; }
  .home-grid { grid-template-columns: 320px minmax(0, 1fr) 265px; gap: 32px; }
  .portrait-interaction { height: 478px; }
  .activity-card, .home-grid .activity-card { padding: 18px 20px 15px; }
  .activity-card p, .home-grid .activity-card p { font-size: 12px; }
  .ability-row, .home-grid .ability-row { min-height: 50px; }
}

@media (max-width: 1440px) {
  main, .status-bar, .site-footer { margin-left: 40px; margin-right: 40px; }
  .home-grid { grid-template-columns: 285px minmax(0, 1fr) 240px; gap: 24px; }
}

@media (max-width: 1280px) and (min-width: 1051px) {
  .site-header { padding-left: 28px; padding-right: 28px; }
  main, .status-bar, .site-footer { margin-left: 28px; margin-right: 28px; }
  .home-grid { grid-template-columns: 265px minmax(0, 1fr) 225px; gap: 22px; }
  .portrait-interaction { height: 410px; }
  .ability-panel { padding: 18px 14px; }
  .scene-card { grid-template-columns: 41% minmax(0, 1fr); min-height: 132px; }
  .scene-art { min-height: 132px; }
  .scene-copy { padding: 13px 14px; }
  .scene-copy h3 { font-size: 18px; }
  .scene-copy p { font-size: 10px; }
  .time-slots { gap: 8px; }
  .glass-nav button { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 1050px) and (min-width: 761px) {
  .site-header { padding: 20px 25px 17px; gap: 16px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 20px; letter-spacing: 3px; }
  .brand img { width: 30px; height: 39px; }
  .brand small { font-size: 7px; letter-spacing: 2.3px; }
  .glass-nav button { padding: 8px 10px; font-size: 11px; letter-spacing: .3px; }
  .profile-button { max-width: 115px; font-size: 11px; gap: 5px; padding-left: 9px; }
  .profile-button #header-name { max-width: 68px; }
  main, .status-bar, .site-footer { margin-left: 25px; margin-right: 25px; }
  .home-grid { grid-template-columns: 245px minmax(0, 1fr); gap: 25px; }
  .growth-column { grid-column: 1 / -1; }
  .portrait-interaction { height: 385px; }
  .ability-panel { display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 30px; padding: 21px; }
  .ability-heading { grid-column: 1; }
  .home-grid .ability-bars { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 22px; }
  .track-section { grid-column: 2; grid-row: 1 / 3; margin: 0; padding: 6px 0 0 25px; border-top: 0; border-left: 1px solid var(--line); }
  .track { margin: 10px 0; }
  .ability-sub { margin-bottom: 7px; }
  .scene-card { grid-template-columns: 42% minmax(0, 1fr); }
  .scene-copy { padding: 13px 14px; }
  .scene-copy h3 { font-size: 18px; }
  .scene-copy p { font-size: 10px; }
  .time-card { padding-left: 13px; padding-right: 13px; }
  .time-slots { gap: 7px; }
  .time-slot { font-size: 9px; }
  .shop-grid { gap: 18px; }
  .product, .product:nth-child(2), .product:nth-child(3) { padding-left: 17px; padding-right: 17px; }
  .product h3 { font-size: 21px; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(83px + env(safe-area-inset-bottom)); }
  .site-header { position: relative; flex-wrap: nowrap; gap: 14px; padding: 18px 20px 16px; }
  .brand { gap: 9px; white-space: nowrap; }
  .brand img { width: 30px; height: 39px; }
  .brand strong { font-size: 22px; letter-spacing: 3.5px; }
  .brand small { font-size: 7px; letter-spacing: 2.5px; }
  .profile-button { max-width: 124px; margin-left: auto; padding-left: 10px; font-size: 11px; gap: 6px; }
  .profile-button #header-name { max-width: 77px; }
  .profile-button .tiny-flower { flex-shrink: 0; font-size: 19px; }
  .glass-nav {
    position: fixed;
    inset: auto 12px max(9px, env(safe-area-inset-bottom));
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: auto;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--card-line);
    border-radius: 5px;
    background: var(--paper);
    box-shadow: 0 5px 25px #27364122, inset 0 0 0 3px #fff4;
    backdrop-filter: none;
  }
  .glass-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    gap: 4px;
    padding: 5px 2px;
    border-radius: 2px;
    font-size: 10px;
    line-height: 1.4;
    letter-spacing: .3px;
  }
  .glass-nav button svg { display: block; width: 19px; height: 19px; stroke-width: 1.2; }
  main, .status-bar, .site-footer { margin-left: 20px; margin-right: 20px; }
  .status-bar { flex-wrap: wrap; gap: 7px; padding: 8px 0 9px; font-size: 9px; }
  .connection { flex: 1 0 auto; font-size: 9px; }
  .connection:before { margin-right: 6px; width: 4px; height: 4px; }
  .resources { margin-left: auto; gap: 10px; }
  .resources #date-small { display: none; }
  .resource { padding-left: 9px; font-size: 10px; min-height: 24px; }
  .resource:before { margin-right: 4px; }
  main { padding-top: 21px; min-height: 0; }
  h1 { font-size: 27px; line-height: 1.5; letter-spacing: 2px; }
  .page-heading { gap: 10px; margin-bottom: 20px; }
  .page-heading .eyebrow { font-size: 8px; letter-spacing: 1.8px; margin-bottom: 2px; }
  .season-caption { font-size: 10px; letter-spacing: 0; }
  .season-caption:before { margin-right: 5px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 25px; }
  .home-grid .character { display: grid; grid-template-columns: 39% minmax(0, 1fr); column-gap: 16px; row-gap: 0; align-items: start; }
  .home-grid .portrait-wrap { grid-column: 1; grid-row: 1 / 5; align-self: stretch; min-height: 225px; padding: 4px; border-radius: 45px 45px 3px 3px; }
  .portrait-wrap:before, .portrait-wrap:after { inset: 4px; border-radius: 40px 40px 1px 1px; }
  .portrait-interaction { width: 100%; height: 100%; min-height: 225px; padding: 20px 0 0; border-radius: 40px 40px 1px 1px; }
  .portrait-wrap .portrait-interaction img { width: 100%; height: 100%; min-height: 205px; max-height: 265px; object-fit: contain; object-position: center bottom; }
  .portrait-tag { top: 13px; padding: 4px 5px; font-size: 6px; letter-spacing: 1.1px; }
  .home-grid .character-caption { grid-column: 2; grid-row: 1; margin: 0; padding: 5px 0 0; border: 0; border-radius: 0; background: none; box-shadow: none; text-align: left; }
  .home-grid .character-caption h2 { font-size: 23px; line-height: 1.6; letter-spacing: 1px; }
  .character-caption span { font-size: 7px; line-height: 1.5; letter-spacing: 1px; }
  .character-details { grid-column: 2; grid-row: 2; justify-content: flex-start; padding: 8px 0 0; gap: 6px; font-size: 9px; line-height: 1.6; }
  .character-speech { grid-column: 2; grid-row: 3; align-self: center; width: 100%; min-height: 0; margin: 11px 0 4px; padding: 9px 10px; border-radius: 3px; font-size: 11px; line-height: 1.8; }
  .character-speech .speaker { font-size: 9px; line-height: 1.5; margin-bottom: 3px; }
  .home-grid .character-actions { grid-column: 2; grid-row: 4; justify-content: flex-start; align-self: start; flex-wrap: wrap; gap: 0 12px; margin-top: 1px; }
  .home-grid .character-actions .text-link { min-height: 44px; padding: 4px 0; font-size: 10px; gap: 5px; }
  .schedule-column { grid-row: 2; min-width: 0; }
  .growth-column { grid-column: 1; }
  .section-title { margin-bottom: 12px; }
  .section-title h2 { font-size: 22px; }
  .time-card { min-height: 64px; padding: 12px 14px; margin-bottom: 14px; }
  .day-number { font-size: 28px; }
  .day-number > span { font-size: 8px; }
  .time-slots { gap: 10px; }
  .time-slot { font-size: 10px; gap: 4px; }
  .scene-card { grid-template-columns: 44% minmax(0, 1fr); min-height: 138px; margin-bottom: 13px; }
  .scene-art { min-height: 138px; }
  .scene-copy { padding: 13px 12px; }
  .scene-copy .eyebrow { font-size: 7px; letter-spacing: 1.2px; margin-bottom: 6px; }
  .scene-copy h3 { font-size: 18px; margin-bottom: 6px; }
  .scene-copy p { font-size: 10px; line-height: 1.8; }
  .route-tabs { margin-bottom: 14px; }
  .route-tabs button { padding: 8px 5px 11px; min-height: 47px; font-size: 12px; letter-spacing: 0; }
  .route-tabs svg { width: 15px; height: 15px; margin-right: 4px; }
  .activity-list { gap: 12px; }
  .activity-card, .home-grid .activity-card { padding: 15px 14px 13px; }
  .activity-card h3, .home-grid .activity-card h3 { font-size: 18px; }
  .activity-card p, .home-grid .activity-card p { font-size: 11px; line-height: 1.85; }
  .activity-top { gap: 11px; }
  .activity-icon { flex-basis: 34px; width: 34px; height: 38px; }
  .activity-bottom, .home-grid .activity-bottom { gap: 10px; margin-top: 11px; padding-top: 11px; }
  .activity-costs { gap: 4px 9px; font-size: 10px; }
  .activity-costs svg { width: 11px; height: 11px; }
  .arrange-button { min-height: 44px; padding: 7px 8px; font-size: 11px; border-color: transparent; background: transparent; isolation: isolate; }
  .arrange-button::before { content: ''; position: absolute; inset: 7px 0; z-index: -1; border: 1px solid var(--arrange-line); border-radius: 3px; background: var(--arrange-fill); pointer-events: none; }
  .gain-tags { font-size: 10px; gap: 4px; }
  .gain-tags span { padding: 1px 4px; }
  .all-schedules { margin-top: 7px; }
  .ability-panel { display: block; padding: 20px 18px; }
  .ability-heading, .ability-bars { grid-column: auto; }
  .home-grid .ability-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 15px; }
  .ability-row, .home-grid .ability-row { min-height: 48px; grid-template-columns: 21px minmax(0, 1fr) 7px; gap: 7px; padding: 7px 2px; }
  .ability-label { font-size: 11px; letter-spacing: .5px; }
  .ability-value { font-size: 14px; }
  .stat-icon svg { width: 19px; height: 19px; }
  .track-section { grid-column: auto; grid-row: auto; margin-top: 16px; padding: 15px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .track { font-size: 11px; margin: 8px 0; }
  .rest-button { min-height: 46px; }
  .end-note { grid-column: auto; font-size: 10px; }
  .chapter-strip { margin-top: 25px; padding: 15px 0; gap: 13px; align-items: flex-start; }
  .chapter-strip p { font-size: 12px; line-height: 1.9; }
  .chapter-strip svg { width: 20px; height: 20px; margin-top: 4px; }
  .chapter-strip .text-link { display: none; }
  .site-footer { gap: 12px; padding: 12px 0 8px; font-size: 8px; letter-spacing: .4px; align-items: center; }
  .site-footer i { padding: 0 4px; }
  .site-footer button { flex-shrink: 0; font-size: 10px; }
  .page-heading .secondary { min-height: 44px; padding: 6px 10px; font-size: 10px; }
  .pending-banner { padding: 15px; gap: 12px; }
  .pending-banner p { font-size: 11px; }
  .pending-banner .primary { padding-left: 12px; padding-right: 12px; white-space: nowrap; }
  .ending-panel { padding: 23px 18px; }
  .ending-panel .primary, .ending-panel .secondary { margin-top: 7px; padding-left: 13px; padding-right: 13px; }
  .journal-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .journal-intro { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 0 15px; padding: 19px; }
  .journal-intro .eyebrow { grid-column: 1 / -1; }
  .journal-intro .large-number { grid-row: 2 / 4; font-size: 48px; }
  .journal-intro .meter { margin: 13px 0 10px; }
  .journal-intro p { font-size: 12px; }
  .journal-intro .text-link { grid-column: 2; }
  .journal-entry { padding: 19px; }
  .journal-entry h3 { font-size: 18px; }
  .journal-entry p { font-size: 12px; }
  .board-shell { padding: 20px 15px; }
  .board-toolbar { flex-wrap: wrap; gap: 12px; }
  .board-toolbar .route-tabs { width: 100%; }
  .board-toolbar .route-tabs button { padding-left: 6px; padding-right: 6px; font-size: 11px; }
  .ranking-row { grid-template-columns: 36px minmax(0, 1fr) 54px; gap: 8px; padding: 17px 7px; }
  .ranking-row .name { font-size: 17px; }
  .ranking-row .score { font-size: 20px; }
  .ranking-row small { margin-left: 5px; font-size: 9px; }
  .rank-join { flex-direction: column; align-items: flex-start; gap: 16px; }
  .board-foot { padding-left: 5px; padding-right: 5px; }
  .shop-intro { flex-direction: column; align-items: flex-start; gap: 15px; margin-bottom: 22px; padding: 0; }
  .shop-intro p { font-size: 13px; }
  .shop-grid { grid-template-columns: minmax(0, 1fr); max-width: 410px; gap: 22px; }
  .product, .product:nth-child(2), .product:nth-child(3) { padding: 28px 25px 25px; border-radius: 50px 50px 4px 4px; }
  .product-art { height: 126px; }
  .product p { min-height: 0; }
  .product .price { margin-top: 16px; }
  .shop-note { font-size: 10px; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 31px 21px 24px; border-radius: 4px; }
  dialog h2 { font-size: 23px; }
  .dialog-eyebrow { font-size: 8px; letter-spacing: 1.6px; }
  .dialog-text { font-size: 14px; line-height: 2.05; margin: 19px 0 23px; }
  .dialog-actions { gap: 9px; }
  .dialog-actions .primary, .dialog-actions .secondary { padding-left: 13px; padding-right: 13px; font-size: 11px; }
  .dialog-character-strip { margin-right: 24px; margin-bottom: 20px; gap: 11px; }
  .portrait-avatar { flex-basis: 46px; width: 46px; height: 56px; }
  .talk-topics { gap: 7px; }
  .talk-topic { font-size: 11px; padding: 8px 10px; }
  .profile-layout { grid-template-columns: 97px minmax(0, 1fr); gap: 15px; }
  .profile-layout img { padding: 5px; border-radius: 30px 30px 3px 3px; max-height: 200px; }
  .profile-layout p { font-size: 12px; }
  .traits { gap: 5px; }
  .traits span { font-size: 9px; padding: 2px 5px; }
  .result-gains span { font-size: 17px; }
  .catalog-route-tabs button { padding-left: 6px; padding-right: 6px; font-size: 11px; }
  .catalog-filter-fields { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .catalog-filter-fields .catalog-stat-picker { display: flex; }
  .catalog-filter-fields .catalog-stat-picker select { min-width: 0; }
  .catalog-route-tabs svg { width: 14px; height: 14px; margin-right: 3px; }
  .catalog-list .activity-card { padding: 14px 12px; }
  .catalog-list .activity-card h3 { font-size: 17px; }
  .catalog-list .activity-icon { flex-basis: 30px; width: 30px; height: 35px; }
  .catalog-list .activity-top { gap: 9px; }
  .catalog-list .arrange-button { padding: 6px 9px; font-size: 10px; }
  .catalog-list .activity-costs { gap: 4px 8px; font-size: 9px; }
  .stat-detail-head { gap: 13px; margin-right: 17px; }
  .stat-emblem { flex-basis: 53px; width: 53px; height: 61px; border-radius: 24px 24px 3px 3px; }
  .stat-emblem svg { width: 29px; height: 29px; }
  .stat-reading h2 { font-size: 23px; }
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); padding: 12px 17px; font-size: 11px; }
}

@media (max-width: 370px) {
  .site-header { padding: 16px 14px 14px; gap: 10px; }
  main, .status-bar, .site-footer { margin-left: 14px; margin-right: 14px; }
  .brand { gap: 7px; }
  .brand img { width: 27px; height: 36px; }
  .brand strong { font-size: 20px; letter-spacing: 2.5px; }
  .brand small { font-size: 6px; letter-spacing: 2px; }
  .profile-button { max-width: 108px; padding-left: 8px; gap: 4px; font-size: 10px; }
  .profile-button #header-name { max-width: 64px; }
  .tiny-flower { font-size: 17px; }
  .resources { gap: 7px; }
  .resource { padding-left: 7px; font-size: 9px; }
  .connection { font-size: 8px; letter-spacing: 0; }
  h1 { font-size: 25px; }
  .season-caption { font-size: 9px; }
  .home-grid .character { grid-template-columns: 38% minmax(0, 1fr); column-gap: 13px; }
  .home-grid .character-caption h2 { font-size: 21px; letter-spacing: .5px; }
  .character-caption span { font-size: 6px; letter-spacing: .7px; }
  .character-details { gap: 4px; font-size: 8px; padding-top: 6px; }
  .character-speech { padding: 8px 9px; margin-top: 10px; font-size: 10px; }
  .home-grid .character-actions { column-gap: 10px; }
  .home-grid .character-actions .text-link { font-size: 9px; gap: 3px; }
  .time-card { padding: 12px; }
  .time-slot { font-size: 9px; gap: 3px; }
  .time-slots { gap: 7px; }
  .day-number { font-size: 26px; }
  .scene-copy { padding: 12px 10px; }
  .scene-copy .eyebrow { font-size: 6px; letter-spacing: 1px; }
  .scene-copy h3 { font-size: 17px; }
  .scene-copy p { font-size: 9px; }
  .route-tabs button { font-size: 11px; padding-left: 3px; padding-right: 3px; }
  .route-tabs svg { width: 14px; height: 14px; margin-right: 3px; }
  .activity-card, .home-grid .activity-card { padding: 14px 12px 12px; }
  .activity-card h3, .home-grid .activity-card h3 { font-size: 17px; }
  .activity-top { gap: 9px; }
  .activity-icon { flex-basis: 31px; width: 31px; height: 36px; }
  .arrange-button { padding-left: 9px; padding-right: 9px; font-size: 10px; }
  .activity-costs { gap: 4px 8px; font-size: 9px; }
  .gain-tags { font-size: 9px; }
  .ability-panel { padding: 19px 15px; }
  .home-grid .ability-bars { column-gap: 12px; }
  .ability-row, .home-grid .ability-row { grid-template-columns: 19px minmax(0, 1fr) 7px; gap: 5px; }
  .ability-label { font-size: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }
  .profile-layout { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .catalog-route-tabs { gap: 4px; }
  .catalog-route-tabs button { font-size: 10px; padding-left: 4px; padding-right: 4px; }
  .catalog-route-tabs svg { width: 12px; margin-right: 2px; }
  .core-skill-grid, .skill-grid { grid-template-columns: minmax(0, 1fr); }
}

/* A short desktop keeps the day's choices and recovery on the first screen. */
@media (min-width: 1051px) and (max-height: 850px) {
  .site-header { padding-top: 12px; padding-bottom: 10px; }
  .status-bar { padding-top: 5px; padding-bottom: 6px; }
  main { padding-top: 12px; }
  h1 { font-size: 26px; line-height: 1.3; }
  .page-heading { margin-bottom: 14px; }
  .page-heading .eyebrow { margin-bottom: 4px; font-size: 8px; line-height: 1.3; }
  .home-grid { align-items: start; }
  .portrait-interaction { height: 320px; padding-top: 19px; }
  .character-caption { padding: 10px 9px 9px; }
  .character-caption h2 { font-size: 21px; }
  .character-details { padding-top: 9px; }
  .character-speech { min-height: 60px; margin-top: 7px; padding: 9px 11px; font-size: 11px; }
  .home-grid .character-actions { margin-top: 1px; gap: 14px; }
  .section-title { min-height: 26px; margin-bottom: 8px; }
  .section-title h2 { font-size: 20px; line-height: 1.3; }
  .time-card { min-height: 46px; padding: 8px 14px; margin-bottom: 8px; }
  .day-number { font-size: 25px; }
  .route-tabs { margin-bottom: 9px; }
  .route-tabs button { min-height: 44px; padding-top: 8px; padding-bottom: 9px; }
  .scene-card { min-height: 76px; margin-bottom: 11px; grid-template-columns: 39% minmax(0, 1fr); }
  .scene-art { min-height: 76px; }
  .scene-copy { padding: 9px 14px; }
  .scene-copy .eyebrow { margin-bottom: 3px; font-size: 7px; letter-spacing: 1.5px; }
  .scene-copy h3 { margin-bottom: 3px; font-size: 17px; line-height: 1.4; }
  .scene-copy p { font-size: 10px; line-height: 1.6; }
  .home-grid .activity-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
  .home-grid .activity-list > .activity-card:nth-child(n+3) { display: none; }
  .home-grid .activity-card { display: flex; flex-direction: column; padding: 12px; }
  .home-grid .activity-top { gap: 9px; flex: 1; }
  .home-grid .activity-icon { flex-basis: 30px; width: 30px; height: 34px; }
  .home-grid .activity-icon svg { width: 18px; height: 18px; }
  .home-grid .activity-kind { font-size: 8px; line-height: 1.4; margin-bottom: 2px; }
  .home-grid .activity-card h3 { font-size: 16px; line-height: 1.5; }
  .home-grid .activity-card p { display: none; }
  .home-grid .activity-bottom { flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 9px; padding-top: 9px; }
  .home-grid .activity-bottom > div { flex: 1 1 130px; }
  .home-grid .activity-costs { gap: 3px 8px; margin-top: 5px; font-size: 9px; }
  .home-grid .gain-tags { font-size: 9px; gap: 4px; }
  .home-grid .gain-tags span { padding: 1px 4px; }
  .home-grid .arrange-button { min-height: 30px; padding: 3px 8px; font-size: 11px; }
  .all-schedules { margin-top: 3px; }
  .all-schedules button { min-height: 44px; }
  .ability-panel { padding: 14px 13px; }
  .ability-heading > .eyebrow { margin-bottom: 4px; font-size: 7px; line-height: 1.4; }
  .ability-panel h2 { font-size: 19px; line-height: 1.3; margin-bottom: 4px; }
  .ability-sub { margin-bottom: 5px; padding-bottom: 8px; line-height: 1.5; }
  .home-grid .ability-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
  .home-grid .ability-row { grid-template-columns: 17px minmax(0, 1fr); gap: 6px; min-height: 44px; padding: 6px 2px; }
  .ability-row .stat-chevron { display: none; }
  .ability-label { font-size: 10px; line-height: 1.3; margin-bottom: 5px; letter-spacing: 0; gap: 4px; }
  .ability-value { font-size: 12px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .track-section { margin-top: 10px; padding-top: 10px; }
  .skill-profile-link { min-height: 44px; margin: -5px 0 4px; padding: 6px 0; font-size: 10px; }
  .track-section .eyebrow { margin-bottom: 6px; font-size: 7px; line-height: 1.5; }
  .track { margin: 4px 0; font-size: 10px; line-height: 1.4; }
  .track b { font-size: 13px; }
  .rest-button { min-height: 44px; margin-top: 8px; font-size: 11px; }
  .rest-button small { margin-left: 4px; font-size: 9px; }
  .end-note { margin-top: 7px; font-size: 9px; line-height: 1.7; }
  .chapter-strip { margin-top: 15px; padding-top: 12px; padding-bottom: 12px; }
  .site-footer { padding-top: 10px; padding-bottom: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .portrait-interaction:hover img, .arrange-button:active { transform: none !important; }
}

@media (forced-colors: active) {
  .ambient, .portrait-wrap:before, .portrait-wrap:after, .scene-art:after { display: none; }
  body, dialog, .glass-nav, .activity-card, .ability-panel, .time-card, .scene-card,
  .character-caption, .character-speech, .dialog-character-strip, .event-choice,
  .primary, .secondary, .arrange-button, .rest-button, .talk-topic, .product,
  .journal-entry, .journal-intro, .board-shell, .stat-related-item, .stat-emblem,
  .catalog-route-tabs button, .theme-choices button, .skill-item, #toast {
    color: CanvasText;
    background: Canvas;
    border-color: CanvasText;
    box-shadow: none;
  }
  .ability-row { border-color: CanvasText; }
  .meter { border: 1px solid CanvasText; height: 4px; background: Canvas; }
  .meter > span, .ability-row:nth-of-type(3n) .meter > span, .ability-row:nth-of-type(3n+1) .meter > span { background: Highlight; }
  .route-tabs .active:after { background: Highlight; }
  button:disabled { color: GrayText; opacity: 1; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline-color: Highlight; }
}

/* An illustrated folio: pale paper, small rocaille details, clear lessons. */
body[data-theme="rose"] {
  --bg: #efede5;
  --paper: #faf7ee;
  --paper-deep: #eae5d8;
  --accent: #607b87;
  --accent-dark: #405d69;
  --accent-soft: #e5eceb;
  --gold: #8a744f;
  --card-line: #ad97705c;
}
.folio-shell { display: inline-block; width: 43px; height: 25px; margin-left: 14px; color: var(--gold); vertical-align: middle; opacity: .65; }
.time-card, .ability-panel, .journey-panel, .journal-intro, .board-shell, .ending-panel {
  border-radius: 7px 7px 3px 3px;
  box-shadow: inset 0 0 0 3px #fff6;
}
.ability-panel { position: relative; }
.ability-panel:after { content: '❧'; position: absolute; top: 8px; right: 13px; color: var(--gold); font: 25px/1 Georgia,serif; transform: rotate(-24deg); opacity: .3; pointer-events: none; }
.primary { color: var(--accent-dark); background: var(--accent-soft); border-color: #849c9d99; box-shadow: inset 0 1px #fff7; }
.primary:not(:disabled):hover { color: var(--accent-dark); background: #d6e3e2; border-color: var(--accent); }
.scene-card { border-radius: 7px 7px 3px 3px; }
.route-tabs .active:after { height: 2px; background: var(--gold); }
.home-grid .activity-list { display: grid; grid-template-columns: minmax(0,1fr); gap: 11px; }
.activity-card, .home-grid .activity-card, .catalog-list .activity-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 13px 14px 11px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(135deg,#fffdfa70,transparent 60%),var(--paper);
  box-shadow: inset 0 0 0 3px #fff5;
}
.activity-card:before { content: ''; position: absolute; width: 13px; height: 9px; right: 5px; top: 5px; border-top: 1px solid #ad97705c; border-right: 1px solid #ad97705c; border-radius: 0 6px 0 0; pointer-events: none; }
.activity-card:hover { background: #fdfaf2; border-color: #8c9f9e; }
.activity-top, .home-grid .activity-top, .catalog-list .activity-top { display: flex; gap: 12px; flex: 1; min-width: 0; align-items: center; }
.activity-top > div { min-width: 0; flex: 1; }
.course-emblem { display: grid; place-items: center; flex: 0 0 60px; width: 60px; height: 65px; border: 1px solid #b4a17b55; border-radius: 23px 23px 4px 4px; color: #5c727a; background: radial-gradient(ellipse at 45% 40%,#eff1e6,#e9e6d74d); box-shadow: inset 0 0 0 3px #fff6; overflow: hidden; }
.course-emblem > svg { display: block; width: 54px; height: 54px; }
.course-emblem .art-paper { fill: #f9f4e5; }
.course-emblem .art-blue { fill: #b9c9cc; }
.course-emblem .art-gold { fill: #d8c59b; }
.course-photo { border-radius: 4px; background: var(--paper-deep); padding: 3px; box-shadow: 2px 2px 0 #ac987822; }
.course-photo img { display: block; width: 100%; height: 100%; object-fit: cover; border: 1px solid #ad977059; }
.activity-kind, .home-grid .activity-kind { display: flex; flex-wrap: wrap; gap: 2px 5px; align-items: center; margin: 0 0 3px; font-size: 9px; line-height: 1.5; letter-spacing: .1px; }
.activity-kind > i { color: #b8a782; font-style: normal; }
.activity-card h3, .home-grid .activity-card h3, .catalog-list .activity-card h3 { margin: 0; font-size: 17px; line-height: 1.5; letter-spacing: .2px; overflow-wrap: anywhere; }
.activity-card p, .home-grid .activity-card p { margin-top: 4px; font-size: 11px; line-height: 1.8; }
.home-grid .activity-card p { display: none; }
.activity-bottom, .home-grid .activity-bottom, .catalog-list .activity-bottom { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 9px; margin-top: 10px; padding-top: 9px; }
.activity-bottom > div, .home-grid .activity-bottom > div { flex: none; min-width: 0; }
.activity-card .gain-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; font-size: 10px; line-height: 1.6; }
.activity-card .gain-tags > span { padding: 0; border: 0; color: var(--muted); background: none; }
.activity-card .gain-tags > span b { font: 500 12px/1.5 Georgia,serif; color: inherit; margin-left: 2px; font-variant-numeric: tabular-nums; }
.activity-card .gain-tags > .course-primary-gain { color: var(--accent-dark); }
.course-primary-gain > i { margin-right: 4px; font-size: 12px; font-style: normal; color: var(--gold); }
.activity-card .gain-tags > .gain-negative { background: none; }
.activity-card .activity-costs, .home-grid .activity-card .activity-costs { display: flex; gap: 3px 10px; margin-top: 5px; font-size: 10px; line-height: 1.5; }
.activity-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 12px; min-height: 30px; }
.activity-actions .arrange-button { margin-left: auto; }
.course-reference-link { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 0; color: var(--gold); background: transparent; border: 0; font-size: 10px; line-height: 1.5; }
.course-reference-link > span:first-child { color: var(--muted); font-size: 9px; }
.course-reference-link:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.catalog-list { grid-template-columns: minmax(0,1fr); align-items: stretch; gap: 12px; }
.catalog-list .activity-card p { display: block; }
.catalog-list .empty-state { grid-column: 1 / -1; }
.catalog-list .activity-top { align-items: flex-start; }
.catalog-list .activity-bottom { margin-top: auto; padding-top: 11px; }
.catalog-list .activity-top + .activity-bottom { margin-top: 12px; }
/* The home portrait is a knee-up introduction; the pose gallery keeps the full figure. */
.home-grid .portrait-interaction { padding: 0; }
.home-grid .portrait-wrap .portrait-interaction img { position: absolute; width: 148%; max-width: none; height: auto; min-height: 0; max-height: none; left: -24%; top: 16px; object-fit: initial; object-position: initial; }
@media (min-width:1200px) {
 .home-grid .activity-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .home-grid .activity-card { padding: 12px 13px 10px; }
 .home-grid .activity-top { gap: 10px; }
 .home-grid .activity-card h3 { font-size: 16px; }
}
@media (min-width:700px) {
 dialog:has(.catalog-list) { width: min(900px,calc(100% - 48px)); }
 .catalog-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (min-width:620px) and (max-width:1050px) {
 .home-grid .activity-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (min-width:1051px) and (max-height:850px) {
 .home-grid .activity-card { padding: 11px 12px 9px; }
 .home-grid .activity-top { min-height: 64px; }
 .home-grid .activity-card .course-emblem { flex-basis: 54px; width: 54px; height: 60px; }
 .home-grid .activity-card .course-emblem > svg { width: 50px; height: 50px; }
 .home-grid .activity-bottom { gap: 7px; margin-top: 8px; padding-top: 7px; }
 .home-grid .activity-actions { min-height: 30px; }
 .home-grid .portrait-wrap .portrait-interaction img { top: 13px; }
}
@media (max-width:760px) {
 .folio-shell { width: 34px; height: 21px; margin-left: 8px; }
 .course-emblem { flex-basis: 58px; width: 58px; height: 64px; }
 .course-emblem > svg { width: 52px; height: 52px; }
 .activity-card, .home-grid .activity-card, .catalog-list .activity-card { padding: 13px 14px 10px; }
 .activity-card h3, .home-grid .activity-card h3, .catalog-list .activity-card h3 { font-size: 17px; }
 .activity-actions { min-height: 44px; gap: 5px 10px; }
 .course-reference-link { min-height: 44px; font-size: 11px; }
 .activity-card .activity-costs, .home-grid .activity-card .activity-costs { gap: 4px 11px; font-size: 10px; }
 .home-grid .portrait-wrap .portrait-interaction img { width: 178%; left: -39%; top: 20px; min-height: 0; max-height: none; }
}
@media (forced-colors:active) {
 .course-emblem, .activity-card, .primary { color: CanvasText; background: Canvas; border-color: CanvasText; }
 .course-emblem .art-paper, .course-emblem .art-blue, .course-emblem .art-gold { fill: Canvas; }
 .folio-shell, .ability-panel:after, .activity-card:before { display: none; }
}
