/* ==========================================================================
   PAINT 3D ONLINE - AUTHENTIC STUDIO & GRAPHICS APPLICATION STYLES
   Inspired by Microsoft Paint 3D with modern Fluent Design aesthetics.
   ========================================================================== */

/* --------------------------------------------------------------------------
   App Frame & Workspace Layout
   -------------------------------------------------------------------------- */
.p3d-app-wrapper {
  width: 100%;
  background: var(--bg-page);
  padding: 16px 20px 40px;
  max-width: 1680px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .p3d-app-wrapper {
    padding: 8px 8px 30px;
  }
}

/* Tool Hero Section (Centered & Aligned with Site Design Principles) */
.about-hero-section.p3d-tool-hero {
  padding: 44px 0 34px 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.p3d-tool-hero .breadcrumbs-trail {
  padding: 0;
  margin-bottom: 14px;
}

.p3d-tool-hero .pill-badge {
  margin-bottom: 16px;
}

.p3d-tool-hero .about-page-title {
  margin: 0 0 16px 0;
}

.p3d-tool-hero .about-hero-box {
  max-width: 1040px;
}

.p3d-tool-hero .about-page-lead {
  max-width: 820px;
}

.hero-specs-row.p3d-tool-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.p3d-tool-specs .spec-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  font-size: 0.86rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.p3d-tool-specs .spec-item:hover {
  border-color: var(--p3d-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.p3d-tool-specs .spec-icon {
  font-size: 1.22rem;
  width: 1.22rem;
  height: 1.22rem;
  color: var(--p3d-blue);
  flex-shrink: 0;
}

body.theme-dark .p3d-tool-specs .spec-icon {
  color: var(--p3d-cyan);
}

@media (max-width: 1080px) {
  .hero-specs-row.p3d-tool-specs {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .hero-specs-row.p3d-tool-specs {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 100%;
    margin-top: 20px;
    padding-top: 16px;
  }

  .p3d-tool-specs .spec-item {
    font-size: 0.82rem;
    padding: 10px 14px;
    white-space: normal;
    text-align: center;
  }

  .about-hero-section.p3d-tool-hero {
    padding: 28px 0 20px 0;
  }
}

/* The standalone desktop-like window shell */
.p3d-window {
  display: flex;
  flex-direction: column;
  height: 840px;
  max-height: 88vh;
  min-height: 580px;
  background: #2b2b2b;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 1024px) {
  .p3d-window {
    height: 720px;
    max-height: 85vh;
  }
}

@media (max-width: 768px) {
  .p3d-window {
    height: 600px;
    max-height: 82vh;
    border-radius: var(--radius-sm);
  }
}

/* Window Fullscreen Mode */
.p3d-window.is-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  z-index: 99999;
  border-radius: 0;
  border: none;
}

/* Window Title Bar */
.p3d-titlebar {
  height: 38px;
  background: #1f1f1f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  color: #c8c8c8;
  flex-shrink: 0;
}

.p3d-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.p3d-title-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.p3d-doc-name {
  color: #f0f0f0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.p3d-save-status {
  font-size: 0.75rem;
  color: #8e8e8e;
}

.p3d-title-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.p3d-title-btn {
  background: transparent;
  color: #a0a0a0;
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.p3d-title-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Top Ribbon (Paint 3D Signature Main Ribbon)
   -------------------------------------------------------------------------- */
.p3d-ribbon {
  height: 52px;
  background: #252526;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
  gap: 8px;
}

/* Menu Button on Left */
.p3d-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.p3d-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.p3d-menu-btn .material-symbols-outlined {
  font-size: 1.15rem;
  color: #00a2ed;
}

/* Ribbon Tabs Scrollable Container */
.p3d-ribbon-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}

.p3d-ribbon-tabs::-webkit-scrollbar {
  display: none;
}

/* Individual Ribbon Tab */
.p3d-ribbon-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  color: #cccccc;
  font-size: 0.84rem;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  cursor: pointer;
}

.p3d-ribbon-tab .material-symbols-outlined {
  font-size: 1.18rem;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.p3d-ribbon-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.p3d-ribbon-tab.active {
  background: #0078d7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 120, 215, 0.4);
}

.p3d-ribbon-tab.active .material-symbols-outlined {
  transform: scale(1.05);
}

/* Right Ribbon Actions (Paste, Undo, Redo, Reset) */
.p3d-ribbon-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.p3d-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 4px 8px;
  background: transparent;
  color: #b0b0b0;
  font-size: 0.72rem;
  border-radius: 4px;
  min-width: 44px;
  height: 44px;
  transition: all var(--transition-fast);
  border: none;
}

.p3d-action-btn .material-symbols-outlined {
  font-size: 1.15rem;
}

.p3d-action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.p3d-action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Sub-Ribbon / Secondary Action Bar
   -------------------------------------------------------------------------- */
.p3d-subribbon {
  height: 42px;
  background: #202020;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  gap: 10px;
}

.p3d-sub-left,
.p3d-sub-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tool toggle buttons in subribbon */
.p3d-sub-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  color: #cccccc;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-sub-tool .material-symbols-outlined {
  font-size: 1.1rem;
}

.p3d-sub-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.p3d-sub-tool.active {
  background: rgba(0, 162, 237, 0.2);
  border-color: #00a2ed;
  color: #ffffff;
}

/* 3D View Toggle Button (Signature Paint 3D Feature) */
.p3d-3dview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ffffff;
  background: #333333;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-3dview-btn:hover {
  background: #444444;
  border-color: rgba(255, 255, 255, 0.3);
}

