/*
  Battle Lab — plain documentation/tool appearance.
  All battle calculations, replay layout and form behaviors remain in the original
  JavaScript/CSS. This stylesheet only changes visual presentation.
*/
:root {
  --ink: #252a30;
  --muted: #65707b;
  --line: #d9dfe3;
  --green: #365d76;
  /* restrained accent; not a green dashboard theme */
  --green-light: #ecf1f4;
  --paper: #f7f8f9;
  --red: #995344;
  --red-light: #f5efed;
  --white: #ffffff;
  --font: "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",Meiryo,system-ui,sans-serif;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

a {
  color: var(--green);
}

button,input,select,textarea {
  border-radius: 3px;
  transition: none;
}

button {
  padding: 7px 11px;
  border-color: #d2d8dc;
  background: #fff;
  font-weight: 500;
}

button:hover {
  background: #f0f2f3;
}

button:active {
  transform: none;
}

button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible {
  outline: 2px solid #6d91ad;
  outline-offset: 2px;
}

input,select,textarea {
  border-color: #cfd6db;
  padding: 7px 9px;
  background: #fff;
}

input[type=checkbox],input[type=range] {
  accent-color: #49677c;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.45;
}

h2 {
  font-size: 15px;
  font-weight: 650;
}

h3 {
  font-size: 13px;
}

/* Neutral navigation rather than a dark, brand-forward dashboard. */
.sidebar {
  background: #f1f3f4;
  color: var(--ink);
  border-right: 1px solid #dce1e4;
  padding: 18px 11px;
}

.brand {
  margin: 0 0 6px;
  padding: 8px 11px 19px;
  border-bottom: 1px solid #dbe0e3;
}

.brand strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  color: #252d33;
}

.brand small {
  font-size: 11px;
  letter-spacing: 0;
  color: #65707b;
}

.brand-mark {
  transform: none;
  border-color: #c7d0d7;
  color: var(--green);
}

.nav-label {
  padding: 14px 11px 7px;
  color: #78838b;
  font-size: 10px;
  letter-spacing: 0;
}

.nav {
  gap: 2px;
}

.nav button {
  padding: 10px 10px;
  color: #3f4a53;
  border-radius: 3px;
  font-size: 12px;
}

.nav button:hover {
  background: #e7ebee;
  color: #25313a;
}

.nav button.active {
  background: #fff;
  color: #2b4e65;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #53778e;
}

.nav .count {
  background: #e4e9ec;
  color: #58656e;
  border: 1px solid #d6dde1;
  border-radius: 2px;
}

.sidebar-footer {
  color: #76818a;
  border-top: 1px solid #dbe0e3;
  padding: 12px 10px;
}

.sidebar-footer b {
  color: var(--ink);
}

.dot {
  background: #8797a1;
}

/* Compact header and section rhythm. */
.topbar {
  height: 52px;
  background: #fff;
  padding: 0 25px;
  border-color: #dce1e4;
}

.breadcrumb {
  font-size: 11px;
  color: #65717b;
  letter-spacing: 0;
}

.top-actions {
  gap: 7px;
}

.top-actions button {
  font-size: 11px;
  padding: 5px 8px;
}

.content {
  max-width: 1460px;
  padding: 24px 26px 44px;
}

.page-heading {
  margin-bottom: 19px;
  gap: 15px;
}

.page-heading .eyebrow {
  display: none;
}

.subtitle {
  font-size: 11px;
  margin-top: 4px;
}

.primary {
  background: #3b5e77;
  border-color: #3b5e77;
  color: #fff;
  font-weight: 600;
}

.primary:hover {
  background: #294b63;
}

.ghost {
  color: #46525a;
  background: transparent;
}

.danger {
  color: #954b46;
}

.small {
  padding: 5px 8px;
}

/* Flat rectangular groupings, minimal chrome and restrained highlights. */
.panel,.team-strip,.steps,.skill-card,.rule-card,.kpi,.meter-field,
.unit-tactics-management,.map-surface,
.map-distance-list,.replay-team,.empty,.tiebreak-grid,.notice,.hint,
.bs-condition-chooser,.bs-condition-item,.map-dialog,dialog {
  border-radius: 3px;
  box-shadow: none;
}

