:root {
    --theme-bg: #191b1e;
    --theme-panel: #23262a;
    --theme-field: #30343a;
    --theme-text: #f1f2f4;
    --theme-muted: #bcc1c8;
    --theme-border: #59616b;
    --theme-accent: #f08070;
    --theme-on-accent: #191b1e;
    --ucs-panel-border: rgba(148, 163, 184, 0.18);
    --ucs-panel-highlight: rgba(255, 255, 255, 0.04);
    --ucs-panel-shadow-1: 0 12px 30px rgba(0, 0, 0, 0.34);
    --ucs-panel-shadow-2: 0 26px 60px rgba(0, 0, 0, 0.35);
    --ucs-button-press-shadow: 0 5px 16px rgba(0, 0, 0, 0.25);
    --ucs-content-max-2xl: 42rem;
    --ucs-content-max-4xl: 56rem;
    --ucs-root-font-size: 16px;
}

#metadata-spellcheck-dialog {
    width: min(58rem, calc(100% - 2rem));
    max-height: min(85dvh, 58rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    background: var(--theme-panel);
    color: var(--theme-text);
    font-family: inherit;
    font-size: 1rem;
    font-feature-settings: "kern" 1;
    line-height: 1.4;
    box-shadow: 0 20px 65px rgb(0 0 0 / .4);
    overflow: auto;
}

