:root {
  --primary: #4285f4;
  --secondary: #e0e0e0;
  --accent: #f9f9f9;
  --text: #333;
  --radius: 8px;
  --font-main: 'Helvetica Neue', 'Segoe UI', sans-serif;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --space-bg: #ffcdd2;
}

body {
  font-family: var(--font-main);
  margin: 0;
  padding: 2rem;
  background: var(--accent);
  color: var(--text);
  display: flex;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 1600px;
  background: #fff;
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

h1 {
  margin-bottom: 1.5rem;
  font-size: 2rem;
  color: var(--primary);
  border-left: 6px solid var(--primary);
  padding-left: 1rem;
}

input[type="text"],
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

.input-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.input-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.word-input {
  font-size: 1.5rem;
  font-family: 'Courier New', monospace;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #ccc;
  border-radius: var(--radius);
  box-sizing: border-box;
  background: transparent;
  z-index: 2;
  position: relative;
}

#char-count {
  font-size: 0.9rem;
  text-align: right;
  margin-top: 4px;
  color: #999;
}

.search-type,
.length-filter,
.theme-filters {
  margin-bottom: 1.5rem;
}

.search-type label,
.length-filter label,
.theme-filters label {
  margin-right: 1rem;
  font-size: 1rem;
  font-weight: 500;
}

.checkbox {
  display: inline-block;
  margin: 0.3rem 0.5rem;
}

.filter-button {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background-color: white;
  color: var(--primary);
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  min-width: 50px;
  text-align: center;
  line-height: 1.2;
}

.toggle-checkbox {
  display: none;
}

.toggle-checkbox:checked + .filter-button {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.theme-filters {
  margin-bottom: 1.5rem;
}

.theme-group-wrapper {
  margin-bottom: 6px;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  padding: 4px 8px;
  background: #fafafa;
}

.theme-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  line-height: 1.2;
}

