:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #747d86;
  --line: #dbe2ea;
  --soft: #f6f8fb;
  --attack-bg: #f9eef8;
  --defense-bg: #e2f6f9;
  --blue: #168bd6;
  --green: #2fa66a;
  --violet: #6577c7;
  --magenta: #c85fa0;
  --danger: #d94f4f;
  --card: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  max-width: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

html::-webkit-scrollbar:horizontal,
body::-webkit-scrollbar:horizontal,
.app::-webkit-scrollbar:horizontal,
main::-webkit-scrollbar:horizontal,
section::-webkit-scrollbar:horizontal,
article::-webkit-scrollbar:horizontal,
div::-webkit-scrollbar:horizontal {
  height: 0;
}

body {
  margin: 0;
  background: #eef3f7;
  color: var(--ink);
  padding-bottom: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
    "Yu Gothic", "Meiryo", sans-serif;
  letter-spacing: 0;
  touch-action: auto;
}

html.selection-open,
body.selection-open {
  overflow: hidden;
  overflow-x: clip;
}

body.selection-open {
  position: fixed;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  left: 0;
  right: 0;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  padding-bottom: 52px;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: visible;
}

main,
section,
article,
header,
footer {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

main,
#calcView,
#partyView,
.topbar,
.battle-summary,
.bottom-tabs,
.site-footer {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  height: 80px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  padding: 0 16px;
}

.topbar-left,
.topbar-center,
.topbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-left {
  justify-content: flex-start;
}

.topbar-center {
  justify-content: center;
}

.topbar-right {
  justify-content: flex-end;
}

.topbar-spacer {
  display: block;
  min-width: 72px;
  min-height: 1px;
}

.top-title-main {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  line-height: 1.08;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.top-title-break {
  display: none;
}

.top-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

.top-title-sub {
  display: block;
  color: #6b737d;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.link-button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 8px 0;
  min-width: 0;
  white-space: nowrap;
}

.topbar-party .topbar-left,
.topbar-party .topbar-right {
  visibility: hidden;
}

.panel {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding:16px;
}

.panel.attack {
  background: var(--attack-bg);
}

.panel.defense {
  background: var(--defense-bg);
}

.section-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: #4d535c;
  font-weight: 800;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.section-head .section-title {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.section-meta {
  color: #838a94;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  margin-left: auto;
  text-align: right;
}

.battle-summary {
  position: sticky;
  top: 80px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 253, 0.94);
  backdrop-filter: blur(14px);
}

.summary-side {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.summary-label {
  color: #7d848e;
  font-size: 11px;
  font-weight: 800;
}

.summary-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
}

.picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.select-like,
.input-like {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd4dc;
  border-radius: 8px;
  background: #fff;
  color: #2c3036;
  padding: 0 12px;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.input-like::placeholder {
  color: #8a929c;
  font-weight: 500;
}

.picker-button,
.choice-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.picker-button span,
.choice-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-button strong,
.choice-button strong {
  color: #8f98a4;
  font-size: 22px;
  line-height: 1;
}

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.input-like:focus,
label.small input:focus,
label.small select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(9, 142, 232, 0.16);
}

.select-like {
  appearance: none;
  text-align: center;
}

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 12px 12px 14px;
  border: 1px solid rgba(32, 36, 42, 0.07);
  box-shadow: 0 8px 20px rgba(38, 48, 60, 0.06);
  min-width: 0;
}

.pokemon-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.sprite {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: #f2f4f6;
  border: 1px solid #e3e7ed;
}

.pokemon-main {
  min-width: 0;
}

.name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.weakness-line {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.weakness-label {
  color: #7a8896;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.weakness-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weakness-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 25.5px;
  padding: 0 8px 0 0;
  border-radius: 5px;
  background: #f3f5f7;
}

.weakness-chip .type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 5px 0 0 5px;
  min-height: 25.5px;
  line-height: 1;
  text-align: center;
}

.weakness-multiplier {
  color: #333;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.weakness-chip.severe .weakness-multiplier {
  color: #c54a2f;
}



.weakness-empty {
  color: #6d7b89;
  font-size: 12px;
  font-weight: 800;
}

.pokemon-name {
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  border-radius: 5px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
}

.type+.type {
  margin-left: 4px;
}

.stat-line,
.ability-line,
.ability-detail-line,
.item-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ability-detail-line {
  white-space: normal;
  line-height: 1.45;
}

.stat-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 4px;
  margin-top: 9px;
}

.stat-pill {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 54px;
  border-radius: 8px;
  background: #f3f5f7;
  color: #22272e;
  padding: 5px 2px;
}

.stat-pill .stat-label {
  color: #7a818b;
  font-size: 10px;
  font-weight: 900;
}

.stat-pill .stat-value {
  color: #20242a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-pill .stat-value.actual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}

.stat-pill .stat-value strong {
  font-size: 14px;
}

.nature-mod {
  font-size: 10px;
  font-weight: 900;
}

.nature-mod.up {
  color: #d64a4a;
}

.nature-mod.down {
  color: #1f72d1;
}

.nature-mod.neutral {
  color: #767d87;
}

.battle-support {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.battle-support-section {
  display: grid;
  gap: 8px;
  border: 1px solid #dde4ec;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.offense-support .battle-support-section {
  border-color: #c7def4;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
}

.defense-support .battle-support-section {
  border-color: #d8e6d8;
  background: linear-gradient(180deg, #f8fcf8 0%, #ffffff 100%);
}

.battle-support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.battle-support-badge {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e9f2fa;
  color: #275d90;
  font-size: 11px;
  font-weight: 900;
}

.defense-support .battle-support-badge {
  background: #edf6ee;
  color: #357143;
}

.battle-support-list {
  display: grid;
  gap: 6px;
}

.battle-support-empty {
  color: #5f6b77;
  font-size: 13px;
  line-height: 1.5;
}

.switch-advice-title {
  color: #4f5865;
  font-size: 13px;
  font-weight: 900;
}

.switch-advice-note {
  color: #5f6b77;
  font-size: 13px;
  line-height: 1.5;
}

.switch-candidates {
  display: grid;
  gap: 6px;
}

.switch-candidates.compact {
  gap: 5px;
}

.switch-candidate {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #dde4ec;
  border-radius: 8px;
  background: #fff;
  padding: 7px;
}

.switch-candidate.safe {
  border-color: #8fc8a5;
  background: #f0faf4;
}

.switch-candidate.watch {
  border-color: #e5cd7d;
  background: #fffaf0;
}

.switch-candidate.danger {
  border-color: #e6aaa8;
  background: #fff5f5;
}

.switch-candidate img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  background: #eef2f6;
}

.switch-candidate-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.switch-candidate-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #20242a;
  font-size: 13px;
  font-weight: 900;
}

.switch-candidate-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6f7884;
  font-size: 12px;
  font-weight: 800;
}