#metadata-spellcheck-dialog::backdrop { background: rgb(0 0 0 / .65); }
.spellcheck-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem 0; }
.spellcheck-header h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.spellcheck-header p { margin: .25rem 0 0; color: var(--theme-muted); }
#spellcheck-close { padding: 0 .5rem; font-size: 1.75rem; line-height: 1; }
.spellcheck-body { padding: 1rem 1.5rem 1.5rem; }
#spellcheck-status { margin: 0 0 1rem; max-width: 65ch; color: var(--theme-muted); }
.spellcheck-preview { padding: 1rem; border: 1px solid var(--theme-border); border-radius: 5px; background: var(--theme-field); white-space: pre-wrap; overflow-wrap: anywhere; }
.spellcheck-word { padding: 0 .05em; border: 0; border-radius: 2px; background: transparent; color: #fda4af; font: inherit; font-weight: 600; text-align: inherit; }
.spellcheck-word:hover { background: rgb(244 63 94 / .15); }
.spellcheck-word-chosen { color: #86efac; background: transparent; }
.spellcheck-issues { display: grid; gap: .6rem; margin-top: 1.25rem; max-height: 38vh; overflow: auto; }
.spellcheck-issues:empty { margin-top: 0; }
.spellcheck-issue { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(10rem, 1.6fr) auto; align-items: start; gap: .75rem; padding: .5rem 0; }
.spellcheck-issue > label { padding-top: .4rem; font-weight: 600; overflow-wrap: anywhere; }
.spellcheck-choice-field { display: grid; gap: .5rem; min-width: 0; }
.spellcheck-choice-field select, .spellcheck-choice-field input { width: 100%; min-width: 0; padding: .45rem .6rem; border: 1px solid var(--theme-border); border-radius: 5px; background: var(--theme-field); color: var(--theme-text); font: inherit; }
#metadata-spellcheck-dialog [hidden] { display: none; }
#metadata-spellcheck-dialog button:disabled, #metadata-spellcheck-dialog select:disabled { opacity: .55; cursor: default; }
.spellcheck-issue > button, #spellcheck-retry, .spellcheck-footer button { padding: .45rem .7rem; border: 1px solid var(--theme-border); border-radius: 5px; font: inherit; }
.spellcheck-issue > button { white-space: nowrap; }
.spellcheck-issue > button[aria-pressed="true"] { color: var(--theme-accent); }
.spellcheck-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-top: 1px solid var(--theme-border); }
.spellcheck-footer p { margin: 0; color: var(--theme-muted); font-size: .9375rem; max-width: 40ch; }
.spellcheck-footer > div { display: flex; gap: .6rem; margin-left: auto; }
#spellcheck-apply { border-color: var(--theme-accent); background: var(--theme-accent); color: var(--theme-on-accent); font-weight: 600; }
#metadata-spellcheck-dialog :focus-visible { outline: 2px solid var(--theme-accent); outline-offset: 3px; }
html[data-theme="light"] .spellcheck-word:not(.spellcheck-word-chosen) { color: #be123c; }
html[data-theme="light"] .spellcheck-word-chosen { color: #166534; }

@media (max-width: 600px) {
    .spellcheck-header { padding: 1rem 1rem 0; }
    .spellcheck-body { padding: 1rem; }
    .spellcheck-issue { grid-template-columns: minmax(0, 1fr) auto; }
    .spellcheck-issue > label { grid-column: 1 / -1; padding-top: 0; }
    .spellcheck-footer { padding: 1rem; }
    .spellcheck-footer > div { width: 100%; justify-content: flex-end; }
}

html[data-theme="teal"] {
    --theme-bg: #25282a; --theme-panel: #303537; --theme-field: #3b4245;
    --theme-text: #f1f5f4; --theme-muted: #c3cecb; --theme-border: #687a75;
    --theme-accent: #56c9b5; --theme-on-accent: #102923;
}
html[data-theme="contrast"] {
    --theme-bg: #050505; --theme-panel: #101010; --theme-field: #191919;
    --theme-text: #ffffff; --theme-muted: #e0e0e0; --theme-border: #b5b5b5;
    --theme-accent: #ffe16b; --theme-on-accent: #050505;
}
html[data-theme="light"] {
    color-scheme: light;
    --theme-bg: #f4f5f6; --theme-panel: #ffffff; --theme-field: #e8ecef;
    --theme-text: #202428; --theme-muted: #505b65; --theme-border: #89949e;
    --theme-accent: #186b61; --theme-on-accent: #ffffff;
}
html[data-theme]:not([data-theme="light"]) { color-scheme: dark; }

.theme-selector { margin: 0 0 20px; padding: 12px; border: 1px solid var(--theme-border); }
.theme-selector legend { padding: 0 6px; font-weight: 700; }
.theme-selector label { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.theme-swatches { display: inline-flex; flex-shrink: 0; gap: 3px; }
.theme-swatches i { width: 18px; height: 18px; border: 1px solid var(--theme-border); border-radius: 50%; }

body {
    position: relative;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
    background-color: #070b12;
    background-image:
        radial-gradient(1200px 700px at 12% -8%, rgba(185, 28, 28, 0.23), transparent 62%),
        radial-gradient(900px 620px at 88% 0%, rgba(37, 99, 235, 0.18), transparent 58%),
        linear-gradient(180deg, #101827 0%, #0b1220 45%, #06090f 100%),
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: auto, auto, auto, 4px 4px;
    background-attachment: fixed;
}

#app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#app-container .max-w-2xl {
    max-width: var(--ucs-content-max-2xl);
}

#app-container .max-w-4xl {
    max-width: var(--ucs-content-max-4xl);
}

#app-container.ucs-tagger-workspace-active {
    max-width: min(calc(100vw - 1rem), 100rem);
    overflow: visible;
}

.tagger-workspace {
    width: 100%;
}

.tagger-main-column {
    width: 100%;
    max-width: var(--ucs-content-max-2xl);
    margin-inline: auto;
}

.tagger-desktop-side {
    display: none;
}

.tagger-helper-tabs,
.tagger-floating-helper-window {
    display: none;
}

@media (min-width: 1280px) {
    #app-container.ucs-tagger-workspace-active > #main-nav {
        width: min(100%, var(--ucs-content-max-4xl));
        margin-inline: auto;
    }

    .tagger-workspace {
        display: grid;
        grid-template-columns: minmax(520px, 672px);
        align-items: start;
        justify-content: center;
    }

    .tagger-desktop-side {
        display: block;
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        overflow: visible;
        justify-self: start;
    }

    .tagger-main-column {
        grid-column: 1;
        grid-row: 1;
        max-width: 672px;
        margin-inline: 0;
    }

    .tagger-helper-tabs {
        position: fixed;
        top: 5.5rem;
        left: 0.5rem;
        z-index: 145;
        display: grid;
        gap: 0.3rem;
        padding: 0.3rem;
        border: 1px solid rgba(71, 85, 105, 0.8);
        border-radius: 6px;
        background-color: rgba(9, 14, 25, 0.94);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
        backdrop-filter: blur(8px);
    }

    .tagger-helper-tab,
    .tagger-helper-layout-reset {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #334155;
        border-radius: 4px;
        background-color: #111827;
        color: #94a3b8;
        transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
    }

    .tagger-helper-tab {
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0;
    }

    .tagger-helper-layout-reset {
        width: 2rem;
        height: 2rem;
        margin-inline: auto;
        padding: 0.4rem;
    }

    .tagger-helper-layout-reset svg {
        width: 100%;
        height: 100%;
    }

    .tagger-helper-tab:hover,
    .tagger-helper-tab:focus-visible,
    .tagger-helper-layout-reset:hover,
    .tagger-helper-layout-reset:focus-visible {
        border-color: rgba(248, 113, 113, 0.72);
        color: #f8fafc;
        outline: none;
    }

    .tagger-helper-tab.is-active {
        border-color: rgba(74, 222, 128, 0.72);
        background-color: rgba(20, 83, 45, 0.5);
        color: #bbf7d0;
    }

    .tagger-floating-helper-window {
        position: fixed;
        z-index: 130;
        display: grid;
        grid-template-rows: 2.35rem minmax(0, 1fr);
        min-width: 220px;
        min-height: 180px;
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        overflow: hidden;
        border: 1px solid rgba(71, 85, 105, 0.95);
        border-radius: 6px;
        background-color: rgba(9, 14, 25, 0.97);
        box-shadow: 0 22px 55px rgba(0, 0, 0, 0.52);
        backdrop-filter: blur(10px);
    }

    .tagger-floating-helper-resize {
        position: absolute;
        right: 0;
        bottom: 0;
        z-index: 2;
        display: flex;
        width: 1.4rem;
        height: 1.4rem;
        align-items: flex-end;
        justify-content: flex-end;
        padding: 0.28rem;
        border: 0;
        background: transparent;
        color: #64748b;
        cursor: nwse-resize;
        touch-action: none;
    }

    .tagger-floating-helper-resize span {
        width: 0.62rem;
        height: 0.62rem;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
    }

    .tagger-floating-helper-resize:hover,
    .tagger-floating-helper-resize:focus-visible {
        color: #cbd5e1;
        outline: none;
    }

    .tagger-floating-helper-window.is-dragging,
    .tagger-floating-helper-window.is-resizing {
        opacity: 0.92;
        box-shadow: 0 28px 68px rgba(0, 0, 0, 0.62);
    }

    .tagger-floating-helper-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.55rem;
        align-items: center;
        padding: 0.35rem 0.45rem 0.35rem 0.65rem;
        border-bottom: 1px solid rgba(51, 65, 85, 0.9);
        background-color: rgba(15, 23, 42, 0.96);
        cursor: move;
        touch-action: none;
        user-select: none;
    }

    .tagger-floating-helper-header h2 {
        min-width: 0;
        overflow: hidden;
        color: #e2e8f0;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0;
        text-overflow: ellipsis;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .tagger-floating-helper-header-actions {
        display: flex;
        gap: 0.3rem;
        align-items: center;
    }

    .sound-adjective-font-controls {
        display: inline-flex;
        align-items: center;
        overflow: hidden;
        border: 1px solid #334155;
        border-radius: 4px;
        background-color: rgba(30, 41, 59, 0.92);
        cursor: default;
    }

    .sound-adjective-font-controls button {
        min-width: 1.75rem;
        height: 1.7rem;
        padding: 0 0.32rem;
        border: 0;
        background: transparent;
        color: #cbd5e1;
        font-size: 10px;
        font-weight: 800;
        cursor: pointer;
    }

    .sound-adjective-font-controls button:hover,
    .sound-adjective-font-controls button:focus-visible {
        background-color: #475569;
        color: #fff;
        outline: none;
    }

    .sound-adjective-font-controls span {
        min-width: 1.5rem;
        color: #f8fafc;
        font-size: 10px;
        font-weight: 800;
        text-align: center;
    }

    .tagger-floating-helper-grip {
        display: grid;
        grid-template-columns: repeat(3, 3px);
        gap: 3px;
        color: #64748b;
    }

    .tagger-floating-helper-grip span {
        width: 3px;
        height: 3px;
        border-radius: 999px;
        background-color: currentColor;
    }

    .tagger-floating-helper-close {
        display: inline-flex;
        width: 1.7rem;
        height: 1.7rem;
        align-items: center;
        justify-content: center;
        padding: 0.35rem;
        border: 0;
        border-radius: 4px;
        color: #94a3b8;
        cursor: pointer;
    }

    .tagger-floating-helper-close:hover,
    .tagger-floating-helper-close:focus-visible {
        background-color: #334155;
        color: #fff;
        outline: none;
    }

    .tagger-floating-helper-close svg {
        width: 100%;
        height: 100%;
    }

    .tagger-floating-helper-content {
        min-width: 0;
        min-height: 0;
        overflow: auto;
        padding: 0.75rem;
        scrollbar-gutter: stable;
    }

    .floating-helper-empty {
        margin: 0;
        padding: 0.65rem;
        color: #64748b;
        font-size: 11px;
        text-align: center;
    }

    .tagger-floating-helper-content .sound-descriptor-groups {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.75rem 0.6rem;
        align-items: start;
    }

    .tagger-floating-helper-content .sound-descriptor-group {
        min-width: 0;
    }

    .tagger-floating-helper-content .sound-descriptor-chip {
        max-width: 100%;
        padding: 0.3rem 0.45rem;
        font-size: var(--sound-adjective-font-size, 13px);
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    [data-floating-helper-window="adjectives"] .sound-descriptor-group p {
        font-size: max(10px, calc(var(--sound-adjective-font-size, 13px) - 2px));
    }

    .catid-compact-list {
        display: grid;
        gap: 0.35rem;
    }

    .catid-compact-row {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.45rem;
        align-items: center;
        min-height: 2.15rem;
        width: 100%;
        padding: 0.38rem 0.5rem;
        overflow: hidden;
        border: 1px solid #334155;
        border-radius: 4px;
        background-color: rgba(30, 41, 59, 0.8);
        color: #cbd5e1;
        text-align: left;
    }

    .catid-compact-row:hover,
    .catid-compact-row:focus-visible {
        border-color: rgba(74, 222, 128, 0.58);
        background-color: rgba(30, 41, 59, 1);
        outline: none;
    }

    .catid-compact-row.is-active {
        border-color: rgba(74, 222, 128, 0.72);
        background-color: rgba(20, 83, 45, 0.42);
    }

    .catid-compact-id {
        color: #4ade80;
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-size: 10px;
        font-weight: 800;
        white-space: nowrap;
    }

    .catid-compact-path {
        min-width: 0;
        overflow: hidden;
        color: #94a3b8;
        font-size: 9px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .catid-compact-count,
    .catid-compact-learned {
        flex-shrink: 0;
        color: #94a3b8;
        font-size: 8px;
        font-weight: 800;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .floating-catid-synonyms {
        margin-top: 0.8rem;
        padding-top: 0.7rem;
        border-top: 1px solid #334155;
    }

    .floating-catid-synonym-label {
        margin: 0 0 0.45rem;
        color: #64748b;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: 0;
        text-transform: uppercase;
    }

    .catid-selected-synonym-heading {
        display: flex;
        min-width: 0;
        gap: 0.5rem;
        align-items: center;
        justify-content: space-between;
    }

    #catid-synonyms-panel .catid-synonym-chip {
        max-width: 100%;
        padding: 0.3rem 0.45rem;
        font-size: var(--sound-adjective-font-size, 13px);
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    #catid-synonyms-panel .catid-synonym-chip:hover,
    #catid-synonyms-panel .catid-synonym-chip:focus-visible {
        border-color: rgba(74, 222, 128, 0.55);
        background-color: rgba(20, 83, 45, 0.28);
        color: #bbf7d0;
        outline: none;
    }

}

html {
    font-size: var(--ucs-root-font-size);
    max-width: 100%;
    overflow-x: hidden;
}

@media (min-width: 1024px) {
    body.ucs-nav-autohide-active #app-container nav.is-desktop-autohide {
        position: fixed;
        top: 0.35rem;
        left: 50%;
        width: min(var(--ucs-content-max-4xl), calc(100vw - 1.5rem));
        margin-bottom: 0 !important;
        transform: translate(-50%, calc(-100% + 12px));
        transition: transform 220ms ease;
        z-index: 160;
        backdrop-filter: blur(6px);
    }

    body.ucs-nav-autohide-active.ucs-nav-revealed #app-container nav.is-desktop-autohide,
    body.ucs-nav-autohide-active #app-container nav.is-desktop-autohide:hover,
    body.ucs-nav-autohide-active #app-container nav.is-desktop-autohide:focus-within {
        transform: translate(-50%, 0);
    }
}

button {
    transition: transform 0.14s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:not(:disabled):hover {
    filter: brightness(1.04);
}

button:not(:disabled):active {
    transform: translateY(1px) scale(0.98);
    box-shadow: var(--ucs-button-press-shadow);
}

@keyframes sectionReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ui-reveal-section {
    opacity: 0;
    transform: translateY(10px);
    animation: sectionReveal 360ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}

@keyframes studioNoteIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#studio-facts-panel {
    animation: studioNoteIn 420ms ease-out both;
    pointer-events: none;
}

#left-catid-panel {
    animation: studioNoteIn 420ms ease-out both;
    pointer-events: none;
}