.theme-group-left {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.theme-group-title {
  font-weight: bold;
  font-size: 0.95em;
}

.theme-count {
  font-size: 0.85em;
  color: #666;
}

.theme-controls {
  display: flex;
  gap: 4px;
}

.theme-controls button {
  font-size: 0.75rem;
  padding: 2px 6px;
  border: none;
  border-radius: 4px;
  background-color: var(--secondary);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.theme-controls button:hover {
  background-color: #ccc;
}

.theme-group {
  margin: 2px 0 0;
}

.theme-group summary {
  font-size: 0.8rem;
  cursor: pointer;
  margin: 0;
  padding: 2px 0;
  color: #007acc;
}

.theme-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 4px;
}

button[type="submit"] {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.3s;
}

button[type="submit"]:hover {
  background-color: #3367d6;
}

.error {
  color: red;
  font-weight: bold;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 1rem;
}

th,
td {
  padding: 0.75rem;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

th {
  background-color: #f0f0f0;
  font-weight: bold;
}

#positioned-letter-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.position-filter {
  background: #1f2937;
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.position-filter label {
  font-size: 14px;
  font-weight: bold;
  color: #9ca3af;
}

.position-filter input[type="text"] {
  padding: 6px 10px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background-color: #111827;
  color: #f9fafb;
  font-size: 14px;
  transition: border 0.2s;
}

.position-filter input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
}

.position-filter select {
  padding: 6px 10px;
  border-radius: 6px;
  background-color: #111827;
  border: 1px solid #4b5563;
  color: #f9fafb;
  font-size: 14px;
  transition: border 0.2s;
}

.position-filter select:focus {
  outline: none;
  border-color: #10b981;
}
.toggle-button {
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.toggle-button[data-state="required"] {
  background-color: #ef4444; 
  color: white;
}

.toggle-button[data-state="optional"] {
  background-color: #6b7280; 
  color: white;
}

td .match-boxes-used {
  font-size: 0.75em;
  white-space: pre-line;
  line-height: 1.1;
  display: block;
  padding: 0;
  margin: 0;
}

td.match-boxes-cell {
  padding-top: 4px;
  padding-bottom: 4px;
}

.reset-button {
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  background-color: #9e9e9e;
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.3s;
}

.reset-button:hover {
  background-color: #7e7e7e;
}

.index-cell {
  width: 3ch;
  text-align: center;
  white-space: nowrap;
  padding-left: 0.2em;
  padding-right: 0.2em;
}

.word-column {
  width: 15ch;
}


#results-table {
  margin-top: 2rem;
  font-size: 1.2rem; 
  line-height: 1.6;
  min-height: 500px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  font-size: 0.8rem;
  padding: 8px;
}

.tabulator .tabulator-cell {
  font-size: 1.2rem;
  padding: 10px 8px;
}

.tabulator .tabulator-header-filter input,
.tabulator .tabulator-header-filter select {
  font-size: 1.1rem;
  padding: 6px 10px;
}

.tabulator .tabulator-cell {
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabulator .tabulator-header .tabulator-col {
  white-space: nowrap !important;
}

#results-table {
  margin-top: 2rem;
  font-size: 1.2rem;
  line-height: 1.6;
  min-height: 500px;
  overflow-x: auto;
  display: block;
}


.tabulator .tabulator-cell {
  font-size: 1.2rem;
  padding: 10px 8px;
  white-space: nowrap !important; 
  overflow: hidden !important; 
  text-overflow: ellipsis !important; 
}

.tabulator .tabulator-header .tabulator-col {
  white-space: nowrap !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  font-size: 0.8rem;
  padding: 8px;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabulator .tabulator-header-filter input,
.tabulator .tabulator-header-filter select {
  font-size: 1.1rem;
  padding: 6px 10px;
  white-space: nowrap;
}

.tabulator {
  width: 100% !important;
  max-width: none !important;
  overflow-x: auto;
}

.tabulator .tabulator-tableholder {
  overflow-x: auto !important;
}

.tabulator .tabulator-table {
  min-width: 1200px !important;
  width: max-content !important;
}

.tabulator .tabulator-cell {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 1.2rem;
  padding: 10px 8px;
}

.tabulator .tabulator-header .tabulator-col,
.tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.tabulator-cell.wrap-theme {
  white-space: normal !important;
  word-break: break-word;
}
.tabulator-cell.nowrap-word {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: unset !important;
}
.site-footer {
  text-align: center;
  margin-top: 40px;
  padding: 30px 10px;
  background-color: #f9f9f9;
  color: #555;
  border-top: 1px solid #ddd;
}
.twitter-tweet {
  margin: 20px auto !important;
}



.site-footer a {
  color: #1da1f2;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.character-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  margin: 5px;
  cursor: grab;
  border: 2px solid #ccc;
  transition: transform 0.2s;
}

.character-icon:hover {
  transform: scale(1.1);
}

.position-filter {
  position: relative;
}

.position-filter .icon-overlay {
  position: absolute;
  top: 32px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
}

.character-icon.selected {
  border: 3px solid var(--primary);
  box-shadow: 0 0 8px rgba(66,133,244,0.6);
}

.position-filter {
  position: relative;
}

.position-filter.dragover {
  outline: 2px dashed var(--primary);
  background-color: rgba(66,133,244,0.05);
}

.clear-button {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 14px;
  font-weight: bold;
  line-height: 20px;
  cursor: pointer;
  display: none;
}

.position-filter.has-value .clear-button {
  display: block;
}

#loading {
  font-size: 1.2rem;
  color: #4285f4;
}

@media screen and (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .container {
    padding: 1rem;
    max-width: 100%;
  }

  h1 {
    font-size: 1.4rem;
  }

  .word-input {
    font-size: 1.1rem;
    padding: 6px 8px;
  }

  #char-count {
    font-size: 0.8rem;
  }

  .filter-button {
    font-size: 0.8rem;
    padding: 6px 10px;
    min-width: 40px;
  }

  .toggle-button {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  .position-filter {
    padding: 6px;
    font-size: 0.9rem;
  }

  .position-filter input[type="text"] {
    font-size: 0.9rem;
    padding: 4px 6px;
  }

  .character-icon {
    width: 36px;
    height: 36px;
    margin: 3px;
  }

  #results-table {
    font-size: 0.9rem;
    min-height: 300px;
    overflow-x: hidden !important;
  }

  .tabulator .tabulator-cell {
    font-size: 0.9rem;
    padding: 6px 4px;
  }

  .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    font-size: 0.7rem;
  }

  .tabulator .tabulator-header-filter input,
  .tabulator .tabulator-header-filter select {
    min-width: unset !important; 
    width: 100% !important;
  }

  button[type="submit"],
  .reset-button {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
  
}
@media screen and (max-width: 768px) {

  .tabulator .tabulator-cell,
  .tabulator .tabulator-header .tabulator-col,
  .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }


  .tabulator .tabulator-cell {
    font-size: 0.8rem;
    padding: 4px 3px;
    line-height: 1.3;
  }


  .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
    font-size: 0.7rem;
  }


  .tabulator .tabulator-header-filter input,
  .tabulator .tabulator-header-filter select {
    font-size: 0.7rem;
    padding: 3px 4px;
  }


  #results-table {
    overflow-x: hidden !important;
  }
    .position-filter input[type="text"] {
    font-size: 0.8rem;
    padding: 4px 4px; 
    letter-spacing: -0.02em;
  }

  .position-filter {
    flex: 1 1 calc(50% - 8px); 
    min-width: 120px;   
  }

  #positioned-letter-filters {
    grid-template-columns: repeat(2, 1fr); 
  }
}

