/* Diff highlight classes for custom font columns */
.custom-font-column .diff-add,
.custom-font-column .diff-del {
    font-family: var(--yzwr-font) !important;
    font-size: inherit;
    line-height: 1;
}
.custom-font-column .diff-add {
    color: #88ff88;
}
.custom-font-column .diff-del {
    color: #ff8888;
}
.logo-column .new-badge,
.logo-column .modified-badge {
    display: block;
    margin: 6px auto 0;
    margin-left: auto;
    margin-right: auto;
}
@font-face {
    font-family: 'YzWr';
    src: url('/src/font/YzWr-Regular.woff2') format('woff2'),
         url('/src/font/YzWr-Regular.woff') format('woff'),
         url('/src/font/YzWr-Regular.ttf') format('truetype');
    font-display: block;
}

@font-face {
    font-family: 'YzWr-Italic';
    src: url('/src/font/YzWr-Italic.woff2') format('woff2'),
         url('/src/font/YzWr-Italic.woff') format('woff'),
         url('/src/font/YzWr-Italic.ttf') format('truetype');
    font-display: block;
}

@font-face {
    font-family: 'YzWr-Bold';
    src: url('/src/font/YzWr-Bold.woff2') format('woff2'),
         url('/src/font/YzWr-Bold.woff') format('woff'),
         url('/src/font/YzWr-Bold.ttf') format('truetype');
    font-display: block;
}

/* CSS variable for font switching - more reliable on mobile */
:root {
    --yzwr-font: 'YzWr', sans-serif;
    --mobile-breakpoint: 768px;
}
/* ancient = YzWr-Italic (backward-compat: data-yzwr="italic" also maps here) */
body[data-yzwr="italic"],
body[data-yzwr="ancient"] {
    --yzwr-font: 'YzWr-Italic', sans-serif;
}
/* future = YzWr-Bold */
body[data-yzwr="future"] {
    --yzwr-font: 'YzWr-Bold', sans-serif;
}
/* Override inline font-family for non-regular modes */
body[data-yzwr="italic"] h1 span[style*="YzWr"],
body[data-yzwr="italic"] h1 [style*="YzWr"],
body[data-yzwr="ancient"] h1 span[style*="YzWr"],
body[data-yzwr="ancient"] h1 [style*="YzWr"],
body[data-yzwr="future"] h1 span[style*="YzWr"],
body[data-yzwr="future"] h1 [style*="YzWr"] {
    font-family: var(--yzwr-font) !important;
}
/* Font selector demo spans — always show their own font regardless of mode */
.font-selector-demo { font-family: inherit !important; }
[style*="font-family: YzWr-Italic"].font-selector-demo { font-family: YzWr-Italic, sans-serif !important; }
[style*="font-family: YzWr-Bold"].font-selector-demo   { font-family: YzWr-Bold, sans-serif !important; }
[style*="font-family: YzWr,"].font-selector-demo       { font-family: YzWr, sans-serif !important; }

/* Override inline YzWr (Regular) in glossary columns when alt font is selected */
body[data-yzwr="ancient"] [style*="font-family: YzWr, sans-serif"]:not(.font-selector-demo),
body[data-yzwr="ancient"] [style*="font-family: YzWr;"]:not(.font-selector-demo),
body[data-yzwr="future"] [style*="font-family: YzWr, sans-serif"]:not(.font-selector-demo),
body[data-yzwr="future"] [style*="font-family: YzWr;"]:not(.font-selector-demo) {
    font-family: var(--yzwr-font) !important;
}

body {
    font-family: sans-serif;
    background-color: #070707;
    color: rgb(190, 190, 190);
    padding: 0 10px; /* keep content away from edges */
    margin: 0;
}

/* Use border-box everywhere to make padding predictable and avoid overflow */
html, body, * { box-sizing: border-box; }

/* Mobile Responsive Base */
@media (max-width: 768px) {
    body {
        padding: 0;
        font-size: 14px;
    }
    
    h1 {
        padding: 10px 8px;
        margin: 0;
    }
    
    h1 img {
        max-width: 250px !important;
    }
}

.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted #666;
    padding: 2px 4px;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #2c2f33;
    color: #ddd;
    text-align: left;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    top: 50%;
    left: 120%;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 0.85em;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 800px;
    min-width: 200px;
    word-wrap: break-word;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    transform: translateY(-50%) translateX(10px);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent #2c2f33 transparent transparent;
    border-right-color: #444;
}

.tooltip:hover .tooltiptext,
.tooltip.active .tooltiptext {
    visibility: visible;
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.tooltip .tooltiptext strong {
    color: #00b0ff;
}

.tooltip .tooltiptext b {
    color: #00b0ff;
}

.tooltip .tooltiptext a {
    color: #ff8c00;
}

.tooltip .tooltiptext a:hover {
    text-decoration: underline;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    position: static;
    z-index: auto;
}

#results-container {
    border: 1px solid #444;
    padding: 10px;
    overflow-x: auto;
    overflow: visible;
    max-width: 100%;
    margin-bottom: 20px;
    background-color: rgb(11, 11, 11);
    z-index: auto;
}

#exp-results-container {
    border: 1px solid #444;
    padding: 10px;
    overflow-x: auto;
    overflow: visible;
    max-width: 100%;
    margin-bottom: 20px;
    background-color: rgb(11, 11, 11);
    z-index: auto;
}

.results-table th,
.results-table td {
    border: 1px solid #444;
    padding: 8px;
    text-align: left;
    word-break: break-word;
    white-space: normal;
}

.results-table th {
    font-weight: bold;
    background-color: #3e3e3e;
    white-space: nowrap;
    color: #e0e0e0;
}

@media (max-width: 768px) {
    .results-table th,
    .results-table td {
        padding: 6px 4px;
        font-size: 0.9em;
    }
    
    .results-table th {
        font-size: 0.85em;
    }
}


.base-text {
    font-family: var(--yzwr-font);
    font-size: 1.6em;
    color: #e0e0e0;
}

/* Ensure Anki/study glyph elements follow the font toggle */
.card-logo,
.card-graph,
.card-phonetic,
.preview-field-value,
.double-text-container .base-text {
    font-family: var(--yzwr-font);
}

