:root {
  --paper: #f6f0e4;
  --paper-deep: #e8dcc9;
  --ink: #201a17;
  --muted: #70665d;
  --line: #4f2b25;
  --blood: #7d1017;
  --blood-dark: #4d080c;
  --gold: #a87c37;
  --green: #4f6f54;
  --blue-gray: #4d6070;
  --nav-overview: #2e5f93;
  --nav-skills: #3f6f6a;
  --nav-disciplines: #8f1119;
  --danger: #b81f2d;
  --shadow: 0 16px 40px rgba(29, 16, 12, 0.14);
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #2a1512;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background: #d8d0c2;
}

body.is-storyteller-overview {
  height: 100dvh;
  overflow: hidden;
  background: #d8d0c2;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--blood-dark);
  border-radius: 6px;
  background: var(--blood);
  color: #fff8ed;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

button:hover {
  background: var(--blood-dark);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: transparent;
  color: var(--blood-dark);
}

button.secondary:hover {
  background: rgba(125, 16, 23, 0.08);
}

button.ghost {
  min-height: 34px;
  border-color: rgba(79, 43, 37, 0.35);
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
}

button.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(79, 43, 37, 0.35);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.82);
  color: var(--ink);
  font-size: 16px;
  padding: 10px 12px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.app-shell {
  width: min(520px, calc(100% - 30px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(18px, 4vh, 42px) 0;
  display: grid;
  align-items: center;
}

.app-shell.is-storyteller-overview {
  width: min(1060px, calc(100% - 8px));
  height: 100dvh;
  min-height: 0;
  padding: clamp(4px, 0.8dvh, 10px) 0;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}

.storyteller-board {
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.6dvh, 24px) clamp(12px, 2vw, 24px);
  border: 2px solid rgba(55, 35, 28, 0.45);
  border-radius: 18px;
  background:
    linear-gradient(rgba(246, 240, 228, 0.9), rgba(246, 240, 228, 0.93)),
    radial-gradient(circle at 22% 0%, rgba(125, 16, 23, 0.06), transparent 36%),
    radial-gradient(circle at 75% 100%, rgba(79, 43, 37, 0.08), transparent 44%);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.storyteller-board.has-settings {
  display: block;
  overflow: auto;
}

.storyteller-board-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
}

.storyteller-board-header h1 {
  color: var(--blood-dark);
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyteller-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  color: var(--blood-dark);
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
}

.storyteller-title span {
  border-top: 1px solid rgba(79, 43, 37, 0.5);
}

.board-gear {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blood-dark);
  font-size: 2.15rem;
  line-height: 1;
}

.board-gear:hover {
  background: transparent;
  color: var(--blood);
}

.storyteller-rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: clamp(7px, 1.6dvh, 18px) 0 clamp(8px, 1.8dvh, 20px);
}

.storyteller-rule::before,
.storyteller-rule::after {
  content: "";
  border-top: 1px solid rgba(79, 43, 37, 0.36);
}

.storyteller-rule span {
  width: 64px;
  height: 14px;
  border-top: 2px solid rgba(101, 16, 13, 0.72);
  border-bottom: 1px solid rgba(101, 16, 13, 0.38);
  border-radius: 999px;
}

.storyteller-grid {
  --storyteller-row-gap: clamp(7px, 1.3dvh, 18px);
  --storyteller-column-gap: clamp(10px, 1.8vw, 20px);
  --storyteller-card-height: calc((100% - (2 * var(--storyteller-row-gap))) / 3);
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--storyteller-row-gap) var(--storyteller-column-gap);
}

