/* 小畫家畫室 — 前台與後台共用 */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
    background: linear-gradient(160deg, #fff7fb, #eef6ff 55%, #f6f4ff);
    min-height: 100vh;
}

.dg-studio-app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.dg-studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.dg-studio-header h1 {
    font-size: 1.6rem;
    color: #db2777;
    margin: 0;
}

.dg-studio-back {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.dg-studio-back a {
    color: #64748b;
    text-decoration: none;
    font-size: .9rem;
}

.dg-studio-back a:hover {
    color: #db2777;
}

.dg-tools {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
}

.dg-tool-btn {
    border: 2px solid #fbcfe8;
    background: #fff;
    color: #9d174d;
    font-size: 1rem;
    padding: .55rem 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.dg-tool-btn.is-active {
    background: #ec4899;
    border-color: #ec4899;
    color: #fff;
}

.dg-paint-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    background: #fff;
    border-radius: 16px;
    padding: .7rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}

.dg-colors {
    display: flex;
    gap: .4rem;
    align-items: center;
}

.dg-color {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px #e2e8f0;
    cursor: pointer;
    padding: 0;
}

.dg-color.is-active {
    box-shadow: 0 0 0 2.5px #0f172a;
}

.dg-brush-size {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: #64748b;
}

.dg-ctl {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: .9rem;
    padding: .45rem .9rem;
    border-radius: 10px;
    cursor: pointer;
}

.dg-ctl:hover {
    background: #f8fafc;
}

.dg-ctl.is-active {
    background: #fdf2f8;
    border-color: #f472b6;
    color: #be185d;
}

.dg-stage {
    position: relative;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .10);
    touch-action: none;
}

.dg-stage canvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

.dg-sign-wrap {
    padding: 1rem;
}

.dg-sign-wrap canvas {
    width: 100%;
    height: 340px;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.dg-hint {
    text-align: center;
    color: #94a3b8;
    font-size: .85rem;
}

.dg-savebar {
    text-align: center;
    margin-top: 1.25rem;
}

.dg-save-btn {
    border: none;
    background: linear-gradient(135deg, #ff5d8f, #fb7185);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    padding: .8rem 2.2rem;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(255, 93, 143, .4);
    transition: transform .15s;
}

.dg-save-btn:hover {
    transform: translateY(-2px);
}

.dg-save-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(20, 10, 40, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.dg-save-modal[hidden] {
    display: none;
}

.dg-save-box {
    background: #fff;
    border-radius: 18px;
    padding: 1.75rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.dg-save-box h2 {
    margin: 0 0 1rem;
    color: #334155;
    font-size: 1.2rem;
}

.dg-save-box input {
    width: 100%;
    padding: .7rem .9rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.dg-save-box input:focus {
    outline: none;
    border-color: #f472b6;
}

.dg-save-actions {
    display: flex;
    justify-content: center;
    gap: .6rem;
}

.dg-save-status {
    margin: .8rem 0 0;
    min-height: 1.2em;
    font-size: .9rem;
}