/* Darken Anki glyph/ruby text for contrast on white cards */
.flashcard .card-graph,
.flashcard .card-phonetic,
.flashcard .card-rubytext .double-text-container .base-text,
.flashcard .double-text-container .base-text,
.flashcard .card-rubytext .inline-ruby-table,
.flashcard .card-rubytext .inline-ruby-table td,
.flashcard .card-rubytext .inline-ruby-table .base-text,
.flashcard .inline-ruby-table td,
.preview-mini-card .card-graph,
.preview-mini-card .card-phonetic,
.preview-mini-card .preview-field-value,
.preview-mini-card .preview-ruby-area .double-text-container .base-text,
.preview-mini-card .preview-ruby-area .inline-ruby-table td {
    color: #111;
}

.card-rubytext,
.preview-ruby-area {
    justify-content: center;
    text-align: center;
    width: 100%;
}

.card-rubytext .double-text-container,
.preview-ruby-area .double-text-container {
    margin: 0 auto;
    justify-content: center;
}

/* Center inline-ruby-tables within flashcard ruby text area */
.flashcard .card-rubytext {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}
.flashcard .card-rubytext .inline-ruby-table {
    display: inline-table !important;
    margin: 0 0.3em 0.1em;
}

/* When ruby is displayed in the graph area, enlarge the table and text so the
   glyphs are readable and match `.card-graph` sizing. This keeps ruby visually
   substituted into the same space as the written graph. */
.card-graph .inline-ruby-table,
.card-graph .inline-ruby-table td {
    display: inline-table !important;
    margin: 0 0.45em 0.12em !important;
}
.card-graph .inline-ruby-table td { font-size: 1.08em !important; padding: 0 0.18em !important; }
.card-graph .inline-ruby-table tr:nth-child(2) td,
.card-graph .inline-ruby-table td .base-text { font-size: 1.22em !important; font-weight: 600 !important; }


/* Make inline ruby table text larger on flashcards so glyphs are not squished
   and play nicely with the card layout. Use !important to override small
   inline sizing emitted by PHP. */
.flashcard .inline-ruby-table { margin: 0 0.45em 0.12em; display: inline-table !important; }
.flashcard .inline-ruby-table td { font-size: 0.95em !important; padding: 0 0.18em !important; vertical-align: middle !important; }
.flashcard .inline-ruby-table tr:nth-child(2) td { font-size: 1.12em !important; font-weight: 600 !important; }
.flashcard .inline-ruby-table td .base-text { font-size: 1.12em !important; }
.flashcard .inline-ruby-table td[style*="font-size"] { /* ensure PHP inline small sizes are overridden */ font-size: 0.95em !important; }


/* Responsive heatmap styles ------------------------------------------------- */
/* Wrap the heatmap table so we can control scaling and overflow */
.heatmap-wrap {
    max-width: 100%;
    overflow: hidden;
    text-align: center; /* keep table centered */
}

/* Default: keep the existing sizing on desktop */
.heatmap-table {
    border-collapse: separate;
    border-spacing: 3px;
    margin: 0 auto;
    font-size: 1.35em; /* matches previous inline style */
    display: inline-table;
    max-width: 100%;
    table-layout: fixed; /* allow columns to shrink to fit */
}

/* Make the heatmap shrink on smaller screens instead of overflowing */
@media (max-width: 768px) {
    .heatmap-table {
        /* reduce base font size to make the whole grid smaller */
        font-size: 0.95em !important;
        width: 100% !important;
    }

    /* If still tight, further reduce slightly on very small screens */
}

@media (max-width: 420px) {
    .heatmap-table {
        font-size: 0.8em !important;
        width: 100% !important;
    }
}

/* Type row stays inline on mobile, unlike other checkbox-rows */
.type-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 4px;
}

.type-row .checkbox-label {
    margin-right: 8px;
    margin-bottom: 0;
}

.type-row #type-section {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
}

@media (max-width: 768px) {
    .checkbox-row {
        /* Keep same as desktop - horizontal flex */
        flex-direction: row;
        margin-bottom: 6px;
    }
    
    /* Type row stays inline even on mobile - force single line */
    .type-row {
        flex-direction: row !important;
        align-items: center;
        margin-bottom: 4px;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 4px;
    }
    
    .type-row .checkbox-label {
        width: auto;
        margin-right: 4px;
        margin-bottom: 0;
        padding: 0;
        flex-shrink: 0;
        font-size: 0.85em;
    }
    
    .type-row #type-section {
        flex-wrap: nowrap !important;
        gap: 1px;
    }
    
    .type-row .search-type-table {
        font-size: 0.8em;
    }
    
    .type-row .search-type-table td {
        padding: 2px 3px;
    }
}

.checkbox-label {
    width: 80px;
    text-align: left;
    margin-right: 15px;
    font-size: 0.95em;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .checkbox-label {
        width: auto;
        margin-right: 8px;
        margin-bottom: 0;
        padding: 0;
        font-size: 0.8em;
    }
}

.column-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

@media (max-width: 768px) {
    .column-checkboxes {
        gap: 6px 8px;
        padding: 0 8px;
    }
}

.column-checkboxes-wrapper {
    margin-right: 200px;
}

@media (max-width: 768px) {
    .column-checkboxes-wrapper {
        margin-right: 0;
        width: 100%;
    }
}

.column-checkbox {
    display: flex;
    align-items: center;
    margin: 0;
    /* Touch target improvements */
    min-height: 44px;
    padding: 4px 2px;
}

.checkbox-buttons {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .checkbox-buttons {
        position: static;
        margin: 0 8px 8px 8px;
        flex-wrap: wrap;
    }
}

.checkbox-buttons button {
    padding: 4px 8px;
    font-size: 0.85em;
    min-width: 50px;
    /* Touch target minimum size */
    min-height: 44px;
}

@media (max-width: 768px) {
    .checkbox-buttons button {
        padding: 4px 6px;
        font-size: 0.8em;
        min-width: auto;
    }
}

.checkbox-group {
    margin-bottom: 10px;
}

.checkbox-group label {
    display: block;
    margin-right: 15px;
}

.column-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    margin-top: 0;
    cursor: pointer;
    position: relative;
}

.column-checkbox label {
    font-size: 0.88em;
    white-space: nowrap;
    line-height: 1.2;
    cursor: pointer;
    /* Larger touch target */
    padding: 8px 4px;
    margin: -8px -4px;
}

@media (max-width: 768px) {
    .column-checkbox label {
        font-size: 0.85em;
    }
}

.search-type-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

@media (max-width: 768px) {
    .search-type-options {
        gap: 6px;
        padding: 0 8px;
    }
}

.search-type-options label {
    display: flex;
    align-items: center;
    font-size: 0.88em;
    line-height: 1.2;
    cursor: pointer;
}