.storyteller-grid.is-scrollable {
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  scrollbar-gutter: stable;
  align-content: start;
  grid-template-rows: none;
  grid-auto-rows: var(--storyteller-card-height);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.storyteller-card {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: clamp(8px, 1.2dvh, 14px);
  border: 1px solid rgba(95, 70, 55, 0.28);
  border-radius: 12px;
  background: rgba(255, 250, 238, 0.72);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  align-content: start;
  gap: clamp(4px, 0.9dvh, 12px);
  container-type: inline-size;
  touch-action: pan-y;
}

.storyteller-card:hover {
  background: rgba(255, 250, 238, 0.86);
}

.storyteller-card-header {
  display: grid;
  grid-template-columns: clamp(30px, 4.8dvh, 52px) minmax(0, 1fr);
  gap: clamp(7px, 1.1dvh, 12px);
  align-items: start;
}

.clan-mark {
  width: clamp(30px, 4.8dvh, 48px);
  height: clamp(30px, 4.8dvh, 48px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blood-dark);
  color: #fff8ed;
  font-size: clamp(1rem, 2.5dvh, 1.65rem);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1;
}

.storyteller-card h2 {
  color: var(--blood-dark);
  font-size: clamp(1rem, 6.2cqw, 1.62rem);
  line-height: 1;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.storyteller-card h2.name-medium {
  font-size: clamp(0.9rem, 5.4cqw, 1.48rem);
}

.storyteller-card h2.name-long {
  font-size: clamp(0.8rem, 4.7cqw, 1.32rem);
}

.storyteller-card h2.name-xlong {
  font-size: clamp(0.72rem, 4.2cqw, 1.16rem);
}

.storyteller-card-header p {
  margin: clamp(1px, 0.35dvh, 4px) 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.72rem, 1.55dvh, 1rem);
  line-height: 1.12;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.storyteller-attributes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid rgba(120, 95, 80, 0.28);
}

.attribute-pair {
  min-height: clamp(22px, 3.5dvh, 42px);
  padding: clamp(3px, 0.65dvh, 8px) clamp(6px, 0.95dvh, 10px) clamp(3px, 0.65dvh, 8px) clamp(7px, 1.1dvh, 12px);
  border-right: 1px solid rgba(120, 95, 80, 0.22);
  border-bottom: 1px solid rgba(120, 95, 80, 0.22);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.attribute-pair:nth-child(2n) {
  border-right: 0;
}

.attribute-pair:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.attribute-pair em {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(0.68rem, 1.55dvh, 0.96rem);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attribute-pair strong {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(0.76rem, 1.75dvh, 1.08rem);
  font-weight: 700;
  gap: 3px;
}

.storyteller-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border-top: 1px solid rgba(100, 75, 60, 0.35);
}

.storyteller-status > span,
.storyteller-status > strong {
  min-height: clamp(20px, 3.2dvh, 34px);
  border-bottom: 1px solid rgba(100, 75, 60, 0.18);
  display: flex;
  align-items: center;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(0.76rem, 1.75dvh, 1.06rem);
  font-weight: 500;
}

.storyteller-status > strong {
  justify-content: center;
  min-width: clamp(102px, 16vw, 174px);
  font-weight: 700;
}

.status-boxes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(2px, 0.45vw, 5px);
  width: clamp(94px, 14vw, 150px);
  max-width: 100%;
}

.status-box {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(79, 43, 37, 0.68);
  border-radius: 3px;
  background: rgba(255, 250, 238, 0.48);
  display: block;
}

.status-box.is-hunger,
.status-box.is-physical {
  background: #8f1119;
  border-color: #741015;
}

.status-box.is-humanity,
.status-box.is-mental {
  background: #2e5f93;
  border-color: #234b75;
}

.status-box.is-mixed {
  background: linear-gradient(135deg, #2e5f93 0 45%, #fff8ed 45% 55%, #8f1119 55% 100%);
  border-color: #543744;
}

.storyteller-skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(4px, 0.8dvh, 8px) clamp(7px, 1.3vw, 12px);
}

.storyteller-skill-grid span {
  min-height: clamp(20px, 3.2dvh, 34px);
  border: 1px solid rgba(105, 40, 35, 0.38);
  border-radius: 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(5px, 0.9vw, 10px);
  padding: 0 clamp(7px, 1.1vw, 12px);
  color: var(--blood-dark);
  font-family: var(--serif);
  font-size: clamp(0.72rem, 1.55dvh, 0.98rem);
}

.storyteller-skill-grid em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storyteller-skill-grid strong {
  color: var(--ink);
}

@media (max-height: 850px) {
  .app-shell.is-storyteller-overview {
    padding: 3px 0;
  }

  .storyteller-board {
    padding: 6px 18px 8px;
    border-radius: 14px;
  }

  .storyteller-board-header {
    gap: 14px;
  }

  .storyteller-board-header h1 {
    font-size: clamp(1.45rem, 3.1vw, 1.8rem);
  }

  .storyteller-title {
    gap: 12px;
    font-size: 0.82rem;
  }

  .board-gear {
    width: 34px;
    min-height: 34px;
    font-size: 1.55rem;
  }

  .storyteller-rule {
    gap: 10px;
    margin: 4px 0 8px;
  }

  .storyteller-rule span {
    width: 54px;
    height: 10px;
  }

  .storyteller-grid {
    --storyteller-row-gap: 8px;
    --storyteller-column-gap: 14px;
  }

  .storyteller-card {
    padding: 7px 10px;
    gap: 4px;
    border-radius: 10px;
  }

  .storyteller-card-header {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 7px;
  }

  .clan-mark {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }

  .storyteller-card h2 {
    font-size: clamp(0.9rem, 5.4cqw, 1.28rem);
    -webkit-line-clamp: 2;
  }

  .storyteller-card-header p {
    font-size: 0.66rem;
    line-height: 1.05;
  }

  .attribute-pair {
    min-height: 20px;
    padding: 2px 6px;
  }

  .attribute-pair em {
    font-size: 0.68rem;
  }

  .attribute-pair strong {
    font-size: 0.72rem;
  }

  .damage-badges i {
    min-width: 10px;
    font-size: 0.5rem;
  }

  .storyteller-status > span,
  .storyteller-status > strong {
    min-height: 18px;
    font-size: 0.7rem;
  }

  .storyteller-status > strong {
    min-width: 92px;
  }

  .status-boxes {
    width: 88px;
    gap: 3px;
  }

  .storyteller-skill-grid {
    gap: 3px 8px;
  }

  .storyteller-skill-grid span {
    min-height: 18px;
    gap: 5px;
    padding: 0 6px;
    font-size: 0.68rem;
  }

}

.top-banner,
.login-panel,
.sheet,
.storyteller-panel {
  background:
    linear-gradient(rgba(246, 240, 228, 0.86), rgba(246, 240, 228, 0.91)),
    radial-gradient(circle at top right, rgba(125, 16, 23, 0.08), transparent 42%);
  border: 1px solid rgba(79, 43, 37, 0.32);
  box-shadow: var(--shadow);
}

.top-banner {
  min-height: 188px;
  padding: 28px;
  display: grid;
  align-content: end;
  border-radius: 8px 8px 0 0;
  border-bottom: 5px solid var(--blood);
}

.storyteller-banner {
  min-height: 166px;
  padding: 22px;
  border-radius: 8px 8px 0 0;
}

.storyteller-banner h1 {
  font-size: clamp(3.2rem, 6vw, 4.6rem);
}

.storyteller-banner .subtitle {
  margin-top: 8px;
  font-size: 1.05rem;
  line-height: 1.3;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blood-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--blood-dark);
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  max-width: 880px;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.55rem;
}