.p3d-3dview-btn.active {
  background: linear-gradient(135deg, #0078d7, #00a2ed);
  border-color: #00a2ed;
  box-shadow: 0 0 12px rgba(0, 162, 237, 0.5);
}

.p3d-3dview-btn .material-symbols-outlined {
  font-size: 1.15rem;
}

/* Zoom Slider & Controls */
.p3d-zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c0c0c0;
  font-size: 0.8rem;
}

.p3d-zoom-btn {
  background: transparent;
  color: #b0b0b0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 0.95rem;
}

.p3d-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.p3d-zoom-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #444444;
  border-radius: 2px;
  outline: none;
}

.p3d-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0078d7;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.p3d-zoom-percent {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-width: 44px;
  text-align: right;
  color: #e0e0e0;
}

.p3d-zoom-reset {
  font-size: 0.72rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: #aaaaaa;
}

.p3d-zoom-reset:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Main Workspace Body: Viewport + Right Sidebar
   -------------------------------------------------------------------------- */
.p3d-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #1b1b1c;
}

/* Viewport (Center Stage) */
.p3d-viewport {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Authentic Paint 3D 3D studio background gradient */
  background: radial-gradient(circle at 50% 30%, #54575b 0%, #3a3c3f 50%, #252628 100%);
  touch-action: none;
}

/* Studio stage grid & floor reflection plane */
.p3d-stage-floor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.25) 100%);
  pointer-events: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Viewport Pan/Zoom Wrapper */
.p3d-stage-container {
  position: relative;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

/* Checkered background pattern for transparent canvas */
.p3d-stage-container.transparent-pattern {
  background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
                    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
                    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #ffffff;
}

/* The primary 2D Drawing Canvas */
.p3d-canvas-2d {
  display: block;
  background: #ffffff;
  position: relative;
  z-index: 1;
  touch-action: none;
}

/* The transparent WebGL 3D Canvas layer */
.p3d-canvas-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
}

/* When 3D view is active, the entire viewport renders WebGL scene */
.p3d-viewport.is-3d-active .p3d-canvas-2d {
  display: none; /* In 3D mode, the 2D canvas is textured directly into the 3D scene */
}

.p3d-viewport.is-3d-active .p3d-canvas-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Interactive Overlay for 2D Selection & Gizmos */
.p3d-gizmo-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Floating Status / Instructions Pill */
.p3d-hint-pill {
  position: absolute;
  bottom: 12px;
  left: 14px;
  background: rgba(20, 20, 22, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 16px;
  color: #cfcfcf;
  font-size: 0.74rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 12;
  pointer-events: none;
}

.p3d-hint-pill .material-symbols-outlined {
  font-size: 1rem;
  color: #00a2ed;
}

/* --------------------------------------------------------------------------
   Gizmo / Selection Handles (Faithful to Paint 3D Figure 11 & Figure 18)
   -------------------------------------------------------------------------- */
.p3d-selection-box {
  position: absolute;
  border: 1.5px solid #00a2ed;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
  pointer-events: auto;
  cursor: move;
}

/* Corner & Edge Scale Handles */
.p3d-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 1.5px solid #0078d7;
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  z-index: 6;
}