.search-type-options input[type="radio"] {
    margin-right: 4px;
}

.tooltip-info {
    font-size: 0.5em;
    text-align: left;
    display: block;
}

.written-header {
    text-align: left;
    display: block;
}

.heading-subtitle {
    font-size: 14px;
    color: #727272 !important;
}

#results-container .inline-ruby-table {
    border: none;
    margin-right: 0.8em;
    margin-bottom: 0.1em;
    text-align: center;
    display: inline-block;
    font-size: 1.2em; /* 20% larger for better readability */
}

#results-container .inline-ruby-table td {
    border: none;
    padding: 0;
    text-align: center;
}

.category-links {
    display: block;
    line-height: 1.6;
    margin: 6px 0 10px 0;
    text-align: center;
    width: 100%;
    padding: 0 6px; /* breathing room from edges */
}

#categories-section {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    gap: 6px;
    width: 100%;
    align-content: flex-start;
    align-items: center;
}

#categories-section.expanded {
    row-gap: 6px;
    justify-content: center;
}

#categories-section .category-item {
    flex: 0 1 auto;
    white-space: nowrap;
}

#categories-section .category-expand {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    /* Never let expand be alone on a line - it flows with items */
}

@media (max-width: 768px) {
    #categories-section {
        justify-content: flex-start;
        gap: 4px 6px;
        flex-wrap: nowrap;
        overflow: visible;
        width: 100%;
    }
    
    #categories-section .category-item {
        font-size: 0.8em;
        padding: 2px 4px;
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* Show expand toggle - always visible at end */
    #categories-section .category-expand {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* When expanded, wrap to show all */
    #categories-section.expanded {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .category-links {
        padding: 0 8px;
    }
}

.category-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
    justify-content: center;
    gap: 4px;
}

@media (max-width: 768px) {
    .category-section {
        justify-content: flex-start;
        gap: 4px;
        flex-wrap: wrap;
        overflow: visible;
        padding-bottom: 4px;
    }
    
    .category-section::-webkit-scrollbar {
        height: 3px;
    }
    
    .category-section::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .category-section::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 3px;
    }
}

.category-section b {
    color: #66aaff;
}

.category-section a {
    margin-right: 8px;
    color: #77ffbb;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .category-section a {
        margin-right: 0;
        padding: 2px 3px;
        font-size: 0.75em;
    }
}

.category-section a:hover {
    color: #aaffdd;
    background-color: rgba(119, 255, 187, 0.15);
    text-shadow: 0 0 6px rgba(170, 255, 221, 0.5);
}

.recent-additions-link.disabled {
    text-decoration: line-through;
    opacity: 0.65;
}

.recent-additions-link.disabled:hover {
    background-color: transparent;
    color: #77ffbb;
}

.category-section a:visited {
    color: #55dd99;
}

.category-section a:visited:hover {
    color: #88ffcc;
}

.category-section.collapsed .category-item {
    transition: all 0.4s ease;
}

.category-section.collapsed .category-item:nth-child(2) {
    opacity: 1;
    filter: brightness(1);
}

.category-section.collapsed .category-item:nth-child(3) {
    opacity: 0.95;
    filter: brightness(0.9);
}

.category-section.collapsed .category-item:nth-child(4) {
    opacity: 0.85;
    filter: brightness(0.75);
}

.category-section.collapsed .category-item:nth-child(5) {
    opacity: 0.7;
    filter: brightness(0.6);
}

.category-section.collapsed .category-item:nth-child(n+6) {
    display: none;
}

.category-expand {
    cursor: pointer;
    color: #66aaff;
    font-weight: bold;
    margin-left: 8px;
    user-select: none;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-size: 0.9em;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .category-expand {
        margin-left: 0;
        padding: 2px 3px;
        font-size: 0.7em;
    }
}

.category-expand:hover {
    color: #88ccff;
    background-color: rgba(102, 170, 255, 0.15);
    text-shadow: 0 0 4px rgba(136, 204, 255, 0.4);
}

h1 {
    text-align: center;
}

form {
    text-align: center;
}

@media (max-width: 768px) {
    form {
        text-align: left;
        padding: 8px;
    }
}

#search-form input[type="text"],
#search-form input[type="number"] {
    box-sizing: border-box;
}

@media (max-width: 768px) {
    #search-form input[type="text"] {
        width: 100%;
        margin-bottom: 8px;
    }
    
    #search-form button[type="submit"] {
        width: 100%;
    }
}

#exp-results-container.no-results {
    height: auto !important;
    min-height: 26px !important;
    padding: 5px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
}

#update-status {
    font-size: 14px !important;
    line-height: 1.5;
    margin-top: 5px;
    display: none;
}

@media (max-width: 768px) {
    #update-status {
        font-size: 12px !important;
        padding: 0 8px;
    }
}

#update-status a {
    text-decoration: underline;
}

#update-status.update-available {
    color: #cdcd76;
}

#update-status.update-available a {
    color: #e6e600;
}

#update-status.update-success {
    color: #aaecaa;
}

#update-status.update-success a {
    color: #d1ca6b;
}

#update-status.update-error {
    color: #ff0000;
}

#update-status.update-error a {
    color: #e0e0e0;
}

#update-status.update-working {
    color: #e0e0e0;
}

#update-status.update-working a {
    color: #e0e0e0;
}

.ellipsis-animation::after {
    content: '';
    animation: ellipsis 3s infinite;
    display: inline-block;
    width: 1.5em;
}

