/* 메탐정 — 채널 추천( channel-picker ) UI 톤과 통일 */

html[data-theme="dark"]{
  color-scheme: dark;
}

html:not([data-theme="dark"]){
  color-scheme: light;
}

.tool-shell{
  width: min(980px, calc(100% - 24px));
  margin: 0 auto 28px;
  padding-top: 20px;
  display: grid;
  gap: 18px;
}

/* 채널 추천과 동일: 폼 행·입력·버튼 */
.form-row{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.form-row .input{
  flex: 1;
  min-width: 220px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-family: inherit;
}

.form-row .input:focus{
  border-color: rgba(110, 168, 255, 0.6);
}

.form-row select.input{
  cursor: pointer;
  appearance: auto;
  color-scheme: light;
}

/* 라이트: 드롭 목록 글자 대비 */
.form-row select.input option{
  background: #fff;
  color: #2a2218;
}

.form-row .primary,
.form-row .ghost-btn{
  flex: 0 0 auto;
}

.form-row .mj-select-server:not(.is-hidden){
  flex: 0 1 320px;
  min-width: 140px;
  max-width: 100%;
}

.primary,
.ghost-btn{
  cursor: pointer;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  font-weight: 800;
  font-size: 14px;
  font-family: inherit;
}

.primary{
  background: rgba(110, 168, 255, 0.18);
}

.primary:hover:not(:disabled){
  background: rgba(110, 168, 255, 0.24);
}

.ghost-btn{
  background: rgba(255, 255, 255, 0.04);
}

.ghost-btn:hover:not(:disabled){
  background: rgba(255, 255, 255, 0.08);
}

.primary:disabled,
.ghost-btn:disabled{
  opacity: 0.55;
  cursor: not-allowed;
}

.mj-search-hints .hint,
.mj-alliance-hint{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
  margin: 10px 0 0;
}

.mj-search-hints{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
}

.mj-search-hints .hint{
  margin: 0;
}

.mj-search-section .h2{
  margin-top: 0;
}

.mj-alliance-search{
  margin: 14px 0 0;
}

.mj-alliance-search .input{
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-family: inherit;
}

.mj-alliance-search .input:focus{
  border-color: rgba(110, 168, 255, 0.6);
}

.mj-alliance-label{
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.mj-members-wrap{
  width: 100%;
}

.mj-members-row{
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  width: 100%;
}

.mj-members-card{
  flex: 0 0 auto;
  width: max-content;
  max-width: min(100%, calc(100vw - 32px));
  min-width: 0;
  align-self: flex-start;
  box-sizing: border-box;
}

.mj-members-card .h2{
  margin-top: 0;
}

.mj-union-block{
  flex: 1 1 280px;
  min-width: min(100%, 280px);
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.mj-union-block .h2{
  margin-top: 0;
  font-size: 18px;
}

.mj-union-filter{
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.mj-union-filter-head{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.mj-union-filter-heading{
  font-size: 13px;
  font-weight: 700;
  color: var(--title);
}

.mj-union-filter-all{
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}

.mj-union-filter-all:hover{
  background: rgba(255, 255, 255, 0.09);
}

.mj-union-filter-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.mj-filter-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.mj-filter-chip input{
  width: 1rem;
  height: 1rem;
  accent-color: rgba(110, 168, 255, 0.85);
  cursor: pointer;
}

.mj-union-filter-summary{
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.mj-table-wrap{
  margin-top: 12px;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.mj-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: var(--text);
}

.mj-table th,
.mj-table td{
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

.mj-table th{
  background: rgba(184, 146, 42, 0.08);
  font-weight: 700;
  color: var(--title);
  white-space: nowrap;
}

.mj-table tr:last-child td{
  border-bottom: none;
}

.mj-tag{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.mj-tag-ref{
  background: rgba(42, 110, 148, 0.12);
  color: var(--accent);
}

.mj-tag-check{
  background: rgba(139, 203, 119, 0.2);
  color: #3d6b2e;
}

.mj-tag-main-guess{
  background: rgba(184, 146, 42, 0.18);
  color: #7a5a12;
}

.mj-tag-alliance{
  background: rgba(90, 130, 180, 0.18);
  color: #2d4a6e;
}

button.mj-mismatch-guild-btn{
  display: inline-block;
  margin: 0;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: filter 0.15s ease, transform 0.1s ease;
}

button.mj-mismatch-guild-btn:hover:not(:disabled){
  filter: brightness(1.06);
}

button.mj-mismatch-guild-btn:active:not(:disabled){
  transform: scale(0.98);
}

button.mj-mismatch-guild-btn:disabled{
  opacity: 0.75;
  cursor: wait;
}

.mj-main-guild-cell{
  vertical-align: top;
  min-width: 140px;
}

.mj-main-guild-out{
  min-height: 2.25rem;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(220, 72, 72, 0.55);
  background: rgba(255, 72, 72, 0.07);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.mj-union-subnote{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.mj-warnings{
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.28);
  font-size: 0.85em;
  color: var(--text);
}

.mj-warnings ul{
  margin: 6px 0 0;
  padding-left: 18px;
}

.mj-warnings strong{
  color: var(--title);
}

.mj-status{
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.mj-status:empty{
  display: none;
}

.mj-status.is-error{
  color: #b75e4a;
}

.mj-meta{
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.mj-member-list{
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: min(60vh, 520px);
  overflow: auto;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.65;
  white-space: nowrap;
  color: var(--text);
}

.mj-member-list li{
  padding: 2px 0;
}

.is-hidden{
  display: none !important;
}

/* 다크모드 — 채널 추천 form-row / input / primary 톤 */
html[data-theme="dark"] .form-row{
  background: rgba(34, 32, 26, 0.6);
  border-color: rgba(201, 168, 76, 0.12);
}

html[data-theme="dark"] .form-row .input{
  border-color: rgba(201, 168, 76, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: #e8dfc8;
}

html[data-theme="dark"] .form-row .input:focus{
  border-color: rgba(201, 168, 76, 0.45);
}

/* 다크: 네이티브 select 드롭다운을 어두운 팔레트로( OS/브라우저에 따라 다름 ) */
html[data-theme="dark"] .form-row select.input{
  color-scheme: dark;
  background-color: #2a251e;
  color: #f0e6d4;
}

html[data-theme="dark"] .form-row select.input option{
  background-color: #1f1c18;
  color: #f0e6d4;
}

html[data-theme="dark"] .form-row select.input option:checked{
  background-color: rgba(201, 168, 76, 0.28);
  color: #fff;
}

html[data-theme="dark"] .primary{
  background: rgba(201, 168, 76, 0.2);
  border-color: rgba(201, 168, 76, 0.35);
  color: var(--gold-light);
}

html[data-theme="dark"] .primary:hover:not(:disabled){
  background: rgba(201, 168, 76, 0.28);
  border-color: rgba(201, 168, 76, 0.45);
}

html[data-theme="dark"] .ghost-btn{
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(201, 168, 76, 0.2);
  color: var(--text);
}

html[data-theme="dark"] .ghost-btn:hover:not(:disabled){
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(201, 168, 76, 0.3);
}

html[data-theme="dark"] .mj-alliance-search .input{
  border-color: rgba(201, 168, 76, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: #e8dfc8;
}

html[data-theme="dark"] .mj-alliance-search .input:focus{
  border-color: rgba(201, 168, 76, 0.45);
}

html[data-theme="dark"] .mj-union-filter{
  border-color: rgba(201, 168, 76, 0.15);
  background: rgba(26, 22, 18, 0.35);
}

html[data-theme="dark"] .mj-union-filter-all{
  border-color: rgba(201, 168, 76, 0.25);
  background: rgba(0, 0, 0, 0.2);
  color: #e8dfc8;
}

html[data-theme="dark"] .mj-union-filter-all:hover{
  background: rgba(201, 168, 76, 0.12);
}

html[data-theme="dark"] .mj-filter-chip input{
  accent-color: rgba(201, 168, 76, 0.9);
}

html[data-theme="dark"] .mj-table-wrap{
  border-color: rgba(201, 168, 76, 0.15);
  background: rgba(26, 22, 18, 0.35);
}

html[data-theme="dark"] .mj-table th{
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold-light);
}

html[data-theme="dark"] .mj-table td{
  border-color: rgba(201, 168, 76, 0.12);
}

html[data-theme="dark"] .mj-tag-main-guess{
  background: rgba(201, 168, 76, 0.16);
  color: #d4bc6a;
}

html[data-theme="dark"] .mj-tag-alliance{
  background: rgba(130, 170, 220, 0.14);
  color: #a8c8f0;
}

html[data-theme="dark"] .mj-main-guild-out{
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(180, 60, 60, 0.12);
}

html[data-theme="dark"] .mj-warnings{
  border-color: rgba(255, 120, 120, 0.25);
  background: rgba(255, 80, 80, 0.08);
  color: rgba(255, 220, 200, 0.95);
}

@media (max-width: 640px){
  .form-row{
    flex-direction: column;
    align-items: stretch;
  }
  .form-row .input{
    min-width: 0;
    width: 100%;
  }
  .form-row .mj-select-server:not(.is-hidden){
    width: 100%;
    min-width: 0;
  }
  .form-row .primary{
    width: 100%;
  }
}
