﻿:root {
  --ui-scale: 1; 
  --base-font: 16px;
  --tab-comp: 1;
  --tab-head-comp: 1;
  --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-size: var(--base-font);
  font-family: var(--font-main);
  margin: 0;
  padding: 2rem;
  background: var(--accent);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}

.container{
  zoom: var(--ui-scale);          
  width: min(100%, 1600px);
  max-width: 1600px;              
  margin: 0 auto;
  background: #fff;
  padding: 2rem 2.5rem;
  box-sizing: border-box;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.top-video-wrap{
  width: min(100%, 1600px);
  max-width: 1600px;
  margin: 0 auto 1rem;
  box-sizing: border-box;
}

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

.yt-latest-section{
  margin: 0 0 1.2rem;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e8f1ff 0%, #f7fbff 100%);
  border: 1px solid #c9dcff;
  overflow: hidden;
}
.yt-latest-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.yt-latest-title{
  margin: 0;
  font-size: .92rem;
  color: #1a4ea5;
  font-weight: 800;
}
.yt-latest-viewport{
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.yt-latest-viewport::-webkit-scrollbar{
  display: none;
}
.yt-latest-viewport.dragging{
  cursor: grabbing;
}
.yt-latest-track{
  display: flex;
  gap: 10px;
  width: max-content;
}
.yt-feed-status{
  padding: 10px 12px;
  border: 1px solid #cdddf8;
  border-radius: 10px;
  background: #fff;
  color: #46608a;
  font-size: .9rem;
  font-weight: 600;
}
.yt-card{
  width: 220px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid #cdddf8;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 18px rgba(20, 56, 120, 0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.yt-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(20, 56, 120, 0.16);
}
.yt-thumb{
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
}
.yt-meta{
  padding: 7px 8px 8px;
}
.yt-video-title{
  color: #1f2937;
  font-weight: 700;
  font-size: .8rem;
  line-height: 1.35;
  min-height: 2.4em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.yt-video-date{
  margin-top: 4px;
  color: #64748b;
  font-size: .72rem;
}

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;
}
#char-count.over-limit {
  color: #d32f2f;
  font-weight: 700;
}
.word-warning{
  margin: 6px 0 0;
  color: #d32f2f;
  font-weight: 700;
  font-size: 0.92rem;
}

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

.length-filter{
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.length-filter .length-filter-title{
  margin-right: 4px;
  font-size: 1rem;
  font-weight: 500;
}

.length-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-type{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.search-type input[type="radio"]{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.search-type label{
  margin-right: 0;
  min-width: 82px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #c9d3e5;
  background: #ffffff;
  color: #24344d;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-type input[type="radio"]:checked + label{
  background: #e9f1ff;
  border-color: #4285f4;
  color: #165dc7;
  box-shadow: 0 0 0 2px rgba(66,133,244,0.18);
}

.search-type label:hover{
  border-color: #4285f4;
}

.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);
}

.include-search-wrap{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1f2937;
  user-select: none;
  cursor: pointer;
}
.include-search-wrap input[type="checkbox"]{
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}


.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;
}


.theme-group-wrapper.inactive {
  background: #f5f5f5;
  opacity: 0.6;
  border-color: #ccc;
}
.theme-group-wrapper.inactive .theme-group-title,
.theme-group-wrapper.inactive summary { color: #888; }
.theme-group-wrapper.inactive .theme-controls button {
  background-color: #ddd;
  color: #888;
  cursor: not-allowed;
}


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; }

.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; }

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


.banmen-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 1rem;
}
.banmen-table th, .banmen-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #ddd;
  text-align: left;
}
.banmen-table 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: relative;
}

.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;
}


.position-filter .pf-head{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-right: 22px;
  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;
}


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


.clear-button {
  position: absolute;
  top: 5px;
  right: 4px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 14px;
  font-weight: bold;
  line-height: 18px;
  cursor: pointer;
  display: none;
}
.position-filter.has-value .clear-button { display: block; }


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


#results-table{
  margin-top: 2rem;
  width: 100%;
  min-height: 0;
}




#results-table{
  overflow: auto; 
}