@keyframes ellipsis {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

h1 img {
    max-width: 320px;
    height: auto;
}

@media (max-width: 768px) {
    h1 img {
        max-width: 240px;
    }
}

.section-toggle {
    cursor: pointer;
    color: #66aaff;
    font-weight: normal;
    font-size: 0.85em;
    margin-left: 6px;
    user-select: none;
    padding: 1px 4px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.section-toggle:hover {
    color: #88ccff;
    background-color: rgba(102, 170, 255, 0.15);
}

.collapsible-section {
    transition: all 0.3s ease;
    overflow: hidden;
}

.collapsible-section.collapsed {
    display: none;
}

#exp-results-container.no-results p {
    margin: 0;
}

.search-count {
    color: #00b300;
    font-weight: bold;
    font-size: 0.85em;
    vertical-align: middle;
    display: inline-block;
    min-width: 35px;
    text-align: left;
    background-color: rgba(0, 179, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(0, 179, 0, 0.3);
}

@media (max-width: 768px) {
    .search-count {
        font-size: 0.75em;
        min-width: 30px;
    }
}

.search-count-container {
    display: inline-block;
    min-width: 35px;
    margin-right: 3px;
}

.search-count-placeholder {
    display: inline-block;
    min-width: 35px;
}

.search-type-option {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    min-width: 140px;
}

@media (max-width: 768px) {
    .search-type-option {
        margin-right: 8px;
        min-width: 110px;
    }
}

.search-type-label {
    font-size: 0.92em;
    vertical-align: middle;
}

.negative-count.search-count {
    color: #a94442 !important;
}

.search-type-cell {
    background-color: transparent !important;
}

.tablesorter th {
    background-color: #2e2e2e;
    color: #e0e0e0;
    padding: 8px;
    cursor: pointer;
}

.tablesorter th:hover {
    background-color: #3a3a3a;
}

.tablesorter .headerSortUp,
.tablesorter .headerSortDown {
    background-color: #444;
}

.date-suffix {
    color: #6c6c6c !important;
    font-weight: 400 !important;
    font-size: 0.95em !important;
    font-family: inherit;
    opacity: 0.85;
    vertical-align: middle;
}

.positive-count {
    color: #00b300;
}

.negative-count {
    color: #a94442;
}

.positive-button {
    background-color: #2f5a2f !important;
}

.negative-button {
    background-color: #2f1616 !important;
}

button {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
}

.results-table td {
    position: relative;
}

.copy-link {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 0.65em;
    color: #555;
    cursor: pointer;
    background: rgba(0,0,0,0.05);
    padding: 1px 3px;
    border-radius: 2px;
    z-index: 10;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.results-table td:hover .copy-link {
    opacity: 1;
}

.copy-link:hover {
    color: #888;
    background: rgba(0,0,0,0.15);
}

.double-text-container {
    position: relative;
    display: inline-block;
    width: 100%;
    padding-bottom: 12px;
}

.double-text-copy-link {
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 0.72em;
    color: #666;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    z-index: 10;
    opacity: 0.6;
    transition: all 0.2s ease;
    line-height: 1;
}

.double-text-container:hover .double-text-copy-link {
    opacity: 1;
    color: #999;
}

.double-text-copy-link:hover {
    color: #bbb;
    background: rgba(0,0,0,0.2);
}

/* Uses column [more]/[less] toggle links */
.uses-toggle {
    color: #6b9ac4;
    font-size: 0.9em;
    text-decoration: none;
    margin-left: 4px;
}

.uses-toggle:hover {
    color: #8ac6de;
    text-decoration: underline;
}

/* Uses truncation: desktop vs mobile visibility */
.uses-mobile-only {
    display: none;
}
.uses-desktop-only {
    display: inline;
}

@media (max-width: 768px) {
    .uses-mobile-only {
        display: inline;
    }
    .uses-desktop-only {
        display: none;
    }
}

.tablesorter-default td {
    background-color: #070707 !important;
}

/* ===== MOBILE SEARCH SETTINGS COLLAPSIBLE ===== */

.mobile-search-toggle {
    display: none;
    width: 100%;
    padding: 10px 8px;
    background-color: #2e2e2e;
    border: 1px solid #444;
    color: #66aaff;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
}

.mobile-search-toggle:hover {
    background-color: #3a3a3a;
}

.mobile-search-toggle::before {
    content: '▼ ';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.3s ease;
}

.mobile-search-toggle.collapsed::before {
    transform: rotate(-90deg);
}

@media (max-width: 768px) {
    .mobile-search-toggle {
        display: block;
    }
    
    #search-settings-container {
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    #search-settings-container.mobile-collapsed {
        max-height: 0;
    }
}

/* Category items expand/collapse on mobile */
@media (max-width: 768px) {
    .category-expand {
        margin: 0;
    }
    
    .category-section.collapsed a:nth-child(n+6) {
        display: none;
    }
}

/* Search form responsive */
@media (max-width: 768px) {
    #restore-interface-link {
        display: block !important;
        margin-bottom: 8px;
    }
    
    #keyword {
        width: calc(100% - 24px) !important;
        max-width: 100%;
    }
    
    #search-button {
        width: calc(100% - 16px) !important;
        margin-left: 0 !important;
        margin-top: 8px;
    }
    
    #search-form > br {
        display: none;
    }
}

/* Global page header responsive */
@media (max-width: 768px) {
    #page-header {
        padding: 8px;
    }
    
    #global-toggle-links {
        padding: 8px;
        font-size: 0.9em;
    }
}

/* Glossary-only mode mobile adjustments */
body.glossary-only-mode #search-settings-container {
    display: none !important;
}

/* Results container mobile padding */
@media (max-width: 768px) {
    #results-container,
    #exp-results-container {
        padding: 8px;
        margin-bottom: 12px;
    }
    
    #results-container h2,
    #exp-results-container h2 {
        font-size: 1.1em;
        margin: 8px 0;
    }
}


.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted #666;
    padding: 2px 4px;
    cursor: pointer;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #2c2f33;
    color: #ddd;
    text-align: left;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    top: 50%;
    left: 120%;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 0.85em;
    line-height: 1.5;
    white-space: nowrap; /* Prevent line breaks */
    max-width: 800px; /* Increased for longer tooltips */
    min-width: 200px; /* Ensure readability */
    word-wrap: break-word;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    transform: translateY(-50%) translateX(10px);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: transparent #2c2f33 transparent transparent;
    border-right-color: #444;
}

.tooltip:hover .tooltiptext,
.tooltip.active .tooltiptext {
    visibility: visible;
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.tooltip .tooltiptext strong {
    color: #00b0ff;
}

.tooltip .tooltiptext b {
    color: #00b0ff; /* Match <strong> for consistency */
}

.tooltip .tooltiptext a {
    color: #ff8c00;
}

.tooltip .tooltiptext a:hover {
    text-decoration: underline;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    position: static;
    z-index: auto;
}

#results-container {
    border: 1px solid #444;
    padding: 10px;
    overflow-x: auto;
    overflow: visible;
    max-width: 100%;
    margin-bottom: 20px;
    background-color: rgb(11, 11, 11);
    z-index: auto;
}

#exp-results-container {
    border: 1px solid #444;
    padding: 10px;
    overflow-x: auto;
    overflow: visible;
    max-width: 100%;
    margin-bottom: 20px;
    background-color: rgb(11, 11, 11);
    z-index: auto;
}