.quick-presets-corner-panel {
    display: none;
}

#studio-facts-panel .studio-fact-shell {
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    pointer-events: auto;
}

#most-used-catids-panel,
#quick-presets-panel,
#suggested-catids-panel,
#catid-synonyms-panel,
#copied-meta-history-panel {
    pointer-events: auto;
}

@media (min-width: 1280px) {
    .quick-presets-corner-panel {
        position: fixed;
        top: 5.5rem;
        right: 0.75rem;
        z-index: 35;
        display: block;
        width: min(16rem, calc(100vw - 1.5rem));
        max-height: calc(100vh - 6.25rem);
        overflow-y: auto;
        pointer-events: auto;
    }
}

#sound-descriptor-desktop-panel,
#sound-descriptor-mobile-panel {
    pointer-events: auto;
}

#sound-descriptor-mobile-panel>summary::-webkit-details-marker {
    display: none;
}

.studio-fact-card {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 420ms ease, transform 420ms ease;
}

.studio-fact-card.is-fading {
    opacity: 0;
    transform: translateY(6px);
}

@keyframes modalOverlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalPanelIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#settings-modal,
#quick-start-modal,
#importer-modal,
#camera-modal,
#generated-image-modal,
#readme-modal,
#signin-modal {
    animation: modalOverlayIn 180ms ease-out;
}