.panel,.team-strip,.skill-card,.rule-card,.kpi,.replay-team {
  border-color: #dce1e4;
  background: #fff;
}

.panel-head {
  padding: 13px 16px;
  background: #fff;
}

.panel-body {
  padding: 17px;
}

.panel+.panel {
  margin-top: 14px;
}

.team-strip {
  padding: 13px;
}

.teams {
  gap: 12px;
  margin-bottom: 16px;
}

.team-title b,.team-strip.enemy .team-title b {
  font-size: 11px;
  letter-spacing: 0;
  color: #3f4e59;
}

.team-title .subtle {
  color: var(--muted);
}

.unit-chip {
  border-radius: 3px;
  padding: 7px 8px;
}

.unit-chip.selected {
  background: #f4f7f8;
  border-color: #6f8a9a;
  box-shadow: inset 0 0 0 1px #6f8a9a;
}

.enemy .unit-chip.selected {
  background: #fcf8f7;
  border-color: #b78e84;
  box-shadow: inset 0 0 0 1px #b78e84;
}

.avatar {
  border-radius: 3px;
  background: #e9eff3;
  color: #3d6178;
}

.avatar.enemy {
  background: #f2eae7;
  color: #955a4f;
}

.steps {
  margin-bottom: 18px;
}

.step {
  padding: 11px 13px;
  font-size: 11px;
}

.step span {
  color: #7c8992;
}

.step.active {
  background: #f2f5f6;
  color: #2c5068;
  box-shadow: inset 0 -2px 0 #56768a;
}

.step.active span {
  color: inherit;
}

.pill {
  border-radius: 2px;
  background: #f1f3f4;
  color: #59636b;
  padding: 2px 6px;
}

.pill.green {
  background: #eef3f5;
  color: #3a6177;
}

.pill.red {
  background: #f6f0ee;
  color: #97584b;
}

.pill.gold {
  background: #f5f3ed;
  color: #806b43;
}

.field-section {
  letter-spacing: 0;
  font-size: 11px;
  color: #4c5862;
}

.fields {
  gap: 11px;
}

.meter-field {
  padding: 11px;
  background: #f7f8f8;
  border: 1px solid #e0e4e6;
}

.meter-field .bar {
  background: #dae2e7;
}

.meter-field.ap .bar {
  background: #d4dce6;
}

.meter-field input {
  font-size: 19px;
}

.hint {
  background: #f4f6f7;
  color: #59666e;
  padding: 10px 12px;
}

.notice {
  background: #faf8f2;
  color: #736748;
  border-color: #e6dfd1;
}

.mini-rule {
  border-color: #e7e9eb;
}

/* Data-first skills / rules. */
.tabs button.active {
  color: #385e78;
  border-bottom-color: #597f96;
}

.skill-grid {
  gap: 10px;
}

.skill-card {
  padding: 13px;
  min-height: 175px;
}

.skill-card.equipped {
  background: #f8fafb;
  border-color: #adc1ce;
}

.skill-card h3 {
  font-size: 12px;
}

.skill-card .description {
  color: #606c74;
}

.rule-card {
  margin-bottom: 11px;
}

.rule-head {
  background: #f5f6f7;
}

.equipped-list button {
  background: #f2f4f5;
  border-color: #d8dfe3;
}

.rule-count {
  color: #6a7882;
}

.unit-tactics-management,.condition-row .bs-condition-chooser {
  background: #f8f9f9;
  border-color: #dce1e4;
}

.bs-condition-chooser>summary {
  color: #435f72;
}

.bs-condition-item:has(input:checked) {
  background: #eaf1f4;
  border-color: #9db4c2;
  color: #34576d;
}

/* Replays keep signal colors for damage / BS, without an overall decorative tint. */
.battle-map {
  background: #f7f9fa;
  border-color: #dee3e5;
  border-radius: 2px;
}

.map-surface,.map-distance-list {
  background: #fff;
  border-color: #dce1e4;
}

.map-zoom-controls output,.map-distance-row strong {
  color: #456174;
}

.map-dialog::backdrop,dialog::backdrop {
  background: #252c3370;
  backdrop-filter: none;
}

.map-dialog {
  padding: 15px 19px;
}

.replay-team {
  border-color: #dce1e4;
}

.replay-team-head {
  background: #f1f4f6;
  color: #405b6d;
  border-color: #dce1e4;
}