.results-table th,
.results-table td {
    border: 1px solid #444;
    padding: 8px;
    text-align: left;
    word-break: break-word;
    white-space: normal;
}

.results-table th {
    font-weight: bold;
    background-color: #3e3e3e;
    white-space: nowrap;
    color: #e0e0e0;
}

.base-text {
    font-family: var(--yzwr-font);
    font-size: 1.6em;
    color: #e0e0e0;
}

#exp-results-container .custom-font-column .base-text {
    font-size: 0.8em;
}

#results-container .custom-font-column {
    text-align: center;
}

.results-table .logo-column .base-text {
    font-size: 4em;
}

/* Match subsearch/unfound-results logogram sizes to main search */
.unfound-results-container .results-table .logo-column .base-text {
    font-size: 4em;
}

.checkbox-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    min-height: 24px;
    position: relative;
}

.checkbox-label {
    width: 80px;
    text-align: left;
    margin-right: 15px;
    font-size: 0.95em;
    line-height: 1.3;
}

.column-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.column-checkboxes-wrapper {
    margin-right: 200px;
}

.column-checkbox {
    display: flex;
    align-items: center;
    margin: 0;
}

.checkbox-buttons {
    position: absolute;
    right: 0;
    top: 0;
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.checkbox-buttons button {
    padding: 4px 8px;
    font-size: 0.85em;
    min-width: 50px;
}

.checkbox-group {
    margin-bottom: 10px;
}

.checkbox-group label {
    display: block;
    margin-right: 15px;
}

/* Duplicate definition overrides for consistency */
.column-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    margin-top: 0;
    cursor: pointer;
}

.column-checkbox label {
    font-size: 0.88em;
    white-space: nowrap;
    line-height: 1.2;
    cursor: pointer;
    padding: 8px 4px;
    margin: -8px -4px;
}

.search-type-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

.search-type-options label {
    display: flex;
    align-items: center;
    font-size: 0.88em;
    line-height: 1.2;
    cursor: pointer;
}

.search-type-options input[type="radio"] {
    margin-right: 4px;
}

.tooltip-info {
    font-size: 0.5em;
    text-align: left;
    display: block;
}

.written-header {
    text-align: left;
    display: block;
}

.heading-subtitle {
    font-size: 0.25em;
    display: block;
    line-height: 1;
}

#results-container .inline-ruby-table {
    border: none;
    margin-right: 0.8em;
    margin-bottom: 0.1em;
    text-align: center;
    display: inline-block;
    font-size: 1.2em; /* 20% larger for better readability */
}

#results-container .inline-ruby-table td {
    border: none;
    padding: 0;
    text-align: center;
}

.category-links {
    display: block;
    line-height: 1.6;
    margin-bottom: 6px; /* reduced to tighten overall category block spacing */
    text-align: center;
    width: 100%;
}

.category-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px; /* tightened spacing between the two category sections */
    justify-content: center;
    gap: 6px;
    padding: 4px 4px; /* small internal padding so content doesn't touch edges */
}

.category-section b {
    color: #66aaff;
    font-weight: 600;
    margin-right: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.category-section a {
    margin-right: 8px;
    color: #77ffbb;
    text-decoration: none;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.3s ease;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}

.category-section a:hover {
    color: #aaffdd;
    background-color: rgba(119, 255, 187, 0.15);
    text-shadow: 0 0 6px rgba(170, 255, 221, 0.5);
}

.category-section a:visited {
    color: #55dd99;
}

.category-section a:visited:hover {
    color: #88ffcc;
}

.category-section.collapsed .category-item {
    transition: all 0.4s ease;
}

.category-section.collapsed .category-item:nth-child(2) {
    opacity: 1;
    filter: brightness(1);
}

.category-section.collapsed .category-item:nth-child(3) {
    opacity: 0.95;
    filter: brightness(0.9);
}

.category-section.collapsed .category-item:nth-child(4) {
    opacity: 0.85;
    filter: brightness(0.75);
}

.category-section.collapsed .category-item:nth-child(5) {
    opacity: 0.7;
    filter: brightness(0.6);
}

.category-section.collapsed .category-item:nth-child(n+6) {
    display: none;
}

.category-expand {
    cursor: pointer;
    color: #66aaff;
    font-weight: bold;
    margin-left: 8px;
    user-select: none;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s ease;
    font-size: 0.9em;
    flex-shrink: 0;
    white-space: nowrap;
}

.category-expand:hover {
    color: #88ccff;
    background-color: rgba(102, 170, 255, 0.15);
    text-shadow: 0 0 4px rgba(136, 204, 255, 0.4);
}

h1 {
    text-align: center;
}

form {
    text-align: center;
}

#exp-results-container.no-results {
    height: auto !important;
    min-height: 26px !important;
    padding: 5px 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
}



#update-status {
    font-size: 14px !important;
    line-height: 1.5;
    margin-top: 5px;
    display: none;
}

#update-status a {
    text-decoration: underline;
}

#update-status.update-available {
    color: #cdcd76;
}

#update-status.update-available a {
    color: #e6e600;
}

#update-status.update-success {
    color: #aaecaa;
}

#update-status.update-success a {
    color: #d1ca6b;
}

#update-status.update-error {
    color: #ff0000;
}

#update-status.update-error a {
    color: #e0e0e0;
}

#update-status.update-working {
    color: #e0e0e0;
}

#update-status.update-working a {
    color: #e0e0e0;
}

.ellipsis-animation::after {
    content: '';
    animation: ellipsis 3s infinite;
    display: inline-block;
    width: 1.5em;
}

@keyframes ellipsis {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
    100% { content: '.'; }
}

h1 img {
    max-width: 320px;
    height: auto;
}

.section-toggle {
    cursor: pointer;
    color: #66aaff;
    font-weight: normal;
    font-size: 0.85em;
    margin-left: 6px;
    user-select: none;
    padding: 1px 4px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.section-toggle:hover {
    color: #88ccff;
    background-color: rgba(102, 170, 255, 0.15);
}

.collapsible-section {
    transition: all 0.3s ease;
    overflow: hidden;
}

.collapsible-section.collapsed {
    display: none;
}

#exp-results-container.no-results p {
    margin: 0;
}

.heading-subtitle {
    font-size: 14px;
    color: #727272 !important;
}