h3 {
  font-size: 1.12rem;
}

.subtitle {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.login-panel {
  padding: 24px;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.login-form,
.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.login-form .pin-field.is-hidden {
  display: none;
}

.message {
  min-height: 24px;
  margin-top: 12px;
  color: var(--blood);
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}

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

.is-storyteller-overview .toolbar {
  justify-content: flex-end;
  margin: 0 0 6px;
}

.is-storyteller-overview .toolbar-actions button {
  min-height: 58px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 1.18rem;
}

.storyteller-panel,
.sheet {
  padding: 22px;
  border-radius: 8px;
}

.storyteller-panel {
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: auto;
}

.is-storyteller-overview .storyteller-panel {
  min-height: calc(100dvh - 230px);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 22px 14px 420px;
}

.sheet {
  height: min(900px, calc(100dvh - 34px));
  min-height: 620px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-quick-actions {
  position: absolute;
  inset: 10px 10px auto 10px;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.sheet-icon-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(246, 240, 228, 0.92);
  color: var(--blood-dark);
  box-shadow: 0 4px 14px rgba(29, 16, 12, 0.16);
  font-size: 1.35rem;
  line-height: 1;
  pointer-events: auto;
}

.sheet-icon-button:hover,
.sheet-icon-button.is-active {
  background: var(--blood);
  color: #fff8ed;
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.overview-table th,
.overview-table td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(79, 43, 37, 0.22);
  text-align: left;
  vertical-align: middle;
}

.overview-table th {
  color: var(--blood-dark);
  font-family: var(--serif);
  font-size: 1rem;
}

.overview-table tr {
  cursor: pointer;
}

.overview-table tr:hover td {
  background: rgba(125, 16, 23, 0.06);
}

.storyteller-panel .overview-table {
  display: none;
}

.mobile-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.overview-card {
  border: 1px solid rgba(79, 43, 37, 0.25);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.62);
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 392px;
}

.overview-identity {
  min-width: 0;
}

.overview-card h3 {
  color: var(--blood-dark);
  font-size: 1.62rem;
  line-height: 1;
}

.overview-card p {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.05;
}

.overview-card:hover {
  background: rgba(125, 16, 23, 0.08);
  color: var(--ink);
}

.sheet-header {
  display: grid;
  grid-template-columns: 1.15fr 2fr;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 3px double var(--line);
}

.storyteller-sheet .sheet-header {
  padding-left: 44px;
  padding-right: 44px;
}

.identity {
  display: grid;
  gap: 9px;
  align-content: start;
}

.character-name-button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--blood-dark);
  display: block;
  text-align: left;
}

.character-name-button:hover {
  background: transparent;
  color: var(--blood);
}

.character-name-button:active {
  transform: none;
}

.identity .character-name {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 0.98;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.field-line {
  min-height: 40px;
  border-bottom: 1px solid rgba(79, 43, 37, 0.55);
  display: grid;
  align-content: end;
  padding: 0 0 5px;
}

.field-line span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field-line strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.tabs,
.main-tabs,
.sub-tabs {
  display: flex;
  margin: 16px 0 8px;
  gap: 6px;
  overflow-x: auto;
}

.nav-stack {
  position: relative;
}

.tab-button,
.main-tab-button,
.sub-tab-button {
  white-space: nowrap;
  background: transparent;
  color: var(--blood-dark);
}

.main-tab-button,
.sub-tab-button {
  opacity: 0.58;
}

.main-tab-button.is-active,
.sub-tab-button.is-active {
  opacity: 1;
}

.main-tab-button.main-overview {
  border-color: var(--nav-overview);
  color: var(--nav-overview);
}

.main-tab-button.main-skills {
  border-color: var(--nav-skills);
  color: var(--nav-skills);
}

.main-tab-button.main-disciplines {
  border-color: var(--nav-disciplines);
  color: var(--nav-disciplines);
}

.main-tab-button.main-overview.is-active {
  background: var(--nav-overview);
  color: #fff8ed;
}

.main-tab-button.main-skills.is-active {
  background: var(--nav-skills);
  color: #fff8ed;
}

.main-tab-button.main-disciplines.is-active {
  background: var(--nav-disciplines);
  color: #fff8ed;
}

.sub-tabs {
  margin-top: -3px;
  position: relative;
}

.sub-tab-button {
  border-color: rgba(79, 43, 37, 0.36);
  background: rgba(255, 252, 246, 0.45);
  color: var(--ink);
}

.nav-stack.main-overview .sub-tab-button {
  border-color: rgba(46, 95, 147, 0.48);
  background: rgba(46, 95, 147, 0.1);
  color: #244c77;
}

.nav-stack.main-overview .sub-tab-button.is-active {
  background: rgba(46, 95, 147, 0.22);
  border-color: var(--nav-overview);
}

.nav-stack.main-skills .sub-tab-button {
  border-color: rgba(63, 111, 106, 0.5);
  background: rgba(63, 111, 106, 0.11);
  color: #2d5551;
}

.nav-stack.main-skills .sub-tab-button.is-active {
  background: rgba(63, 111, 106, 0.24);
  border-color: var(--nav-skills);
}

.nav-stack.main-disciplines .sub-tab-button {
  border-color: rgba(143, 17, 25, 0.48);
  background: rgba(143, 17, 25, 0.1);
  color: var(--blood-dark);
}

.nav-stack.main-disciplines .sub-tab-button.is-active {
  background: rgba(143, 17, 25, 0.22);
  border-color: var(--nav-disciplines);
}

.sub-tabs::before {
  content: none;
}

.nav-stack::before {
  content: none;
}

.sub-tab-button {
  position: relative;
}

.sub-tab-button::before {
  content: none;
}

.sheet-section {
  display: none;
  padding: 20px 0;
  border-bottom: 1px solid rgba(79, 43, 37, 0.24);
}

.sheet-section.is-active {
  display: block;
}

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

.section-head {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.paper-group {
  padding: 14px;
  border: 1px solid rgba(79, 43, 37, 0.22);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.42);
}

.paper-group h3 {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(125, 16, 23, 0.35);
}

.attribute-strip {
  margin-bottom: 10px;
}

.attribute-strip .rating-row:last-child {
  border-bottom: 1px solid rgba(79, 43, 37, 0.12);
}

.rating-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(79, 43, 37, 0.12);
}

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