.p3d-handle.tl { top: -6px; left: -6px; cursor: nwse-resize; }
.p3d-handle.tr { top: -6px; right: -6px; cursor: nesw-resize; }
.p3d-handle.bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.p3d-handle.br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.p3d-handle.tm { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.p3d-handle.bm { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.p3d-handle.lm { left: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.p3d-handle.rm { right: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* 3D Rotation Circular Gizmos */
.p3d-rot-handle {
  position: absolute;
  width: 28px;
  height: 28px;
  background: #ffffff;
  border: 1.5px solid #0078d7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0078d7;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  cursor: grab;
  transition: transform var(--transition-fast), background var(--transition-fast);
  z-index: 7;
}

.p3d-rot-handle:hover {
  background: #0078d7;
  color: #ffffff;
  transform: scale(1.12);
}

.p3d-rot-handle:active {
  cursor: grabbing;
}

/* Top: Roll (Z) */
.p3d-rot-handle.rot-z {
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
}

.p3d-rot-handle.rot-z:hover {
  transform: translateX(-50%) scale(1.12);
}

/* Right: Turn (Y) */
.p3d-rot-handle.rot-y {
  right: -42px;
  top: 50%;
  transform: translateY(-50%);
}

.p3d-rot-handle.rot-y:hover {
  transform: translateY(-50%) scale(1.12);
}

/* Bottom: Tilt (X) */
.p3d-rot-handle.rot-x {
  bottom: -42px;
  left: 50%;
  transform: translateX(-50%);
}

.p3d-rot-handle.rot-x:hover {
  transform: translateX(-50%) scale(1.12);
}

/* Left: Z-Depth Slider Handle */
.p3d-depth-handle {
  position: absolute;
  left: -48px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: #ffffff;
  border: 1.5px solid #0078d7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0078d7;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: ns-resize;
  pointer-events: auto;
  z-index: 7;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.p3d-depth-handle:hover {
  background: #0078d7;
  color: #ffffff;
  transform: translateY(-50%) scale(1.12);
}

/* Action button bar attached to active selection (Stamp, Commit, Make 3D) */
.p3d-selection-actions {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #1f1f1f;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 8;
}

.p3d-sel-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-sel-btn:hover {
  background: #0078d7;
}

.p3d-sel-btn .material-symbols-outlined {
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Right Sidebar (Tool Options & Properties)
   -------------------------------------------------------------------------- */
.p3d-sidebar {
  width: 330px;
  background: #252526;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: #dcdcdc;
  transition: transform var(--transition-base), width var(--transition-base);
  z-index: 20;
}

@media (max-width: 1024px) {
  .p3d-sidebar {
    width: 260px;
  }
}

/* Mobile responsive sidebar drawer */
@media (max-width: 768px) {
  .p3d-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 290px;
    max-width: 86vw;
    z-index: 100;
    transform: translateX(100%);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.65);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .p3d-sidebar.mobile-open {
    transform: translateX(0);
  }

  .p3d-sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    cursor: pointer;
  }

  .p3d-window.mobile-panel-open .p3d-sidebar-backdrop,
  .p3d-workspace.mobile-panel-open .p3d-sidebar-backdrop,
  .mobile-panel-open .p3d-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Floating toggle button for mobile sidebar */
.p3d-mobile-panel-toggle {
  display: none;
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 40;
  background: #0078d7;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-mobile-panel-toggle:hover {
  background: #0063b1;
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .p3d-mobile-panel-toggle {
    display: flex;
  }
}

.p3d-sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: #c8c8c8;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
}

.p3d-sidebar-close-btn:hover {
  color: #ffffff;
}

@media (max-width: 768px) {
  .p3d-sidebar-close-btn {
    display: block;
  }
}

/* Sidebar Section Headers */
.p3d-panel-title {
  padding: 16px 18px 10px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.p3d-panel-subtitle {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8f8f8f;
  margin: 14px 18px 8px;
  font-weight: 600;
}

.p3d-panel-content {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Brushes Grid (10 Media Options)
   -------------------------------------------------------------------------- */
.p3d-brushes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: 6px;
}

.p3d-brush-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  background: #303030;
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: #b8b8b8;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-brush-btn:hover {
  background: #3e3e3e;
  color: #ffffff;
}

.p3d-brush-btn.active {
  background: rgba(0, 120, 215, 0.25);
  border-color: #0078d7;
  color: #ffffff;
}

.p3d-brush-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p3d-brush-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.p3d-brush-label {
  font-size: 0.62rem;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Slider Controls (Thickness, Opacity)
   -------------------------------------------------------------------------- */
.p3d-slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p3d-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #c0c0c0;
}

.p3d-slider-val {
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #f0f0f0;
  width: 54px;
  text-align: center;
}

.p3d-range {
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: #404040;
  border-radius: 3px;
  outline: none;
}

.p3d-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0078d7;
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s;
}

.p3d-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* --------------------------------------------------------------------------
   Material Finish Dropdown (Matte, Gloss, Dull Metal, Polished Metal)
   -------------------------------------------------------------------------- */
.p3d-select-wrapper {
  position: relative;
}

.p3d-select {
  width: 100%;
  padding: 8px 12px;
  background: #333333;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 0.84rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.p3d-select:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.p3d-select:focus {
  border-color: #0078d7;
}

.p3d-select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #aaaaaa;
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Color Palette & Custom Color Swatch
   -------------------------------------------------------------------------- */
.p3d-color-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.p3d-active-swatch {
  flex: 1;
  height: 38px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  position: relative;
  cursor: pointer;
}

.p3d-eyedropper-btn {
  width: 38px;
  height: 38px;
  background: #333333;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-eyedropper-btn:hover {
  background: #444444;
}

.p3d-eyedropper-btn.active {
  background: #0078d7;
  border-color: #00a2ed;
}

.p3d-palette-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}

.p3d-swatch-btn {
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  outline: none;
}

.p3d-swatch-btn:hover {
  transform: scale(1.18);
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.p3d-swatch-btn.selected {
  outline: 2px solid #ffffff;
  outline-offset: -1px;
  z-index: 2;
}

.p3d-add-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.p3d-custom-color-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #333333;
  color: #e0e0e0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.p3d-custom-color-btn:hover {
  background: #444444;
  color: #ffffff;
}

.p3d-hidden-color-picker {
  opacity: 0;
  position: absolute;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* --------------------------------------------------------------------------
   2D Shapes Panel Styles
   -------------------------------------------------------------------------- */
.p3d-lines-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.p3d-shape-item-btn {
  aspect-ratio: 1;
  background: #303030;
  border: 1.5px solid transparent;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b8b8b8;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-shape-item-btn:hover {
  background: #3e3e3e;
  color: #ffffff;
}

.p3d-shape-item-btn.active {
  background: rgba(0, 120, 215, 0.25);
  border-color: #0078d7;
  color: #ffffff;
}

.p3d-shape-item-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.p3d-shapes-2d-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

/* --------------------------------------------------------------------------
   3D Shapes Panel Styles
   -------------------------------------------------------------------------- */
.p3d-doodles-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.p3d-3d-objects-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.p3d-3d-models-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

/* --------------------------------------------------------------------------
   Stickers Panel Styles
   -------------------------------------------------------------------------- */
.p3d-sticker-subtabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
}

.p3d-sticker-subtab {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #999999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.p3d-sticker-subtab.active {
  color: #00a2ed;
  border-bottom-color: #00a2ed;
}

.p3d-stickers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.p3d-sticker-card {
  aspect-ratio: 1;
  background: #303030;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  overflow: hidden;
  padding: 6px;
}

.p3d-sticker-card:hover {
  background: #3e3e3e;
  border-color: #0078d7;
  transform: scale(1.05);
}

.p3d-sticker-card svg,
.p3d-sticker-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.p3d-custom-sticker-upload {
  width: 100%;
  padding: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #cccccc;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-custom-sticker-upload:hover {
  border-color: #00a2ed;
  background: rgba(0, 162, 237, 0.08);
}

/* --------------------------------------------------------------------------
   Text Panel Styles
   -------------------------------------------------------------------------- */
.p3d-text-mode-row {
  display: flex;
  gap: 8px;
}

.p3d-text-mode-btn {
  flex: 1;
  padding: 8px;
  background: #303030;
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: #cccccc;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-text-mode-btn:hover {
  background: #3e3e3e;
}

.p3d-text-mode-btn.active {
  background: rgba(0, 120, 215, 0.25);
  border-color: #0078d7;
  color: #ffffff;
}

.p3d-text-format-row {
  display: flex;
  gap: 4px;
}

.p3d-format-btn {
  flex: 1;
  padding: 6px;
  background: #303030;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #cccccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
}

.p3d-format-btn:hover {
  background: #3e3e3e;
}

.p3d-format-btn.active {
  background: #0078d7;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Effects Panel & Interactive Light Wheel
   -------------------------------------------------------------------------- */
.p3d-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.p3d-filter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #b0b0b0;
}

.p3d-filter-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.p3d-filter-btn:hover .p3d-filter-swatch {
  transform: scale(1.1);
}

.p3d-filter-btn.active .p3d-filter-swatch {
  border-color: #ffffff;
  outline: 2px solid #0078d7;
}

.p3d-filter-name {
  font-size: 0.7rem;
}

/* Authentic Light Wheel Dial */
.p3d-light-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.p3d-light-wheel {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  position: relative;
  cursor: crosshair;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(0, 0, 0, 0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.p3d-light-indicator {
  position: absolute;
  width: 28px;
  height: 28px;
  background: #ffb900;
  color: #1a1a1a;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(255, 185, 0, 0.8);
  font-size: 1rem;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* --------------------------------------------------------------------------
   Canvas Panel Styles (Resize, Transparent Canvas, Rotate/Flip)
   -------------------------------------------------------------------------- */
.p3d-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.p3d-switch-label {
  font-size: 0.84rem;
  color: #e0e0e0;
}

/* Toggle Switch */
.p3d-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.p3d-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.p3d-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #444444;
  transition: 0.3s;
  border-radius: 22px;
}

.p3d-switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
}

.p3d-switch input:checked + .p3d-switch-slider {
  background-color: #0078d7;
}

.p3d-switch input:checked + .p3d-switch-slider:before {
  transform: translateX(22px);
}

.p3d-canvas-dim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.p3d-dim-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.p3d-dim-input-group label {
  font-size: 0.74rem;
  color: #999999;
}

.p3d-dim-input {
  width: 100%;
  padding: 6px 10px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  outline: none;
}

.p3d-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #cccccc;
  cursor: pointer;
}

.p3d-transform-btn-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.p3d-transform-btn {
  aspect-ratio: 1.2;
  background: #303030;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #cccccc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.p3d-transform-btn:hover {
  background: #3e3e3e;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Menu Screen Overlay (Authentic Paint 3D Figure 22 / Welcome Screen)
   -------------------------------------------------------------------------- */
.p3d-menu-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 30, 32, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.p3d-menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.p3d-menu-nav {
  width: 220px;
  background: #202022;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
}

.p3d-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: transparent;
  color: #cccccc;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.p3d-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.p3d-menu-item.active {
  background: rgba(0, 120, 215, 0.2);
  color: #00a2ed;
  border-left: 3px solid #00a2ed;
}

.p3d-menu-item.back-btn {
  color: #00a2ed;
  font-weight: 600;
  margin-bottom: 8px;
}

.p3d-menu-panel {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  color: #ffffff;
}

.p3d-menu-panel h2,
.p3d-dialog-heading {
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 700;
  color: #ffffff;
}

.p3d-dialog-subheading {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #ffffff;
}

.p3d-export-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 900px;
}

.p3d-export-card {
  background: #2a2a2d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: #ffffff;
  font-family: inherit;
  width: 100%;
}

.p3d-export-card:hover {
  background: #333336;
  border-color: #0078d7;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.p3d-export-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(0, 120, 215, 0.15);
  color: #00a2ed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.p3d-export-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.p3d-export-desc {
  font-size: 0.82rem;
  color: #aaaaaa;
  line-height: 1.5;
}

/* Saved Projects Grid */
.p3d-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.p3d-saved-card {
  background: #2a2a2d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.p3d-saved-card:hover {
  border-color: #0078d7;
  transform: translateY(-2px);
}

.p3d-saved-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a1a1a;
  object-fit: cover;
}

.p3d-saved-meta {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p3d-saved-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #ffffff;
}

.p3d-saved-date {
  font-size: 0.72rem;
  color: #888888;
}

.p3d-saved-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.p3d-saved-card:hover .p3d-saved-delete-btn {
  opacity: 1;
}

.p3d-saved-delete-btn:hover {
  background: #e81123;
}

/* --------------------------------------------------------------------------
   Supporting Documentation Section Below Studio
   -------------------------------------------------------------------------- */
.p3d-docs-section {
  padding: 56px 0 70px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-subtle);
}