.switch-candidate-targets {
  color: #44515f;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  white-space: normal;
}

.switch-candidate-side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.switch-candidate-detail-button {
  min-width: 48px;
  min-height: 28px;
  border: 1px solid #bfcddd;
  border-radius: 6px;
  background: #fff;
  color: #4a5868;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.switch-candidate-badge {
  min-width: 62px;
  border-radius: 6px;
  padding: 4px 6px;
  color: #fff;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
}

.switch-candidate.safe .switch-candidate-badge {
  background: #2f9b61;
}

.switch-candidate.watch .switch-candidate-badge {
  background: #b98520;
}

.switch-candidate.danger .switch-candidate-badge {
  background: #d94f4f;
}

.switch-candidate.best {
  border-color: #6fa8dc;
  background: #eef6ff;
}

.switch-candidate.best .switch-candidate-badge {
  background: #2e78c7;
}

.switch-candidate-action {
  color: #495460;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.switch-candidate-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #eef3f8;
  color: #3f4f61;
  font-size: 12px;
  font-weight: 900;
}

.offense-coverage-list {
  display: grid;
  gap: 8px;
}

.offense-coverage-row {
  display: grid;
  gap: 6px;
}

.offense-coverage-move-name {
  color: #20242a;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.offense-coverage-move-meta {
  margin-top: 2px;
  color: #6f7884;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.offense-coverage-targets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.offense-coverage-targets.detail-single-target {
  grid-template-columns: minmax(0, 1fr);
}

.offense-coverage-target {
  display: grid;
  gap: 2px;
  min-width: 0;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d6dee8;
  background: #fff;
}

.offense-coverage-target strong {
  color: #334150;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
}

.offense-coverage-target em {
  color: #667381;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.offense-coverage-target small {
  color: #6f7884;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.offense-coverage-target.super {
  border-color: #efc5c3;
  background: #fff4f3;
}

.offense-coverage-target.super em {
  color: #c14e4e;
}

.offense-coverage-target.ko {
  border-color: #da9a97;
  background: linear-gradient(180deg, #ffeceb 0%, #fff6f5 100%);
}

.offense-coverage-target.ko em {
  color: #c14e4e;
}

.offense-coverage-target.neutral {
  border-color: #d6dee8;
  background: #fff;
}

.offense-coverage-target.resist {
  border-color: #cfe2c9;
  background: #f3fbf1;
}

.offense-coverage-target.resist em {
  color: #4a8a4a;
}

.offense-coverage-target.immune {
  border-color: #d5ccec;
  background: #f6f2ff;
}

.offense-coverage-target.immune em {
  color: #6d56a8;
}

.ability-line strong,
.item-line strong {
  color: #2d3138;
  font-weight: 700;
}

.inline-choice {
  min-width: 0;
  border: 0;
  background: transparent;
  color: #2d3138;
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: center;
  gap: 3px;
  padding: 0;
  font-weight: 700;
  vertical-align: baseline;
}

.inline-choice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-choice strong {
  color: #8f98a4;
  font-size: 16px;
  line-height: 1;
}

.inline-choice:focus {
  outline: 3px solid rgba(9, 142, 232, 0.16);
  border-radius: 5px;
}

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

.details summary {
  cursor: pointer;
  color: #4f5865;
  font-weight: 700;
  list-style: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 10px 12px;
  border: 1px solid rgba(32, 36, 42, 0.07);
}

.details summary::-webkit-details-marker {
  display: none;
}

.details summary::after {
  content: "開く";
  float: right;
  color: var(--blue);
  font-size: 12px;
}

.details[open] summary::after {
  content: "閉じる";
}

.grid-3,
.grid-4,
.grid-6 {
  display: grid;
  gap: 8px;
}

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

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

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

.build-tuning {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-radius: 8px;
}

.mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #4f5865;
  font-size: 13px;
}

label.small {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #69717c;
  font-size: 12px;
}

label.small input,
label.small select {
  min-height: 40px;
  min-width: 0;
  border: 1px solid #cfd4dc;
  border-radius: 8px;
  padding: 4px 8px;
  background: #fff;
  font-size: 16px;
  line-height: 1.35;
}

.attackerNature {
  max-width: 100%;
}

.defenderNature {
  max-width: 100%;
}

.item-picker-label {
  min-width: 0;
}

.item-row {
  max-width: min(420px, 100%);
}

.choice-button {
  min-height: 34px;
  border: 1px solid #cfd4dc;
  border-radius: 8px;
  background: #fff;
  color: #2c3036;
  text-align: center;
}

.choice-button:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(9, 142, 232, 0.16);
}

label.small input[readonly],
label.small select:disabled {
  background: #f3f5f7;
  color: #4f5865;
  opacity: 1;
}

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

.move-panel {
  background: #f7fafb;
}

.move-card {
  display: grid;
  gap: 10px;
}

.move-card .row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.roll-grid {
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.roll-cell {
  min-height: 32px;
  border-radius: 8px;
  background: #eef4f8;
  color: #333941;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.roll-cell.ko {
  background: #ffe0de;
  color: #bb3f3f;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 0;
  border-radius: 8px;
  background: #eef0f2;
  color: #4d535c;
  min-height: 34px;
  padding: 0 14px;
  font-weight: 700;
}

.chip.active {
  background: var(--blue);
  color: #fff;
}

.chip.violet.active {
  background: var(--violet);
}

.chip.magenta.active {
  background: var(--magenta);
}

.results {
  background: #fff;
}

.result-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}

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

.result-matchup-side {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #e1e6ed;
  border-radius: 8px;
  background: #fff;
}

.result-matchup-label {
  color: #6d7681;
  font-size: 11px;
  font-weight: 800;
}