.search-count {
    color: #00b300;
    font-weight: bold;
    font-size: 0.85em;
    vertical-align: middle;
    display: inline-block;
    min-width: 35px;
    text-align: left;
    background-color: rgba(0, 179, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(0, 179, 0, 0.3);
}

.search-count-container {
    display: inline-block;
    min-width: 35px;
    margin-right: 3px;
}

.search-count-placeholder {
    display: inline-block;
    min-width: 35px;
}

.search-type-option {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    min-width: 140px;
}

.search-type-label {
    font-size: 0.92em;
    vertical-align: middle;
}

.negative-count.search-count {
    color: #a94442 !important;
}

.search-type-cell {
    background-color: transparent !important;
}

.tablesorter th {
    background-color: #2e2e2e;
    color: #e0e0e0;
    padding: 8px;
    cursor: pointer;
}

.tablesorter th:hover {
    background-color: #3a3a3a;
}

.tablesorter .headerSortUp,
.tablesorter .headerSortDown {
    background-color: #444;
}

.date-suffix {
    color: #6c6c6c !important;
    font-weight: 400 !important;
    font-size: 0.95em !important;
    font-family: inherit;
    opacity: 0.85;
    vertical-align: middle;
}

.positive-count {
    color: #00b300;
}

.negative-count {
    color: #a94442;
}

.positive-button {
    background-color: #2f5a2f !important;
}

.negative-button {
    background-color: #2f1616 !important;
}

button {
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
}

.results-table td {
    position: relative;
}

.copy-link {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 0.65em;
    color: #555;
    cursor: pointer;
    background: rgba(0,0,0,0.05);
    padding: 1px 3px;
    border-radius: 2px;
    z-index: 10;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.results-table td:hover .copy-link {
    opacity: 1;
}

.copy-link:hover {

    color: #888;

    background: rgba(0,0,0,0.15);

}

.double-text-container {
    position: relative;
    display: inline-block;
    width: 100%;
    padding-bottom: 12px;
}

.double-text-copy-link {
    position: absolute;
    bottom: 0;
    right: 0;
    font-size: 0.72em;
    color: #666;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    z-index: 10;
    opacity: 0.6;
    transition: all 0.2s ease;
    line-height: 1;
}

.double-text-copy-link:hover {
    opacity: 1;
    color: #bbb;
    background: rgba(0,0,0,0.2);
}

.tablesorter-default td {
    background-color: #070707 !important;
}

/* ===== MOBILE SEARCH SETTINGS COLLAPSIBLE ===== */

.mobile-search-toggle {
    display: none;
    width: 100%;
    padding: 10px 8px;
    background-color: #2e2e2e;
    border: 1px solid #444;
    color: #66aaff;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 8px;
    text-align: left;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
}

.mobile-search-toggle:hover {
    background-color: #3a3a3a;
}

.mobile-search-toggle::before {
    content: "▼ ";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.3s ease;
}

.mobile-search-toggle.collapsed::before {
    transform: rotate(-90deg);
}

@media (max-width: 768px) {
    .mobile-search-toggle {
        display: block;
    }
    
    #search-settings-container {
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    #search-settings-container.mobile-collapsed {
        max-height: 0;
    }
}

/* Search terms container - responsive layout
   Default: single-line flex with fixed button width and flexible input
   Mobile: keep single-line but make input larger; prevent wrapping */
#search-terms-container {
    display: flex !important;
    gap: 8px;
    align-items: center;
    width: 100%;
    flex-wrap: nowrap !important;
}

#search-terms-container > span {
    flex: 0 0 auto;
    margin: 0;
}

/* input: flexible but constrained so it doesn't shrink too small */
#search-terms-container > input {
    box-sizing: border-box;
    flex: 1 1 auto !important;
    min-width: 60px !important;
    max-width: 9999px;
    width: auto !important; /* override any inline width */
}

/* button: fixed width to avoid resizing weirdness */
#search-terms-container > button {
    flex: 0 0 92px !important;
    width: 92px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 36px !important;
    padding: 0 12px !important;
    vertical-align: middle;
}

/* Make the "Terms:" label slightly larger and vertically centered */
#search-terms-container > span {
    font-size: 1.05em;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* On very small screens, keep everything on one line but allow input to take more space */
@media (max-width: 420px) {
    #search-terms-container > button {
        flex: 0 0 78px;
        width: 78px;
        padding: 6px 10px;
        font-size: 12px;
    }

    #search-terms-container > input {
        min-width: 80px;
    }
}

/* Collapsible settings container */
.collapsible-settings {
    /* Desktop: subtle, non-boxy appearance by default */
    background-color: transparent; /* no large grey box on desktop */
    padding: 0;
    border-radius: 0;
    max-height: none;
    overflow: visible;
    transition: none;
}

.collapsible-settings.mobile-collapsed {
    /* Only applies on mobile */
    max-height: 0;
    overflow: hidden;
}

/* Search form responsive */
@media (max-width: 768px) {
    .collapsible-settings {
        /* Small dark panel on mobile to distinguish from page background */
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.3s ease;
        background-color: #0f0f0f; /* subtly darker */
        padding: 8px;
        border-radius: 6px;
        margin-top: 4px;
    }
    
    .collapsible-settings .checkbox-row {
        margin-bottom: 4px;
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: wrap;
    }
    
    .collapsible-settings .checkbox-label {
        width: auto;
        margin-right: 6px;
        margin-bottom: 0;
        padding: 0;
        font-size: 0.9em;
    }
    
    .collapsible-settings .checkbox-buttons {
        flex-wrap: nowrap;
        gap: 3px;
        margin: 0;
        position: static;
    }
    
    .collapsible-settings .checkbox-buttons button {
        padding: 3px 6px;
        font-size: 0.8em;
        white-space: nowrap;
    }
    
    .collapsible-settings .column-checkboxes {
        display: flex;
        flex-wrap: wrap;
        gap: 3px 6px;
        padding: 0;
        width: 100%;
        margin-top: 4px;
    }
    
    .collapsible-settings .column-checkbox {
        font-size: 0.85em;
    }
    
    .collapsible-settings .column-checkbox input[type="checkbox"] {
        margin-right: 3px;
    }
    
    .collapsible-settings .column-checkbox label {
        margin-bottom: 0;
    }

    .collapsible-settings.mobile-collapsed {
        max-height: 0;
        overflow: hidden;
    }

    #search-form > div[style*="display: flex"] {
        flex-wrap: wrap;
    }
    
    #keyword {
        flex: 1 !important;
        min-width: 200px;
    }
    
    #search-button {
        flex-shrink: 0;
    }
    
    #search-form > br {
        display: none;
    }
    
    #mobile-search-toggle {
        display: block;
        margin-top: 8px;
        margin-bottom: 8px !important;
    }
    
    /* On mobile, collapse settings by default */
    .collapsible-settings {
        max-height: 2000px;
        transition: max-height 0.3s ease;
    }
    
    .collapsible-settings.mobile-collapsed {
        max-height: 0;
        overflow: hidden;
    }
}