.p3d-docs-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.p3d-docs-section .section-header {
  max-width: 820px;
  margin: 0 auto 48px auto;
  text-align: center;
}

.p3d-guide-subblock {
  margin-top: 64px;
  padding-top: 52px;
  border-top: 1px solid var(--border-subtle);
}

.p3d-guide-subblock .section-header {
  margin-bottom: 36px;
}

/* Features Grid */
.p3d-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-bottom: 30px;
}

.p3d-doc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.p3d-doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.p3d-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--p3d-cyan-light);
  color: var(--p3d-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

body.theme-dark .p3d-card-icon {
  color: var(--p3d-cyan);
}

.p3d-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.p3d-card-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* How to Use Steps */
.p3d-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.p3d-step-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.p3d-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--p3d-blue);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.p3d-step-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.p3d-step-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

.p3d-step-body kbd {
  font-family: inherit;
  font-size: 0.8rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 1px 5px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

/* Formats Grid */
.p3d-formats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.p3d-format-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.p3d-format-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--p3d-blue);
  background: rgba(0, 120, 215, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.p3d-format-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.p3d-format-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Comparison / Specs Table */
.p3d-specs-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-top: 24px;
}

.p3d-specs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.p3d-specs-table th {
  background: var(--table-head-bg);
  padding: 14px 18px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

.p3d-specs-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.55;
}