.character-search-wrapper {
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  background: #fdfdfd;
  box-shadow: var(--shadow);
}

.character-search-wrapper h3 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

#character-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 1rem;
}

.chara-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 10px;
  gap: 6px;
}

.character-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid #ccc;
  transition: transform 0.2s, border 0.2s, box-shadow 0.2s;
}

.character-icon:hover {
  transform: scale(1.1);
  border-color: var(--primary);
  box-shadow: 0 0 6px rgba(66,133,244,0.4);
}
@media screen and (max-width: 768px) {
  .character-icon {
    width: 28px;
    height: 28px;
    margin: 1px;
  }

  #character-icons {
    gap: 6px;
  }
}
#character-icons {
  display: block;
}

.chara-row {
  display: flex; 
  flex-wrap: wrap;
  margin-bottom: 10px;
  gap: 6px;
}

.character-search-summary {
  font-size: 1rem;
  font-weight: bold;
  color: #4285f4;
  cursor: pointer;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f9f9f9;
  margin-bottom: 8px;
  display: inline-block;
}

.character-search-section {
  margin-bottom: 1.5rem;
}

.sticky-search-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1000;
  padding: 10px;
  border-bottom: 2px solid #ddd;
}

.sticky-search-header.no-sticky {
  position: static;
}

.toggle-sticky-btn {
  margin-left: 10px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
.sticky-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
}

.switch input {
  display: none;
}

.switch .slider {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: #ccc;
  border-radius: 34px;
  transition: background-color 0.3s;
  margin-right: 8px;
}

.switch .slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.switch .switch-label {
  color: var(--text);
  font-weight: bold;
}


.sticky-search-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1000;
  padding: 12px 16px;
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);  
}

.sticky-search-header.no-sticky {
  position: static;
  border-bottom: 2px solid #ddd; 
  box-shadow: none;
}

.character-search-summary {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary);
  cursor: pointer;
  padding: 12px 16px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: linear-gradient(135deg, #f9f9f9, #ffffff);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.character-search-summary:hover {
  background: #f0f7ff;
  box-shadow: 0 3px 8px rgba(66,133,244,0.2);
}

.character-search-summary .summary-text {
  flex-grow: 1;
}

.character-search-summary .summary-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
}


.character-search-section[open] .summary-icon {
  transform: rotate(180deg);
}

.character-search-wrapper {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.2rem;
  margin-top: 6px;
  background: #ffffff;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.05);
  animation: fadeIn 0.3s ease;
}


@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.theme-group-wrapper.inactive {
  background: #f5f5f5;
  opacity: 0.6;
  border-color: #ccc;
}

.theme-group-wrapper.inactive .theme-group-title {
  color: #888;
}

.theme-group-wrapper.inactive summary {
  color: #888;
}

.theme-group-wrapper.inactive .theme-controls button {
  background-color: #ddd;
  color: #888;
  cursor: not-allowed;
}

.word-preview {
  font-size: 1rem;
  color: #555;
  margin-top: 4px;
  text-align: left;
  font-family: 'Courier New', monospace;
  white-space: pre;
}


body.dark-mode {
  background: #121212;
  color: #e0e0e0;
}