.rating-label {
  min-width: 0;
  font-weight: 700;
}

.rating-edit-button {
  width: 100%;
  min-height: 44px;
  padding: 0;
  border-width: 0 0 1px;
  border-color: rgba(79, 43, 37, 0.12);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.rating-edit-button:hover {
  background: rgba(125, 16, 23, 0.06);
}

.dots,
.static-dots,
.boxes {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.dot,
.box {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: transparent;
  cursor: default;
  min-height: 0;
  padding: 0;
}

.dot:disabled,
.box:disabled {
  opacity: 1;
}

.dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.dots.large .dot {
  width: 25px;
  height: 25px;
}

.dots.mini {
  gap: 3px;
}

.dots.mini .dot,
.static-dots.mini .dot {
  width: 10px;
  height: 10px;
}

.static-dots.mini {
  gap: 3px;
}

.boxes.mini {
  gap: 3px;
}

.boxes.mini .box {
  width: 11px;
  height: 11px;
}

.dot.is-filled {
  background: var(--ink);
}

.dot.is-disabled {
  background: rgba(32, 26, 23, 0.1);
}

.dot.is-editable,
.box.is-editable {
  cursor: pointer;
}

.dot.is-editable:hover,
.box.is-editable:hover {
  outline: 2px solid rgba(168, 124, 55, 0.42);
  outline-offset: 2px;
}

.boxes {
  flex-wrap: wrap;
}

.box {
  width: 28px;
  height: 28px;
  border-radius: 3px;
}

.box.is-marked,
.box.is-red {
  background: var(--blood);
}

.box.is-humanity,
.box.is-blue {
  background: var(--nav-overview);
}

.box.is-mixed {
  background: linear-gradient(135deg, var(--nav-overview) 0 45%, #fff8ed 45% 55%, var(--blood) 55% 100%);
}

.box.is-empty {
  background: rgba(255, 255, 255, 0.34);
}

.warning-boxes .box.is-marked {
  background: var(--danger);
}

.track-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.track-divider {
  width: 52px;
  height: 1px;
  margin: 1px auto;
  border-top: 1px solid rgba(79, 43, 37, 0.38);
}

.track-row {
  display: grid;
  gap: 6px;
  padding: 0;
  border: 1px solid rgba(79, 43, 37, 0.22);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.46);
  overflow: hidden;
}

.track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-display {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
}

.track-display:hover {
  background: rgba(125, 16, 23, 0.05);
}

.track-row.is-open .track-display {
  background: rgba(255, 252, 246, 0.52);
}

.track-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
  justify-items: end;
}

.humanity-track .track-control {
  grid-template-columns: 1fr;
}

.track-title {
  font-family: var(--serif);
  color: var(--blood-dark);
  font-weight: 700;
  font-size: 1.05rem;
}

.stepper {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.stepper output {
  min-width: 44px;
  text-align: center;
  font-weight: 800;
}

.track-boxes {
  justify-content: center;
}

.track-boxes .box:nth-child(4) {
  margin-left: 14px;
}

.heavy-open-button {
  width: 100%;
  margin-top: 8px;
  min-height: 34px;
}

.heavy-summary {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(79, 43, 37, 0.18);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.38);
}

.heavy-summary-list {
  display: grid;
  gap: 3px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 13, 10, 0.42);
}

