.character-header {
  --ha-filter-control-height: clamp(36px, 4.5vh, 44px);
  --ha-filter-gap: clamp(8px, 1vw, 14px);
  --ha-filter-radius: 6px;
  --ha-filter-text: #dffbff;
  --ha-filter-muted: #9fd7ff;
  --ha-filter-line: rgba(0, 160, 255, 0.76);
  --ha-filter-line-strong: #00f0ff;
  --ha-filter-bg: linear-gradient(180deg, rgba(4, 32, 58, 0.94), rgba(2, 20, 40, 0.96));
  --ha-filter-bg-hover: rgba(0, 82, 142, 0.88);
  --ha-filter-shadow: 0 0 8px rgba(0, 200, 255, 0.18), inset 0 0 8px rgba(0, 160, 255, 0.12);
  --ha-filter-shadow-hover: 0 0 14px rgba(0, 240, 255, 0.38), inset 0 0 10px rgba(0, 200, 255, 0.22);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: var(--ha-filter-gap);
  width: 100%;
  min-height: var(--ha-filter-control-height);
  margin-bottom: 10px;
  padding: 0 clamp(12px, 1.4vw, 22px);
  font-size: 0.82rem;
}

.mode-pokemon-original,
.flex-card-size-btns {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  align-items: stretch;
  gap: 8px;
  height: var(--ha-filter-control-height);
  min-height: 0;
  max-height: none;
}

.advanced-filter-form {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 720px;
  align-items: stretch;
  justify-content: center;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  width: auto;
  min-width: 0;
  height: var(--ha-filter-control-height);
  max-height: none;
  margin: 0;
  position: relative;
  z-index: 10;
}

.filter-btn,
.card-size-btn,
.filter-reset-link {
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: var(--ha-filter-control-height);
  min-height: var(--ha-filter-control-height);
  margin: 0;
  padding: 0 14px;
  border-radius: var(--ha-filter-radius);
  font-family: "Zen Maru Gothic", "M PLUS Rounded 1c", "Meiryo", "Segoe UI", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.filter-btn {
  min-width: 82px;
  color: #5fffd1;
  background: linear-gradient(180deg, rgba(0, 54, 56, 0.92), rgba(0, 34, 48, 0.96));
  border: 1px solid rgba(0, 255, 176, 0.78);
  box-shadow: 0 0 8px rgba(0, 255, 176, 0.18), inset 0 0 8px rgba(0, 255, 176, 0.1);
}

.filter-btn:hover,
.filter-btn:focus-visible {
  color: #ffffff;
  background: rgba(0, 126, 98, 0.82);
  border-color: #00ffc0;
  box-shadow: 0 0 14px rgba(0, 255, 192, 0.46), inset 0 0 10px rgba(0, 220, 160, 0.22);
  outline: none;
  transform: translateY(-1px);
}

.filter-btn.filter-active {
  color: #ffffff;
  background: linear-gradient(180deg, rgba(0, 142, 102, 0.96), rgba(0, 92, 76, 0.98));
  border-color: #00ffb0;
  box-shadow: 0 0 14px rgba(0, 255, 176, 0.6), inset 0 0 10px rgba(0, 255, 176, 0.18);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.42);
}

.filter-select,
.filter-text-input {
  box-sizing: border-box;
  height: var(--ha-filter-control-height);
  min-height: var(--ha-filter-control-height);
  min-width: 0;
  margin: 0;
  color: var(--ha-filter-text);
  background: var(--ha-filter-bg);
  border: 1px solid var(--ha-filter-line);
  border-radius: var(--ha-filter-radius);
  box-shadow: var(--ha-filter-shadow);
  font-family: "Zen Maru Gothic", "M PLUS Rounded 1c", "Meiryo", "Segoe UI", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
  outline: none;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.filter-select {
  width: auto;
  padding: 0 34px 0 12px;
}

.advanced-filter-form .filter-select {
  flex: 1 1 180px;
  max-width: 260px;
}

.filter-text-input {
  width: auto;
  padding: 0 12px;
}

.advanced-filter-form .filter-text-input {
  flex: 0.8 1 150px;
  max-width: 220px;
}

.filter-select:hover,
.filter-select:focus,
.filter-text-input:hover,
.filter-text-input:focus {
  color: #ffffff;
  background: var(--ha-filter-bg-hover);
  border-color: var(--ha-filter-line-strong);
  box-shadow: var(--ha-filter-shadow-hover);
}

.filter-text-input::placeholder {
  color: var(--ha-filter-muted);
  opacity: 0.82;
}

.filter-reset-link {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 0 16px;
  color: #8eeaff;
  background: rgba(0, 30, 60, 0.72);
  border: 1px solid rgba(0, 160, 255, 0.68);
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.18), inset 0 0 8px rgba(0, 150, 255, 0.08);
}

.filter-reset-link:hover,
.filter-reset-link:focus-visible {
  color: #ffffff;
  background: var(--ha-filter-bg-hover);
  border-color: var(--ha-filter-line-strong);
  box-shadow: var(--ha-filter-shadow-hover);
  text-shadow: none;
  outline: none;
  transform: translateY(-1px);
}

.card-size-btn {
  width: clamp(44px, 3.4vw, 58px);
  padding: 0 10px;
  color: #8eeaff;
  background: rgba(0, 30, 60, 0.8);
  border: 1px solid rgba(0, 160, 255, 0.72);
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.18), inset 0 0 8px rgba(0, 150, 255, 0.1);
}

.card-size-btn.active,
.card-size-btn.card-size-active,
.card-size-btn:hover,
.card-size-btn:focus-visible {
  color: #ffffff;
  background: var(--ha-filter-bg-hover);
  border-color: var(--ha-filter-line-strong);
  box-shadow: var(--ha-filter-shadow-hover);
  outline: none;
  transform: translateY(-1px);
}

@media (max-width: 1200px) {
  .character-header {
    --ha-filter-gap: 8px;
    padding-inline: 10px;
  }

  .filter-btn {
    min-width: 74px;
    padding-inline: 10px;
  }

  .advanced-filter-form {
    gap: 8px;
  }

  .advanced-filter-form .filter-select {
    flex-basis: 132px;
  }

  .advanced-filter-form .filter-text-input {
    flex-basis: 128px;
  }

  .filter-reset-link {
    min-width: 76px;
    padding-inline: 12px;
  }

  .card-size-btn {
    width: 44px;
  }
}

@media (max-width: 980px) {
  .character-header {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 8px;
  }

  .advanced-filter-form {
    order: 3;
    flex: 1 1 100%;
  }
}

@media (max-width: 680px) {
  .advanced-filter-form {
    flex-wrap: wrap;
    height: auto;
  }

  .advanced-filter-form .filter-select,
  .advanced-filter-form .filter-text-input {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }

  .advanced-filter-form .filter-reset-link {
    flex: 1 1 100%;
  }
}