#settings-modal .settings-card,
#quick-start-modal>div,
#importer-modal>div,
#camera-modal-content,
#generated-image-modal>div,
#readme-modal>div,
#signin-modal>div {
    animation: modalPanelIn 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
    transform-origin: center top;
}

#app-container nav,
#app-container .bg-gray-800.rounded-lg.shadow-lg,
#app-container .bg-gray-800.rounded-lg.shadow-xl,
#app-container .bg-gray-800.rounded-lg.shadow-2xl,
#app-container .bg-gray-800.rounded-md.shadow-lg,
#camera-modal-content,
#settings-modal .settings-card,
#quick-start-modal>div,
#generated-image-modal>div,
#readme-modal>div,
#signin-modal>div {
    border: 1px solid var(--ucs-panel-border);
    box-shadow: var(--ucs-panel-shadow-1), var(--ucs-panel-shadow-2), inset 0 1px 0 var(--ucs-panel-highlight);
}

#app-container nav,
#camera-modal-content,
#settings-modal .settings-card,
#quick-start-modal>div,
#generated-image-modal>div,
#readme-modal>div,
#signin-modal>div {
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.94) 0%, rgba(17, 24, 39, 0.94) 100%);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Custom scrollbar for better aesthetics in dark mode */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
    /* bg-gray-800 */
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    /* bg-gray-600 */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
    /* bg-gray-500 */
}