.heavy-modal {
  width: min(430px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid rgba(79, 43, 37, 0.22);
  border-radius: 8px;
  background: rgba(246, 240, 228, 0.96);
  box-shadow: var(--shadow);
  padding: 16px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.track-modal-backdrop {
  z-index: 70;
}

.track-modal {
  width: min(430px, 100%);
  border: 1px solid rgba(79, 43, 37, 0.3);
  border-radius: 10px;
  background: rgba(246, 240, 228, 0.98);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.track-modal h2 {
  text-align: center;
  font-size: 1.35rem;
}

.track-modal-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.track-modal-heavy-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.track-modal-side {
  display: grid;
  gap: 6px;
}

.track-modal-side .icon-button {
  width: 48px;
  padding: 0 5px;
  white-space: nowrap;
  font-weight: 800;
}

.track-modal-boxes {
  display: grid;
  justify-content: center;
}

.track-modal-boxes .track-boxes {
  justify-content: center;
}

.track-modal-boxes .box {
  width: 25px;
  height: 25px;
}

.track-modal-ok {
  width: 100%;
}

.rating-drop-zone {
  min-height: 62px;
  padding: 10px;
  border: 1px solid rgba(79, 43, 37, 0.18);
  border-radius: 8px;
  background: rgba(255, 252, 246, 0.76);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  touch-action: none;
  user-select: none;
}

.rating-drop-target {
  min-width: 34px;
  min-height: 34px;
  justify-self: center;
  cursor: grab;
}

.rating-drop-target.is-current {
  outline: 2px solid rgba(168, 124, 55, 0.65);
  outline-offset: 3px;
}

.rating-zero {
  width: 30px;
  height: 30px;
  border: 1px dashed rgba(79, 43, 37, 0.62);
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.48);
}

.heavy-damage-summary-boxes {
  margin-top: -2px;
}

.heavy-damage-box {
  display: inline-grid;
  place-items: center;
  color: #fff8ed;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

button.heavy-damage-box {
  cursor: pointer;
}

.heavy-damage-box.is-empty {
  color: transparent;
}

.heavy-damage-box.is-red:hover {
  background: var(--blood-dark);
}

.heavy-damage-box.is-blue:hover {
  background: #244c77;
}

.heavy-modal-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
}

.heavy-attribute-groups {
  display: grid;
  gap: 12px;
}

.heavy-attribute-group {
  display: grid;
  gap: 7px;
}

.heavy-attribute-group h3 {
  font-size: 0.98rem;
  text-align: center;
}

.heavy-attribute-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.heavy-attribute-button {
  min-height: 36px;
  padding: 5px 8px;
  font-size: 0.86rem;
  font-weight: 800;
}

.heavy-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.heavy-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.heavy-control button {
  min-height: 34px;
  padding: 4px 8px;
}

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

.heavy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(79, 43, 37, 0.28);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(125, 16, 23, 0.07);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.chip-button {
  width: 20px;
  min-height: 20px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
}

.heavy-empty {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.warning {
  color: var(--danger);
  font-weight: 800;
}

.caution {
  color: var(--gold);
  font-weight: 800;
}

.discipline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.discipline-catalog-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.discipline-catalog-grid {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.catalog-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.catalog-empty {
  grid-column: 1 / -1;
}

.discipline-site {
  min-height: 100vh;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 0%, rgba(125, 16, 23, 0.2), transparent 38%),
    #d8d0c2;
}

.discipline-site-shell {
  width: min(1180px, calc(100% - 30px));
  margin: 0 auto;
  padding: clamp(18px, 4vw, 48px) 0;
}

.discipline-site-header,
.discipline-site-content,
.discipline-site-detail {
  border: 1px solid rgba(79, 43, 37, 0.32);
  background:
    linear-gradient(rgba(246, 240, 228, 0.9), rgba(246, 240, 228, 0.94)),
    radial-gradient(circle at top right, rgba(125, 16, 23, 0.08), transparent 42%);
  box-shadow: var(--shadow);
}

.discipline-site-header {
  padding: clamp(24px, 5vw, 54px);
  border-bottom: 5px solid var(--blood);
  border-radius: 12px 12px 0 0;
}

.discipline-site-header h1 {
  font-size: clamp(3rem, 8vw, 6rem);
}

.discipline-site-content {
  padding: clamp(18px, 3vw, 32px);
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

.discipline-site .discipline-catalog-filters {
  grid-template-columns: repeat(2, minmax(190px, 1fr)) auto;
  align-items: end;
}

.discipline-site .catalog-count {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.discipline-site .discipline-catalog-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  overflow: visible;
}

.discipline-site-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 36px);
  border-radius: 12px;
}

.discipline-site-detail .detail-card {
  max-width: none;
  min-height: 0;
  max-height: none;
  overflow: visible;
  cursor: default;
}

.discipline-card {
  min-height: 255px;
  border: 1px solid rgba(79, 43, 37, 0.35);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.9), rgba(230, 218, 199, 0.86));
  padding: 14px;
  display: grid;
  gap: 10px;
  cursor: pointer;
}

.card-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid rgba(79, 43, 37, 0.25);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--blue-gray);
  font-size: 0.75rem;
  font-weight: 800;
}