.result-matchup-side strong {
  color: #20242a;
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-layout {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: stretch;
}

.result-side {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e1e6ed;
  padding: 10px;
}

.result-side.right {
  text-align: left;
}

.calc-param {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
  color: #67707b;
  font-size: 12px;
  font-weight: 800;
}

.result-side.right .calc-param {
  grid-template-columns: auto minmax(0, 1fr);
}

.calc-param strong {
  color: #20242a;
  font-size: 18px;
  font-weight: 900;
  text-align: right;
}

.damage-main {
  display: grid;
  gap: 6px;
  align-content: center;
}

.damage-number {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

.damage-percent {
  color: var(--danger);
  font-size: 24px;
  font-weight: 900;
  text-align: left;
}

.bar {
  position: relative;
  height: 14px;
  border-radius: 8px;
  background: #edf0f3;
  overflow: hidden;
}

.bar span {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  border-radius: 8px;
}

.bar-max {
  z-index: 1;
  background: #a7d8f0;
}

.bar-min {
  z-index: 2;
  background: #168bd6;
}

.ko-line {
  color: #4d535c;
  font-weight: 700;
}

.formula {
  color: #6a727d;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.box-grid {
  display: grid;
  gap: 8px;
}

.box-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.box-card img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 8px;
  background: #f2f4f6;
}

.box-card strong,
.box-card>span:not(.type),
.box-card>span:not(.type) span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.box-card>span:not(.type) span {
  color: #79818b;
  font-size: 12px;
}

.box-card .type {
  display: inline-flex;
}

.box-card:disabled {
  opacity: 0.72;
  cursor: default;
}

.party-view {
  background: #e1ebf3;
}

.type-balance-view {
  background: #e1ebf3;
  padding: 14px;
}

.type-balance-panel {
  display: grid;
  gap: 16px;
  background: linear-gradient(180deg, #f9fcff 0%, #f1f7fc 100%);
}

.type-balance-note {
  margin: 0;
  color: #5f6b77;
  font-size: 14px;
  line-height: 1.7;
}

.type-balance-builder {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d7e2ec;
  border-radius: 12px;

  background: var(--attack-bg);
}

.type-balance-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.type-balance-save-form {
  flex: 1 1 220px;
  min-width: min(100%, 240px);
  max-width: 320px;
}

.type-balance-builder-copy {
  display: grid;
  gap: 4px;
}

.type-balance-builder-copy strong {
  color: #334354;
  font-size: 14px;
  font-weight: 900;
}

.type-balance-builder-copy span {
  color: #617181;
  font-size: 12px;
  line-height: 1.5;
}

.type-balance-builder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.type-balance-build-button {
  min-width: 116px;
}

.type-balance-pool-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-balance-pool-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #c9d9e8;
  border-radius: 999px;
  background: #fff;
  color: #33485d;
  font-size: 12px;
  font-weight: 800;
}

.type-balance-pool-pill img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.type-balance-pool-pill strong {
  color: #7f8d9b;
  font-size: 14px;
}

.type-balance-slots {
  gap: 8px;
}

.type-balance-result-section {
  display: grid;
  gap: 12px;
}

.type-balance-result-title {
  margin: 0;
  color: #25313d;
  font-size: 16px;
  font-weight: 900;
}

.type-balance-opponent-panel {
  display: grid;
  gap: 0;
}

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

.type-balance-summary-card {
  display: grid;
  gap: 8px;
  align-content: start;
  align-items: start;
  padding: 12px;
  border: 1px solid #d7e2ec;
  border-radius: 10px;
  background: #fff;
}

.type-balance-summary-card h3 {
  margin: 0;
  color: #20242a;
  font-size: 14px;
  line-height: 1.2;
}

.type-balance-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-balance-summary-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #f4f8fb;
  border: 1px solid #d8e3ec;
  color: #4f5f70;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.type-balance-combo-card {
  align-content: start;
}

.type-balance-combo-note {
  color: #667382;
  font-size: 12px;
  line-height: 1.5;
}

.type-balance-combo-list {
  display: grid;
  gap: 8px;
}

.type-balance-combo-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #d7e2ec;
  border-radius: 10px;
  background: #f8fbfd;
}

.type-balance-combo-item.clean {
  border-color: #cfe8d7;
  background: #f4fbf6;
}

.type-balance-combo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.type-balance-combo-rank,
.type-balance-combo-status {
  font-size: 11px;
  font-weight: 900;
}

.type-balance-combo-rank {
  color: #506171;
}

.type-balance-combo-status {
  color: #16805a;
}

.type-balance-combo-item.mixed .type-balance-combo-status {
  color: #a85c2b;
}

.type-balance-combo-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-balance-combo-member {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #d8e3ec;
  color: #33414f;
  font-size: 12px;
  font-weight: 800;
}

.type-balance-combo-meta {
  color: #667382;
  font-size: 12px;
  font-weight: 800;
}

.type-balance-card {
  appearance: none;
  width: 100%;
  min-height: 100px;
  padding: 8px;
  border: 1px solid #d7e2ec;
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.type-balance-card.fixed {
  border-color: #168bd6;
  background: #e7f4fd;
  box-shadow: inset 0 0 0 1px rgba(22, 139, 214, 0.35);
}

.type-balance-card.empty {
  place-items: center;
  align-content: center;
  color: #8a96a3;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.type-balance-card-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.type-balance-card-main img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: #eef2f6;
}

.type-balance-card-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #20242a;
  font-size: 14px;
  font-weight: 900;
}

.type-balance-card-state {
  margin-top: 2px;
  color: #617181;
  font-size: 11px;
  font-weight: 800;
}

.type-balance-card-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.type-balance-card-actions {
  margin-top: auto;
}

.type-balance-candidate-card {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  cursor: pointer;
  border-radius: 14px;
  padding: 10px 12px;
  transition:
    transform 0.15s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.type-balance-candidate-card.disabled {
  cursor: default;
  opacity: 0.84;
}

.type-balance-candidate-card.selected {
  border-color: #7bb9ea;
  background: linear-gradient(180deg, #f8fcff 0%, #eef7ff 100%);
  box-shadow: 0 10px 24px rgba(42, 96, 144, 0.08);
}

.type-balance-candidate-subaction {
  min-height: 30px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid #c6d4e2;
  border-radius: 8px;
  background: #fff;
  color: #5b6875;
  font-size: 12px;
  font-weight: 800;
}

.type-balance-candidate-subaction.primary {
  border-color: #6fa9e2;
  color: #2f7fc8;
  background: #f7fbff;
}

.type-balance-candidate-subaction:disabled {
  opacity: 0.7;
}

.type-balance-candidate-actions {
  display: grid;
  gap: 6px;
  align-items: center;
  justify-items: end;
  align-self: center;
}

.type-balance-candidate-actions .party-add {
  min-width: 0;
  width: auto;
  padding: 0 12px;
}

.type-balance-candidate-badge {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 20px;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #6d7f92;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.type-balance-candidate-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(35, 60, 88, 0.08);
}

.save-limit-overwrite-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.save-limit-current-name {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #d7e2ec;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.save-limit-current-name span {
  color: #6f7d8b;
  font-size: 12px;
  font-weight: 800;
}

.save-limit-current-name strong {
  color: #233242;
  font-size: 15px;
  font-weight: 900;
}

.save-limit-overwrite-label {
  color: #5f6b77;
  font-size: 13px;
  font-weight: 800;
}

.save-limit-overwrite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d7e2ec;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 18px rgba(41, 63, 91, 0.06);
  transition:
    transform 0.15s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.save-limit-overwrite-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.save-limit-overwrite-main strong {
  color: #243343;
  font-size: 14px;
}

.save-limit-overwrite-main span {
  color: #738191;
  font-size: 12px;
}

.save-limit-overwrite-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #b9d5ef;
  border-radius: 8px;
  background: #eef7ff;
  color: #2f7fc8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.notice-body {
  display: grid;
  gap: 14px;
  padding: 0 24px 8px;
}

.notice-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 24px 24px;
}

