.paint-page { width:min(1100px,100%); }
.paint-card { width:100%; max-width:none; }
.paint-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.back-link { color:var(--text, #30264a); text-decoration:none; font-weight:800; font-size:.82rem; letter-spacing:.08em; }
.paint-intro { margin:24px 0 20px; text-align:center; }
.paint-intro h1 { margin:4px 0 8px; font-size:clamp(2rem,6vw,3.5rem); letter-spacing:-.06em; }
.paint-intro h1 span { color:#8b5cf6; }
.paint-intro p:last-child { max-width:520px; margin:0 auto; color:var(--muted, #756b89); }
.paint-layout { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(220px,.65fr); gap:22px; align-items:start; }
.paint-board-panel,.paint-controls { min-width:0; }
.board-frame { width:100%; max-width:640px; margin:0 auto; aspect-ratio:1; position:relative; overflow:hidden; border:1px solid var(--border, #e5dcf7); border-radius:16px; background:#f8f6fc; touch-action:none; box-shadow:0 8px 30px #5b3b8614; }
#paintBoard { display:block; width:100%; height:100%; image-rendering:pixelated; image-rendering:crisp-edges; touch-action:none; cursor:crosshair; transform:translate3d(var(--pan-x, 0px),var(--pan-y, 0px),0) scale(var(--zoom, 1)); transform-origin:center; }
.board-loading { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:#f8f6fce8; color:#6d28d9; font-size:.78rem; font-weight:900; letter-spacing:.1em; }
.board-loading[hidden] { display:none; }
.board-tools { display:flex; align-items:center; justify-content:center; gap:9px; margin-top:12px; }
.board-tools button,.eraser-button { border:1px solid var(--border, #ded4f1); border-radius:10px; background:var(--surface, #fff); color:var(--text, #30264a); min-width:40px; min-height:40px; font-weight:800; cursor:pointer; }
#zoomLabel { min-width:48px; text-align:center; font-size:.8rem; font-weight:800; }
#resetView { padding:0 12px; font-size:.7rem; letter-spacing:.04em; }
.paint-hint { text-align:center; color:var(--muted, #756b89); font-size:.78rem; line-height:1.5; }
.paint-controls { display:flex; flex-direction:column; gap:16px; }
.control-section,.quota-card,.status-card { padding:16px; border:1px solid var(--border, #e5dcf7); border-radius:14px; background:var(--surface, #fff); }
.control-section h2 { margin:0 0 12px; font-size:.75rem; letter-spacing:.1em; }
.palette { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.palette-button { min-width:0; aspect-ratio:1; border:2px solid #00000012; border-radius:9px; cursor:pointer; position:relative; box-shadow:inset 0 0 0 1px #00000008; }
.palette-button[aria-pressed="true"] { outline:3px solid #8b5cf6; outline-offset:2px; }
.palette-button[aria-pressed="true"]::after { content:"✓"; position:absolute; inset:0; display:grid; place-items:center; color:var(--contrast, #fff); text-shadow:0 1px 4px #000; font-weight:900; }
.eraser-button { margin-top:13px; width:100%; }
.eraser-button[aria-pressed="true"] { outline:2px solid #8b5cf6; background:#f0e9ff; }
.quota-heading { color:var(--muted, #756b89); font-size:.68rem; font-weight:900; letter-spacing:.1em; }
.quota-count { margin:7px 0 10px; font-size:2rem; font-weight:900; line-height:1; }
.quota-count small { font-size:.66rem; letter-spacing:.06em; }
.quota-track { height:7px; overflow:hidden; border-radius:99px; background:var(--border, #e5dcf7); }
.quota-track span { display:block; width:100%; height:100%; background:#8b5cf6; transition:width .2s ease; }
.quota-card p { margin:11px 0 0; color:var(--muted, #756b89); font-size:.76rem; line-height:1.5; }
.status-card { display:flex; align-items:center; gap:8px; font-size:.75rem; font-weight:700; }
.connection-dot { width:8px; height:8px; flex:0 0 auto; border-radius:50%; background:#eab308; }
.connection-dot.online { background:#22c55e; }.connection-dot.offline { background:#ef4444; }
.status-spacer { flex:1; }.paint-footer { display:flex; flex-wrap:wrap; justify-content:center; gap:9px; margin-top:26px; color:var(--muted, #756b89); font-size:.76rem; }
.paint-notice { max-width:700px; margin:14px auto 0; text-align:center; color:var(--muted, #756b89); font-size:.7rem; line-height:1.5; }
[data-theme="dark"] .board-frame { background:#171321; }.dark .board-loading { background:#171321e8; }
[data-theme="dark"] .board-loading { background:#171321e8; color:#c4b5fd; }
[data-theme="dark"] .back-link { color:var(--text, #f2ecff); }
@media (max-width:720px) { .paint-layout { grid-template-columns:1fr; }.paint-controls { display:grid; grid-template-columns:1fr 1fr; }.control-section { grid-row:span 2; }.board-frame { border-radius:12px; }.paint-intro { margin-top:18px; }.paint-card { padding:18px 14px; } }
@media (max-width:420px) { .paint-controls { grid-template-columns:1fr; }.control-section { grid-row:auto; }.palette { grid-template-columns:repeat(6,minmax(0,1fr)); }.palette-button { border-radius:7px; }.board-tools { gap:6px; }.board-tools button { min-height:38px; } }

/* Canvas tool modes and explicit dark-theme contrast */
.mode-tools { display:flex; justify-content:center; gap:10px; margin:12px auto 0; }
.mode-button { display:flex; align-items:center; justify-content:center; gap:8px; min-height:42px; padding:0 16px; border:1px solid #7434d7; border-radius:11px; background:#7434d7; color:#fff; font-size:.76rem; font-weight:900; letter-spacing:.04em; cursor:pointer; box-shadow:0 0 0 2px #8b5cf633; transition:background-color .12s ease, transform .12s ease; }
.mode-button:hover { background:#6425c5; transform:translateY(-1px); }
.mode-button:active { transform:translateY(0); }
.mode-button:focus-visible { outline:3px solid #a78bfa; outline-offset:3px; }
.mode-button span { font-size:1.1rem; }
.mode-button[aria-pressed="true"] { color:#fff; background:#7434d7; border-color:#7434d7; }
#paintBoard { touch-action:none; }
html[data-theme="dark"] .control-section,
html[data-theme="dark"] .quota-card,
html[data-theme="dark"] .status-card,
html[data-theme="dark"] .board-tools button,
html[data-theme="dark"] .mode-button { background:#8b5cf6; border-color:#a78bfa; color:#fff; }
html[data-theme="dark"] .quota-heading,
html[data-theme="dark"] .quota-card p,
html[data-theme="dark"] .paint-hint,
html[data-theme="dark"] .paint-footer,
html[data-theme="dark"] .paint-notice,
html[data-theme="dark"] #zoomLabel { color:#d4c5e5; }
html[data-theme="dark"] .quota-count,
html[data-theme="dark"] .quota-count small,
html[data-theme="dark"] #connectionStatus,
html[data-theme="dark"] #lastUpdated,
html[data-theme="dark"] .control-section h2 { color:#f6f0ff; }
html[data-theme="dark"] .mode-button[aria-pressed="true"] { background:#8b5cf6; border-color:#a78bfa; color:#fff; }
html[data-theme="dark"] .quota-track { background:#49365a; }
html[data-theme="dark"] .eraser-button[aria-pressed="true"] { background:#49365a; }
@media (max-width:420px) { .mode-tools { gap:8px; }.mode-button { flex:1; padding:0 8px; } }
