/* ======= 词云生成器：专属样式（三语共享） =======
   只写本工具专属部件；.btn / .form-input / .toast / .info-card / .feature-grid /
   .tutorial-steps / .scenario-grid / .glossary-item / .faq-item / .related-tools 等共享类在 /style.css。 */

/* 双栏版式需要更宽的容器（默认 900px 会把画布挤得很小） */
.tool-page .tool-container {
    max-width: 1200px;
}

.wc-tool-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.wc-layout {
    display: grid;
    grid-template-columns: minmax(0, 350px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.wc-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wc-stage {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* ---------- 面板分组 ---------- */

.wc-section {
    padding: 1rem 1.125rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
}

.wc-section-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.wc-section-title i {
    color: var(--primary-color);
}

.wc-input-area {
    width: 100%;
    min-height: 108px;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.7;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition-fast);
    box-sizing: border-box;
}

.wc-input-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.wc-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.625rem;
}

.wc-btn-row .btn {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
}

.wc-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.wc-hint i {
    flex: none;
    margin-top: 0.1rem;
    color: var(--primary-color);
}

/* ---------- 表单行 ---------- */

.wc-field {
    margin-top: 0.75rem;
}

.wc-field:first-child {
    margin-top: 0;
}

.wc-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.wc-label b {
    font-weight: 600;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

.wc-text-input {
    width: 100%;
    padding: 0.4375rem 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: var(--transition-fast);
}

.wc-text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.wc-range {
    width: 100%;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.wc-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    margin-top: 0.625rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.wc-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
    margin: 0;
}

.wc-color {
    width: 100%;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    box-sizing: border-box;
}

/* 只在特定选项下出现的行：默认 display:none，靠 .is-on 显示。
   不用 [hidden]，避免作者样式覆盖 UA 的 [hidden]{display:none}。 */
.wc-cond {
    display: none;
}

.wc-cond.is-on {
    display: block;
}

/* ---------- chips ---------- */

.wc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.wc-chip {
    padding: 0.3125rem 0.6875rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.wc-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.wc-chip.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

/* 调色板色块 */
.wc-swatch {
    padding: 3px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    transition: var(--transition-fast);
    line-height: 0;
}

.wc-swatch:hover {
    border-color: var(--primary-color);
}

.wc-swatch.active {
    border-color: var(--primary-color);
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

.wc-swatch-strip {
    display: flex;
    border-radius: 3px;
    overflow: hidden;
}

.wc-swatch-strip i {
    display: block;
    width: 15px;
    height: 20px;
}

/* ---------- 操作按钮 ---------- */

.wc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.wc-actions .btn {
    flex: 1 1 132px;
}

/* ---------- 画布 ---------- */

.wc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wc-toolbar-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.wc-toolbar-label i {
    color: var(--primary-color);
}

.wc-canvas-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.wc-canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-light);
    box-sizing: border-box;
    overflow: hidden;
}

.wc-canvas-wrap canvas {
    display: block;
    max-width: 100%;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 透明背景时铺一层棋盘格，让「透明」可见 */
.wc-canvas-wrap.is-transparent {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #eaeaea 25%, transparent 25%, transparent 75%, #eaeaea 75%),
        linear-gradient(45deg, #eaeaea 25%, transparent 25%, transparent 75%, #eaeaea 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.wc-empty {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 150px;
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

.wc-empty.is-on {
    display: flex;
}

/* 未放下 / 已屏蔽提示条 */
.wc-note {
    display: none;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid #ffe58f;
    border-radius: var(--radius-md);
    background: #fffbe6;
    color: #8a6100;
    font-size: 0.8rem;
    line-height: 1.5;
}

.wc-note.is-on {
    display: flex;
}

/* ---------- 统计 ---------- */

.wc-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.625rem;
}

.wc-stat {
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    text-align: center;
}

.wc-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.wc-stat-value {
    display: block;
    margin-top: 0.125rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ---------- 词频表 ---------- */

.wc-words-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.wc-words-head h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.wc-words-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.wc-words-empty {
    display: none;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.wc-words-empty.is-on {
    display: block;
}

.wc-words-wrap {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.wc-words {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.wc-words thead th {
    position: sticky;
    top: 0;
    padding: 0.4375rem 0.625rem;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.wc-words thead th:last-child,
.wc-words td:last-child {
    text-align: right;
}

.wc-words td {
    padding: 0.375rem 0.625rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
}

.wc-words td:nth-child(2) {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    width: 4.5rem;
}

.wc-words tbody tr:hover {
    background: var(--primary-light);
}

.wc-words tbody tr.is-off td {
    color: var(--text-muted);
    text-decoration: line-through;
}

.wc-words-state {
    font-size: 0.75rem;
    color: var(--warning-color, #d48806);
    white-space: nowrap;
}

/* ---------- 正文速查表 ---------- */

.wc-table-wrap {
    overflow-x: auto;
}

.wc-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.wc-table thead th {
    padding: 0.625rem 0.75rem;
    background: var(--bg-light);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.wc-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.wc-table td:first-child {
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.wc-table tbody tr:hover {
    background: var(--primary-light);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1024px) {
    .tool-page .tool-container {
        max-width: 900px;
    }

    .wc-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .wc-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* 移动端按钮组用 grid 两列：flex-basis 在 column 方向会变成高度、把按钮撑高 */
    .wc-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .wc-actions .btn {
        flex: none;
        width: auto;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .wc-actions .btn:first-child {
        grid-column: 1 / -1;
    }

    .wc-swatch-strip i {
        width: 13px;
        height: 18px;
    }
}

@media (max-width: 400px) {
    .wc-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .wc-actions .btn:first-child {
        grid-column: auto;
    }
}