.notice-sheet {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.notice-message {
  margin: 0;
  color: #334252;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 700;
}

.notice-confirm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #cfd9e4;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fc 100%);
  color: #445364;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(32, 52, 75, 0.08);
}

.notice-confirm-button:hover {
  border-color: #b8cadc;
  background: linear-gradient(180deg, #ffffff 0%, #eef5fb 100%);
}

.save-limit-overwrite-item:hover {
  transform: translateY(-1px);
  border-color: #bad4ea;
  box-shadow: 0 12px 24px rgba(41, 63, 91, 0.09);
}

@media (max-width: 720px) {
  .notice-body {
    padding: 0 16px 8px;
  }

  .notice-actions {
    padding: 0 16px 16px;
  }

  .notice-confirm-button {
    width: 100%;
  }
}

.type-balance-table {
  width: 100%;
}

.type-balance-mobile-list {
  display: none;
}

.type-balance-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d7e2ec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(48, 72, 102, 0.06);
}

.type-balance-matrix {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.type-balance-matrix th,
.type-balance-matrix td {
  padding: 10px 8px;
  border-bottom: 1px solid #e6edf4;
  border-right: 1px solid #eef3f8;
  text-align: center;
  vertical-align: middle;
}

.type-balance-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fbff;
  color: #667381;
  font-size: 12px;
  font-weight: 900;
}

.type-balance-matrix thead th:first-child,
.type-balance-matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}

.type-balance-matrix thead th:first-child {
  z-index: 3;
  background: #f7fbff;
}

.type-balance-matrix tbody tr:last-child th,
.type-balance-matrix tbody tr:last-child td {
  border-bottom: 0;
}

.type-balance-matrix th:last-child,
.type-balance-matrix td:last-child {
  border-right: 0;
}

.type-balance-pokemon-head {
  min-width: 92px;
}

.type-balance-pokemon-head-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.type-balance-pokemon-head-inner img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.type-balance-pokemon-head-inner span {
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-balance-cell {
  min-width: 76px;
  padding: 0;
  font-weight: 900;
}

.type-balance-cell.neutral {
  background: #e9eef4;
}

.type-balance-cell.weak {
  background: #ffd9d2;
}

.type-balance-cell.weak.severe {
  background: #ffbeb3;
}

.type-balance-cell.immune {
  background: #e4d8ff;
}

.type-balance-cell.resist {
  background: #d8f0d2;
}

.type-balance-cell.resist.strong {
  background: #bee6b4;
}

.type-balance-table-count {
  color: #20242a;
  font-size: 13px;
  font-weight: 900;
}

.type-balance-cell-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 8px 6px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.type-balance-cell-label.neutral {
  color: #50606f;
}

.type-balance-cell-label.weak {
  color: #a22f20;
}

.type-balance-cell-label.weak.severe {
  color: #8a2014;
}

.type-balance-cell-label.resist {
  color: #246834;
}

.type-balance-cell-label.resist.strong {
  color: #175526;
}

.type-balance-cell-label.immune {
  color: #563b95;
}

.type-balance-mobile-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d7e2ec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(48, 72, 102, 0.06);
}

.type-balance-mobile-row-head {
  display: flex;
  align-items: center;
}

.type-balance-mobile-cells {
  display: grid;
  gap: 8px;
}

.type-balance-mobile-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e3ebf3;
  border-radius: 12px;
  background: #fbfdff;
}

.type-balance-mobile-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #233142;
  font-size: 13px;
  font-weight: 900;
}

.type-balance-mobile-cell .type-balance-cell-label {
  width: auto;
  min-height: 28px;
  padding: 0;
  flex: 0 0 auto;
  justify-items: center;
}

.type-balance-empty {
  padding: 16px;
  border: 1px dashed #cfd9e4;
  border-radius: 10px;
  background: #f8fafc;
  color: #70808f;
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

.type-balance-matrix tbody th .type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

@media (max-width: 980px) and (min-width: 521px) {
  .type-balance-table-wrap {
    overflow-x: hidden;
  }

  .type-balance-matrix {
    min-width: 0;
    table-layout: fixed;
  }

  .type-balance-matrix th,
  .type-balance-matrix td {
    padding: 7px 4px;
  }

  .type-balance-matrix thead th {
    font-size: 11px;
  }

  .type-balance-matrix thead th:first-child,
  .type-balance-matrix tbody th {
    width: 72px;
    min-width: 72px;
  }

  .type-balance-pokemon-head {
    min-width: 0;
  }

  .type-balance-pokemon-head-inner {
    gap: 4px;
  }

  .type-balance-pokemon-head-inner img {
    width: 30px;
    height: 30px;
  }

  .type-balance-pokemon-head-inner span {
    max-width: 100%;
    font-size: 10px;
    line-height: 1.25;
  }

  .type-balance-cell {
    min-width: 0;
  }

  .type-balance-cell-label {
    min-height: 38px;
    padding: 6px 2px;
    line-height: 1.2;
  }
}

@media (max-width: 740px) {
  .type-balance-matrix tbody th .type {
    font-size: 9px;
    line-height: 1;
  }
}

.party-team-grid {
  display: grid;
  gap: 14px;
}

.party-storage-panel {
  margin-bottom: 14px;
  background: #fff;
}

.party-storage-form {
  display:flex;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
  justify-content: start;
}

.party-storage-name-input {
  height: 46px;
  width: 360px;
  max-width: 100%;
}

.party-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
}

.party-save-error {
  margin: -2px 0 12px;
  color: #d94f4f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.party-save-button {
  width: 140px;
  min-width: 140px;
  min-height: 46px;
  max-width: 100%;
  text-align: center;
}

.party-edit-done-button {
  text-align: center;
  width: 140px;
  min-width: 104px;
  min-height: 46px;
  max-width: 100%;
  border-color: #ccd5df;
  background: #fff;
  color: #3c4652;
}

.party-storage-note {
  margin-bottom: 12px;
  color: #6b7380;
  font-size: 13px;
  line-height: 1.5;
}

.party-storage-list {
  display: grid;
  gap: 8px;
}

.party-storage-empty {
  padding: 14px;
  border: 1px solid #dde4ec;
  border-radius: 10px;
  background: #f9fbfd;
  color: #6d7681;
  font-size: 13px;
  text-align: center;
}