body.dark-mode .container {
  background: #1e1e1e !important;
  color: #e0e0e0 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}
body.dark-mode .input-wrapper {
  background: transparent !important;
}

body.dark-mode h1 {
  color: #90caf9;
  border-left-color: #90caf9;
}

body.dark-mode input[type="text"],
body.dark-mode input[type="checkbox"],
body.dark-mode input[type="radio"],
body.dark-mode select,
body.dark-mode .word-input {
  background: #2a2a2a;
  border: 2px solid #555;
  color: #e0e0e0;
}

body.dark-mode #char-count {
  color: #bbb;
}

body.dark-mode .filter-button {
  background-color: #333;
  color: #90caf9;
  border-color: #90caf9;
}

body.dark-mode .toggle-checkbox:checked + .filter-button {
  background-color: #90caf9;
  color: #000;
}

body.dark-mode .theme-group-wrapper {
  background: #2b2b2b;
  border: 1px solid #555;
}

body.dark-mode .theme-controls button {
  background-color: #444;
  color: #e0e0e0;
}

body.dark-mode .theme-controls button:hover {
  background-color: #555;
}

body.dark-mode .character-search-wrapper {
  background: #242424;
  border: 1px solid #555;
}

body.dark-mode .character-search-summary {
  background: linear-gradient(135deg, #2d2d2d, #1e1e1e);
  border: 2px solid #90caf9;
  color: #90caf9;
}

body.dark-mode .site-footer {
  background-color: #1e1e1e;
  color: #bbb;
  border-top: 1px solid #555;
}

body.dark-mode .site-footer a {
  color: #64b5f6;
}

body.dark-mode #loading {
  color: #90caf9;
}


body.dark-mode .tabulator {
  background: #1e1e1e;
  color: #e0e0e0;
}

body.dark-mode .tabulator .tabulator-cell {
  border-right: 1px solid #555 !important;
  border-bottom: 1px solid #555 !important;
}


body.dark-mode .tabulator .tabulator-header .tabulator-col {
  background: #2b2b2b;
  border-color: #444;
}

body.dark-mode .tabulator .tabulator-header .tabulator-col .tabulator-col-title {
  color: #ccc;
}

body.dark-mode .tabulator .tabulator-cell {
  background: #1e1e1e;
  border-color: #444;
  color: #e0e0e0;
}

body.dark-mode .tabulator .tabulator-header-filter input,
body.dark-mode .tabulator .tabulator-header-filter select {
  background: #2a2a2a;
  border: 1px solid #555;
  color: #e0e0e0;
}


body.dark-mode .word-input {
  background: #2a2a2a;
  border: 2px solid #555;
  color: #e0e0e0;
}
body.dark-mode .word-input::placeholder {
  color: #888;
}


body.dark-mode .tabulator-row:hover .tabulator-cell {
  background-color: #333 !important;
  color: #fff !important;
}

body.dark-mode .tabulator-col:hover {
  background-color: #444 !important;
  color: #fff !important;
}


body.dark-mode .word-input {
  background-color: #2a2a2a !important;
  border: 2px solid #555 !important;
  color: #e0e0e0 !important;
}

body.dark-mode .word-input::placeholder {
  color: #aaa !important;
}


#visual-overlay {
  background: transparent !important;
  pointer-events: none;
  z-index: 1;
}


.word-input {
  position: relative;
  z-index: 2 !important;
}

body.dark-mode .sticky-search-header {
  background: #1e1e1e !important; 
  border-bottom: 2px solid #444 !important; 
  box-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
}


body.dark-mode .tabulator {
  border: 1px solid #555 !important;
}


body.dark-mode .tabulator .tabulator-header {
  border-bottom: 1px solid #555 !important;
}


body.dark-mode .tabulator .tabulator-cell {
  border-right: 1px solid #555 !important;
  border-bottom: 1px solid #555 !important;
}


body.dark-mode .tabulator .tabulator-cell:last-child {
  border-right: none !important; 
 
}

.sticky-header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.sticky-header-controls .input-label {
  margin-right: auto;
}

.sticky-header-controls .switch {
  margin-left: 12px; 
}

.sticky-header-controls .switch:last-child {
  margin-right: 0;
}

