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

@font-face {
  font-family: "Pretendard-Regular";
  src: url("https://fastly.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff")
    format("woff");
  font-weight: 400;
  font-style: normal;
}

body {
  font-family: "Pretendard-Regular", sans-serif;
  font-weight: normal;
  background-color: #f4f4f9;
}

.container1 {
  width: 100%;
  max-width: max-content;
  margin: 20px auto;
  margin-top: 130px;
  padding: 0 15px;
  box-sizing: border-box;
}

.filters {
  background-color: white;
  padding: 10px 20px 5px;
  border-radius: 10px;
  margin-bottom: 20px;
  position: relative;
}

.filter-row {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
}

.filter-row:last-child {
  margin-bottom: 15px;
}

.filter-row .button-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.filter-row .button-group label {
  display: flex;
  align-items: center;
  margin-right: 10px;
}

.filter-row .button-group input[type="checkbox"] {
  transform: scale(1.25);
  margin-top: 1px;
  margin-right: 5px;
}

.filter-label {
  width: 150px;
  font-size: 15px;
  font-weight: bold;
}

.search-box {
  margin-bottom: 20px;
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.search-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.results {
  position: relative;
  background-color: rgb(255, 255, 255);
  margin-top: 10px;
}

.result-table {
  table-layout: auto;
  width: 100%;
  border-collapse: collapse;
}

.result-table th,
.result-table td {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  padding: 9px;
  border: 1px solid #ccc;
}

.result-table th {
  background-color: #e9ebec;
  font-weight: bold;
}

.result-table th.sortable {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.evolution-btn,
.type-btn,
.skill-btn,
.skillweak-btn,
.skillstrong-btn,
.field-btn {
  border: 2px solid transparent;
  background-color: transparent;
  cursor: pointer;
  padding: 5px;
  margin: 0 8.1px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.evolution-btn.active,
.type-btn.active,
.skill-btn.active,
.skillweak-btn.active,
.skillstrong-btn.active,
.field-btn.active {
  border: 2px solid rgb(0, 0, 0);
}

.evolution-btn img,
.type-btn img,
.skill-btn img,
.skillweak-btn img,
.skillstrong-btn img,
.field-btn img {
  display: block;
  width: 33px;
  height: 33px;
  margin: 0;
  padding: 0;
}

.skill-btn {
  background-image: url("https://media.dsrwiki.com/dsrwiki/background.webp");
  background-size: cover;
  background-position: center;
}

.skillweak-btn {
  background-image: url("https://media.dsrwiki.com/dsrwiki/weakbackground.webp");
  background-size: cover;
  background-position: center;
}

.skillstrong-btn {
  background-image: url("https://media.dsrwiki.com/dsrwiki/strongbackground.webp");
  background-size: cover;
  background-position: center;
}

.button-group-field {
  padding-left: 30px;
}

th {
  padding: 10px;
  background-color: hsla(0, 0%, 100%, 0.26);
  font-weight: bold;
  text-align: center;
}

th.sortable {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

th span {
  margin-left: 5px;
  font-size: 0.8em;
}

th:hover {
  background-color: #8f8f8f;
}

.reset-sort-container {
  display: inline-block;
}

table {
  width: 100%;
}

tbody {
  height: auto;
}

.active {
  color: white;
}

.tooltip {
  display: inline-block;
  vertical-align: middle;
  position: relative;
}

.tooltiptext {
  visibility: hidden;
  position: absolute;
  z-index: 9999;
  background: rgba(40,40,40,0.95);
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: normal;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-top: 8px;
  left: 50%;
  transform: translateX(-50%);
  min-width: max-content;
}

.tooltiptext::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(40,40,40,0.95);
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}

.tooltip-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tooltip-description {
  white-space: pre-line;
}

.filter-label {
  position: relative;
  display: inline-block;
}

.field-qm,
.skill-qm {
  width: 13px;
  height: 13px;
  position: absolute;
  top: -3px;
}

.tooltip-field,
.tooltip-skill {
  visibility: hidden;
  opacity: 0;
  background-color: rgba(0, 0, 0, 0.9);
  color: #fff;
  border-radius: 8px;
  position: absolute;
  z-index: 1;
  top: 0px;
  transition: opacity 0.3s ease;
}

.tooltip-field {
  width: 450px;
  left: 190%;
  transform: translateX(-53%);
}

.tooltip-skill {
  width: 480px;
  left: 190%;
  transform: translateX(-43%);
  max-height: 300px;
  font-size: 12px;
  font-weight: lighter;
  overflow-y: auto;
  padding: 5px;
}

.tooltip-field.show,
.tooltip-skill.show {
  visibility: visible;
  opacity: 1;
}

.tooltip-table-header,
.tooltip-table-header-skill {
  display: grid;
  grid-template-columns: 0.5fr 1.5fr;
  font-weight: bold;
  padding: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.header-condition,
.header-description {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: deepskyblue;
}

.tooltip-table-content,
.tooltip-table-content-skill {
  display: grid;
  grid-template-columns: 0.5fr 1.5fr;
  gap: 10px;
  padding: 10px 0;
  max-height: 200px;
  overflow-y: auto;
}

.condition {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 12px;
}

.condition img {
  width: 30px;
  height: 30px;
  margin-right: 5px;
  object-fit: contain;
}

.description {
  margin-top: 5px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.tooltip-table-content::-webkit-scrollbar,
.tooltip-skill::-webkit-scrollbar {
  width: 8px;
}

.tooltip-table-content::-webkit-scrollbar-track,
.tooltip-skill::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.tooltip-table-content::-webkit-scrollbar-thumb,
.tooltip-skill::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

.tooltip-table-content::-webkit-scrollbar-thumb:hover,
.tooltip-skill::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: rgb(255, 255, 255);
  cursor: pointer;
  z-index: 3;
  display: inline-block;
  padding: 0;
}

.close-btn:hover {
  color: #ccc;
}

.field-qm:hover + .tooltip-field,
.skill-qm:hover + .tooltip-skill {
  visibility: visible;
  opacity: 1;
}

.tooltip-table {
  width: 100%;
  border-collapse: collapse;
}

.tooltip-table td {
  padding: 8px;
}

.weak-col {
  width: 1%;
}

.label-col {
  width: 11%;
  text-align: center;
}

.description-col {
  width: 60%;
}

.weak-background,
.strong-background {
  width: 35px;
  height: 35px;
  object-fit: cover;
}

.weak-label {
  color: rgb(0, 183, 255);
}

.strong-label {
  color: red;
}

.highlight {
  color: rgb(0, 255, 0);
}

.tooltip-footer {
  color: #ff0000;
  padding: 7px;
  text-align: center;
  font-size: 10px;
  position: relative;
}

.text-container {
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.text,
.text2 {
  flex: 1;
}

.text {
  font-size: 13px;
  margin-left: 5px;
}

.text2 {
  position: absolute;
  top: 0;
  right: 10px;
  font-size: 13px;
  margin-left: 5px;
  display: flex;
  gap: 20px;
  align-items: center;
}

.text2 p {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.all-text::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  background-color: rgb(220, 248, 248);
  margin-right: 5px;
  border: #202020 1px solid;
}

.casting-text::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  background-color: rgb(255, 234, 234);
  margin-right: 5px;
  border: #202020 1px solid;
}

.reset-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 15px;
  background-color: #f44336;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  z-index: 1;
}

.reset-btn:hover {
  background-color: #d32f2f;
}

.custom-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  padding: 6px 12px;
  background: rgba(40,40,40,0.95);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: normal;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  margin-top: 8px;
}

.tooltip-arrow {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(40,40,40,0.95);
}

/* 모바일 드롭다운 기본 숨김 */
.mobile-filter-dropdown { display: none; }

/* 모바일 전용: ≤768px */
@media (max-width: 768px) {
  .container1 {
    margin-top: 100px;
    padding: 0 10px;
    overflow-x: hidden;
  }

  .filters {
    padding: 10px;
    margin-bottom: 15px;
  }

  .filter-row {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .filter-row:last-child {
    margin-bottom: 15px;
  }

  .filter-label {
    width: 100%;
    margin-bottom: 5px;
  }

  .filter-row .button-group {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }

  .evolution-btn,
  .type-btn,
  .skill-btn,
  .skillweak-btn,
  .skillstrong-btn,
  .field-btn {
    margin: 0 2px;
    padding: 3px;
  }

  .evolution-btn img,
  .type-btn img,
  .skill-btn img,
  .skillweak-btn img,
  .skillstrong-btn img,
  .field-btn img {
    width: 28px;
    height: 28px;
  }

  .search-box {
    margin: 15px 0;
  }

  .search-input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .results {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background-color: white;
    border-radius: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  .result-table {
    margin: 0 auto;
    min-width: 100%;
    border-radius: 0 !important;
  }

  .text2 {
    display: none !important;
  }

  .filters .filter-row:first-child .button-group {
    justify-content: flex-start !important;
    margin: 0 !important;
    text-align: left !important;
  }

  .button-group > button,
  .button-group > label {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .tooltip-field,
  .tooltip-skill {
    width: 90vw;
    max-width: 300px;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 10px;
  }

  .tooltip-table-header,
  .tooltip-table-header-skill {
    grid-template-columns: 1fr 2fr;
  }

  .tooltip-table-content,
  .tooltip-table-content-skill {
    grid-template-columns: 1fr 2fr;
  }

  .header-condition,
  .header-description {
    font-size: 16px;
  }

  .description {
    font-size: 13px;
  }

  .condition img {
    width: 24px;
    height: 24px;
  }
}

/* 정렬 가능한 컬럼 스타일 */
.sortable {
  cursor: pointer;
  position: relative;
  user-select: none;
  white-space: nowrap;
}

.sortable:hover {
  background-color: #f0f0f0;
}

.sortable span {
  display: inline-block;
  margin-left: 2px;
  font-size: 10px;
  color: #999;
  vertical-align: middle;
}

.sortable span::before {
  content: '⇅';
  opacity: 0.5;
}

.sortable span.ascending::before {
  content: '↑';
  opacity: 1;
  color: #007bff;
}

.sortable span.descending::before {
  content: '↓';
  opacity: 1;
  color: #007bff;
}