.party-storage-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #dde4ec;
  border-radius: 10px;
  background: #fff;
}

.party-storage-item.active {
  border-color: #168bd6;
  background: #f2f8fe;
}

.party-storage-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.party-storage-title {
  color: #1f252d;
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-storage-detail {
  color: #6f7884;
  font-size: 12px;
  font-weight: 700;
}

.party-storage-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.party-storage-button {
  min-width: 68px;
  min-height: 32px;
  border: 1px solid #ccd5df;
  border-radius: 8px;
  background: #fff;
  color: #3c4652;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  padding: 0 10px;
}

.party-storage-button.primary {
  border-color: #168bd6;
  background: #eaf6fd;
  color: #11699f;
}

.party-storage-button.danger {
  border-color: #e5c0c0;
  color: #bf5656;
}

.party-panel {
  background: #fff;
}

.party-panel-note {
  margin: -2px 0 10px;
  color: #5f6b77;
  font-size: 13px;
  line-height: 1.5;
}

.my-party-panel{
  background: var(--attack-bg);
}

.opponent-party-panel{
  background: var(--defense-bg);
}

.section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mini-action-button {
  min-height: 32px;
  border: 1px solid #168bd6;
  border-radius: 8px;
  background: #eaf6fd;
  color: #11699f;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 0 10px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.mini-action-button:hover {
  border-color: #1277b9;
  background: #dff1fc;
}

.mini-action-button:active {
  background: #d3ebfa;
}

.mini-action-button:focus-visible {
  outline: 3px solid rgba(22, 139, 214, 0.18);
  outline-offset: 2px;
}

.mini-action-button:disabled {
  border-color: #d7e0e8;
  background: #f4f7fa;
  color: #98a3af;
  cursor: default;
}

.party-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.party-slot {
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  display: grid;
  gap: 6px;
  align-content: start;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.party-slot.empty {
  place-items: center;
  align-content: center;
  justify-content: center;
  color: #8a929c;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  cursor: default;
}

.party-slot.chosen {
  border-color: #168bd6;
  background: #e7f4fd;
  box-shadow: inset 0 0 0 1px rgba(22, 139, 214, 0.35);
}

.party-form-toggle {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.party-form-button {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d1dce8;
  border-radius: 999px;
  background: #fff;
  color: #5f6f80;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.party-form-button.active {
  border-color: #168bd6;
  background: #e7f4fd;
  color: #11699f;
}

.party-slot-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.party-slot-main img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: #eef2f6;
}

.party-slot-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 900;
}

.party-slot-state {
  min-height: 18px;
  color: #77818d;
  font-size: 11px;
  font-weight: 900;
}

.party-slot.chosen .party-slot-state {
  color: #11699f;
}

.party-slot-coverage {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #d7e6f3;
  border-radius: 8px;
  background: #f7fbff;
}

.party-slot-coverage-title {
  color: #4f5f70;
  font-size: 11px;
  font-weight: 900;
}

.party-slot-coverage-empty {
  color: #6b7785;
  font-size: 11px;
  line-height: 1.5;
}

.party-slot-coverage-list {
  display: grid;
  gap: 6px;
}

.party-slot-move-row {
  display: grid;
  gap: 4px;
}

.party-slot-move-name {
  color: #1f252d;
  font-size: 12px;
  font-weight: 900;
}

.party-slot-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.party-slot-target {
  display: grid;
  flex: 0 0 calc((100% - 20px) / 6);
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border-radius: 7px;
  border: 1px solid #d6dee8;
  background: #fff;
}

.party-slot-target strong {
  color: #334150;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}

.party-slot-target em {
  color: #667381;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
}

.party-slot-target small {
  color: #6f7884;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.party-slot-target.super {
  border-color: #efc5c3;
  background: #fff4f3;
}

.party-slot-target.super em {
  color: #c14e4e;
}

.party-slot-target.neutral {
  border-color: #d6dee8;
  background: #fff;
}

.party-slot-target.resist {
  border-color: #cfe2c9;
  background: #f3fbf1;
}

.party-slot-target.resist em {
  color: #4a8a4a;
}

.party-slot-target.immune {
  border-color: #d5ccec;
  background: #f6f2ff;
}

.party-slot-target.immune em {
  color: #6d56a8;
}

.party-coverage-sheet {
  max-width: 920px;
  height: auto;
  max-height: min(760px, calc(100dvh - 32px));
  margin-top: 16px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
}

.party-coverage-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow-y: auto;
}

.party-coverage-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.battle-support-pokemon-head {
  padding-bottom: 4px;
  border-bottom: 1px solid #e6edf4;
}

.party-coverage-head img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  background: #eef2f6;
}

.party-coverage-head-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.party-coverage-name {
  color: #20242a;
  font-size: 20px;
  font-weight: 900;
}

.party-coverage-note {
  color: #667381;
  font-size: 13px;
  line-height: 1.5;
}

.party-coverage-content .party-slot-coverage {
  padding: 0;
  border: 0;
  background: transparent;
}

@media (max-width: 680px) {
  .party-coverage-sheet {
    height: 100%;
    max-height: none;
    margin-top: 0;
    border-radius: 0;
  }

  .party-coverage-body {
    padding: 14px;
  }

  .party-coverage-head {
    align-items: flex-start;
  }

  .party-coverage-name {
    font-size: 18px;
  }

  .party-slot-targets {
    gap: 4px;
  }

  .party-slot-target {
    flex-basis: calc((100% - 4px) / 2);
  }
}

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

.party-actions.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.party-action,
.party-add {
  min-height: 30px;
  border: 1px solid #ccd5df;
  border-radius: 8px;
  background: #fff;
  color: #3c4652;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.party-add {
  min-width: 58px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  line-height: 1;
  text-align: center;
}

.party-action.primary,
.party-add.primary {
  border-color: #168bd6;
  background: #eaf6fd;
  color: #11699f;
}

.party-search {
  margin-bottom: 12px;
}

.party-list .box-card {
  cursor: pointer;
  grid-template-columns: 42px minmax(0, 1fr) minmax(58px, auto);
  align-items: center;
}

.party-list .box-card.selected {
  border-color: #168bd6;
  background: #f0f8ff;
}