/* Simple spinner for loading states */
.spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    width: 16px;
    height: 16px;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Styles for the custom suggestions dropdown */
.suggestions-container {
    display: none;
    position: absolute;
    background-color: #451a03;
    /* A darker amber for the background */
    border: 1px solid #d97706;
    /* A brighter amber for the border */
    border-radius: 0.375rem;
    width: 100%;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #b45309;
    /* A mid-range amber for hover */
}

.suggestion-delete-btn {
    color: #9ca3af;
    /* text-gray-400 */
    padding: 0.25rem;
    border-radius: 9999px;
}

.suggestion-delete-btn:hover {
    color: #ef4444;
    /* text-red-500 */
    background-color: #451a03;
}

/* Notification styles */
#notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.5s ease-in-out;
    z-index: 101;
    /* Ensure it's above the modal */
}

#notification.show {
    top: 20px;
}

.entry-item {
    cursor: pointer;
}

/* Camera Modal Styles */
#camera-modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

#camera-modal-content {
    background-color: #1f2937;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 520px;
    width: 95%;
    margin: auto;
}

#camera-stream {
    width: 100%;
    max-width: 480px;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
}

#camera-capture {
    max-width: 480px;
    max-height: 400px;
    width: 100%;
    object-fit: contain;
    border-radius: 8px;
    cursor: grab;
}