.details {
  display: none;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.discipline-card.is-open .details {
  display: grid;
  gap: 6px;
}

.detail-card {
  max-width: 430px;
  min-height: 560px;
  margin: 0 auto;
}

.detail-card .details {
  display: grid;
  gap: 6px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.storyteller-notes {
  border-color: rgba(125, 16, 23, 0.42);
  background: rgba(125, 16, 23, 0.06);
}

.settings-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(125, 16, 23, 0.28);
  border-radius: 8px;
  background: var(--paper);
}

.overview-settings-panel {
  margin-top: 0;
}

.settings-panel.is-hidden {
  display: none;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-subsection {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(79, 43, 37, 0.2);
}

.overview-character-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.overview-character-row {
  display: grid;
  grid-template-columns: 34px auto minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(79, 43, 37, 0.18);
  border-radius: 6px;
  background: rgba(255, 252, 246, 0.42);
  color: var(--ink);
  font-size: 0.86rem;
}

.overview-character-row.is-dragging {
  opacity: 0.72;
  outline: 2px solid rgba(168, 124, 55, 0.55);
  outline-offset: 2px;
}

.overview-drag-handle {
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: rgba(79, 43, 37, 0.25);
  background: rgba(255, 252, 246, 0.6);
  color: var(--line);
  cursor: grab;
  touch-action: none;
}

.overview-drag-handle:hover {
  background: rgba(125, 16, 23, 0.08);
  color: var(--blood-dark);
}

.overview-character-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.overview-character-row span,
.overview-character-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-character-row small {
  color: var(--muted);
}

.discipline-filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.discipline-picker {
  display: grid;
  gap: 8px;
}

.discipline-card-option.is-hidden {
  display: none;
}

.settings-save-row {
  position: sticky;
  bottom: -16px;
  margin: 18px -16px -16px;
  padding: 12px 16px;
  border-top: 1px solid rgba(79, 43, 37, 0.2);
  background: rgba(246, 240, 228, 0.96);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.save-status {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.checkbox-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 0.95rem;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.export-box {
  width: 100%;
  min-height: 180px;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.settings-wide {
  grid-column: 1 / -1;
}

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

.overview-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.08;
}

.overview-status div {
  display: grid;
  gap: 2px;
}

.overview-status div:last-child {
  text-align: right;
}

.overview-status span,
.overview-attributes span,
.overview-skills span {
  min-width: 0;
}

.overview-status strong {
  color: var(--ink);
  font-weight: 700;
}

.overview-attributes {
  display: grid;
  gap: 31px;
  margin-top: 14px;
}

.overview-attributes span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  font-size: 0.92rem;
  line-height: 1;
}

.overview-attributes em {
  color: var(--ink);
  font-style: normal;
  white-space: nowrap;
}

.overview-attributes strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-weight: 700;
}

.damage-badges {
  display: inline-flex;
  gap: 2px;
}

.damage-badges i {
  min-width: 13px;
  border: 1px solid rgba(79, 43, 37, 0.25);
  border-radius: 3px;
  background: rgba(32, 26, 23, 0.1);
  color: var(--blood-dark);
  font-size: 0.58rem;
  font-style: normal;
  line-height: 1.2;
  text-align: center;
}

.overview-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.overview-skills strong {
  color: var(--ink);
}

.utility-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.gear-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--blood-dark);
}