.party-list .box-card .party-card-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.party-list .box-card .party-card-title {
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.party-list .box-card .party-card-title strong {
  min-width: 0;
  max-width: 100%;
  color: #1f252d;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-list .box-card .party-card-types {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.party-list .box-card .party-card-types .type {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 3px 8px;
  color: #fff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-list .box-card .party-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.party-list-more {
  display: block;
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 220px;
  min-height: 42px;
  border: 1px solid #ccd5df;
  border-radius: 10px;
  background: #fff;
  margin: 0 auto;
  padding: 12px;
  color: #5f6b77;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.party-list-more:active {
  background: #f3f7fb;
}

.party-scroll-top {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(68px + env(safe-area-inset-bottom));
  z-index: 60;
  min-width: 68px;
  min-height: 38px;
  border: 1px solid #168bd6;
  border-radius: 8px;
  background: #fff;
  color: #11699f;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(23, 40, 54, 0.14);
}

@media (min-width: 1030px) {
  .party-scroll-top {
    left: max(16px, calc((100vw - 1180px) / 2 + 14px));
  }
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  max-width: 100%;
  padding: 0 0 env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(245, 247, 250, 0.96);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.bottom-tab {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-right: 1px solid rgba(167, 179, 193, 0.55);
  border-radius: 0;
  background: #eef2f6;
  color: #5f6b78;
  font-weight: 900;
}

.bottom-tab:last-child {
  border-right: 0;
}

.bottom-tab.active {
  background: #168bd6;
  color: #fff;
  border-right-color: rgba(255, 255, 255, 0.18);
}

.bottom-tab:disabled {
  background: #eef2f6;
  color: #9aa5b1;
}

.settings {
  background: #fff;
}

.hidden {
  display: none;
}

main.hidden,
#calcView.hidden,
#partyView.hidden,
#typeBalanceView.hidden,
#battleSummary.hidden {
  display: none;
}

.notice {
  margin: 10px 0 0;
  color: #656d78;
  font-size: 13px;
  line-height: 1.6;
}

.site-footer {
  width: 100%;
  max-width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 16px;
  text-align: right;
  overflow-x: hidden;
  overflow-x: clip;
  background-color: #fff;
}

.site-footer a {
  color: #8a929c;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--blue);
  text-decoration: underline;
}


.selection-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  pointer-events: none;
  align-items: flex-start;
  justify-content: center;
  overscroll-behavior: contain;
  overflow-x: hidden;
}

.selection-modal.open {
  display: flex;
  pointer-events: auto;
}

.selection-modal[aria-hidden="true"] {
  display: none !important;
  pointer-events: none !important;
}

.selection-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(27, 31, 36, 0.34);
}

.selection-sheet {
  position: relative;
  width: 100%;
  max-width: min(980px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 32px);
  margin-top: 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(20, 28, 36, 0.18);
  overflow: hidden;
}

.selection-grip {
  width: 42px;
  height: 4px;
  border-radius: 8px;
  background: #d4d8df;
  justify-self: center;
  margin-top: 8px;
}

.selection-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  border-bottom: 1px solid #e3e6eb;
  padding: 0 14px;
}

.selection-header h2 {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.selection-close {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 8px 0;
  text-align: left;
  font-weight: 700;
}

.selection-search {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-bottom: 1px solid #e8ebef;
  padding: 0 20px;
  color: #20242a;
  font-size: 16px;
  background: #fff;
}

.selection-search:focus {
  outline: none;
  background: #fbfcfd;
}

.selection-list {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

.selection-row {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid #eef0f3;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 10px 14px;
  text-align: left;
}

.selection-row:active,
.selection-row.selected {
  background: #f2f8fd;
}

.selection-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.selection-name-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.selection-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1f252d;
  font-size: 17px;
  font-weight: 900;
}

.selection-detail {
  color: #8a929c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.selection-tag {
  flex: 0 0 auto;
  min-width: 50px;
  border-radius: 5px;
  color: #fff;
  padding: 2px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.selection-tag-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.selection-tag-pills .type {
  min-width: 42px;
  padding: 3px 8px;
  font-size: 12px;
}

.selection-empty {
  padding: 28px 20px;
  color: #7b838d;
  text-align: center;
  font-weight: 700;
}

.party-member-editor-sheet {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: auto;
  max-height: calc(100vh - 32px);
  margin-top: 16px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #f8fbff 0%, #ffffff 18%, #ffffff 100%);
}

.selection-modal.selection-over-editor {
  z-index: 90;
}

.selection-modal.selection-over-editor {
  align-items: flex-start;
  justify-content: center;
}

.selection-modal.selection-over-editor .selection-backdrop {
  background: rgba(27, 31, 36, 0.24);
}

.selection-modal.selection-over-editor .selection-sheet {
  width: min(980px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: auto;
  max-height: calc(100vh - 32px);
  margin-top: 16px;
  border-radius: 24px;
  box-shadow: 0 24px 52px rgba(20, 28, 36, 0.24);
}

#partyMemberEditorModal.modal-under-selection {
  z-index: 70;
}

#partyMemberEditorModal.modal-under-selection .selection-backdrop {
  background: rgba(27, 31, 36, 0.18);
}

.party-member-editor-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  padding: 18px;
  display: grid;
  gap: 18px;
}

.party-member-editor-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.party-member-editor-header h2 {
  font-size: 17px;
}

.party-member-editor-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid #e2e9f1;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f9ff 100%);
  box-shadow: 0 10px 30px rgba(19, 35, 52, 0.06);
}

.party-member-editor-head img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: #eef5fb;
  object-fit: contain;
}

.party-member-editor-name {
  font-size: 28px;
  font-weight: 900;
  color: #1f252d;
  line-height: 1.1;
}

.party-member-editor-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.party-member-editor-note {
  margin-top: 10px;
  color: #687483;
  font-size: 13px;
  font-weight: 700;
}

.party-member-editor-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #e3e9f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 33, 46, 0.04);
}

.party-member-editor-label {
  font-size: 14px;
  font-weight: 900;
  color: #334153;
}

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

.party-member-editor-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.party-member-editor-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.party-member-editor-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.party-member-editor-field span {
  color: #5f6a77;
  font-size: 12px;
  font-weight: 800;
}

.party-member-editor-field select,
.party-member-editor-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid #d5dfeb;
  border-radius: 14px;
  background: #fbfdff;
  padding: 0 14px;
  color: #1f252d;
  font-size: 15px;
  font-weight: 700;
}

.party-member-editor-field select:focus,
.party-member-editor-field input:focus {
  outline: none;
  border-color: #168bd6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(22, 139, 214, 0.12);
}

.party-member-editor-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-top:1px solid #d5dfeb;
  padding:15px 0;
}

.party-member-editor-footer-note {
  grid-column: 1;
  color: #6a7480;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding-left: 18px;
}

.party-member-editor-close-button {
  grid-column: 2;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: auto;
  justify-self: center;
  padding:0 10px;
}