#camera-capture.grabbing {
    cursor: grabbing;
}

/* Styles for Description-based CatID suggestions */
#description-suggestions-box {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Fixed positioning to float over content without affecting layout */
    background-color: #2d3748;
    /* bg-gray-700 */
    border: 1px solid #4a5568;
    /* bg-gray-600 */
    border-radius: 0.375rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    /* High z-index to appear on top of everything */
    min-width: 300px;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.description-suggestion-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #4a5568;
}

.description-suggestion-item:last-child {
    border-bottom: none;
}

.description-suggestion-item:hover {
    background-color: #4a5568;
    /* bg-gray-600 */
}

.suggestion-catid {
    font-family: monospace;
    font-weight: bold;
    color: #68d391;
    /* A green color for visibility */
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.suggestion-explanation {
    font-size: 0.8rem;
    color: #a0aec0;
    /* text-gray-400 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Importer Page Styles */
.importer-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

#importer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Quick Start Guide Styles */
#quick-start-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
    z-index: 200;
    /* Highest z-index */
}

#quick-start-modal>div {
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    margin: auto;
}

/* Mobile-friendly styles for clear buttons */
@media (max-width: 640px) {
    .reset-btn {
        display: none !important;
    }

    .reset-btn.mobile-reset-visible {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .field-container {
        flex-direction: column;
    }

    .field-input-wrapper {
        width: 100%;
    }

    #app-container nav .nav-btn {
        font-size: 0.75rem;
        line-height: 1.1rem;
        padding: 0.55rem 0.4rem;
    }

    #format-toggle {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 0.35rem;
    }

    #format-toggle .format-btn {
        min-height: 2.35rem;
        padding: 0.35rem 0.25rem;
    }

    #quick-start-modal {
        align-items: flex-start;
        padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
    }

    #quick-start-modal>div {
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1.5rem);
    }
}

/* Settings Modal */
#settings-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    /* toggled via render */
    align-items: flex-start;
    justify-content: center;
    z-index: 190;
    overflow-y: auto;
    padding: 20px 0;
}

#settings-modal .settings-card {
    border-radius: 10px;
    width: 95%;
    max-width: 720px;
    padding: 20px;
    margin: auto;
    max-height: none;
}

#settings-modal .settings-actions button {
    min-width: 110px;
}

.ucs-report-enabled {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

#ucs-issue-report-button {
    position: fixed;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 180;
    min-width: 88px;
    height: 44px;
    padding: 0 18px;
    border: 1px solid #c3544b;
    border-radius: 8px;
    background: #8f302a;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: 0 3px 14px #0005;
}

#ucs-issue-report-button:hover { background: #ab3b33; }
.ucs-report-enabled #app-update-banner { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

#ucs-issue-report-dialog {
    box-sizing: border-box;
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 0;
    overflow-y: auto;
    border: 1px solid #59606d;
    border-radius: 8px;
    background: #171a22;
    color: #f3f4f6;
    text-align: left;
    font-size: 14px;
    letter-spacing: 0;
    box-shadow: 0 16px 64px #0008;
}

