/* Shared canvas-first layout; engine-specific drawing styles remain separate. */
[hidden] { display: none !important; }
body { gap: 8px; }
.site-header { padding: 6px 12px; }
.topbar { margin: 0 auto; gap: 8px; flex-direction: row; align-items: center; }
.topbar-copy { min-width: 0; text-align: right; align-items: flex-end; font-size: .8rem; }
.topbar-copy strong, .topbar-copy span { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-link { padding: 0 12px; box-shadow: none; }
.app { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 12px 16px; gap: 10px; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "header header" "canvas toolbar" "canvas control" "feedback feedback" "extras extras" "browser browser" "adult adult"; }
.app-header h1 { font-size: 1.25rem; margin: 0; }
.app-header p { font-size: .85rem; margin: 4px 0 0; }
.canvas-wrap { padding: 8px; gap: 4px; min-width: 0; }
.zoom-controls button { min-height: 44px; padding: 4px 10px; }
.toolbar { min-width: 0; padding: 10px; gap: 6px; }
.palette { grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: 6px; }
.color-swatch { height: 44px; min-width: 44px; position: relative; border: 2px solid #334155; }
.color-swatch.active { transform: none; outline: 2px solid #172554; outline-offset: 1px; }
.color-swatch.active::after { content: "✓"; position: absolute; right: 2px; bottom: 2px; color: #111827; background: white; border: 1px solid #111827; border-radius: 50%; width: 20px; height: 20px; font-size: 15px; line-height: 18px; }
.controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px; }
button, summary, .adult-area a, .mode-link { min-height: 44px; }
button { font-size: .9rem; }
.save-state, .export-state { margin: 2px 0; font-size: .85rem; }
.export-state { grid-area: feedback; }
.other-actions { grid-area: extras; background: white; border-radius: 12px; padding: 0 8px; }
.other-actions button { margin: 6px; }
.status { color: #475569; font-size: .85rem; }
summary { display: list-item; padding: 12px 8px; font-weight: bold; cursor: pointer; }
.advanced-options { border-top: 1px solid #e2e8f0; }
.advanced-options > div { margin: 8px 0; }
.gallery-browser { grid-area: browser; min-width: 0; background: white; border-radius: 14px; padding: 6px 12px; }
.asset-gallery { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); max-height: 420px; overflow: auto; gap: 10px; }
.asset-card { color: #172554; background: #fffaf3; min-height: 158px; }
.asset-card img { width: 100%; height: 112px; object-fit: contain; }
.asset-card small { font-weight: normal; color: #475569; }
.asset-card.active, .asset-card[aria-pressed="true"] { border: 3px solid #172554; }
.category-chip { min-height: 44px; font-size: .9rem; }
.category-filters { margin: 8px 0; }
.adult-area { grid-area: adult; padding: 6px 12px; border: 2px solid #d6c4a7; background: #fffaf3; border-radius: 14px; }
.adult-area p { color: #475569; line-height: 1.5; }
.adult-area nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.adult-area a { display: inline-flex; align-items: center; padding: 8px; color: #163a70; }
.consent-banner { position: static; box-shadow: none; margin: 8px 0; color: #172554; }
.site-footer { text-align: center; padding: 8px; font-size: .85rem; color: #475569; }
:where(button, a, input, select, summary):focus-visible, .color-swatch:focus-visible { outline: 3px solid #1447c4; outline-offset: 3px; box-shadow: 0 0 0 2px white; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "header" "canvas" "toolbar" "control" "feedback" "extras" "browser" "adult"; }
}
@media (orientation: landscape) and (max-height: 500px) and (min-width: 600px) {
  .app { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "header header" "canvas toolbar" "canvas control" "feedback feedback" "extras extras" "browser browser" "adult adult"; }
  .app { grid-template-areas: "header header" "canvas control" "canvas toolbar" "feedback feedback" "extras extras" "browser browser" "adult adult"; }
  .palette { display: flex; overflow-x: auto; padding: 3px; }
  .color-swatch { flex: 0 0 44px; }
  .app-header p, .hint, .topbar-copy span { display: none; }
}
@media print {
  body > * { display: none !important; }
  #printPreviewImage { display: block !important; max-width: 100%; max-height: 95vh; object-fit: contain; margin: auto; }
  body { display: block; background: white; }
}