.replay-team.enemy {
  border-color: #e6ddda;
}

.replay-team.enemy .replay-team-head {
  background: #f7f3f2;
  color: #896052;
  border-color: #e6ddda;
}

.replay-log-panel .log:hover {
  background: #f5f7f8;
}

.replay-log-panel .selected-log {
  background: #edf2f5;
  border-left-color: #577b92;
}

.log.turn {
  background: #f5f6f7;
}

.kpi {
  padding: 14px 16px;
}

.tiebreak-total {
  color: #3b6076;
}

.tiebreak-caption {
  background: #f3f5f6;
  color: #46515a;
}

.tiebreak-value.point-awarded {
  background: #eaf2f2;
  color: #2b5b59;
}

.tiebreak-value b {
  background: #cce1df;
}

.log-tag {
  border-radius: 2px;
  font-weight: 600;
}

#toast {
  background: #29333c;
  border-radius: 3px;
  box-shadow: 0 5px 15px #1112;
  transition: opacity .14s,transform .14s;
}

dialog {
  box-shadow: 0 12px 36px #10182035;
}

.modal-header {
  background: #f5f7f8;
}

/* Respect existing narrow-screen layout rules while keeping navigation legible. */
@media (max-width:1150px) {
  .sidebar {
    padding: 13px 8px;
  }

  .content {
    padding: 21px 20px 32px;
  }

}

@media (max-width:700px) {
  .sidebar {
    padding: 9px 12px 0;
    border-right: 0;
    border-bottom: 1px solid #d9dfe3;
  }

  .brand {
    padding: 4px 6px 11px;
    border-bottom: 0;
    margin: 0;
  }

  .nav button {
    padding: 9px 10px;
    border-radius: 2px 2px 0 0;
  }

  .nav button.active {
    box-shadow: inset 0 -2px 0 #56768a;
  }

  .topbar {
    height: auto;
    min-height: 47px;
    padding: 9px 14px;
  }

  .content {
    padding: 19px 14px 30px;
  }

  h1 {
    font-size: 20px;
  }

  .page-heading {
    margin-bottom: 16px;
  }

  .panel-head {
    padding: 12px 13px;
  }

  .panel-body {
    padding: 13px;
  }

  .skill-card {
    padding: 11px;
  }

}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation-duration: .01ms !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

}

/* Skill library: clear boundaries and full effect text in the comparison column.
   No changes to skills, combat calculations, or equipped state. */