.results-grid-table{
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}
.results-grid-table col.col-rownum { width: 5ch; }
.results-grid-table col.col-len { width: 6ch; }
.results-grid-table col.col-match { width: 6ch; }
.results-grid-table col.col-word { width: 16ch; }
.results-grid-table col.col-boxes { width: 10ch; }
.results-grid-table col.col-need { width: 10ch; }
.results-grid-table col.col-format { width: 16ch; }
.results-grid-table col.col-theme { width: 16ch; }
.results-grid-table th,
.results-grid-table td{
  border: 1px solid #d9d9d9;
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  background: #fff;
}
.results-grid-table th{
  background: #f3f4f6;
  font-weight: 700;
}
.results-grid-table td.num{
  text-align: center;
  white-space: nowrap;
}
.results-grid-table td.rg-boxes-cell{
  white-space: normal;
  line-height: 1.3;
}
.results-grid-table td.rg-word-cell{
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.results-grid-table .rg-sort{
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.results-grid-table .rg-head{
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.results-grid-table .rg-filter-input,
.results-grid-table .rg-filter-select{
  width: 100%;
  height: 30px;
  box-sizing: border-box;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 6px;
  background: #fff;
}
.results-grid-table tbody tr:nth-child(even) td{
  background: #fcfcfc;
}


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


#loading {
  margin: 20px 0;
}

.loading-indicator{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: fit-content;
  margin: 20px auto;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}
.loading-indicator[hidden]{
  display: none !important;
}

.loading-spinner{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(29,78,216,0.25);
  border-top-color: #1d4ed8;
  animation: loadingSpin .8s linear infinite;
}

.loading-text{
  font-size: 1rem;
}

@keyframes loadingSpin{
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.site-footer {
  text-align: center;
  margin-top: 40px;
  padding: 30px 10px;
  background-color: #f9f9f9;
  color: #555;
  border-top: 1px solid #ddd;
}
.site-footer a {
  color: #1da1f2;
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

.twitter-tweet { margin: 20px auto !important; }


.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: block; }

.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);
}
.character-icon.selected {
  border: 3px solid var(--primary);
  box-shadow: 0 0 8px rgba(66,133,244,0.6);
}


.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; }
.sticky-header-controls .right-toggles{
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.sticky-header-controls .right-toggles .switch{
  margin-left: 0;
}

.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;
}
.toggle-sticky-btn {
  margin-left: 10px;
  padding: 4px 8px;
  font-size: 0.9rem;
  cursor: pointer;
}


.sticky-header-controls{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}


.sticky-header-controls .input-label{
  flex: 1 1 100%;
  margin: 0;
}


.sticky-header-controls .scale-controls,
.sticky-header-controls .switch{
  flex: 0 0 auto;
}


@media (max-width: 768px){
  .sticky-search-header{ padding: 10px 10px; }
  .sticky-header-controls{ gap: 6px; }

  .scale-controls{ margin-left: 0; }
  .switch{ margin-left: 0; }
  .switch .switch-label{ font-size: .8rem; }
  .sticky-header-controls .right-toggles{
    width: 100%;
    justify-content: flex-end;
    margin-left: 0;
  }
}


.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;
}



.scale-controls{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;

  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.scale-label{
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.scale-btn{
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  width: 28px;
  height: 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
}
.scale-btn:hover{
  background:#eef2f7;
}


body.dark-mode .scale-controls{
  background:#2a2a2a;
  border-color:#555;
}
body.dark-mode .scale-label{
  color:#e5e7eb;
}
body.dark-mode .scale-btn{
  background:#333;
  border-color:#555;
  color:#e5e7eb;
}
body.dark-mode .scale-btn:hover{
  background:#3a3a3a;
}


.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; }

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


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


.cta-howto {
  display: inline-block;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  line-height: 1;
  transition: background .2s, color .2s, border-color .2s;
}
.cta-howto:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.howto-section {
  margin-top: 48px;
  padding-top: 14px;
  border-top: 1px solid #ddd;
}
#howto { scroll-margin-top: 120px; }
.howto-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.howto-card{
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #dbe8ff;
  background:
    linear-gradient(120deg, rgba(66,133,244,0.08), rgba(66,133,244,0.01) 45%),
    #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}
.howto-card-wide{
  grid-column: 1 / -1;
}
.howto-card h3{
  margin: 0 0 10px;
  font-size: 1.02rem;
  line-height: 1.4;
  color: #1d4fa8;
}
.howto-card p{
  margin: 7px 0;
  line-height: 1.75;
  color: #1f2937;
  font-size: 0.95rem;
}
.howto-card-note{
  grid-column: 1 / -1;
  border-color: #bfd7ff;
  background:
    linear-gradient(125deg, rgba(66,133,244,0.12), rgba(66,133,244,0.03) 48%),
    #f8fbff;
}

.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  line-height: 44px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 1100;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}


.banmen-list { margin: 10px 0 20px; }
.banmen-block {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  margin: 8px 0;
}
.banmen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  gap: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.banmen-header:hover {
  background: #f1f5fb;
}
.banmen-header:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(66,133,244,0.35);
}
.banmen-title { font-weight: 700; color: #374151; }
.banmen-state {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  min-width: 72px;
  text-align: center;
  font-weight: 700;
}

.banmen-panel { padding: 6px 10px 12px; }
.banmen-table-wrap { overflow-x: auto; }

.banmen-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 0.95rem;
  background: transparent;
}
.banmen-table th, .banmen-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.banmen-table th {
  background: #f3f4f6;
  font-weight: 700;
}