body.dark-mode .tabulator .tabulator-row {
  border-bottom: 1px solid #444 !important;
  background: #1e1e1e !important;
}

body.dark-mode .tabulator .tabulator-row.tabulator-row-odd {
  background: #1a1a1a !important;
}

body.dark-mode .tabulator .tabulator-cell {
  border-right: 1px solid #444 !important;
  border-bottom: 1px solid #444 !important;
}

.user-icons-wrapper {
  margin-top: 16px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.user-icons-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.user-icons-header .badge {
  display: inline-block;
  font-weight: bold;
  color: #444;
  background: #eaeaea;
  border-radius: 6px;
  padding: 4px 8px;
}
.user-icons-controls {
  display: flex;
  gap: 6px;
}
.ui-secondary, .ui-primary, .mini-save {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
}
.ui-secondary { background: #eee; color: #333; }
.ui-secondary.active { background: #d0e1ff; color: #1a4fbf; }
.ui-primary { background: var(--primary); color: #fff; }
.mini-save {
  margin-left: 6px;
  background: #4caf50;
  color: #fff;
  padding: 4px 8px;
  font-size: 11px;
  vertical-align: middle;
}

.user-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
}
.user-icons-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #666;
}

.user-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #999;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}
.user-icon .user-icon-text {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  text-align: center;
  line-height: 1.1;
  padding: 2px;
  word-break: break-all;
}
.user-icon.selected {
  outline: 2px solid var(--primary);
}
.user-icon.dragging {
  opacity: 0.6;
}
.user-icon.dragover {
  box-shadow: 0 0 0 3px rgba(66,133,244,0.35) inset;
}

.user-icons.mode-delete .user-icon {
  cursor: pointer;
  border-color: #e57373;
  box-shadow: 0 0 0 2px rgba(229, 115, 115, 0.2) inset;
}
.user-icons.mode-reorder .user-icon {
  cursor: grab;
  border-color: #64b5f6;
  box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.2) inset;
}


body.dark-mode .user-icons-wrapper {
  background: #1e1e1e;
  border-color: #555;
}
body.dark-mode .user-icons-header .badge {
  background: #333;
  color: #ddd;
}
body.dark-mode .user-icon { background: #2a2a2a; border-color: #666; }
body.dark-mode .user-icon .user-icon-text { color: #e0e0e0; }
body.dark-mode .ui-secondary { background: #444; color: #e0e0e0; }
body.dark-mode .ui-secondary.active { background: #2b3e6b; color: #e0e8ff; }

.position-filter .pf-head{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}
.position-filter .pf-head > label{
  margin: 0;
}

.position-filter .pf-head .mini-save{
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1;
}


.user-icon.will-delete{
  opacity: .55;
  border-style: dashed;
  border-color: #e57373;
  position: relative;
}
.user-icon.will-delete::after{
  content: "×";
  position: absolute;
  right: -6px;
  top: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e57373;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
}

body.dark-mode .user-icon.will-delete{
  border-color: #ef9a9a;
}
body.dark-mode .user-icon.will-delete::after{
  box-shadow: 0 0 0 2px #1e1e1e;
}

.search-summary {
  margin: 10px 0 18px;
  padding: 10px 14px;
  background: #f5faff;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
}
.search-summary .ss-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 6px 0;
  flex-wrap: wrap;
}
.search-summary .ss-label {
  font-weight: 700;
  color: #334155;
  min-width: 8em;
}
.search-summary .ss-value {
  color: #111827;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 6px 2px 0;
  border-radius: 999px;
  background: #e8f0fe;
  color: #1f2937;
  border: 1px solid #c7dbff;
  font-size: 0.9rem;
  line-height: 1.6;
}

.no-result {
  color: #d32f2f;
  font-weight: 700;
}

body.dark-mode .search-summary {
  background: #16202e;
  border-left-color: #90caf9;
}
body.dark-mode .search-summary .ss-label { color: #cbd5e1; }
body.dark-mode .search-summary .ss-value { color: #e5e7eb; }
body.dark-mode .chip {
  background: #263445;
  color: #e5e7eb;
  border-color: #3b4d63;
}


#condition-summary:empty,
.search-summary:empty {
  display: none;
}

.search-summary:not(:has(.ss-row)) {
  display: none;
}