.skill-results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 0 0 10px;
  padding: 0 1px;
  font-size: 11px;
}
.skill-results-bar strong { font-size: 12px; font-weight: 650; color: #27353e; }
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 0;
  background: transparent;
  overflow: visible;
}
.skill-list-head,
.skill-entry {
  display: grid;
  grid-template-columns: minmax(160px,1.45fr) 64px 64px 95px minmax(230px,3fr) 128px;
  column-gap: 9px;
  align-items: center;
}
.skill-list-head {
  padding: 7px 12px;
  background: #e9eef1;
  border: 1px solid #d1dbe1;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  color: #5e6c77;
}
.skill-entry {
  padding: 8px 12px;
  border: 1px solid #cbd5dc;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(24 44 60 / 4%);
}
.skill-entry:last-child { border-bottom: 1px solid #cbd5dc; }
.skill-entry:hover { background: #f7fafc; border-color: #a9bbc7; }
.skill-entry.equipped {
  background: #f4f9fc;
  border-color: #abc3d0;
  box-shadow: inset 3px 0 0 #6a93a8, 0 1px 2px rgb(24 44 60 / 4%);
}
.skill-entry.equipped:hover { background: #edf5fa; }
.skill-primary,.skill-range-col,.skill-value-col,.skill-effects-col { min-width: 0; }
.skill-title-line { display: flex; align-items: flex-start; min-width: 0; gap: 6px; flex-wrap: wrap; }
.skill-title-line h3 {
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 650;
  letter-spacing: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}
.skill-kind-label {
  display: inline-flex;
  flex: none;
  align-items: center;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid #dce3e8;
  color: #526673;
  background: #f5f7f8;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.skill-kind-label.attack { color: #835342; background: #faf6f4; border-color: #e9ded9; }
.skill-kind-label.hp,.skill-kind-label.ap,.skill-kind-label.ha,.skill-kind-label.cleanse {
  color: #486956; background: #f3f8f4; border-color: #dce8df;
}
.skill-equipped-label { flex: none; color: #397089; font-size: 10px; font-weight: 650; }
.skill-range-col strong,.skill-value-col strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
  color: #28353d;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.skill-range-col small,.skill-value-col small {
  display: block;
  font-size: 10px;
  color: #75808a;
  margin-top: 1px;
  line-height: 1.3;
}
.skill-effects-col {
  display: flex;
  align-items: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #344a58;
}
.skill-effect-fulltext {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}
.skill-effect-chip {
  font-size: 10.5px;
  padding: 2px 5px;
  line-height: 1.5;
  border: 1px solid #d9e2e7;
  border-radius: 2px;
  color: #425b6b;
  background: #f4f7f9;
  white-space: normal;
  overflow-wrap: anywhere;
}
.skill-no-effects { font-size: 11px; color: #79858d; }
.skill-row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.skill-row-actions button { font-size: 11px; padding: 4px 8px; line-height: 1.4; white-space: nowrap; }
.skill-row-actions .skill-unequip { color: #496579; border-color: #c9d9e2; background: #f0f6f8; }
.skill-row-actions button:focus-visible { outline: 2px solid #618aa4; outline-offset: 2px; }
.skill-mobile-label { display: none; }
@media (max-width: 1200px) {
  .skill-list-head { display: none; }
  .skill-entry {
    grid-template-columns: minmax(0,2fr) minmax(63px,.6fr) minmax(70px,.6fr) minmax(90px,.7fr);
    grid-template-areas: 'name range ap cost' 'effects effects effects actions';
    gap: 7px 12px;
  }
  .skill-primary { grid-area: name; }
  .skill-range-col { grid-area: range; }
  .skill-entry > .skill-value-col:nth-child(3) { grid-area: ap; }
  .skill-entry > .skill-value-col:nth-child(4) { grid-area: cost; }
  .skill-effects-col { grid-area: effects; padding-top: 7px; border-top: 1px solid #e3e9ed; }
  .skill-row-actions { grid-area: actions; align-self: end; }
  .skill-mobile-label { display: block; color: #778994; font-size: 10px; line-height: 1.35; margin-bottom: 3px; }
}
@media (max-width: 700px) {
  .skill-entry {
    grid-template-columns: repeat(3,minmax(0,1fr));
    grid-template-areas: 'name name name' 'range ap cost' 'effects effects effects' 'actions actions actions';
    gap: 7px 10px;
    padding: 9px 10px;
  }
  .skill-effects-col { padding-top: 7px; min-height: 20px; }
  .skill-row-actions { justify-content: flex-end; border-top: 1px solid #e3e9ed; padding-top: 7px; }
  .skill-row-actions button { padding: 5px 9px; }
}

/* Fixed 20+5 format and compact sudden-death phase markers. */
.fixed-turns{display:flex;align-items:center;min-height:36px;padding:7px 10px;border:1px solid var(--line);background:var(--paper);border-radius:3px;font-weight:600;font-variant-numeric:tabular-nums}
.log.sudden,.log.suddenDamage{background:#fff5ea;border-left:3px solid #ba7745}
.log.sudden .type,.log.suddenDamage .type{color:#8c522c;background:#f8e7d5}

/* Shield protection appears beside HP/AP at the selected replay frame. */
.replay-barrier { color: var(--green); font-weight: 700; white-space: nowrap; }

/* Character-owned specializations are visually separated from the shared library. */
.specialized-skill-section { margin: 12px 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--green-light); }
.specialized-skill-header { margin-bottom: 8px; }
.specialized-skill-header h2 { font-size: 14px; margin: 0; color: var(--ink); }
.specialized-skill-header h2 span { font-size: 11px; font-weight: 500; color: var(--muted); }
.specialized-skill-header p { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.specialized-skill-section .skill-list { gap: 6px; }
.specialized-skill-section .skill-entry { background: var(--white); }
.specialized-base { margin: 3px 0 0; font-size: 10px; line-height: 1.35; color: var(--muted); }
.specialized-modal-reference { padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; margin-bottom: 15px; background: var(--green-light); font-size: 12px; }
.specialized-modal-reference p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