.banmen-cell {
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.2;
}
.banmen-cell:hover { background: #eff6ff; }
.banmen-cell-empty { color:#9ca3af; }


.result-actions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:8px;
  margin-bottom:6px;
}
.btn-ghost{
  appearance:none;
  border:1px solid #cfd8e3;
  background:#fff;
  color:#334155;
  font-size:.85rem;
  padding:4px 8px;
  border-radius:6px;
  cursor:pointer;
}
.btn-ghost:hover{ background:#f8fafc; }

.copy-options{ position:relative; display:inline-block; }

.copy-options-panel{
  position:absolute;
  top:110%;
  left:0;
  z-index:1200;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.08);
  padding: 12px 14px;
  min-width: 420px;
  max-width: 640px;
  width: clamp(420px, 50vw, 640px);
}

.copy-opt-row{
  display:flex; align-items:flex-start; gap:6px;
  margin:6px 0;
}
.copy-opt-label{
  font-size:.85rem; color:#475569; min-width:44px;
}
.copy-col-checks{
  display:flex; flex-wrap:wrap; gap:8px;
  max-height:260px; overflow:auto;
}
.copy-col-checks label{
  display:inline-flex; align-items:center; gap:4px;
  border:1px solid #dbe4f0; border-radius:999px;
  padding:6px 10px;
  font-size:.9rem;
  background:#fff;
  cursor:pointer;
}
.copy-col-checks input{ accent-color:var(--primary); }

.copy-delimiter{
  width:140px;
  font-size:1rem;
  padding:6px 8px;
  border:1px solid #cbd5e1;
  border-radius:6px;
}
.copy-opt-actions{ display:flex; justify-content:flex-end; margin-top:6px; }

.btn-primary{
  border:none; background:var(--primary); color:#fff;
  font-size:.85rem; padding:5px 10px; border-radius:6px; cursor:pointer;
}
.btn-primary:hover{ filter:brightness(0.95); }


.copy-toast{
  position: fixed;
  z-index: 2147483647;
  pointer-events: none;
  background: rgba(33,33,33,.96);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.2;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .2s ease;
}
.copy-toast.show{
  opacity: 1;
  transform: translateY(0);
}


.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.reorder-pick {
  outline: 2px solid #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
.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;
}

.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;
}


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


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 .yt-latest-section{
  background: linear-gradient(135deg, #102133 0%, #0f172a 100%);
  border-color: #2c4770;
}
body.dark-mode .yt-latest-title{
  color: #b9d9ff;
}
body.dark-mode .yt-card{
  background: #1f2937;
  border-color: #3b4d66;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}
body.dark-mode .yt-video-title{
  color: #e5e7eb;
}
body.dark-mode .yt-video-date{
  color: #93a0b5;
}
body.dark-mode .yt-feed-status{
  background: #1f2937;
  border-color: #3b4d66;
  color: #c9d7ea;
}
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 .word-input::placeholder { color: #aaa !important; }
body.dark-mode #char-count { color: #bbb; }
body.dark-mode #char-count.over-limit { color: #ff8a80; }
body.dark-mode .word-warning { color: #ff8a80; }

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 .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 .loading-indicator{
  background: rgba(21,49,83,0.65);
  border-color: #28558a;
  color: #90caf9;
}
body.dark-mode .loading-spinner{
  border-color: rgba(144,202,249,0.28);
  border-top-color: #90caf9;
}


body.dark-mode .tabulator {
  background: #1e1e1e;
  color: #e0e0e0;
  border: 1px solid #555 !important;
}
body.dark-mode .tabulator .tabulator-header { 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-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 {
  background: #1e1e1e;
  border-right: 1px solid #444 !important;
  border-bottom: 1px solid #444 !important;
  color: #e0e0e0;
}
body.dark-mode .tabulator .tabulator-cell:last-child { border-right: none !important; }

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 .tabulator-row:hover .tabulator-cell {
  background-color: #333 !important;
  color: #fff !important;
}


body.dark-mode .btn-ghost{ background:#2a2a2a; color:#e5e7eb; border-color:#555; }
body.dark-mode .btn-ghost:hover{ background:#333; }
body.dark-mode .copy-options-panel{
  background:#1e1e1e; border-color:#555; box-shadow:0 8px 24px rgba(0,0,0,.45);
}
body.dark-mode .copy-col-checks label{
  background:#2a2a2a; border-color:#555; color:#e5e7eb;
}
body.dark-mode .copy-delimiter{ background:#2a2a2a; color:#e5e7eb; border-color:#555; }
body.dark-mode .btn-primary{ background:#90caf9; color:#000; }
body.dark-mode .copy-toast{ background: rgba(240,240,240,.95); color: #111; }


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 .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; }
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; }

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;
}

body.dark-mode .howto-section code { background: #2a2a2a; padding: 0 .25em; border-radius: 4px; }
body.dark-mode .howto-card{
  border-color: #334155;
  background:
    linear-gradient(120deg, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0.04) 45%),
    #1f2937;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
}
body.dark-mode .howto-card h3{
  color: #93c5fd;
}
body.dark-mode .howto-card p{
  color: #e5e7eb;
}
body.dark-mode .howto-card-note{
  border-color: #3b82f6;
  background:
    linear-gradient(125deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.07) 52%),
    #1e293b;
}
body.dark-mode .back-to-top {
  background: #90caf9;
  color: #000;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}


body.dark-mode .results-grid-table th,
body.dark-mode .results-grid-table td{
  background: #1e1e1e;
  border-color: #444;
  color: #e5e7eb;
}
body.dark-mode .results-grid-table th{
  background: #2b2b2b;
}
body.dark-mode .results-grid-table .rg-filter-input,
body.dark-mode .results-grid-table .rg-filter-select{
  background: #2a2a2a;
  border-color: #555;
  color: #e5e7eb;
}
body.dark-mode .results-grid-table tbody tr:nth-child(even) td{
  background: #212121;
}


body.dark-mode .tabulator .tabulator-tableholder,
body.dark-mode .tabulator .tabulator-table,
body.dark-mode .tabulator-tableholder{
  background: #1e1e1e !important;
}

body.dark-mode .tabulator .tabulator-footer{
  background: #1e1e1e !important;
  border-top: 1px solid #555 !important;
  color: #e0e0e0 !important;
}


body.dark-mode select { color-scheme: dark; }


body.dark-mode .banmen-block{
  background: #1e1e1e;
  border-color: #555;
}
body.dark-mode .banmen-title{ color: #e5e7eb; }
body.dark-mode .banmen-header{ border-bottom: 1px solid #444; }
body.dark-mode .banmen-header:hover{
  background: #272727;
}
body.dark-mode .banmen-state{
  background: #2a2a2a;
  color: #e5e7eb;
  border-color: #555;
}

body.dark-mode .banmen-table th{
  background: #2b2b2b;
  color: #e5e7eb;
  border-bottom-color: #444;
}
body.dark-mode .banmen-table td{ border-bottom-color: #444; }

body.dark-mode .banmen-cell{
  background: #2a2a2a;
  color: #90caf9;
  border-color: #90caf9;
}
body.dark-mode .banmen-cell:hover{ background: #333; }


body.dark-mode .tabulator .tabulator-header .tabulator-col:hover,
body.dark-mode .tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover,
body.dark-mode .tabulator .tabulator-header .tabulator-col:hover .tabulator-col-content{
  background-color: #333 !important;
}

body.dark-mode .tabulator .tabulator-header .tabulator-col:hover .tabulator-col-title{
  color: #e5e7eb !important;
}


body.dark-mode .tabulator .tabulator-header .tabulator-col.tabulator-col-sorter-element,
body.dark-mode .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element{
  background-color: #2b2b2b !important;
}


body.dark-mode .cta-howto{
  background: #2a2a2a;
  color: #90caf9;
  border-color: #90caf9;
}
body.dark-mode .cta-howto:hover{
  background: #90caf9;
  color: #000;
  border-color: #90caf9;
}


body.dark-mode .switch .switch-label{
  color: #e5e7eb;
}
body.dark-mode .search-type label{
  background: #262626;
  border-color: #4b5563;
  color: #e5e7eb;
}
body.dark-mode .search-type input[type="radio"]:checked + label{
  background: #16385f;
  border-color: #79b8ff;
  color: #dbeafe;
  box-shadow: 0 0 0 2px rgba(121,184,255,0.22);
}

body.dark-mode .include-search-wrap{
  color: #dbeafe;
}


body.dark-mode .sticky-header-controls .input-label{
  color: #e5e7eb;
}


@media screen and (max-width: 768px) {
  body { padding: 1rem; }
  .container { padding: 1rem; max-width: 100%; }
  h1 { font-size: 1.4rem; }
  .yt-latest-section{
    padding: 8px;
  }
  .yt-card{
    width: 180px;
  }
  .yt-thumb{
    height: 80px;
  }
  .yt-video-title{
    font-size: .75rem;
  }

  .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; }
  .include-search-wrap { font-size: 0.82rem; gap: 4px; }
  .include-search-wrap input[type="checkbox"] { width: 14px; height: 14px; }
  .length-filter .length-filter-title { margin-right: 0; width: 100%; }
  .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.8rem;
    padding: 4px 4px;
    letter-spacing: -0.02em;
  }
  .position-filter .pf-head{
    gap: 4px;
    padding-right: 18px;
  }
  .position-filter .pf-head > label{
    font-size: 11px;
  }
  .position-filter .pf-head .mini-save{
    font-size: 10px;
    padding: 2px 6px;
  }
  .clear-button{
    top: 4px;
    right: 3px;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 16px;
  }

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

  .character-icon { width: 28px; height: 28px; margin: 1px; }

  
  #results-table { min-height: 300px; overflow-x: auto; }

  .howto-grid{
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .howto-card{
    padding: 12px;
    border-radius: 10px;
  }
  .howto-card h3{
    font-size: 0.95rem;
  }
  .howto-card p{
    font-size: 0.9rem;
    line-height: 1.7;
  }

  .results-grid-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
    font-size: 11px;
  }
  .results-grid-table col.col-rownum { width: 4ch; }
  .results-grid-table col.col-word { width: 14ch; }
  .results-grid-table col.col-match { width: 4ch; }
  .results-grid-table col.col-boxes { width: 8ch; }
  .results-grid-table col.col-len { width: 4ch; }
  .results-grid-table col.col-need { width: 6ch; }
  .results-grid-table col.col-format { width: 8ch; }
  .results-grid-table col.col-theme { width: 8ch; }
  .results-grid-table th,
  .results-grid-table td {
    padding: 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .results-grid-table .rg-sort {
    white-space: normal;
    line-height: 1.15;
    font-size: 11px;
  }
  .results-grid-table .rg-filter-input,
  .results-grid-table .rg-filter-select {
    height: 24px;
    font-size: 11px;
    padding: 2px 4px;
  }
  .results-grid-table td.rg-word-cell{
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
  }
  .copy-options-panel{
    min-width: 280px;
    width: min(94vw, 420px);
  }

  button[type="submit"], .reset-button { font-size: 0.9rem; padding: 0.5rem 1rem; }

  #howto { scroll-margin-top: 140px; }
  .back-to-top { right: 12px; bottom: 12px; }
}


@media (min-width: 769px){
  #results-table { overflow: auto; }
}


.character-search-section > summary{
  list-style: none;
}
.character-search-section > summary::-webkit-details-marker{
  display: none;
}

.character-search-summary{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;

  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;

  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.character-search-summary::after{
  content: "▼";
  opacity: .8;
  font-size: .9em;
}

.character-search-section[open] > .character-search-summary{
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(66,133,244,.15);
}
.character-search-section[open] > .character-search-summary::after{
  content: "▲";
}


body.dark-mode .character-search-summary{
  background: #2a2a2a;
  border-color: #555;
  color: #e5e7eb;
}
body.dark-mode .character-search-section[open] > .character-search-summary{
  box-shadow: 0 0 0 2px rgba(144,202,249,.18);
}


#search-form > button[type="submit"],
#search-form > button.reset-button{
  margin-top: 10px;
}


.character-search-section{
  margin-bottom: 10px;
}




#results-table{
  padding-right: 12px;
  box-sizing: border-box;
}






