.tnx-symbol-picker {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.tnx-symbol-picker-input {
    display: none;
}

.tnx-symbol-picker-trigger {
    width: 6rem !important;
    height: 6rem !important;
    min-width: 6rem !important;
    max-width: 6rem !important;
    min-height: 6rem !important;
    max-height: 6rem !important;
    inline-size: 6rem;
    block-size: 6rem;
    padding: 0;
    margin: 0 !important;
    display: inline-flex;
    flex: 0 0 6rem;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 14px;
    background: var(--input-bg);
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

@media (max-width: 480px) {
    .tnx-symbol-picker-trigger {
        width: 4.5rem !important;
        height: 4.5rem !important;
        min-width: 4.5rem !important;
        max-width: 4.5rem !important;
        min-height: 4.5rem !important;
        max-height: 4.5rem !important;
        inline-size: 4.5rem;
        block-size: 4.5rem;
        flex-basis: 4.5rem;
    }
}

.tnx-symbol-picker-trigger:hover,
.tnx-symbol-picker-trigger:focus-visible,
.tnx-symbol-picker-trigger[aria-expanded="true"] {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
}

.tnx-symbol-picker-trigger:focus,
.tnx-symbol-picker-category:focus-visible,
.tnx-symbol-picker-symbol:focus-visible {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: none;
}

.tnx-symbol-picker-trigger-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3.6rem;
    line-height: 1;
}

/* The symbol waits for its script, but once ready it inherits again instead of forcing itself
   visible: a page holding its editor out of the first paint (tnxRenderInitialEditorState) would
   otherwise show the symbol alone in the empty page before everything else. */
.tnx-symbol-picker:not([data-symbol-picker-ready="true"]) .tnx-symbol-picker-trigger-value {
    visibility: hidden;
}

/* One fixed height, however much the card shows: fewer search results leave the rest of it empty
   and more of them scroll, so the card never grows or shrinks while someone is picking. The
   pickers of ./UI/FieldPickers.js use the same card. */
.tnx-symbol-picker-panel {
    display: flex;
    flex-direction: column;
    width: min(28.8rem, calc(100vw - 2rem));
    max-width: 100%;
    height: min(calc((52px * 7) + (0.5rem * 6) + 9.5rem + 200px), calc(100vh - 2rem));
    border-radius: 16px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    box-sizing: border-box;
    overflow: hidden;
}

.tnx-symbol-picker-panel[hidden] {
    display: none !important;
}

.tnx-symbol-picker-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 0.9rem;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border-radius: inherit;
}

.tnx-symbol-picker-search {
    width: 100%;
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: normal;
}

.tnx-symbol-picker-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(52px, 52px));
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
}

.tnx-symbol-picker-category {
    width: 52px;
    height: 52px;
    min-width: 52px;
    padding: 0;
    margin: 0 !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--border-color);
    box-shadow: none;
    display: inline-flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.tnx-symbol-picker-category:hover,
.tnx-symbol-picker-category:focus-visible {
    opacity: 0.3;
}

.tnx-symbol-picker-category.is-active {
    opacity: 1;
    border-color: var(--primary-color);
}

.tnx-symbol-picker-category.is-active:hover,
.tnx-symbol-picker-category.is-active:focus-visible {
    opacity: 1;
}

.tnx-symbol-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 0.5rem;
}

.tnx-symbol-picker-symbol {
    min-width: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    margin: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    line-height: 1;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    transition: all 0.2s ease;
}

.tnx-symbol-picker-symbol:hover,
.tnx-symbol-picker-symbol:focus-visible {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

.tnx-symbol-picker-symbol.is-active {
    opacity: 1;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.04);
}

/* These controls have neutral backgrounds, so their icon ink follows the theme text. */
html[data-monocolor-symbols="1"] .tnx-symbol-picker-trigger,
html[data-monocolor-symbols="1"] .tnx-symbol-picker-category,
html[data-monocolor-symbols="1"] .tnx-symbol-picker-symbol {
    color: var(--text-color);
}

.tnx-symbol-picker-empty {
    padding: 0.75rem 0.5rem;
    text-align: center;
    opacity: 0.5;
    grid-column: 1 / -1;
}

/* A picker inside a table cell floats its panel right below its box instead of stretching the row.
   The floating card sits in the browser's top layer (./UI/FieldPickers.js), so the browser's own
   box for it (border, padding, canvas colors, centring) is taken away again. */
.tnx-symbol-picker-floating {
    position: fixed;
    z-index: 100002;
    top: 0;
    left: 0;
    margin: 0;
    border: 0;
    padding: 0;
    overflow: visible;
    color: inherit;
    background: transparent;
}

.tnx-symbol-picker-floating::backdrop {
    pointer-events: none;
}

/* While its field is scrolled out of sight the card waits unseen instead of floating elsewhere. */
.tnx-symbol-picker-floating.is-out-of-sight {
    visibility: hidden !important;
}

.tnx-symbol-picker-floating.is-mobile-modal {
    display:flex;
    align-items:center;
    justify-content:center;
    box-sizing:border-box;
    padding:1rem;
    background:rgba(10, 10, 10, 0.45);
    backdrop-filter:blur(8px);
    -webkit-backdrop-filter:blur(8px);
}
.tnx-symbol-picker-floating.is-mobile-modal .tnx-symbol-picker-panel {
    max-height:100%;
    box-shadow:0 30px 60px -20px var(--shadow-color);
}
/* The "(empty)" tile of a symbol field that may stay empty. */
.tnx-symbol-picker-symbol.tnx-symbol-picker-empty-choice {
    font-size: 0.7rem;
    line-height: 1.1;
    opacity: 0.6;
    white-space: normal;
    text-align: center;
}
