.damage-page {
  --ink: var(--yy-ink, #162640);
  --muted: var(--yy-muted, #51647b);
  --blue: var(--yy-blue, #265abb);
  --rim: var(--yy-line, #ccd8eb);
  --panel: var(--yy-paper, #fbfcff);
  --shadow: 0 12px 36px -22px #46569955, 0 1px 2px #4f679716, inset 0 1px #fff;
  max-width: 1256px;
  margin: 0 auto;
  padding: 32px clamp(16px, 3.8vw, 48px) 80px;
  color: var(--ink);
  line-height: 1.5;
}
.damage-page *, .damage-page *::before, .damage-page *::after { box-sizing: border-box; }
.damage-page h1, .damage-page h2, .damage-page p { margin: 0; }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 25px; }
.page-heading h1 { font-size: clamp(2.1rem, 4vw, 3.25rem); letter-spacing: -.055em; line-height: 1.16; }
.page-heading p { margin-top: 8px; color: var(--muted); }
.damage-page button, .damage-page select, .damage-page input { font: inherit; }
.damage-page button { cursor: pointer; }
.damage-page :focus-visible { outline: 3px solid #2b69c4; outline-offset: 3px; }
.modes { display: inline-flex; flex: none; gap: 3px; padding: 4px; border-radius: 100px;
  background: #e7eef9e6; border: 1px solid #acbcd398; box-shadow: inset 0 1px 1px #fff, 0 3px 10px #375c9010; }
.modes button { border: 1px solid transparent; border-radius: inherit; background: transparent; padding: 8px 17px; min-height: 39px; color: #435672; font-weight: 650; }
.modes button[aria-pressed=true] { color: #1b4186; background: linear-gradient(170deg,white,#f1f5ff); border-color: #b7c9e0b3; box-shadow: 0 2px 6px #3b548b2a, inset 0 1px white; }
#damage-form { display: grid; gap: 18px; }
.fighters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; align-items: start; }
.panel, .duel-board { min-width: 0; background: var(--panel); border: 1px solid var(--rim); border-radius: 24px; box-shadow: var(--shadow); }
.panel { padding: clamp(15px,1.6vw,22px); }
.panel h2 { font-size: 1.18rem; margin: 0 0 16px; letter-spacing: -.025em; }
.combatant { --portrait-wash: #c3d9fb; --profile-ink: #245597; --portrait-fade: #f0f5ff; overflow: hidden; }
.combatant:nth-child(2) { --portrait-wash: #d7ccfb; --profile-ink: #5c5092; --portrait-fade: #f7f3fd; }
.profile-header {
  margin: calc(-1 * clamp(15px,1.6vw,22px)) calc(-1 * clamp(15px,1.6vw,22px)) 16px;
  padding: 16px clamp(15px,1.6vw,22px); position: relative; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; min-height: 123px; overflow: hidden;
  background: radial-gradient(ellipse at 84% 80%, #fff9 0%, transparent 58%), linear-gradient(112deg,var(--portrait-fade),var(--portrait-wash));
  border-bottom: 1px solid #617bad20;
}
.profile-header::before { content: ""; position: absolute; z-index: -1; right: -15px; top: -67px; width: 194px; height: 194px; border-radius: 50%; border: 1px solid #ffffff9c; box-shadow: 0 0 0 22px #ffffff26, 0 0 0 23px #ffffff73, 0 0 0 59px #ffffff25; }
.profile-identity { position: relative; z-index: 1; max-width: 66%; }
.profile-label { display: flex; align-items: center; gap: 9px; font-size: .79rem; line-height: 1.3; color: var(--profile-ink); }
.profile-label strong { border-radius: 20px; padding: 3px 8px; background: #ffffffc9; border: 1px solid #fff; }
.dex-number { font: 600 .79rem/1.2 ui-monospace, "SFMono-Regular", monospace; letter-spacing: .035em; }
.profile-header h2 { margin: 7px 0 7px; font-size: clamp(1.4rem,2vw,1.8rem); letter-spacing: -.045em; line-height: 1.12; overflow-wrap: anywhere; }
.profile-types { display: flex; flex-wrap: wrap; gap: 5px; }
.profile-types span { display: inline-flex; align-items: center; gap: 4px; background: #ffffffc4; border: 1px solid #fff; border-radius: 30px; padding: 1px 7px 1px 3px; color: #394d63; font-weight: 650; font-size: .78rem; }
.profile-types img { width: 17px; height: 17px; }
.portrait { position: absolute; right: 2%; top: 4%; height: 94%; width: 35%; object-fit: contain; filter: drop-shadow(0 4px 5px #354a7930); }
.field-grid, .fighter-grid, .points { display: grid; gap: 10px; }
.fighter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.field-grid { grid-template-columns: repeat(auto-fit,minmax(min(144px,100%),1fr)); gap: 12px; }
.fighter-grid label, .field-grid label, .points label { display: grid; gap: 4px; min-width: 0; color: #485b76; font-size: .875rem; font-weight: 630; }
.damage-page select, .damage-page input:is([type=number],[type=text]) { height: 39px; min-width: 0; width: 100%; border: 1px solid #b8c8dd; border-radius: 10px; background-color: #fafcff; color: var(--ink); font-size: 1rem; padding: 5px 9px; font-weight: 540; }
.damage-page select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m2 2 4 4 4-4' fill='none' stroke='%23536a8d' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.damage-page select:disabled { opacity: .75; }
.section-label { display: flex; justify-content: space-between; align-items: center; margin: 17px 0 6px; font-size: .91rem; color: #465b76; }
.section-label span { font-size: .85rem; font-variant-numeric: tabular-nums; }
.points { display: grid; grid-template-columns: minmax(0,1fr); gap: 2px; }
.point-row { display: grid; grid-template-columns: 40px minmax(0,1fr) 50px; align-items: center; gap: 10px; }
.point-row label { font-size: .87rem; white-space: nowrap; }
.damage-page .points input[type=range] { accent-color: #477dc9; width: 100%; min-width: 0; padding: 0; margin: 0; height: 26px; box-shadow: none; border: none; background: transparent; cursor: pointer; }
.damage-page .points input[type=number] { height: 29px; text-align: center; font-weight: 680; font-variant-numeric: tabular-nums; padding: 2px; border-radius: 7px; }
.points input::-webkit-inner-spin-button { -webkit-appearance: none; }
.damage-page details { border-top: 1px solid #dbe3ee; margin-top: 14px; padding-top: 11px; }
.match-output details { margin-top: 6px; padding-top: 6px; }
.match-output summary { margin-inline: auto; }
.damage-page summary { cursor: pointer; color: #37588a; font-size: .9rem; width: fit-content; }
.damage-page details .fighter-grid { margin-top: 12px; }
.checks { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 7px; }
.checks label { display: inline-flex; gap: 5px; align-items: center; min-height: 34px; padding: 4px 9px; font-size: .86rem; color: #3b506e; border-radius: 10px; background: #eef3fb; cursor: pointer; }
.checks label:has(:checked) { background: #e2edff; color: #244c94; }
.checks input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }
.damage-page .note { margin-top: 13px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.duel-board { display: grid; grid-template-columns: minmax(0,1fr) minmax(280px,1.05fr) minmax(0,1fr); align-items: center; gap: 16px; padding: 18px 22px; background: radial-gradient(ellipse at 0 50%,#dceafb 0%,transparent 49%), radial-gradient(ellipse at 100% 65%,#e6dcf8 0%,transparent 48%),#f6f9ff; }
.match-entry { display: flex; align-items: center; gap: 12px; min-width: 0; }
.match-entry:last-child { flex-direction: row-reverse; text-align: right; }
.match-identity { display: grid; align-content: center; gap: 2px; min-width: 0; }
.match-identity small, .match-identity span { color: #4c607e; font-size: .84rem; }
.match-identity strong { font-size: clamp(1.16rem,2.1vw,1.7rem); letter-spacing: -.045em; line-height: 1.25; overflow-wrap: anywhere; }
.match-portrait { width: clamp(56px,6.7vw,98px); height: 88px; object-fit: contain; }
.match-output { min-width: 0; text-align: center; }
#result section { padding: 0; }
#result-prompt { color: var(--muted); }
.arena-fields { display: grid; grid-template-columns: minmax(0,.82fr) minmax(0,1.3fr) minmax(0,.82fr); gap: 16px; align-items: start; }
.arena-fields > section { min-width: 0; }
.arena-fields h3 { font-size: .96rem; color: var(--ink); margin: 0 0 9px; }
.arena-fields .field-grid { grid-template-columns: minmax(0,1fr); }
.arena-shared { border-inline: 1px solid #d7e1ef; padding-inline: 16px; }
.arena-shared fieldset { padding: 0; margin: 0 0 8px; min-width: 0; border: 0; }
.arena-shared legend { padding: 0; font-size: .87rem; margin-bottom: 3px; color: var(--muted); font-weight: 630; }
.arena-choices { display: flex; gap: 4px; flex-wrap: wrap; }
.arena-choices label { position: relative; cursor: pointer; }
.arena-choices input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.arena-choices span { display: inline-block; border: 1px solid #c6d4e6; background: #f4f7fc; color: #3f5474; border-radius: 9px; padding: 4px 8px; font-size: .86rem; }
.arena-choices input:checked + span { color: #214e97; border-color: #8aafe3; background: #dfeaff; font-weight: 640; }
.arena-choices input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }
.arena-side:last-child .checks { margin-top: 0; }
#result h2 { font-size: .92rem; letter-spacing: .015em; color: #425a7b; margin: 0 0 6px; }
.result-line { display: block; color: #2155a8; font-weight: 750; letter-spacing: -.055em; font-size: clamp(1.96rem,2.55vw,2.5rem); line-height: 1.15; font-variant-numeric: tabular-nums; }
#result p { margin-top: 9px; font-size: .94rem; line-height: 1.7; }
.result-meta, .rolls { color: var(--muted); font-variant-numeric: tabular-nums; }
.damage-meter { margin: 8px 0; height: 8px; border-radius: 20px; background: linear-gradient(to right,#376ac3 0 var(--min-damage),#98bbfc var(--min-damage) var(--max-damage),#dce5f0 var(--max-damage) 100%); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.damage-page .primary { min-height: 44px; color: white; padding: 9px 22px; border-radius: 100px; border: 1px solid #214d9c; background: linear-gradient(165deg,#4675ce,#2452ad); box-shadow: inset 0 1px #ffffff6e, 0 4px 12px #3256a123; font-weight: 670; }
.damage-page .primary:hover { background: #2554a9; }
.damage-page .primary:disabled { opacity: .7; cursor: wait; }
#state { color: var(--muted); font-size: .875rem; text-align: center; }
#state:empty { display: none; }
.table-wrap { overflow: auto; }
.damage-page table { width: 100%; border-collapse: collapse; margin: 10px 0 0; }
.damage-page th,.damage-page td { text-align: left; padding: 6px 3px; border-bottom: 1px solid var(--rim); font-size: .87rem; overflow-wrap: anywhere; }
.damage-page th { color: #415978; }
.damage-page [hidden] { display: none !important; }
@supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .modes { background: #e9eef9a8; backdrop-filter: blur(18px) saturate(145%); -webkit-backdrop-filter: blur(18px) saturate(145%); }
}
@media (max-width: 680px) {
  .damage-page { padding-top: 21px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 16px; }
  .fighters { grid-template-columns: minmax(0,1fr); }
  .duel-board { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px; gap: 9px; }
  .match-entry { gap: 5px; }
  .match-entry:last-child { grid-column: 2; grid-row: 1; }
  .match-portrait { width: 41px; height: 50px; }
  .match-identity strong { font-size: 1.02rem; }
  .match-identity small, .match-identity span { font-size: .76rem; }
  .match-output { grid-column: 1/-1; grid-row: 2; border-top: 1px solid #d3deef; padding-top: 9px; }
  .arena-fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 11px; }
  .arena-shared { grid-column: 1/-1; grid-row: 2; border-inline: 0; border-top: 1px solid #dde5ef; padding: 12px 0 0; }
  .arena-side:last-child { grid-column: 2; grid-row: 1; }
  .profile-header { min-height: 112px; }
  .field-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .damage-page select, .damage-page input:is([type=number],[type=text]) { height: 42px; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more), (forced-colors: active) {
  .modes { background: #e8eef8; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .panel, .duel-board { background: #fff; border-color: #a5b8d2; }
  .profile-header { background: var(--portrait-fade); }
  .profile-header::before { display: none; }
}
