[hidden] {
    display: none !important;
}

.cat-create .create_textinput,
.cat-create .create_textarea {
    width: 100%;
    max-width: 720px;
    box-sizing: border-box;
}

.cat-create .create_option {
    margin: 8px 0 14px;
}

.cat-create .create_option label {
    margin-left: 6px;
}

.cat-meta {
    color: #526170;
    margin: 0 0 12px;
}

.cat-editors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 8px 0 16px;
}

.cat-editor {
    margin: 0;
    padding: 16px;
    border: 1px solid #d5dee8;
    border-radius: 12px;
    background: #f8fbfe;
    min-width: 0;
}

.cat-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.cat-editor-label {
    font-weight: 700;
    color: #243140;
}

.cat-name-label {
    display: block;
    margin-bottom: 12px;
}

.cat-name,
.cat-word {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #8aa0b5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 1rem;
}

.cat-name {
    font-weight: 400;
}

.cat-word-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.cat-word-row .cat-word {
    margin-top: 0;
}

.cat-icon-btn,
.cat-remove,
.cat-add-word,
#addCategory {
    height: auto;
    min-height: 38px;
}

.cat-icon-btn {
    width: 38px;
    flex: 0 0 38px;
    padding: 0;
    font-size: 1.3rem;
    line-height: 1;
}

.cat-add-word,
#addCategory,
.cat-remove {
    background: #fff;
    color: #0a345c;
    border: 1px solid #8aa4be;
}

.cat-words {
    margin-bottom: 8px;
}

.cat-form-error {
    color: #b42318;
    font-weight: 700;
}

.input-method-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px;
}

.method-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid #007bff;
    background: #fff;
    color: #007bff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.2;
}

.method-toggle.active {
    background: #007bff;
    color: #fff;
}

.method-toggle:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: #fff;
}

.method-toggle:not(.active):hover {
    background: #e7f3ff;
    color: #007bff;
}

.cat-bulk-intro,
.paste-example {
    margin: 0 0 10px;
    color: #243140;
}

.cat-bulk-example {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

#bulkCategories {
    width: 100%;
    box-sizing: border-box;
    min-height: 180px;
}

.bulk-help {
    color: #526170;
    font-size: 0.95rem;
    margin: 10px 0 0;
}

.bulk-actions {
    margin-top: 12px;
}

.bulk-actions .create_button {
    height: auto;
    min-height: 44px;
}

.bulk-status {
    margin: 0 0 12px;
    color: #1e7e34;
    font-weight: 700;
}

.bulk-status:empty {
    display: none;
}

.bulk-status-error {
    color: #b42318;
}

.success-message {
    display: block;
    text-align: center;
    padding: 32px 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.success-message h2 {
    color: #1e7e34;
}

.url-display {
    margin: 16px auto;
    padding: 14px;
    background: #fff;
    border: 2px solid #1e7e34;
    border-radius: 8px;
    max-width: 720px;
}

.activity-url {
    word-break: break-all;
}

.cat-activity {
    max-width: 1100px;
}

.cat-help {
    color: #526170;
}

.cat-board {
    display: grid;
    gap: 16px;
    margin: 20px 0 16px;
}

.cat-board.count-2 {
    grid-template-columns: 1fr 1fr;
}

.cat-board.count-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.cat-board.count-4 {
    grid-template-columns: 1fr 1fr;
}

.cat-board.count-5 {
    grid-template-columns: repeat(6, 1fr);
}

.cat-board.count-5 .cat-box:nth-child(-n+3) {
    grid-column: span 2;
}

.cat-board.count-5 .cat-box:nth-child(4) {
    grid-column: 2 / span 2;
}

.cat-board.count-5 .cat-box:nth-child(5) {
    grid-column: 4 / span 2;
}

.cat-box,
.cat-tray {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 8px;
    min-height: 150px;
    padding: 14px;
    border-radius: 14px;
    border: 2px dashed transparent;
    box-sizing: border-box;
}

.cat-box[data-tone="1"] { background: #e8f2ff; border-color: #8eb7e8; }
.cat-box[data-tone="2"] { background: #e7f7ee; border-color: #8ec9a8; }
.cat-box[data-tone="3"] { background: #fff3e0; border-color: #e2c08a; }
.cat-box[data-tone="4"] { background: #f3e9ff; border-color: #c3a6e6; }
.cat-box[data-tone="5"] { background: #fde8ef; border-color: #e7a8bc; }

.cat-box.is-over,
.cat-tray.is-over {
    border-style: solid;
    border-color: #1875d0;
    box-shadow: inset 0 0 0 2px #1875d0;
}

.cat-box-title,
.cat-tray h2 {
    flex: 1 0 100%;
    margin: 0 0 4px;
    text-align: center;
    font-size: 1.35rem;
    color: #243140;
}

.cat-hint {
    flex: 1 0 100%;
    margin: 18px 0;
    text-align: center;
    color: #5c6b7a;
}

.cat-tray {
    margin-top: 8px;
    background: #f7f9fb;
    border: 2px dashed #b7c3ce;
}

.cat-tray h2 {
    text-align: left;
    font-size: 1.15rem;
}

.cat-item {
    background: #fff;
    border: 2px solid #c5ced6;
    border-radius: 8px;
    padding: 8px 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    font-size: 1.05rem;
    color: #243140;
}

.cat-item.is-dragging,
.cat-drag-ghost {
    cursor: grabbing;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.cat-drag-ghost {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    margin: 0;
    box-sizing: border-box;
}

.cat-item.is-source {
    opacity: 0.35;
}

body.cat-dragging {
    user-select: none;
    touch-action: none;
}

.cat-item.is-selected {
    outline: 3px solid #1875d0;
    outline-offset: 2px;
}

.cat-item.is-correct {
    background: #d8f3df;
    border-color: #2e9e4f;
    cursor: default;
}

.cat-item.is-wrong {
    background: #fde2e4;
    border-color: #d64550;
}

.cat-item.is-locked {
    cursor: default;
}

.cat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}

.cat-check,
.cat-reset {
    height: auto;
    min-height: 44px;
    padding: 8px 18px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
}

.cat-check {
    background: #1875d0;
    color: #fff;
    border: 1px solid #135ba2;
}

.cat-reset {
    background: #fff;
    color: #0a345c;
    border: 1px solid #8aa4be;
}

.cat-check:disabled,
.cat-reset:disabled {
    background: #e6ebf0;
    color: #7b8794;
    border-color: #d5dee8;
    cursor: not-allowed;
}

.cat-result {
    margin: 12px 0 0;
    min-height: 1.4em;
    font-size: 1.15rem;
    font-weight: 700;
}

.cat-result.is-done {
    color: #1e7e34;
}

.cat-create input:focus,
.cat-create textarea:focus,
.cat-create button:focus,
.cat-item:focus,
.cat-box:focus,
.cat-tray:focus {
    outline: 3px solid #1875d0 !important;
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .cat-board.count-2,
    .cat-board.count-3,
    .cat-board.count-4,
    .cat-board.count-5 {
        grid-template-columns: 1fr;
    }

    .cat-board.count-5 .cat-box:nth-child(n) {
        grid-column: auto;
    }

    .input-method-toggle {
        flex-direction: column;
    }
}
