/* drawing-board.html 私有样式 */
.container {
    max-width: 1400px;
}

.main {
    grid-template-columns: 1fr 400px;
}

/* ---- 工具网格 ---- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s;
}

.tool-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.tool-btn.active {
    border-color: #667eea;
    background: #eef2ff;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* ---- 画笔大小预览 ---- */
.brush-preview {
    display: flex;
    justify-content: center;
    padding: 6px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    min-height: 30px;
}

.size-val {
    font-size: 12px;
    color: #667eea;
    font-weight: 600;
    float: right;
    font-variant-numeric: tabular-nums;
}

/* ---- 参数行 ---- */
.param-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.param-row input[type="range"] {
    flex: 1;
    accent-color: #667eea;
    cursor: pointer;
}

/* ---- 颜色 ---- */
.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.color-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: #fff;
}

.color-hex {
    font-size: 13px;
    color: #6b7280;
    font-family: monospace;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
}

.palette-chip {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.palette-chip:hover {
    transform: scale(1.15);
    z-index: 1;
}

.palette-chip.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* ---- 背景选择 ---- */
.bg-bar {
    display: flex;
    gap: 6px;
}

.bg-bar .btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
}

.bg-bar .btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* ---- 画布尺寸 ---- */
.size-display {
    font-size: 13px;
    color: #6b7280;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-variant-numeric: tabular-nums;
}

/* ---- 操作按钮 ---- */
.action-bar {
    display: flex;
    gap: 6px;
}

.action-bar .btn {
    flex: 1;
    font-size: 12px;
    padding: 6px 8px;
}

.action-bar .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ---- 画布区域 ---- */
.canvas-panel {
    display: flex;
    flex-direction: column;
}

.canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #f0f0f0;
    min-height: 300px;
    max-height: calc(100vh - 220px);
    overflow: auto;
}

.canvas-wrap canvas {
    border: 1px solid #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    cursor: crosshair;
    touch-action: none;
}

/* ---- 全屏模式 ---- */
.canvas-wrap:-webkit-full-screen,
.canvas-wrap:-moz-full-screen,
.canvas-wrap:fullscreen {
    background: #2a2a2a;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.canvas-wrap:-webkit-full-screen canvas,
.canvas-wrap:-moz-full-screen canvas,
.canvas-wrap:fullscreen canvas {
    max-width: none;
    max-height: none;
}

/* ---- 全屏浮动工具栏（仅全屏时显示） ---- */
.fs-toolbar {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: rgba(17, 17, 17, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    z-index: 20;
    max-height: calc(100% - 24px);
    overflow-y: auto;
}

.canvas-wrap:-webkit-full-screen .fs-toolbar,
.canvas-wrap:-moz-full-screen .fs-toolbar,
.canvas-wrap:fullscreen .fs-toolbar {
    display: flex;
}

.fs-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.fs-tool:hover {
    background: #fff;
    transform: scale(1.08);
}

.fs-tool:active {
    transform: scale(0.95);
}

.fs-tool.active {
    background: #667eea;
    color: #fff;
}

.fs-divider {
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
    margin: 2px 0;
    flex-shrink: 0;
}

.fs-range {
    width: 30px;
    height: 90px;
    writing-mode: vertical-lr;
    direction: rtl;
    accent-color: #667eea;
    cursor: pointer;
    flex-shrink: 0;
}

.fs-size-val {
    font-size: 11px;
    color: #fff;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.fs-color {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
}

/* ---- 响应式 ---- */
@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
    .canvas-wrap {
        min-height: 300px;
    }
}

@media (max-width: 600px) {
    .tool-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    .tool-btn {
        font-size: 16px;
        padding: 8px 4px;
    }
    .color-palette {
        grid-template-columns: repeat(10, 1fr);
    }
    .action-bar {
        flex-wrap: wrap;
    }
    .size-row {
        flex-wrap: wrap;
    }
}