@media (max-width: 640px) {
  .selection-sheet {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin-top: 0;
    border-radius: 0;
  }

  .party-member-editor-sheet {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin-top: 0;
    border-radius: 0;
  }

  .selection-modal.selection-over-editor .selection-sheet {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin-top: 0;
    border-radius: 0;
  }

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

  .party-member-editor-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .party-member-editor-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .party-member-editor-footer {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 14px 16px;
  }

  .party-member-editor-footer-note,
  .party-member-editor-close-button {
    grid-column: auto;
    padding-left: 0;
  }

  .party-member-editor-close-button {
    width: auto;
    min-width: 132px;
    padding: 0 24px;
  }

  .party-member-editor-body {
    padding: 14px;
    gap: 14px;
  }

  .party-member-editor-head {
    grid-template-columns: 60px minmax(0, 1fr);
    padding: 14px;
  }

  .party-member-editor-head img {
    width: 60px;
    height: 60px;
  }

  .party-member-editor-name {
    font-size: 18px;
  }

  .party-member-editor-section {
    padding: 14px;
  }

  .party-member-editor-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .party-member-editor-close-button {
    width: auto;
    min-width: 132px;
  }

  .party-member-editor-field span {
    font-size: 11px;
  }

  .party-member-editor-field select,
  .party-member-editor-field input,
  .party-member-editor-field .choice-button {
    min-height: 44px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 13px;
  }
}

.pokemon-suggest {
  position: fixed;
  z-index: 30;
  max-height: 552px;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d8dde5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(24, 32, 42, 0.18);
}

.pokemon-suggest.hidden {
  display: none !important;
  pointer-events: none !important;
}

.pokemon-suggest button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-align: left;
}

.pokemon-suggest button:last-child {
  border-bottom: 0;
}

.pokemon-suggest button:active {
  background: #f2f8fd;
}

.pokemon-suggest-more {
  padding: 10px 12px;
  color: #7b838d;
  background: #fbfcfd;
  border-top: 1px solid #edf0f3;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.pokemon-suggest strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pokemon-suggest strong {
  color: #20242a;
  font-size: 14px;
  font-weight: 900;
}

.suggest-types {
  display: inline-flex;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.suggest-types .type {
  min-width: 42px;
  padding: 3px 7px;
  font-size: 12px;
}

.suggest-types .type+.type {
  margin-left: 0;
}

@media (min-width: 1030px) {
  .app {
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    background: #fff;
  }

  .selection-sheet {
    border-radius: 0;
  }

  .bottom-tabs {
    left: 50%;
    right: auto;
    width: min(1180px, 100%);
    transform: translateX(-50%);
  }
}

@media (max-width: 1029.99px) {

  html,
  body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
  }

  .app {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    border-left: 0;
    border-right: 0;
    background-color: #fff;
  }

  .topbar,
  .battle-summary,
  #calcView,
  #partyView,
  #typeBalanceView,
  .bottom-tabs {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
  }

  #calcView,
  #partyView,
  #typeBalanceView {
    padding: 0;
  }

  .bottom-tabs {
    left: 0;
    right: 0;
    transform: none;
  }
}

@media (min-width: 1030px) {
  body {
    background: #f1f7fc;
  }

  .app {
    max-width: 1180px;
  }

  #calcView {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "attack defense"
      "move settings"
      "results results";
    gap: 14px;
    padding: 14px;
    background: #e1ebf3;
  }

  #partyView {
    padding: 14px;
    background: #e1ebf3;
  }

  #typeBalanceView {
    padding: 14px;
    background: #e1ebf3;
  }

  .party-panel {
    border-radius: 8px;
    border: 1px solid rgba(32, 36, 42, 0.08);
  }

  .type-balance-panel {
    border-radius: 8px;
    border: 1px solid rgba(32, 36, 42, 0.08);
  }

  .topbar {
    grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  }

  .topbar-center {
    padding: 0 12px;
  }

  .top-title-main {
    white-space: nowrap;
    line-height: 1.1;
  }

  .party-save-actions {
    flex-wrap: nowrap;
  }

  .party-storage-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .party-slots {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

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

  .panel {
    border-radius: 8px;
    border: 1px solid rgba(32, 36, 42, 0.08);
  }

  .panel.attack {
    grid-area: attack;
  }

  .panel.defense {
    grid-area: defense;
  }

  .move-panel {
    grid-area: move;
  }

  .settings {
    grid-area: settings;
  }

  .results {
    grid-area: results;
  }

  .battle-summary,
  .topbar {
    max-width: 1180px;
    margin: 0 auto;
  }

  .selection-sheet {
    height: min(760px, calc(100dvh - 48px));
    max-height: calc(100dvh - 48px);
    margin-top: 24px;
    border-radius: 8px;
  }

  .bottom-tabs {
    width: 1180px;
  }
}

