.cc-page { max-width: 1500px; line-height: 1.5; }
.cc-page *, .cc-page *::before, .cc-page *::after { box-sizing: border-box; }
.cc-page [hidden] { display: none !important; }
.cc-page .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.cc-intro { font-size: 1rem; margin-bottom: 1rem; }
.cc-notice { padding: .85rem 1rem; border-left: 3px solid #7e8d9c; background: #83919e0c; font-size: .875rem; line-height: 1.6; }
.cc-panel { padding: 1.25rem; margin-bottom: 1rem; min-width: 0; }
.cc-side--attackers { --cc-side-rgb: 178, 91, 70; }
.cc-side--defenders { --cc-side-rgb: 64, 115, 170; }
[data-theme="dark"] .cc-side--attackers { --cc-side-rgb: 224, 144, 122; }
[data-theme="dark"] .cc-side--defenders { --cc-side-rgb: 113, 167, 219; }
.cc-side { background-image: linear-gradient(rgba(var(--cc-side-rgb), .055), rgba(var(--cc-side-rgb), .055)); border-top: 3px solid rgba(var(--cc-side-rgb), .55); }
.cc-side .cc-tag { background: rgba(var(--cc-side-rgb), .1); border-color: rgba(var(--cc-side-rgb), .3); }
.cc-casualties { min-width: 0; padding: .85rem; border-radius: .4rem; margin-top: 1rem; }
.cc-panel .cc-casualties h3 { margin-top: 0; }
.cc-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cc-heading h2 { margin: 0; font-size: 1.1rem; }
.cc-heading > a { font-size: .85rem; }
.cc-tag { border: 1px solid #83919e50; padding: .2rem .6rem; border-radius: 1rem; font-size: .75rem; }
.cc-conditions, .cc-forces { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cc-conditions { max-width: 680px; }
.cc-help { font-size: .82rem; line-height: 1.65; opacity: .85; margin: .8rem 0 0; }
.cc-page label { display: flex; flex-direction: column; gap: .4rem; font-size: .82rem; font-weight: 500; min-width: 0; }
.cc-page input, .cc-page select, .cc-page textarea { width: 100%; min-width: 0; min-height: 38px; margin: 0; padding: .5rem .6rem; border: 1px solid #83919e80; border-radius: .3rem; color: inherit; background-color: var(--bg-surface); font: inherit; line-height: 1.4; }
.cc-page textarea { resize: vertical; }
.cc-page select { appearance: none; padding-right: 1.8rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%2383919e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .5rem center; }
.cc-page select option, .cc-page select optgroup { color: var(--text); background: var(--bg-surface); }
[data-theme="dark"] .cc-page input, [data-theme="dark"] .cc-page select, [data-theme="dark"] .cc-page textarea { color-scheme: dark; }
[data-theme="light"] .cc-page input, [data-theme="light"] .cc-page select, [data-theme="light"] .cc-page textarea { color-scheme: light; }
.cc-page button { font: inherit; line-height: 1.4; min-height: 38px; cursor: pointer; border-radius: .3rem; padding: .5rem .8rem; }
.cc-page button:disabled { cursor: default; opacity: .5; }
.cc-page :focus-visible { outline: 2px solid #4987cb; outline-offset: 3px; }
.cc-secondary { border: 1px solid #83919e80; background: transparent; color: inherit; font-size: .82rem !important; }
.cc-primary { background: #2765a2; border: 1px solid #2765a2; color: white; font-weight: 600 !important; }
.cc-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: .25rem 0 1.5rem; }
#cc-status { margin: 0; font-size: .875rem; flex-basis: 100%; }
.cc-divisions { display: grid; gap: 1rem; margin-bottom: 1rem; }
.cc-template-tools { display: grid; grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr) auto auto; gap: .6rem; align-items: end; }
.cc-importer { border-top: 1px solid #83919e40; border-bottom: 1px solid #83919e40; margin: 1rem 0; padding: .8rem 0; }
.cc-importer > summary { cursor: pointer; font-size: .85rem; font-weight: 600; }
.cc-importer label { margin: .8rem 0; }
.cc-division { min-width: 0; padding: 1rem; margin: 0; border: 1px solid #83919e40; border-radius: .4rem; }
.cc-division legend { float: none; width: auto; padding: 0 .3rem; margin: 0; font-size: .85rem; font-weight: 600; }
.cc-division-bar { display: flex; justify-content: flex-end; margin-bottom: .5rem; }
.cc-troops { display: grid; gap: .7rem; margin-bottom: .75rem; }
.cc-troop { display: grid; grid-template-columns: 100px minmax(0, 1fr) 90px 32px; gap: .6rem; align-items: end; }
.cc-troop .cc-remove { padding: .5rem 0; }
.cc-unit-picker { min-width: 0; }
.cc-unit-picker > * { display: block; }
.cc-unit-picker > [hidden] { display: none; }
.cc-npc-note { padding: .55rem .7rem; border-left: 2px solid #b9822d; background: #b9822d12; }
.cc-commander { border-top: 1px solid #83919e40; margin-top: 1rem; padding-top: .8rem; }
.cc-commander > summary { cursor: pointer; font-size: .85rem; }
.cc-page summary { display: flex; align-items: baseline; gap: .55rem; list-style: none; line-height: 1.5; }
.cc-page summary::-webkit-details-marker { display: none; }
.cc-page summary::before { content: ""; flex: 0 0 .4rem; width: .4rem; height: .4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); align-self: flex-start; margin-top: .45em; }
.cc-page details[open] > summary::before { transform: rotate(45deg); margin-top: .35em; }
.cc-commander-fields { display: grid; gap: .75rem; margin-top: .85rem; }
.cc-bonuses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.cc-bonuses input:disabled { opacity: .5; }
.cc-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.cc-metric { border: 1px solid #83919e40; border-radius: .4rem; padding: .9rem; margin: 0; }
.cc-metric dt { font-weight: 400; font-size: .8rem; }
.cc-metric dd { font-size: 1.2rem; font-weight: 600; margin: .5rem 0 0; overflow-wrap: anywhere; }
.cc-panel h3 { font-size: .95rem; margin: 1.2rem 0 .75rem; }
.cc-scroll { overflow-x: auto; margin-top: .75rem; }
.cc-page table { border-collapse: collapse; width: 100%; font-size: .8rem; font-variant-numeric: tabular-nums; }
.cc-page th, .cc-page td { padding: .65rem .6rem; text-align: right; border-bottom: 1px solid #83919e40; white-space: nowrap; }
.cc-page th:first-child, .cc-page td:first-child { text-align: left; }
.cc-page tfoot { font-weight: 600; }
.cc-unit-race { display: block; font-size: .73rem; opacity: .8; margin-top: .2rem; }
.cc-details { padding: 1rem 0; border-top: 1px solid #83919e40; margin-top: 1rem; }
.cc-details > summary { cursor: pointer; font-size: .9rem; font-weight: 600; }
.cc-details:last-child { padding-bottom: 0; }
.cc-rules { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr); gap: 1rem 1.5rem; margin: 1.25rem 0 0; font-size: .85rem; line-height: 1.7; }
.cc-rules dt { font-weight: 600; }
.cc-rules dt, .cc-rules dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.cc-equation { padding: 1rem; background: #83919e0c; line-height: 1.8; font-size: .85rem; font-variant-numeric: tabular-nums; white-space: pre-line; }
.cc-list { padding-left: 1.25rem; margin: 1rem 0 0; font-size: .85rem; line-height: 1.75; }
.cc-list li + li { margin-top: .5rem; }
.cc-steps { display: grid; gap: .5rem; }
.cc-step { border-left: 2px solid #83919e60; padding: .5rem .8rem; font-size: .82rem; line-height: 1.7; overflow-wrap: anywhere; }
.cc-step p { margin: .25rem 0 0; }
#cc-reference, #cc-result { scroll-margin-top: 80px; }
@media (max-width: 1050px) { .cc-forces { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .cc-panel { padding: 1rem; }
  .cc-conditions { grid-template-columns: minmax(0, 1fr); }
  .cc-division { padding: .7rem; }
  .cc-troop { grid-template-columns: 82px minmax(0, 1fr) 26px; gap: .4rem; }
  .cc-troop > label:nth-child(1) { grid-column: 1; }
  .cc-troop > label:nth-child(2) { grid-column: 2 / 4; }
  .cc-troop > label:nth-child(3) { grid-column: 1 / 3; }
  .cc-troop > .cc-remove { grid-column: 3; }
  .cc-troop select { font-size: .75rem; padding-left: .3rem; padding-right: 1.6rem; }
  .cc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cc-rules { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .cc-template-tools { grid-template-columns: minmax(0, 1fr) auto; }
  .cc-template-tools label:nth-of-type(2) { grid-column: 1 / -1; }
  .cc-rules dt { margin-top: .6rem; }
}