/* Global page header responsive */
@media (max-width: 768px) {
    #page-header {
        padding: 8px;
    }
}

/* Top bar styling */
body > div:first-of-type {
    font-size: 0.9em;
}

@media (max-width: 768px) {
    body > div:first-of-type {
        flex-direction: column;
        gap: 4px;
    }
    
    body > div:first-of-type a {
        font-size: 0.85em;
    }
}

/* Glossary-only mode mobile adjustments */
body.glossary-only-mode #search-settings-container {
    display: none !important;
}

/* Results container mobile padding */
@media (max-width: 768px) {
    #results-container,
    #exp-results-container {
        padding: 8px;
        margin-bottom: 12px;
    }
    
    #results-container h2,
    #exp-results-container h2 {
        font-size: 1.1em;
        margin: 8px 0;
    }
}

/* ===== IPA VOICE PLAY BUTTON ===== */
.ipa-cell-container {
    position: relative;
    display: inline-block;
    width: 100%;
    padding-bottom: 14px;
}

.ipa-copy-link,
.ipa-play-link {
    position: absolute;
    font-size: 0.72em;
    text-decoration: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 2px;
    z-index: 10;
    opacity: 0.6;
    transition: all 0.2s ease;
    line-height: 1;
    user-select: none;
    color: #666;
}

.ipa-copy-link {
    bottom: 0;
    right: 0;
}

.ipa-play-link {
    top: 0;
    right: 0;
}

.ipa-copy-link:hover,
.ipa-play-link:hover {
    opacity: 1;
    color: #bbb;
    background: rgba(0,0,0,0.2);
}

.ipa-play-link.playing {
    color: #77ffbb;
    opacity: 1;
}

@media (max-width: 768px) {
    .ipa-copy-link,
    .ipa-play-link {
        opacity: 0.6;
        font-size: 0.8em;
        padding: 3px 5px;
    }
}

/* ===== IPA VOICE OPTIONS PANEL ===== */
.ipa-voice-options {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1318 100%);
    border: 1px solid #3a4556;
    border-radius: 8px;
    margin: 20px auto;
    max-width: 600px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ipa-voice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(106, 159, 181, 0.1);
    border-bottom: 1px solid #3a4556;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.ipa-voice-header:hover {
    background: rgba(106, 159, 181, 0.15);
}

.ipa-voice-header h2,
.ipa-voice-header .ipa-voice-title {
    margin: 0;
    color: #8ac6de;
    font-size: 0.95em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ipa-voice-header h2::before,
.ipa-voice-header .ipa-voice-title::before {
    content: '🔊';
    font-size: 1.1em;
}

.ipa-voice-toggle {
    color: #6a9fb5;
    font-size: 0.8em;
    transition: transform 0.3s;
}

.ipa-voice-options.collapsed .ipa-voice-toggle {
    transform: rotate(-90deg);
}

.ipa-voice-content {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 500px;
    opacity: 1;
}

.ipa-voice-options.collapsed .ipa-voice-content {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
    overflow: hidden;
}

.ipa-voice-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ipa-voice-control label {
    color: #99aab5;
    font-size: 0.8em;
    font-weight: 500;
}

.ipa-voice-control input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #2a3444;
    border-radius: 3px;
    outline: none;
}

.ipa-voice-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #6a9fb5;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.ipa-voice-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #8ac6de;
}

.ipa-voice-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #6a9fb5;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.ipa-voice-control select {
    background: #2a3444;
    color: #e0e0e0;
    border: 1px solid #3a4556;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.85em;
    outline: none;
    cursor: pointer;
}

.ipa-voice-control select:focus {
    border-color: #6a9fb5;
}

.ipa-voice-control .value-display {
    color: #6a9fb5;
    font-size: 0.75em;
    text-align: right;
    min-width: 35px;
}

.ipa-voice-control .control-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ipa-voice-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px solid #2a3444;
    margin-top: 4px;
}

.ipa-voice-actions button {
    background: #2a3444;
    color: #99aab5;
    border: 1px solid #3a4556;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s;
}

.ipa-voice-actions button:hover {
    background: #3a4556;
    color: #e0e0e0;
}

.ipa-voice-actions button.primary {
    background: rgba(106, 159, 181, 0.2);
    border-color: #6a9fb5;
    color: #8ac6de;
}

.ipa-voice-actions button.primary:hover {
    background: rgba(106, 159, 181, 0.3);
}

@media (max-width: 768px) {
    .ipa-voice-options {
        margin: 15px 8px;
        border-radius: 6px;
    }
    
    .ipa-voice-header {
        padding: 10px 12px;
    }
    
    .ipa-voice-header h2,
    .ipa-voice-header .ipa-voice-title {
        font-size: 0.9em;
    }
    
    .ipa-voice-content {
        padding: 12px;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .ipa-voice-actions {
        flex-wrap: wrap;
    }
}

/* ========================================
   Additional Mobile Compactness & Polish
   ======================================== */
@media (max-width: 768px) {
    /* Tighter header */
    #page-header h1 {
        font-size: 1.1em;
        line-height: 1.3;
    }
    
    /* Compact category sections */
    .category-section {
        margin-bottom: 4px;
        gap: 3px 6px;
    }
    
    .category-section b {
        font-size: 0.8em;
        margin-right: 4px;
    }
    
    .category-section a {
        font-size: 0.78em;
        padding: 2px 5px;
    }
    
    /* Compact search form */
    #search-form {
        padding: 6px 10px;
    }
    
    #search-form input[type="text"] {
        height: 32px;
        font-size: 13px;
        padding: 6px 10px;
    }
    
    #search-form button[type="submit"] {
        height: 34px;
        padding: 4px 12px;
        font-size: 13px;
    }
    
    /* Checkbox groups more compact */
    .checkbox-group {
        padding: 6px 8px;
    }
    
    .checkbox-label {
        font-size: 0.85em;
    }
    
    /* Toggle links smaller */
    #global-toggle-links {
        font-size: 0.8em;
        margin-bottom: 6px;
    }
    
    #global-toggle-links a {
        margin: 0 6px;
    }
    
    /* Result tables tighter */
    #results-container table th,
    #results-container table td {
        padding: 4px 6px;
        font-size: 0.85em;
    }
    
    /* Heading subtitle */
    .heading-subtitle {
        font-size: 0.7em;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .category-section a {
        font-size: 0.72em;
        padding: 2px 4px;
    }
    
    .category-expand {
        font-size: 0.65em !important;
        padding: 2px 4px;
    }
    
    #page-header h1 {
        font-size: 1em;
    }
    
    #page-header h1 img {
        max-width: 180px !important;
    }
    
    .type-row .search-type-table {
        font-size: 0.72em;
    }
    
    .type-row .search-type-table td {
        padding: 1px 2px;
    }
}

