/* =========================================================
   お絵描き自由帳 v5.0.0
   固定ヘッダー＋全画面キャンバス＋左右ボタンドック（ホバー/タップ フライアウト）
   ぬりえモード／ローカルストレージ自動保存／背景グラデーション設定 対応
   全て .da-wrap 配下にスコープ
   ========================================================= */

.da-wrap {
    --main:#1e3a5f; --main-light:#2d5a8f; --main-dark:#0f1e3a;
    --accent:#d4af37; --accent-light:#f4cf5f; --accent-dark:#b8941f;
    --text:#2C3E50; --text-light:#7F8C8D; --border:#E8E8E8;
    --danger:#ef4444; --success:#3dbf7b;
    --font: 'M PLUS Rounded 1c', 'BIZ UDGothic', system-ui, -apple-system, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;

    box-sizing: border-box;
    font-family: var(--font);
    font-size: 13px;
    user-select: none;
    margin: 0 !important;
    padding: 0 !important;
}
.da-wrap * { box-sizing: border-box; }
.da-hidden { display: none !important; }

/* ===== キャンバスサイズ選択 POPUP ===== */
.da-size-popup {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.72);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.da-size-popup-inner {
    background: #fff;
    border-radius: 16px;
    padding: 36px 40px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.4);
    text-align: center;
    max-width: 520px;
    width: 90%;
}
.da-size-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--main);
    margin: 0 0 24px;
}
.da-continue-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 20px;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    background: var(--accent);
    color: var(--main-dark);
    font-family: inherit;
    transition: background .15s, transform .15s;
}
.da-continue-btn:hover { background: var(--accent-light); transform: translateY(-2px); }

/* 起動時モード選択（おえかき／ぬりえ） */
.da-mode-row-start { gap: 16px; margin-bottom: 4px; }
.da-mode-btn.da-mode-btn-lg {
    padding: 28px 16px;
    border-width: 2px;
    border-radius: 16px;
}
.da-mode-btn.da-mode-btn-lg svg { width: 30px; height: 30px; }
.da-mode-btn.da-mode-btn-lg span { font-size: 15px; }

/* ===== アプリ外枠 ===== */
.da-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ===== 固定ヘッダー ===== */
.da-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: var(--main);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    z-index: 10;
}
.da-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .02em;
    white-space: nowrap;
}
.da-header-spacer { flex: 1; }
.da-page-add-quick {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.14);
    color: #fff;
    transition: background .15s, transform .15s;
    padding: 0;
}
.da-page-add-quick svg {
    width: 18px; height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
}
.da-page-add-quick:hover { background: rgba(255,255,255,.26); transform: translateY(-1px); }