@media (min-width: 1180px) {
  .result-layout {
    grid-template-columns: 140px minmax(0, 1fr) 140px;
  }

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

@media (min-width: 731px) and (max-width: 1029.99px) {
  .party-storage-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 730px) {
  .topbar h1 {
    font-size: calc(22px - 2px);
    max-width: 100%;
    overflow-wrap: anywhere;
    display: grid;
    gap: 1px;
    white-space: normal;
  }

  .link-button {
    font-size: calc(16px - 1px);
  }

  .section-title {
    font-size: calc(16px - 1px);
  }

  .section-meta,
  .summary-name,
  .pokemon-suggest strong {
    font-size: calc(14px - 1px);
  }

  .pokemon-name,
  .damage-number,
  .calc-param strong {
    font-size: calc(18px - 1px);
  }

  .stat-line,
  .ability-line,
  .ability-detail-line,
  .item-line,
  .defense-advice,
  .notice,
  .selection-detail {
    font-size: calc(13px - 1px);
  }

  .type,
  .roll-cell,
  .formula,
  label.small,
  .selection-tag {
    font-size: calc(12px - 1px);
  }

  .damage-percent {
    font-size: calc(24px - 3px);
  }

  .selection-name {
    font-size: calc(17px - 1px);
  }
}

@media (max-width: 690px) {

  /* 通常時（1列） */
  .party-storage-form {
    display: flex;
    flex-wrap: nowrap;
  }

  .party-storage-name-input {
    width: 360px;
    flex: 0 0 auto;
  }

  /* 編集モードだけ折り返し */
  .party-storage-panel.editing .party-storage-form {
    flex-wrap: wrap;
  }

  .party-storage-panel.editing .party-storage-name-input {
    width: 100%;
    flex: 0 0 100%;
  }

  .party-storage-panel.editing .party-save-actions {
    width: 100%;
    display: flex;
  }
}

@media (max-width: 520px) and (pointer: coarse) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 4px;
    height: 80px;
    padding: 0 8px;
  }

  .topbar-center {
    padding: 0 4px;
  }

  .topbar-spacer {
    min-width: 56px;
  }

  .link-button {
    width: auto;
    min-width: 0;
    padding: 8px 2px;
    text-align: center;
    line-height: 1.15;
    white-space: nowrap;
    overflow-wrap: normal;
    font-size: 12px;
  }

  .top-title {
    gap: 1px;
    padding: 0 4px;
  }

  .top-title-main {
    width: 100%;
    font-size: 16px;
    line-height: 1.05;
    white-space: normal;
  }

  .battle-summary {
    top: 80px;
    padding: 8px 16px;
  }

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

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

  .pokemon-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .sprite {
    width: 48px;
    height: 48px;
  }

  .picker-row {
    grid-template-columns: 1fr;
  }

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

  .party-list .box-card .party-card-types,
  .suggest-types {
    max-width: 100%;
    overflow: hidden;
  }

  .party-list .box-card .party-card-types .type,
  .suggest-types .type {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .party-list .box-card .party-card-title {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px 6px;
    min-height: 0;
  }

  .party-list .box-card .party-card-title strong {
    flex: 1 1 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .party-list .box-card .party-card-types {
    flex: 1 1 100%;
    overflow: visible;
  }

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

  .party-storage-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .party-save-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  .party-save-button {
    min-width: 112px;
  }

  .party-edit-done-button {
    min-width: 0;
  }

  .party-storage-item {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .party-storage-list {
    grid-template-columns: 1fr;
  }

  .party-storage-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
  }

  .party-storage-button {
    width: 60px;
    min-width: 60px;
  }

  .section-head-actions {
    gap: 6px;
  }

  .mini-action-button {
    min-height: 32px;
    padding: 0 12px;
  }

  .result-layout {
    grid-template-columns: minmax(76px, 0.52fr) minmax(0, 1.4fr) minmax(76px, 0.52fr);
    gap: 6px;
  }

  .result-side {
    padding: 8px 7px;
  }

  .calc-param {
    grid-template-columns: 1fr;
    gap: 1px;
    font-size: 11px;
  }

  .calc-param strong {
    font-size: 17px;
    text-align: left;
  }

  .damage-percent {
    font-size: 19px;
  }
}

@media (max-width: 600px) {
  .top-title-break {
    display: block;
  }

  .top-title-main {
    white-space: normal;
    line-height: 1.05;
  }

  .top-title-sub {
    display: none !important;
  }
}

@media (max-width: 550px) {
  .party-storage-name-input {
    width: 68%;
  }
}

@media (max-width: 380px) {
  .app {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 4px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-center {
    padding: 0 2px;
  }

  .topbar-spacer {
    min-width: 52px;
  }

  .link-button {
    font-size: 12px;
    width: auto;
    min-width: 0;
    padding: 8px 1px;
    text-align: center;
    line-height: 1.15;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  .top-title {
    gap: 1px;
    padding: 0 4px;
  }

  .top-title-main {
    font-size: 16px;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .top-title-sub {
    display: none !important;
  }

  .section-head {
    gap: 8px;
  }

  .section-title {
    font-size: 15px;
  }

  .section-meta {
    font-size: 11px;
    text-align: right;
  }

  .summary-name,
  .pokemon-name,
  .stat-line,
  .ability-line,
  .item-line {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .pokemon-card {
    align-items: start;
  }

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

  .result-layout {
    grid-template-columns: 1fr;
  }

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

  .damage-main {
    order: -1;
  }

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

  .box-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .box-card .type {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 390px){
  .party-storage-name-input {
    width: 100%;
  }

  .party-storage-form {
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .type-balance-summary {
    grid-template-columns: 1fr;
  }

  .type-balance-summary-list {
    display: flex;
    flex-wrap: wrap;
  }

  .type-balance-summary-item {
    white-space: normal;
  }

  .type-balance-panel {
    gap: 12px;
  }

  .type-balance-summary-card,
  .type-balance-combo-item {
    padding: 10px;
  }

  .type-balance-builder-actions {
    width: 100%;
  }

  .type-balance-matrix {
    min-width: 560px;
  }

  .type-balance-matrix th,
  .type-balance-matrix td {
    padding: 8px 6px;
  }

  .type-balance-pokemon-head-inner img {
    width: 34px;
    height: 34px;
  }

  .type-balance-pokemon-head-inner span {
    max-width: 72px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .type-balance-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .type-balance-summary-item,
  .type-balance-combo-member {
    width: auto;
    max-width: 100%;
    min-width: 0;
    justify-content: flex-start;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .type-balance-combo-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .type-balance-card {
    min-height: 100px;
  }

  .type-balance-card-main {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .type-balance-card-main img {
    width: 34px;
    height: 34px;
  }

  .type-balance-table-wrap {
    overflow-x: hidden;
    border-radius: 12px;
  }

  .type-balance-table-desktop {
    display: block;
  }

  .type-balance-mobile-list {
    display: none;
  }

  .type-balance-matrix {
    min-width: 0;
    table-layout: fixed;
  }

  .type-balance-matrix th,
  .type-balance-matrix td {
    padding: 6px 2px;
  }

  .type-balance-matrix thead th {
    font-size: 10px;
  }

  .type-balance-matrix thead th:first-child,
  .type-balance-matrix tbody th {
    width: 60px;
    min-width: 60px;
  }

  .type-balance-matrix tbody th .type {
    min-height: 24px;
    padding: 0 5px;
    border-radius: 8px;
    white-space: normal;
  }

  .type-balance-pokemon-head {
    min-width: 0;
  }

  .type-balance-pokemon-head-inner {
    gap: 3px;
  }

  .type-balance-pokemon-head-inner img {
    width: 24px;
    height: 24px;
  }

  .type-balance-pokemon-head-inner span {
    max-width: 100%;
    font-size: 10px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
  }

  .type-balance-cell {
    min-width: 0;
  }

  .type-balance-cell-label {
    min-height: 30px;
    padding: 4px 1px;
    line-height: 1.1;
  }
}

@media (max-width: 500px) {
  .type-balance-candidate-card {
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    row-gap: 8px;
  }

  .type-balance-candidate-card .party-card-title {
    display: grid;
    gap: 4px;
    align-items: start;
  }

  .type-balance-candidate-card .party-card-title strong {
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .type-balance-candidate-card .party-card-types {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100%;
  }

  .type-balance-candidate-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .type-balance-candidate-badge {
    flex: 0 0 100%;
    justify-content: flex-start;
    font-size: 11px;
  }

  .type-balance-candidate-subaction,
  .type-balance-candidate-actions .party-add {
    width: auto;
    flex: 0 0 auto;
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
  }

  .type-balance-candidate-actions .party-add {
    margin-left: auto;
  }

  .type-balance-cell-label {
    font-size: 12px;
  }
}