#ucs-issue-report-dialog::backdrop { background: #000a; }
.ucs-report-header, .ucs-report-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.ucs-report-header { border-bottom: 1px solid #383c46; }
.ucs-report-header h2 { margin: 0; font-size: 18px; font-weight: 650; }
#ucs-report-close { width: 36px; height: 36px; flex: 0 0 36px; font-size: 25px; line-height: 1; }
.ucs-report-content { padding: 16px 20px; }
.ucs-report-content label { display: block; margin: 12px 0 6px; font-weight: 600; }
.ucs-report-content > label:first-child { margin-top: 0; }
.ucs-report-content input, .ucs-report-content textarea, .ucs-report-content select {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #545a68;
    border-radius: 5px;
    background: #272b36;
    color: #f3f4f6;
    font: inherit;
    line-height: 1.5;
    letter-spacing: 0;
}
.ucs-report-content textarea { resize: vertical; overflow-wrap: anywhere; }
.ucs-report-content textarea[readonly] { background: #20232b; color: #d8dbe3; }
.ucs-report-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ucs-report-comparison > div { min-width: 0; }
.ucs-report-muted { color: #a3a9b7; font-weight: 400; font-size: 12px; }
#ucs-report-model { margin: 6px 0 0; overflow-wrap: anywhere; }
.ucs-report-details { margin-top: 18px; }
.ucs-report-details summary { cursor: pointer; color: #b6d9e9; }
.ucs-report-privacy { margin: 16px 0 0; color: #a3a9b7; font-size: 12px; line-height: 1.5; }
#ucs-report-status { min-height: 21px; margin: 12px 0 0; color: #a5e6bb; overflow-wrap: anywhere; }
#ucs-report-status.ucs-report-error { color: #ffb3a8; }
.ucs-report-actions { border-top: 1px solid #383c46; }
.ucs-report-actions button { min-height: 42px; padding: 8px 14px; border: 1px solid #545a68; border-radius: 6px; font-weight: 600; }
#ucs-report-send { background: #8f302a; border-color: #c3544b; }
#ucs-issue-report-dialog button:disabled, #ucs-issue-report-dialog select:disabled { opacity: 0.55; cursor: not-allowed; }
#ucs-issue-report-dialog :focus-visible, #ucs-issue-report-button:focus-visible { outline: 2px solid #91d5e8; outline-offset: 3px; }
@media (max-width: 540px) {
    .ucs-report-comparison { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .ucs-report-header, .ucs-report-content, .ucs-report-actions { padding-left: 14px; padding-right: 14px; }
    .ucs-report-content textarea, .ucs-report-content select { font-size: 16px; }
    .ucs-report-actions { flex-wrap: wrap; }
}

/* PWA Install Button */
#pwa-install-btn {
    display: none;
}

#pwa-install-btn.show {
    display: flex;
}

/* Theme surfaces override legacy utility colors across Tagger and its dialogs. */
html[data-theme] body { background: var(--theme-bg); color: var(--theme-text); }
html[data-theme] :is(.settings-card, .tagger-floating-helper-window, .tagger-floating-helper-header, .ucs-report-dialog,
    [class*="bg-gray-9"], [class*="bg-gray-8"]) { background: var(--theme-panel); color: var(--theme-text); }
html[data-theme] :is(input:not([type="radio"]):not([type="checkbox"]), textarea, select,
    [class*="bg-gray-7"], [class*="bg-gray-6"], .sound-descriptor-chip, .catid-synonym-chip, .catid-compact-row) {
    background-color: var(--theme-field); color: var(--theme-text); border-color: var(--theme-border);
}
html[data-theme] :is([class*="text-gray-"], .catid-compact-path, .floating-catid-synonym-label, .floating-helper-empty) { color: var(--theme-muted); }
html[data-theme] :is(.tagger-floating-helper-header h2, [class*="text-white"]) { color: var(--theme-text); }
html[data-theme] :is([class*="border-gray-"], .settings-card, .tagger-floating-helper-window, .tagger-floating-helper-header) { border-color: var(--theme-border); }
html[data-theme] :is(.tagger-helper-tab.is-active, #settings-save-btn, #add-update-btn, .format-btn.bg-red-600) {
    background: var(--theme-accent); color: var(--theme-on-accent); border-color: var(--theme-accent);
}
html[data-theme] :is(.sound-descriptor-chip, .catid-synonym-chip, .catid-compact-row):hover { border-color: var(--theme-accent); }
html[data-theme] :is(input, textarea)::placeholder { color: var(--theme-muted); opacity: 0.85; }
html[data-theme="light"] :is(.text-green-400, .text-red-400, .text-red-300, .text-green-300, .catid-compact-id) { color: var(--theme-accent); }
html[data-theme] :is(.bg-green-600, .bg-orange-600, .bg-blue-600, .bg-purple-600, .bg-indigo-600) { color: #fff; }