.utility-popover {
  position: absolute;
  right: 0;
  bottom: 40px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid rgba(79, 43, 37, 0.28);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    width: min(100% - 18px, 520px);
    height: 100dvh;
    padding: 12px 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
  }

  .app-shell.is-storyteller-overview {
    width: min(100% - 10px, 940px);
    padding: 5px 0;
  }

  .storyteller-board {
    min-height: 0;
    padding: 10px 12px;
  }

  .storyteller-board-header {
    gap: 14px;
  }

  .storyteller-board-header h1 {
    font-size: 1.55rem;
  }

  .storyteller-title {
    gap: 10px;
    font-size: 0.86rem;
  }

  .board-gear {
    width: 40px;
    min-height: 40px;
    font-size: 1.8rem;
  }

  .storyteller-rule {
    margin: 12px 0 16px;
  }

  .storyteller-grid {
    --storyteller-row-gap: 8px;
    --storyteller-column-gap: 10px;
  }

  .storyteller-card {
    min-height: 0;
    padding: 7px;
    gap: 4px;
  }

  .storyteller-card-header {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 7px;
  }

  .clan-mark {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
  }

  .storyteller-card h2 {
    font-size: clamp(0.84rem, 5.2cqw, 1.02rem);
  }

  .storyteller-card-header p {
    font-size: 0.72rem;
  }

  .attribute-pair {
    min-height: 22px;
    padding: 3px 5px;
  }

  .attribute-pair em {
    font-size: 0.68rem;
  }

  .attribute-pair strong {
    font-size: 0.76rem;
  }

  .storyteller-status > span,
  .storyteller-status > strong {
    min-height: 20px;
    font-size: 0.72rem;
  }

  .storyteller-status > strong {
    min-width: 88px;
  }

  .status-boxes {
    width: 84px;
    gap: 3px;
  }

  .storyteller-skill-grid span {
    min-height: 20px;
    gap: 5px;
    padding: 0 5px;
    font-size: 0.68rem;
  }

  .overview-character-row {
    grid-template-columns: 30px auto minmax(0, 1fr);
    gap: 6px;
    font-size: 0.76rem;
  }

  .overview-character-row small {
    display: none;
  }

  .overview-drag-handle {
    width: 28px;
    min-height: 28px;
  }

  .discipline-filter-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .top-banner,
  .login-panel,
  .sheet,
  .storyteller-panel {
    border-radius: 8px;
  }

  .top-banner {
    min-height: 132px;
    padding: 16px;
  }

  .storyteller-banner {
    min-height: 116px;
    padding: 14px 16px;
  }

  .storyteller-banner h1 {
    font-size: clamp(2.2rem, 9vw, 3.4rem);
  }

  .storyteller-banner .subtitle {
    margin-top: 5px;
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .login-form,
  .settings-form,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .sheet,
  .storyteller-panel {
    min-height: 0;
    padding: 7px 8px 8px;
    display: block;
    overflow: auto;
  }

  .storyteller-panel {
    display: grid;
    gap: 12px;
    align-content: start;
    overflow: auto;
  }

  .is-storyteller-overview .toolbar-actions button {
    min-height: 46px;
    padding: 6px 13px;
    font-size: 1rem;
  }

  .toolbar {
    min-height: 28px;
    margin-bottom: 4px;
  }

  .toolbar-actions {
    gap: 4px;
  }

  .toolbar-actions button {
    min-height: 30px;
    padding: 3px 8px;
    font-size: 0.78rem;
  }

  .sheet-header {
    display: block;
    padding-bottom: 4px;
  }

  .identity {
    gap: 2px;
  }

  .eyebrow {
    margin-bottom: 1px;
    font-size: 0.62rem;
  }

  .identity .character-name {
    font-size: clamp(1.08rem, 5.4vw, 1.55rem);
    line-height: 1.02;
    max-height: 3.2rem;
    overflow: hidden;
  }

  .overview-table {
    display: none;
  }

  .mobile-overview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .overview-card {
    min-height: 0;
    padding: 10px;
    display: grid;
    gap: 6px;
    box-shadow: none;
  }

  .overview-card h3 {
    font-size: 1.08rem;
    line-height: 1;
  }

  .overview-card p {
    margin: 0;
    font-size: 0.72rem;
  }

  .overview-status {
    gap: 8px;
    font-size: 0.7rem;
  }

  .overview-attributes {
    gap: 19px;
    margin-top: 8px;
  }

  .overview-attributes span {
    font-size: 0.72rem;
  }

  .overview-skills {
    font-size: 0.68rem;
  }

  .tabs,
  .main-tabs,
  .sub-tabs {
    display: grid;
    flex: 0 0 auto;
    gap: 4px;
    overflow: visible;
  }

  .main-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 7px 0 4px;
  }

  .sub-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 0 10px;
    padding-top: 0;
  }

  .tab-button,
  .main-tab-button,
  .sub-tab-button {
    min-height: 33px;
    padding: 4px 4px;
    font-size: 0.76rem;
    white-space: normal;
    line-height: 1.05;
  }

  .sub-tab-button {
    min-height: 30px;
    font-size: 0.7rem;
  }

  .sub-tabs::before {
    top: 0;
  }

  .nav-stack::before {
    top: 41px;
    height: 15px;
  }

  .sub-tab-button::before {
    top: -8px;
    height: 8px;
  }

  .sheet-section {
    display: none;
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
    overflow: hidden;
    border-bottom: 0;
  }

  .sheet-section.is-active {
    display: flex;
    flex-direction: column;
  }

  .section-head {
    margin-bottom: 6px;
  }

  .section-head h2 {
    font-size: 1.04rem;
  }

  .section-head p {
    display: none;
  }

  .three-columns {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 0;
    flex: 1;
  }

  .paper-group {
    padding: 6px 7px;
    min-height: 0;
    overflow: hidden;
  }

  .paper-group h3 {
    padding-bottom: 3px;
    font-size: 0.82rem;
  }

  .rating-row {
    min-height: 0;
    grid-template-columns: minmax(96px, 1fr) auto;
    gap: 8px;
    padding: var(--mobile-skill-row-pad, 6px) 0;
  }

  .rating-label {
    font-size: var(--mobile-skill-font, 0.88rem);
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .dot {
    width: var(--mobile-skill-dot, 14px);
    height: var(--mobile-skill-dot, 14px);
  }

  .dots {
    gap: 4px;
  }

  .box {
    width: 20px;
    height: 20px;
  }

  .track-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    flex: 1;
  }

  .track-row {
    gap: 0;
    padding: 0;
    align-content: start;
  }

  .track-divider {
    width: 38px;
    margin: -2px auto;
  }

  .track-title {
    font-size: 1rem;
  }

  .track-control {
    gap: 0;
  }

  .track-boxes .box:nth-child(4) {
    margin-left: 16px;
  }

  .stepper output {
    min-width: 34px;
    font-size: 0.75rem;
  }

  button.icon-button,
  button.ghost {
    width: 28px;
    min-height: 28px;
  }

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

  .field-line {
    min-height: 32px;
    padding-bottom: 3px;
  }

  .field-line span {
    font-size: 0.55rem;
  }

  .field-line strong {
    font-size: 0.72rem;
    line-height: 1.05;
  }

  .info-head {
    margin-bottom: 3px;
  }

  .subsection-title {
    margin: 0 0 5px;
    color: var(--blood-dark);
    font-family: var(--serif);
    font-size: 0.92rem;
  }

  .tracker-title {
    margin-top: 12px;
    padding-top: 7px;
    border-top: 1px solid rgba(79, 43, 37, 0.22);
  }

  .compact-button {
    min-height: 28px;
    padding: 2px 9px;
    font-size: 0.72rem;
  }

  .compact-tracks {
    flex: 0 0 auto;
    gap: 4px;
    margin-top: 0;
  }

  .compact-tracks .track-divider {
    width: 34px;
    margin: -1px auto;
  }

  .compact-tracks .track-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    align-items: stretch;
    padding: 0;
  }

  .compact-tracks .track-display {
    min-height: 31px;
    padding: 5px 8px;
    grid-template-columns: minmax(96px, 1fr) auto;
    gap: 7px;
  }

  .compact-tracks .track-title {
    font-size: 0.78rem;
    line-height: 1.05;
  }

  .compact-tracks .track-control {
    gap: 0;
  }

  .compact-tracks .box {
    width: 15px;
    height: 15px;
  }

  .compact-tracks .track-boxes .box:nth-child(4) {
    margin-left: 9px;
  }

  .track-modal {
    width: min(360px, 100%);
    gap: 10px;
    padding: 12px;
  }

  .track-modal-boxes .box {
    width: 22px;
    height: 22px;
  }

  .heavy-attribute-groups {
    gap: 9px;
  }

  .heavy-attribute-buttons {
    gap: 6px;
  }

  .heavy-attribute-button {
    min-height: 32px;
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  .skill-page {
    flex: 1;
    overflow: hidden;
  }

  .attribute-strip {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
    margin-bottom: 7px;
  }

  .attribute-strip h3 {
    display: none;
  }

  .attribute-strip .rating-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    align-content: start;
    padding: var(--mobile-attr-row-pad, 2px) 0 3px;
  }

  .attribute-strip .rating-label {
    font-size: var(--mobile-attr-font, 0.88rem);
    line-height: 1.02;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .attribute-strip .dot {
    width: var(--mobile-attr-dot, 14px);
    height: var(--mobile-attr-dot, 14px);
  }

  .attribute-strip .dots {
    gap: 3px;
  }

  .discipline-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: hidden;
  }

  .discipline-catalog-filters {
    gap: 6px;
    margin-bottom: 7px;
  }

  .discipline-catalog-filters select {
    padding: 7px 8px;
  }

  .discipline-catalog-grid {
    overflow-y: auto;
  }

  .discipline-card {
    min-height: 0;
    padding: 9px;
    gap: 5px;
  }

  .discipline-card h3 {
    font-size: 1rem;
  }

  .discipline-card p,
  .details {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .card-kicker,
  .tag {
    font-size: 0.62rem;
  }

  .detail-card {
    flex: 1;
    width: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }

  .sheet > .settings-panel {
    position: fixed;
    inset: 8px;
    z-index: 20;
    margin: 0;
    overflow: auto;
    background: var(--paper);
    box-shadow: var(--shadow);
  }

  .notes-grid {
    grid-template-columns: 1fr;
    gap: 9px;
    flex: 1;
    min-height: 0;
  }

  textarea {
    min-height: 92px;
    max-height: none;
    padding: 8px;
    font-size: 16px;
  }

  input,
  select {
    font-size: 16px;
  }

  label {
    gap: 3px;
    font-size: 0.72rem;
  }
}