/* ========================================
   Mobile Search Area - Same layout as desktop, just smaller
   ======================================== */
@media (max-width: 768px) {
    /* Full width, no margin gaps */
    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Search form container */
    #search-form {
        background: transparent;
        border-radius: 0;
        padding: 8px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Search input row - input and button together, never wrap */
    #search-form #keyword {
        width: calc(100% - 75px) !important;
        max-width: calc(100% - 75px) !important;
        display: inline-block;
        vertical-align: middle;
        margin-bottom: 0 !important;
        height: 34px !important;
        flex-shrink: 1;
    }
    
    #search-form #search-button {
        width: 65px !important;
        min-width: 65px !important;
        display: inline-block;
        vertical-align: middle;
        margin-left: 4px !important;
        height: 34px !important;
        padding: 0 8px !important;
        font-size: 12px !important;
        flex-shrink: 0;
    }
    
    /* Remove excessive br tags spacing */
    #search-form > br {
        display: none;
    }
    
    /* Search settings container */
    #search-settings-container {
        margin-top: 8px;
        padding-top: 0;
        border-top: none;
    }
    
    /* Checkbox group styling - minimal */
    #search-settings-container .checkbox-group {
        background: transparent;
        border-radius: 0;
        padding: 4px 0;
        margin-bottom: 0;
    }
    
    /* Each checkbox row - HORIZONTAL like desktop */
    #search-settings-container .checkbox-row {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        flex-wrap: wrap;
        margin-bottom: 6px;
        padding-bottom: 0;
        border-bottom: none;
        position: relative;
    }
    
    /* Row labels - inline */
    #search-settings-container .checkbox-label {
        font-size: 0.8em;
        margin-bottom: 0;
        margin-right: 8px;
        padding: 0;
        color: #88aacc;
        width: auto;
        flex-shrink: 0;
    }
    
    /* Buttons - inline before checkboxes */
    #search-settings-container .checkbox-buttons {
        position: static;
        display: inline-flex;
        gap: 4px;
        margin: 0 8px 4px 0;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    
    #search-settings-container .checkbox-buttons button {
        flex: 0 0 auto;
        padding: 3px 6px;
        font-size: 0.7em;
        border-radius: 3px;
        background: #3a3a45;
        border: 1px solid #555;
        min-width: auto;
    }
    
    /* Checkboxes - FLEX ROW like desktop, flow after buttons */
    #search-settings-container .column-checkboxes {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 4px 10px;
        padding: 0;
        margin-right: 0;
        flex: 1 1 auto;
    }
    
    #search-settings-container .column-checkbox {
        font-size: 0.75em;
        display: flex;
        align-items: center;
    }
    
    #search-settings-container .column-checkbox input[type="checkbox"] {
        width: 12px;
        height: 12px;
        margin-right: 3px;
    }
    
    #search-settings-container .column-checkbox label {
        font-size: inherit;
    }
    
    /* Selection hints */
    #search-settings-container .selection-hint {
        display: none;
    }
    
    /* Type row - keep inline */
    #search-settings-container .type-row {
        flex-direction: row !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px;
        padding-bottom: 0;
        border-bottom: none;
        margin-bottom: 6px;
    }
    
    #search-settings-container .type-row .checkbox-label {
        margin-bottom: 0;
        flex-shrink: 0;
        width: auto;
    }
    
    #search-settings-container .type-row #type-section {
        flex: 1;
        overflow-x: auto;
    }
    
    /* Search type table compact */
    #search-settings-container .search-type-table {
        font-size: 0.7em;
    }
    
    #search-settings-container .search-type-table td {
        padding: 2px 3px;
        white-space: nowrap;
    }
    
    #search-settings-container .search-type-table input[type="radio"] {
        width: 11px;
        height: 11px;
        margin-right: 2px;
    }
}

/* Extra small - same layout, just smaller text */
@media (max-width: 480px) {
    #search-form {
        padding: 6px;
    }
    
    #search-form #keyword {
        width: calc(100% - 60px) !important;
        font-size: 11px !important;
        padding: 5px 6px !important;
        height: 30px !important;
    }
    
    #search-form #search-button {
        width: 52px !important;
        font-size: 10px !important;
        height: 30px !important;
    }
    
    #search-settings-container .column-checkboxes {
        gap: 3px 8px;
        margin-right: 0;
    }
    
    #search-settings-container .column-checkbox {
        font-size: 0.68em;
    }
    
    #search-settings-container .checkbox-buttons button {
        padding: 2px 5px;
        font-size: 0.65em;
    }
    
    #search-settings-container .search-type-table {
        font-size: 0.62em;
    }
    
    #search-settings-container .checkbox-label {
        font-size: 0.72em;
    }
}

/* ========================================
   Mobile Collapsible Search/Display Sections
   (Removed - now always visible)
   ======================================== */

/* Hide expand toggle everywhere - no longer used */
.mobile-expand-toggle {
    display: none;
}
/* Fix for nested table shading in Duplicates view */
.dup-group-row td table td {
    background-color: transparent !important;
}

/* Accessibility: Visually hidden class for labels */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hyphenation for glossary table cells */
.results-table td {
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Duplicates Shading */
.dup-group-even {
    background-color: rgba(255, 255, 255, 0.03);
}
.dup-group-odd {
    background-color: rgba(255, 255, 255, 0.07);
}
/* Forms: enable horizontal scrolling for narrow screens without visible scrollbar */
.forms-container .form-section { position: relative; }
.forms-container .form-section-body {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* momentum scrolling on iOS */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}
.forms-container .form-section-body::-webkit-scrollbar { height: 6px; display: none; }

/* Subtle right-edge gradient hint for overflow (non-interactive) */
.forms-container .form-section::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(to left, rgba(18,18,18,0.7), rgba(18,18,18,0));
  display: block;
}