.p3d-specs-table tbody tr:last-child td,
.p3d-specs-table tbody tr:last-child th {
  border-bottom: none;
}

.p3d-specs-table a {
  color: var(--p3d-blue);
  text-decoration: underline;
  font-weight: 500;
}

.p3d-specs-table a:hover {
  color: var(--p3d-cyan);
}

/* FAQs List */
.p3d-faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.p3d-faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 24px;
}

.p3d-faq-question {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.p3d-faq-answer {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

.p3d-faq-answer a {
  color: var(--p3d-blue);
  text-decoration: underline;
  font-weight: 500;
}

.p3d-faq-answer a:hover {
  color: var(--p3d-cyan);
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Mobile & Responsive Enhancements for Paint 3D Online
   ========================================================================== */
@media (max-width: 768px) {
  /* Ribbon Layout */
  .p3d-ribbon {
    padding: 0 8px;
    gap: 6px;
    height: 48px;
  }

  .p3d-menu-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .p3d-ribbon-tabs {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .p3d-ribbon-tabs::-webkit-scrollbar {
    display: none;
  }

  .p3d-ribbon-tab {
    padding: 6px 10px;
    font-size: 0.8rem;
    gap: 4px;
    flex-shrink: 0;
  }

  .p3d-ribbon-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .p3d-action-btn {
    min-width: 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 4px;
    justify-content: center;
  }

  .p3d-action-btn span:not(.material-symbols-outlined) {
    display: none;
  }

  /* Sub-ribbon Secondary Controls */
  .p3d-subribbon {
    height: 40px;
    padding: 0 8px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .p3d-subribbon::-webkit-scrollbar {
    display: none;
  }

  .p3d-sub-left {
    gap: 4px;
    flex-shrink: 0;
  }

  .p3d-sub-tool {
    padding: 4px 8px;
    font-size: 0.76rem;
    gap: 4px;
    white-space: nowrap;
  }

  .p3d-sub-tool .material-symbols-outlined {
    font-size: 1rem;
  }

  .p3d-3dview-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .p3d-zoom-slider,
  .p3d-zoom-percent,
  .p3d-zoom-reset {
    display: none !important;
  }

  .p3d-zoom-control {
    gap: 2px;
  }

  .p3d-zoom-btn {
    width: 26px;
    height: 26px;
    font-size: 0.95rem;
  }

  /* Hide floating tools toggle when sidebar is open */
  .p3d-workspace.mobile-panel-open .p3d-mobile-panel-toggle,
  .p3d-window.mobile-panel-open .p3d-mobile-panel-toggle,
  .mobile-panel-open .p3d-mobile-panel-toggle {
    display: none !important;
    pointer-events: none !important;
  }
}

@media (max-width: 520px) {
  .p3d-zoom-control {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .p3d-docs-grid,
  .p3d-steps-grid,
  .p3d-formats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .p3d-doc-card,
  .p3d-step-box,
  .p3d-format-card,
  .p3d-faq-item {
    padding: 18px 16px;
  }

  .p3d-specs-table-wrap {
    margin-top: 16px;
    border-radius: var(--radius-sm);
  }

  .p3d-specs-table th,
  .p3d-specs-table td {
    padding: 12px 14px;
    font-size: 0.84rem;
  }
}