/* ===== ページナビゲーション（前へ／表示・タップで一覧／次へ） ===== */
.da-page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.da-page-arrow {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.14);
    color: #fff;
    padding: 0;
    transition: background .15s, transform .15s;
}
.da-page-arrow svg {
    width: 16px; height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-page-arrow:hover:not(:disabled) { background: rgba(255,255,255,.26); }
.da-page-arrow:disabled { opacity: .3; cursor: not-allowed; }

.da-page-pill-text {
    flex-shrink: 0;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.da-page-pill-text:hover { background: rgba(255,255,255,.26); }
.da-page-pill-text span { font-size: 15px; font-weight: 900; margin-left: 2px; }

/* ===== 全画面キャンバスエリア ===== */
.da-canvas-area {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}
/* 背景グラデーション プリセット（設定フライアウトから切り替え） */
.da-canvas-area.da-bg-ocean  { background: linear-gradient(135deg,#0ea5e9,#6366f1,#8b5cf6); }
.da-canvas-area.da-bg-sunset { background: linear-gradient(135deg,#f97316,#ec4899,#8b5cf6); }
.da-canvas-area.da-bg-forest { background: linear-gradient(135deg,#22c55e,#14b8a6,#0891b2); }
.da-canvas-area.da-bg-candy  { background: linear-gradient(135deg,#f472b6,#fb923c,#facc15); }
.da-canvas-area.da-bg-mono   { background: linear-gradient(135deg,#e2e8f0,#cbd5e1); }

.da-canvas-area canvas {
    display: block;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    cursor: crosshair;
    touch-action: none;
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

/* ===== 左 描画ツール ボタンドック ===== */
.da-tool-dock {
    position: fixed;
    left: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 10px;
    max-height: calc(100vh - 100px);
    z-index: 50;
}
.da-dbtn {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--main);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    transition: transform .15s, box-shadow .15s, background .15s, color .15s;
    padding: 0;
    flex-shrink: 0;
}
.da-dbtn svg {
    width: 22px; height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-dbtn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.da-dbtn:active { transform: translateY(0); }
.da-dbtn.active {
    background: var(--accent);
    color: var(--main-dark);
    box-shadow: 0 4px 14px rgba(212,175,55,.5);
}

/* ===== ホバー／タップで開くフライアウト（図形・色・太さ・背景の濃さ・設定 共通） ===== */
.da-dock-group { position: relative; flex-shrink: 0; }

.da-color-preview {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: block;
    border: 2px solid rgba(0,0,0,.1);
}

.da-flyout {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translate(-8px, -50%);
    margin-left: 12px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 999px;
    padding: 8px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s, transform .15s;
    z-index: 60;
    white-space: nowrap;
}
/* 右側ツールバー用：ボタンの左側に開く（縦積みのスライダー/スウォッチ表示） */
.da-flyout-left {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 12px;
    transform: translate(8px, -50%);
    border-radius: 16px;
    flex-direction: column;
    align-items: stretch;
    width: 190px;
    padding: 14px 16px;
    white-space: normal;
}
/* 色フライアウトは横一列表示（折り返さない） */
.da-flyout-color { border-radius: 999px; }

/* 左ドック用：右側に開く縦積みレイアウト（ぬりえ設定など複数スライダー用） */
.da-flyout-tall {
    flex-direction: column;
    align-items: stretch;
    width: 190px;
    padding: 14px 16px;
    white-space: normal;
    border-radius: 16px;
}
.da-modal-label-spaced { margin-top: 14px; }

/* 用紙サイズ（設定フライアウト内） */
.da-paper-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.da-paper-btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 64px;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text);
    background: #f8fafc;
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
}
.da-paper-btn:hover { border-color: var(--main-light); }
.da-paper-btn.active { border-color: var(--accent); background: #fff8e5; color: var(--main-dark); }

.da-settings-action {
    display: block;
    width: 100%;
    margin-top: 14px;
    border: none;
    border-radius: 10px;
    padding: 10px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    background: var(--main);
    color: #fff;
    font-family: inherit;
    transition: background .12s;
}
.da-settings-action:hover { background: var(--main-light); }

.da-dock-group:hover > .da-flyout,
.da-dock-group.da-flyout-open > .da-flyout {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
}

.da-fbtn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--main);
    flex-shrink: 0;
    transition: background .12s, transform .12s;
}
.da-fbtn svg {
    width: 20px; height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-fbtn:hover { transform: translateY(-2px); }
.da-fbtn.active { background: var(--accent); color: var(--main-dark); }

/* ===== ペン先選択（□/○） ===== */
.da-tip-row {
    display: flex;
    gap: 8px;
}
.da-tip-btn {
    flex: 1;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--main);
    transition: all .12s;
}
.da-tip-btn svg {
    width: 16px; height: 16px;
    fill: currentColor;
    stroke: none;
}
.da-tip-btn:hover { border-color: var(--main-light); }
.da-tip-btn.active { border-color: var(--accent); background: #fff8e5; color: var(--main-dark); }

/* ===== ぬりえ下絵の自由移動（トグル＋リセット） ===== */
.da-move-row {
    display: flex;
    gap: 8px;
}
.da-move-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: #f8fafc;
    color: var(--main);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    transition: all .12s;
}
.da-move-toggle svg {
    width: 16px; height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-move-toggle:hover { border-color: var(--main-light); }
.da-move-toggle.active { border-color: var(--accent); background: #fff8e5; color: var(--main-dark); }
.da-move-reset {
    width: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: #f8fafc;
    color: var(--main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.da-move-reset svg {
    width: 16px; height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-move-reset:hover { border-color: var(--main-light); }

/* ===== 背景グラデーション スウォッチ（設定フライアウト内） ===== */
.da-grad-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.da-grad-swatch {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .12s;
    padding: 0;
}
.da-grad-swatch[data-bg="ocean"]  { background: linear-gradient(135deg,#0ea5e9,#6366f1,#8b5cf6); }
.da-grad-swatch[data-bg="sunset"] { background: linear-gradient(135deg,#f97316,#ec4899,#8b5cf6); }
.da-grad-swatch[data-bg="forest"] { background: linear-gradient(135deg,#22c55e,#14b8a6,#0891b2); }
.da-grad-swatch[data-bg="candy"]  { background: linear-gradient(135deg,#f472b6,#fb923c,#facc15); }
.da-grad-swatch[data-bg="mono"]   { background: linear-gradient(135deg,#e2e8f0,#cbd5e1); }
.da-grad-swatch:hover { transform: scale(1.15); }
.da-grad-swatch.active { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ===== 右下 縦型アイコンツールバー ===== */
.da-toolbar {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 50;
}
.da-tbtn {
    width: 54px; height: 54px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--main);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
    transition: transform .15s, box-shadow .15s, background .15s, color .15s;
    padding: 0;
}
.da-tbtn svg {
    width: 24px; height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-tbtn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.da-tbtn:active { transform: translateY(0); }
.da-tbtn.da-primary { background: var(--accent); color: var(--main-dark); }
.da-tbtn.da-danger:hover { background: var(--danger); color: #fff; }
.da-tbtn.da-save:hover { background: var(--success); color: #fff; }
.da-tbtn:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: 0 4px 14px rgba(0,0,0,.2); }

/* ===== モーダル 共通 ===== */
.da-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    padding: 16px;
}
.da-modal-overlay.da-open { opacity: 1; pointer-events: auto; }
.da-modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: min(400px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.da-modal h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--main);
}
.da-modal-section { margin-bottom: 16px; }
.da-modal-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 8px;
}
.da-modal-label span { color: var(--main); font-size: 14px; }
.da-modal-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.da-modal-close {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    background: #f1f5f9;
    color: var(--main);
    font-family: inherit;
}
.da-modal-close:hover { background: #e2e8f0; }

/* ===== 色選択（左ドックのフライアウト内） ===== */
.da-qdot {
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--border);
    flex-shrink: 0;
    transition: transform 0.12s;
}
.da-qdot:hover { transform: scale(1.15); }
.da-qdot.active { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.da-custom-color-wrap {
    width: 30px; height: 30px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px dashed var(--text-light);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.da-custom-color-wrap input[type=color] {
    width: 40px; height: 40px;
    border: none; padding: 0; cursor: pointer; background: none;
}

/* ===== 横スライダー（太さ・背景の濃さ） ===== */
.da-hslider {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ===== ページ管理モーダル ===== */
.da-page-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 16px;
}
.da-page-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
    background: #f8fafc;
    transition: all .12s;
}
.da-page-item:hover { border-color: var(--main-light); }
.da-page-item.active { border-color: var(--accent); background: #fff8e5; }
.da-page-thumb {
    width: 48px; height: 36px;
    border-radius: 4px;
    border: 1px solid var(--border);
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}
.da-page-name { flex: 1; font-size: 13px; font-weight: 800; color: var(--text); }
.da-page-del {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: all .12s;
}
.da-page-del:hover { background: var(--danger); color: #fff; }

/* ===== 新しいページ：モード選択（おえかき／ぬりえ） ===== */
.da-mode-row {
    display: flex;
    gap: 10px;
}
.da-mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all .12s;
    font-family: inherit;
}
.da-mode-btn svg {
    width: 22px; height: 22px;
    fill: none;
    stroke: var(--main);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.da-mode-btn span { font-size: 12px; font-weight: 800; color: var(--text); }
.da-mode-btn:hover { border-color: var(--main-light); transform: translateY(-2px); }
.da-mode-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.da-mode-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.5;
}

/* ===== レスポンシブ ===== */
@media (max-width: 600px) {
    .da-app { height: 100svh; min-height: 100svh; }
    .da-title { font-size: 15px; }
    .da-tbtn { width: 46px; height: 46px; }
    .da-tbtn svg { width: 20px; height: 20px; }
    .da-toolbar { right: 12px; bottom: 12px; gap: 10px; }
    .da-dbtn { width: 40px; height: 40px; }
    .da-dbtn svg { width: 18px; height: 18px; }
    .da-tool-dock { left: 12px; bottom: 12px; gap: 8px; max-height: calc(100vh - 80px); }
    .da-fbtn { width: 36px; height: 36px; }
    .da-fbtn svg { width: 18px; height: 18px; }
    .da-flyout-left { width: 160px; padding: 12px 14px; }
    .da-page-arrow { width: 26px; height: 26px; }
    .da-page-arrow svg { width: 14px; height: 14px; }
    .da-page-pill-text { padding: 6px 10px; font-size: 11px; }
    .da-size-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .da-size-popup-inner { padding: 24px 20px; }
}

/* 共通可変道具BOX v1.1.0 */
/* 移動・可変の道具BOX */
.da-wrap.vtb-host .atb-toolbox{display:flex;position:fixed;right:16px;bottom:84px;width:244px;height:380px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 64px);padding:0;gap:0;align-items:stretch;flex-direction:column;background:#f5f7fc;border:2px solid #c8d3e3;border-radius:16px;box-shadow:0 6px 24px #13274240;overflow:hidden;z-index:1000;box-sizing:border-box;container-type:inline-size}
.da-wrap.vtb-host .atb-toolbox-head{display:flex;flex-shrink:0;height:44px;background:var(--navy,#1e3a5f);color:white;align-items:center}
.da-wrap.vtb-host .atb-toolbox-head button{border:0;background:transparent;color:white;height:44px;margin:0;padding:0 12px;font-family:inherit;font-size:16px;font-weight:bold;box-shadow:none;border-radius:0}
.da-wrap.vtb-host .atb-toolbox-grip{flex:1;text-align:left;cursor:move;touch-action:none;user-select:none}
.da-wrap.vtb-host .atb-toolbox-fold{width:40px;font-size:24px!important;cursor:pointer}
.da-wrap.vtb-host .atb-toolbox-body{display:grid;grid-template-columns:repeat(auto-fit,minmax(94px,1fr));align-content:start;gap:8px;padding:10px 10px 24px;overflow:auto;min-height:0;flex:1}
.da-wrap.vtb-host .atb-toolbox .atb-toolbar-group{display:contents;border-radius:0;box-shadow:none}
.da-wrap.vtb-host .atb-toolbox-body button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;width:100%;height:68px;min-height:48px;margin:0;padding:6px;border:1px solid #d7dfeb;border-radius:12px;background:white;color:var(--navy,#1e3a5f);box-shadow:0 2px 4px #13274212;cursor:pointer;font-family:inherit}
.da-wrap.vtb-host .atb-toolbox-body button.mode-on{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.da-wrap.vtb-host .atb-toolbox-body button:disabled{opacity:.35;cursor:default}
.da-wrap.vtb-host .atb-toolbox-body .atb-tool-icon{width:26px;height:26px;flex-shrink:0}
.da-wrap.vtb-host .atb-toolbox-body .atb-tool-label{font-size:13px;font-weight:bold;line-height:1.2;white-space:normal;text-align:center}
.da-wrap.vtb-host .atb-toolbox-resize{position:absolute;right:0;bottom:0;width:26px;height:24px;border:0;background:#e4eaf4;color:var(--navy,#1e3a5f);font-size:20px;cursor:nwse-resize;touch-action:none;padding:0;margin:0}
.da-wrap.vtb-host .atb-toolbox.atb-toolbox-compact .atb-toolbox-body{grid-template-columns:repeat(auto-fit,minmax(44px,1fr));padding:6px 6px 24px}
.da-wrap.vtb-host .atb-toolbox.atb-toolbox-compact .atb-toolbox-body button{width:44px;height:44px;min-height:44px;border-radius:50%;justify-self:center;gap:0}
.da-wrap.vtb-host .atb-toolbox.atb-toolbox-compact .atb-tool-label{display:none}
.da-wrap.vtb-host .atb-toolbox.atb-toolbox-compact button:has(img[hidden]) .atb-tool-label{display:block;font-size:10px}
.da-wrap.vtb-host .atb-toolbox-closed{height:44px!important;min-height:44px}
.da-wrap.vtb-host .atb-toolbox-closed .atb-toolbox-body,
.da-wrap.vtb-host .atb-toolbox-closed .atb-toolbox-resize{display:none}
.da-wrap.vtb-host .atb-toolbox button:focus-visible{outline:3px solid #4d97ff;outline-offset:-3px}


.da-wrap.vtb-host .atb-toolbox-layouts{display:flex;flex-shrink:0;gap:4px;padding:5px;background:#e7edf6}
.da-wrap.vtb-host .atb-toolbox-layouts button{flex:1;min-width:0;height:32px;margin:0;padding:2px;border:1px solid #c7d2e3;border-radius:7px;background:white;color:var(--navy,#1e3a5f);font-family:inherit;font-size:12px;font-weight:bold;cursor:pointer}
.da-wrap.vtb-host .atb-toolbox-layouts button[aria-pressed="true"]{background:var(--gold,#d4af37);border-color:var(--gold,#d4af37)}
.da-wrap.vtb-host .atb-toolbox[data-layout] .atb-toolbox-body{grid-template-columns:repeat(var(--atb-tool-columns),minmax(0,1fr))}
.da-wrap.vtb-host .atb-toolbox-closed .atb-toolbox-layouts{display:none}

/* 役割ごとの固定色。丸形・文字付きで共通。 */
.da-wrap.vtb-host .atb-toolbox-body button{--tool-bg:#eef1f5;--tool-border:#cbd2dc;--tool-ink:#394657;--tool-active:#465568;background:var(--tool-bg);border-color:var(--tool-border);color:var(--tool-ink)}
.da-wrap.vtb-host .atb-toolbox-body button[data-color="blue"]{--tool-bg:#e0edff;--tool-border:#9abce9;--tool-ink:#184d91;--tool-active:#245fa8}
.da-wrap.vtb-host .atb-toolbox-body button[data-color="orange"]{--tool-bg:#ffead4;--tool-border:#e6b07a;--tool-ink:#8b420c;--tool-active:#a64c10}
.da-wrap.vtb-host .atb-toolbox-body button[data-color="green"]{--tool-bg:#dcf2e5;--tool-border:#91c7a8;--tool-ink:#1d6342;--tool-active:#24734d}
.da-wrap.vtb-host .atb-toolbox-body button[data-color="purple"]{--tool-bg:#ede4fb;--tool-border:#bda2df;--tool-ink:#654091;--tool-active:#7045a1}
.da-wrap.vtb-host .atb-toolbox-body button[data-color="navy"]{--tool-bg:#e3eaf4;--tool-border:#9eafc7;--tool-ink:#1e3a5f;--tool-active:#1e3a5f}
.da-wrap.vtb-host .atb-toolbox-body button:hover:not(:disabled){box-shadow:0 0 0 2px var(--tool-border)}
.da-wrap.vtb-host .atb-toolbox-body button.mode-on{background:var(--tool-active);border-color:var(--tool-active);color:#fff;box-shadow:inset 0 0 0 2px #ffffff80}
.da-wrap.vtb-host .atb-toolbox-body button.mode-on img.atb-tool-icon{filter:brightness(0) invert(1)}


.da-wrap.vtb-host .atb-tool-icon{width:26px;height:26px;display:block;fill:currentColor}.da-wrap.vtb-host .atb-toolbox-settings svg{fill:currentColor}

.da-wrap.vtb-host .atb-toolbox [hidden]{display:none!important}
.da-wrap.vtb-host .atb-toolbox-grip{font-size:15px!important;line-height:1.2!important;min-width:0;white-space:normal}
.da-wrap.vtb-host .atb-toolbox-body>label,.da-wrap.vtb-host .atb-toolbox-body>select,.da-wrap.vtb-host .atb-toolbox-body>.tool-options,.da-wrap.vtb-host .atb-toolbox-body>.tool-info{grid-column:1/-1;min-width:0;margin:0;padding:6px;position:static;transform:none;background:transparent;box-shadow:none}
.da-wrap.vtb-host .atb-toolbox-body label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:14px;color:#1e3a5f}
.da-wrap.vtb-host .atb-toolbox-body select{min-width:0;max-width:100%;width:100%;height:44px;background:white;color:#1e3a5f;border:1px solid #c7d2e3;border-radius:8px;font-size:14px}
.da-wrap.vtb-host .atb-toolbox-body .tool-options{display:flex;flex-direction:column;gap:8px}
.da-wrap.vtb-host .atb-toolbox-body :is(.atb-toolbar-group,.piece-tools,nav){display:contents;position:static;transform:none;padding:0;background:none;box-shadow:none}
.da-wrap.vtb-host .atb-toolbox-body button{border-radius:12px!important;font-size:14px;line-height:1.3!important}
.da-wrap.vtb-host .atb-toolbox-body img.atb-tool-icon,.da-wrap.vtb-host .atb-toolbox-body svg.atb-tool-icon{width:26px!important;height:26px!important;fill:currentColor;stroke:none;touch-action:auto}
.da-wrap.vtb-host .atb-toolbox-head svg{width:24px!important;height:24px!important;fill:currentColor}
.da-wrap.vtb-host .atb-toolbox-compact .atb-toolbox-body button{border-radius:50%!important}
.da-wrap.vtb-host .atb-toolbox-body .tool-info{font-size:13px;text-align:center;color:#1e3a5f}
.da-wrap.vtb-host .atb-toolbox-body [aria-pressed=true]{background:var(--tool-active,#245fa8);color:white}
@media print{.da-wrap.vtb-host .atb-toolbox{display:none!important}}

.da-wrap{position:relative;isolation:isolate;height:100dvh;min-height:0;overflow:hidden}
.da-wrap .da-app{height:100%;min-height:0}.da-wrap .da-header,.da-wrap .da-tool-dock,.da-wrap .da-toolbar{display:none!important}
.da-wrap .da-canvas-area{height:100%;min-height:0}.da-wrap .atb-toolbox{position:absolute;left:16px;top:16px;min-width:160px;max-height:calc(100% - 16px)}
.da-wrap:has(.da-app.da-hidden) .atb-toolbox,.da-wrap:has(.da-app.da-hidden) .da-storage-status{display:none!important}
.da-wrap .atb-toolbox-head{gap:0}.da-wrap .atb-toolbox-grip{min-width:24px;white-space:nowrap;padding:0 6px;overflow:hidden}
.da-wrap .atb-toolbox-head .atb-toolbox-settings,.da-wrap .atb-toolbox-head .atb-toolbox-fold{display:flex;justify-content:center;align-items:center;flex:0 0 36px;width:36px;padding:0}
.da-wrap .da-toolbox-count{font-size:12px;white-space:nowrap;padding:4px 6px;background:#ffffff20;border-radius:8px;flex:0 0 auto}
.da-wrap .atb-toolbox-body svg.atb-tool-icon{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;display:block;margin:0}
.da-wrap .atb-toolbox-body button{box-sizing:border-box}.da-wrap .atb-toolbox-body .atb-tool-label{line-height:1.2}
.da-wrap .da-toolbox-panel{border:0;border-radius:18px;padding:24px;margin:auto;width:min(460px,calc(100vw - 32px));max-height:85dvh;overflow:auto;color:#1e3a5f;background:#fff;font-family:inherit}
.da-wrap .da-toolbox-panel::backdrop{background:#14274288}.da-wrap .da-toolbox-panel h2{font-size:20px;margin:0 0 16px}
.da-wrap .da-panel-body{display:flex;flex-direction:column;gap:12px}.da-wrap .da-panel-choices{display:flex;flex-wrap:wrap;gap:10px}
.da-wrap .da-panel-choices button{width:auto;min-width:80px;height:auto;min-height:64px;display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;border-radius:12px;padding:10px;border:1px solid #bdcde3;background:#eef4fb;color:#1e3a5f}
.da-wrap .da-panel-choices button svg{width:24px;height:24px}.da-wrap .da-panel-content{position:static!important;opacity:1!important;pointer-events:auto!important;transform:none!important;margin:0!important;box-shadow:none!important;border-radius:0!important;width:100%!important;padding:0!important;white-space:normal!important;flex-wrap:wrap!important}
.da-wrap .da-size-editor{display:grid;grid-template-columns:1fr auto;gap:10px}.da-wrap .da-size-editor input{width:100%;grid-row:2;grid-column:1/-1;min-height:32px;accent-color:#5469d7}
.da-wrap .da-panel-action,.da-wrap .da-panel-close,.da-wrap .da-panel-save button{min-height:44px;border:1px solid #bdcde3;border-radius:10px;padding:10px;background:#eef4fb;color:#1e3a5f;cursor:pointer;font:inherit}.da-wrap .da-panel-close{margin-top:18px;width:100%}.da-wrap .da-panel-save{display:flex;flex-direction:column;gap:10px}
.da-wrap .da-storage-status{position:absolute;bottom:5px;left:10px;right:10px;text-align:center;font-size:12px;color:#1e3a5f;pointer-events:none;background:#ffffffbb;z-index:2}
body.admin-bar .da-wrap{height:calc(100dvh - 32px)}@media(max-width:782px){body.admin-bar .da-wrap{height:calc(100dvh - 46px)}}.da-wrap:fullscreen{height:100dvh}

.da-wrap.vtb-host .atb-toolbox{position:absolute;max-height:calc(100% - 16px)}

/* ボタンに隣接する選択画面。端末の画面内に収める */
.da-wrap .da-toolbox-panel{position:fixed;margin:0;inset:auto;width:min(360px,calc(100vw - 16px));max-height:calc(100dvh - 16px)}
.da-wrap .da-modal-overlay .da-modal{position:fixed;margin:0;width:min(400px,calc(100vw - 16px));max-height:calc(100dvh - 16px)}
.da-wrap [data-da-close],.da-wrap .da-panel-close{display:none!important}
.da-wrap.vtb-host .atb-toolbox-body [hidden]{display:none!important}

/* 参考画像に合わせた小型ポップアップ */
.da-wrap .da-toolbox-panel{width:240px;max-width:calc(100vw - 16px);padding:14px;border:1px solid #1e3a5f;border-radius:14px;box-shadow:0 6px 24px #15294333}
.da-wrap .da-toolbox-panel>h2{display:none}
.da-wrap .da-toolbox-panel::backdrop{background:transparent}
.da-wrap .da-panel-body{gap:10px}
.da-wrap .da-panel-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.da-wrap .da-panel-choices button{min-width:0;width:100%;min-height:60px;padding:8px;font-size:12px;box-shadow:none}
.da-wrap .da-panel-choices button svg{width:22px;height:22px}
.da-wrap .da-flyout-color.da-panel-content{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;justify-items:center}
.da-wrap .da-qdot{width:32px;height:32px;margin:0}
.da-wrap .da-compact-custom{grid-column:1/-1;display:flex;flex-direction:column;align-items:center;gap:7px;padding:10px 0 2px;font-size:12px;width:100%}
.da-wrap .da-compact-custom .da-custom-color-wrap{width:42px;height:42px;border:0;border-radius:10px}
.da-wrap .da-compact-custom input[type=color]{width:52px;height:52px}
.da-wrap .da-size-editor{font-size:13px;gap:6px}
.da-wrap .da-modal-overlay{background:transparent;z-index:2000}
.da-wrap .da-modal-overlay .da-modal{width:280px;max-width:calc(100vw - 16px);padding:14px;border:1px solid #1e3a5f;border-radius:14px;box-shadow:0 6px 24px #15294333}
.da-wrap .da-modal h2{font-size:15px;margin-bottom:10px}
.da-wrap .da-panel-save button{padding:9px;font-size:12px;min-height:40px}

.da-wrap.vtb-host .atb-toolbox-head .da-toolbox-count-button{flex:0 0 auto;width:auto;min-width:38px;height:32px;padding:0 4px;margin:0 2px;border:0;border-radius:8px;background:#ffffff20;cursor:pointer;color:white;display:flex;align-items:center;justify-content:center}
.da-wrap .da-toolbox-count-button .da-toolbox-count{background:transparent;padding:0;pointer-events:none}
.da-wrap .da-toolbox-count-button:hover{background:#ffffff35}

.da-wrap svg.da-source-icon,.da-wrap.vtb-host .atb-toolbox-body svg.da-source-icon{fill:currentColor!important;stroke:none!important}