@media (max-width: 520px) {
  .toolbar {
    display: flex;
  }

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

  .paper-group,
  .discipline-card {
    padding: 7px;
  }

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

@media (max-width: 680px) {
  .discipline-site-shell {
    width: min(100% - 16px, 1180px);
    padding: 8px 0;
  }

  .discipline-site .discipline-catalog-filters {
    grid-template-columns: 1fr 1fr;
  }

  .discipline-site .catalog-count {
    grid-column: 1 / -1;
    min-height: 0;
    justify-content: flex-start;
  }

  .discipline-site .discipline-catalog-grid {
    overflow: visible;
  }

  .discipline-site-detail .detail-card {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .app-shell.is-storyteller-overview {
    width: calc(100% - 6px);
    padding: 3px 0;
  }

  .storyteller-board {
    padding: 6px;
    border-radius: 10px;
  }

  .storyteller-board-header h1 {
    font-size: 1.5rem;
  }

  .board-gear {
    width: 30px;
    min-height: 30px;
    font-size: 1.35rem;
  }

  .storyteller-rule {
    margin: 5px 0 8px;
  }

  .storyteller-grid {
    --storyteller-row-gap: 7px;
    --storyteller-column-gap: 6px;
  }

  .storyteller-card {
    padding: 6px;
    gap: 4px;
  }

  .storyteller-card-header {
    grid-template-columns: 25px minmax(0, 1fr);
    gap: 5px;
  }

  .clan-mark {
    width: 25px;
    height: 25px;
    font-size: 0.86rem;
  }

  .storyteller-card h2 {
    font-size: clamp(0.86rem, 5.4cqw, 1.12rem);
  }

  .storyteller-card h2.name-medium,
  .storyteller-card h2.name-long,
  .storyteller-card h2.name-xlong {
    font-size: clamp(0.74rem, 4.7cqw, 0.96rem);
  }

  .storyteller-card-header p {
    font-size: 0.64rem;
    line-height: 1.06;
  }

  .attribute-pair {
    min-height: 19px;
    padding: 2px 4px;
    gap: 4px;
  }

  .attribute-pair em {
    font-size: 0.64rem;
  }

  .attribute-pair strong {
    font-size: 0.7rem;
  }

  .storyteller-status > span,
  .storyteller-status > strong {
    min-height: 18px;
    font-size: 0.64rem;
  }

  .storyteller-status > strong {
    min-width: 70px;
  }

  .status-boxes {
    width: 68px;
    gap: 2px;
  }

  .storyteller-skill-grid {
    gap: 3px 5px;
  }

  .storyteller-skill-grid span {
    min-height: 18px;
    padding: 0 4px;
    font-size: 0.64rem;
  }

}
