 :root {
      --primary: #f0515f;
      --primary-dark: #EE3A49;
      --secondary: #EE3A49;
      --light-bg: #F8FCFF;
      --border: #e1e5f1;
      --text: #333;
      --text-light: #666;
      --danger: #ff6b6b;
      --success: #06d6a0;
      --warning: #ffd166;
      --radius-sm: 4px;
  }

  * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Poppins', sans-serif;
  }

  body {
      background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
      min-height: 100vh;
      overflow: hidden;
      user-select: none;
  }

  #fileInput {
      display: none;
  }

  /* Browse Button */
  .primary {
      padding: 12px 20px;
      border: none;
      border-radius: var(--radius-sm);
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: white;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      box-shadow: 0 2px 6px rgba(27, 164, 200, 0.3);
  }

  .primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 3px 6px rgba(0,0,0,0.1);
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  }

  .primary:active {
      transform: translateY(0);
  }

  /* Main Layout */
  .app-container {
      display: flex;
      height: 100vh;
      width: 100vw;
      position: relative;
      background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
                  linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
                  linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
                  linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
      background-size: 20px 20px;
      background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  }

  .app-container.canvas-loaded {
      background: white !important;
  }

  /* Right Panel - Combined colors and tools */
  .right-panel {
      width: 115px;
      background: rgba(255, 255, 255, 0.98);
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 10px 5px;
      box-shadow: -2px 0 15px rgba(0, 0, 0, 0.08);
      z-index: 100;
      position: fixed;
      right: 0;
      top: 0;
      bottom: 0;
      transition: width 0.3s ease;
  }

  /* Panel Toggle Button - Now on left side */
  .panel-toggle-btn {
      position: absolute;
      left: -25px;
      top: 30px;
      transform: translateY(-50%);
      width: 25px;
      height: 40px;
      border-radius: 10px 0 0 10px;
      background: white;
      border: 1px solid var(--border);
      border-right: none;
      color: var(--text-light);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      transition: all 0.3s ease;
      z-index: 101;
      padding: 0;
      margin: 0;
  }

  .panel-toggle-btn:hover {
      background: var(--primary);
      color: white;
  }

  .panel-toggle-btn i {
      transition: transform 0.3s ease;
  }

  .panel-toggle-btn.expanded i {
      transform: rotate(180deg);
  }

  /* Expanded Panel State */
  .right-panel.expanded {
      width: 300px;
      transition: width 0.3s ease;
  }

  .right-panel.expanded .color-palette-container {
      width: 100%;
  }

  .right-panel.expanded .color-palette-vertical {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
      gap: 2px;
      padding: 10px;
      align-items: center;
      justify-items: center;
      max-height: calc(100% - 300px);
      overflow-y: auto;
  }

  .right-panel.expanded .color-box-vertical {
      width: 30px;
      height: 30px;
      min-width: 30px;
      min-height: 30px;
      border-radius: 6px;
      cursor: pointer;
      border: 1px solid transparent;
      transition: all 0.2s ease;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      position: relative;
      flex-shrink: 0;
  }

  .right-panel.expanded .color-box-vertical:hover {
      border-color: white;
      box-shadow: 0 0 0 2px var(--primary), 0 3px 8px rgba(0, 0, 0, 0.15);
      z-index: 1;
  }

  .right-panel.expanded .color-box-vertical.selected {
      border-color: white;
      box-shadow: 0 0 0 2px var(--primary), 0 3px 8px rgba(0, 0, 0, 0.15);
      z-index: 1;
  }

  /* Bottom Panel - Desktop only - Now with 8 buttons */
  .bottom-panel {
      position: fixed;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(255, 255, 255, 0.98);
      border: 1px solid var(--border);
      border-radius: 12px 12px 0 0;
      padding: 12px 25px;
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 12px;
      box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.08);
      z-index: 100;
      min-width: 550px;
      max-width: 90vw;
  }

  /* Main Area */
  .main-area {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      position: relative;
      overflow: hidden;
      margin: 0 80px 60px 20px;
      height: calc(100vh - 60px);
      width: calc(100vw - 100px);
      transition: margin-right 0.3s ease, width 0.3s ease;
  }

  .main-area.expanded-right {
      margin-right: 280px;
      width: calc(100vw - 300px);
  }

  /* Upload Area */
  .upload-area-main {
      border: 2px dashed var(--primary);
      border-radius: 8px;
      padding: 40px 30px;
      text-align: center;
      background-color: rgba(27, 164, 200, 0.03);
      cursor: pointer;
      transition: all 0.25s ease;
      max-width: 400px;
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      gap: 15px;
  }

  .upload-area-main:hover {
      background-color: rgba(27, 164, 200, 0.08);
      border-color: var(--primary-dark);
      transform: translateY(-2px);
      box-shadow: 0 12px 30px rgba(27, 164, 200, 0.15);
  }


  .upload-area-main i {
      font-size: 2.5rem;
      color: var(--primary);
  }

  .upload-area-main h3 {
      font-size: 1.1rem;
      margin: 0;
      color: var(--secondary);
      font-weight: 600;
  }

  .upload-area-main p {
      color: var(--text-light);
      font-size: 0.9rem;
      margin: 0;
  }

  #browseBtnMain {
      padding: 12px 25px !important;
      background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
      color: white !important;
      font-size: 14px !important;
      font-weight: normal !important;
      border: none !important;
      box-shadow: 0 2px 6px rgba(27, 164, 200, 0.3) !important;
      gap: 8px !important;
  }

  #browseBtnMain i {
      margin-right: 5px;
      font-size: 18px;
      color: #e7f2f6;
  }

  #browseBtnMain:hover {
      transform: translateY(-1px) !important;
      box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
      background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  }

  #browseBtnMain:active {
      transform: translateY(0) !important;
  }

  /* Color Palette */
  .color-palette-container {
      flex: 1;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      height: calc(100vh - 350px);
      min-height: 200px;
      max-height: calc(100vh - 350px);
  }

  .scroll-btn {
      width: 34px;
      height: 25px;
      border: none;
      background: white;
      color: var(--text-light);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      transition: all 0.2s ease;
      border-radius: 4px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      margin: 0;
      z-index: 2;
      position: relative;
  }

  .scroll-btn:hover {
      background: var(--primary);
      color: white;
  }

  .scroll-btn.holding {
      background: var(--primary);
      color: white;
      animation: pulse 0.5s infinite alternate;
  }

  @keyframes pulse {
      from { transform: scale(1); }
      to { transform: scale(0.95); }
  }

  .color-palette-vertical {
      width: 100%;
      max-height: calc(100% - 70px);
      overflow-y: auto;
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      align-items: center;
      justify-items: center;
      gap: 2px;
      padding: 8px 0;
      scrollbar-width: none;
  }

  .color-palette-vertical::-webkit-scrollbar {
      width: 3px;
  }

  .color-palette-vertical::-webkit-scrollbar-track {
      background: #f0f0f0;
      border-radius: 2px;
  }

  .color-palette-vertical::-webkit-scrollbar-thumb {
      background: var(--primary);
      border-radius: 2px;
  }

  .color-box-vertical {
      width: 30px;
      height: 30px;
      min-width: 30px;
      min-height: 30px;
      border-radius: 6px;
      cursor: pointer;
      border: 1px solid transparent;
      transition: all 0.2s ease;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      position: relative;
      flex-shrink: 0;
  }

  .color-box-vertical:hover {
      border-color: white;
      box-shadow: 0 0 0 2px var(--primary), 0 3px 8px rgba(0, 0, 0, 0.15);
  }

  .color-box-vertical.selected {
      border-color: white;
      box-shadow: 0 0 0 2px var(--primary), 0 3px 8px rgba(0, 0, 0, 0.15);
      z-index: 1;
  }

  /* Current Color Display - COMPACT VERSION */
  .current-color-display {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 5px;
      margin:  0;
      padding: 0;
      background: rgba(255, 255, 255, 0.95);
      position: relative;
      z-index: 2;
  }

  .color-input-row {
      display: flex;
      align-items: center;
      gap: 2px;
      width: 100%;
      padding: 0;
      margin-bottom: 5px;
      position: relative;
  }

  .current-color-preview {
      width: 30px;
      height: 30px;
      border-radius: 6px;
      border: 2px solid white;
      box-shadow: 0 0 0 1px var(--border), 0 2px 6px rgba(0, 0, 0, 0.15);
      cursor: pointer;
      flex-shrink: 0;
      position: relative;
  }

  .current-color-hex-input {
      flex: 1;
      min-width: 0;
      padding: 5px 8px;
      border: 1px solid var(--border);
      border-radius: 4px;
      font-size: 11px;
      font-family: monospace;
      color: var(--text);
      background: #f5f5f5;
      outline: none;
      transition: all 0.2s ease;
  }

  .current-color-hex-input:focus {
      border-color: var(--primary);
      background: white;
      box-shadow: 0 0 0 2px rgba(27, 164, 200, 0.2);
  }

  /* Hidden color picker input */
  .color-picker-input {
      position: absolute;
      opacity: 0;
      width: 30px;
      height: 30px;
      cursor: pointer;
      z-index: 10;
  }

  .color-picker-input::-webkit-color-swatch {
      border: none;
      border-radius: 4px;
  }

  .color-picker-input::-moz-color-swatch {
      border: none;
      border-radius: 4px;
  }

  /* Gradient Color Picker */
  .gradient-picker-container {
      width: 100%;
      margin-top: 5px;
  }

  .gradient-picker {
      width: 100%;
      height: 30px;
      border-radius: 6px;
      border: 2px solid var(--border);
      cursor: pointer;
      background: linear-gradient(90deg, 
          #ff0000 0%, 
          #ffff00 16.66%, 
          #00ff00 33.33%, 
          #00ffff 50%, 
          #0000ff 66.66%, 
          #ff00ff 83.33%, 
          #ff0000 100%);
      transition: all 0.2s ease;
  }

  .gradient-picker:hover {
      border-color: var(--primary);
      transform: scale(1.02);
  }

  .gradient-picker:active {
      transform: scale(0.98);
  }

  /* Bottom Tool Buttons */
  .bottom-tool-btn {
      width: 52px;
      height: 52px;
      border-radius: 10px;
      border: none;
      background: white;
      color: var(--text);
      font-size: 18px;
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  }

  .bottom-tool-btn:hover {
      background: #f8f9fa;
      color: var(--primary);
      transform: translateY(-2px);
      box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12);
  }

  .bottom-tool-btn.active {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: white;
      box-shadow: 0 6px 15px rgba(27, 164, 200, 0.3);
  }

  .bottom-tool-btn.danger {
      background: var(--danger);
      color: white;
  }

  .bottom-tool-btn.danger:hover {
      background: #ff5252;
  }

  /* Canvas Wrapper */
  .canvas-wrapper {
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;
      display: none;
      background: white;
  }

  #drawingCanvas {
      display: block;
      touch-action: none;
      cursor: crosshair;
  }

  /* Zoom Controls - Now with 6 buttons */
  .zoom-controls {
      position: absolute;
      bottom: 20px;
      right: 20px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      z-index: 100;
      backdrop-filter: blur(10px);
      padding: 10px;

  }

  .zoom-controls::before {
      content: '';
      position: absolute;
      top: 50%;
      right: 0;
      width: 1px;
      height: 80%;
      background: var(--border);
      transform: translateY(-50%);
  }

  .zoom-btn {
      width: 45px;
      height: 45px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.95);
      border: 1px solid var(--border);
      color: var(--text);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
      transition: all 0.2s ease;
  }

  .zoom-btn:hover {
      background: var(--primary);
      color: white;
      transform: scale(1.1);
  }

  .zoom-btn.active {
      background: var(--primary);
      color: white;
  }

  .zoom-btn.inactive {
      background: #f0f0f0;
      color: var(--text-light);
      opacity: 0.7;
  }

  .zoom-btn.inactive:hover {
      background: #e0e0e0;
      color: var(--text-light);
      transform: scale(1.1);
  }

  /* Status Bar */
  .status-bar {
      position: absolute;
      bottom: 20px;
      left: 20px;
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(10px);
      padding: 8px 15px;
      border-radius: 20px;
      font-size: 12px;
      color: var(--text-light);
      display: flex;
      gap: 15px;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
      z-index: 100;
      transition: left 0.3s ease;
  }

  .status-item {
      display: flex;
      align-items: center;
      gap: 5px;
  }

  /* Toast */
  .toast {
      position: fixed;
      top: 20px;
      right: 140px;
      background: #333;
      color: white;
      padding: 12px 20px;
      border-radius: 8px;
      font-size: 14px;
      z-index: 9999;
      opacity: 0;
      transform: translateY(-10px);
      transition: opacity 0.3s, transform 0.3s;
      max-width: 300px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
      pointer-events: none;
  }

  .toast.show {
      opacity: 1;
      transform: translateY(0);
  }

  .toast-success {
      background: var(--success);
  }

  .toast-error {
      background: var(--danger);
  }

  .toast-info {
      background: var(--primary);
  }

  /* Config Panel */
  .config-panel {
      position: fixed;
      top: 50%;
      right: -400px;
      transform: translateY(-50%);
      width: 350px;
      background: rgba(255, 255, 255, 0.98);
      backdrop-filter: blur(10px);
      border-radius: 12px 0 0 12px;
      box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
      padding: 20px;
      z-index: 9999;
      transition: right 0.4s ease;
      max-height: 90vh;
      overflow-y: auto;
  }

  .config-panel.open {
      right: 0;
  }

  /* Tool Options in Right Panel - MINIMALIST */
  .tool-options-section {
      width: 100%;
      margin-top: 15px;
      padding: 15px 0;
      border-top: 1px solid var(--border);
  }

  /* When panel is collapsed - minimalist style */
  .right-panel:not(.expanded) .tool-options-section {
      padding: 8px 5px;
  }

  .tool-option {
      display: none;
      width: 100%;
  }

  .tool-option.active {
      display: block;
  }

  .tool-option-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
      font-size: 14px;
      color: var(--secondary);
      font-weight: 600;
  }

  .right-panel:not(.expanded) .tool-option-header {
      display: none;
  }

  .tool-control {
      margin-bottom: 12px;
  }

  .right-panel:not(.expanded) .tool-control {
      margin-bottom: 8px;
  }

  .tool-control label {
      display: block;
      font-size: 12px;
      color: var(--text);
      margin-bottom: 4px;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 6px;
  }

  .right-panel:not(.expanded) .tool-control label {
      font-size: 10px;
      margin-bottom: 2px;
      text-align: center;
  }

  .right-panel:not(.expanded) .tool-control label i {
      display: none;
  }

  .tool-slider {
      width: 100%;
      height: 4px;
      -webkit-appearance: none;
      appearance: none;
      background: #e0e0e0;
      outline: none;
      border-radius: 2px;
      margin-bottom: 3px;
  }

  .right-panel:not(.expanded) .tool-slider {
      height: 3px;
  }

  .tool-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      border: 3px solid var(--primary);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .right-panel:not(.expanded) .tool-slider::-webkit-slider-thumb {
      width: 14px;
      height: 14px;
      border: 2px solid var(--primary);
  }

  .tool-value {
      font-size: 11px;
      color: var(--text-light);
      text-align: right;
      font-family: monospace;
  }

  .right-panel:not(.expanded) .tool-value {
      font-size: 10px;
      text-align: center;
      margin-top: 1px;
  }

  /* Tool tooltip info */
  .tool-tip {
      font-size: 9px;
      color: #999;
      margin-top: 2px;
      line-height: 1.2;
  }

  .right-panel:not(.expanded) .tool-tip {
      display: none;
  }

  /* Loader */
  .loader-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(5px);
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      gap: 20px;
      z-index: 9999;
  }

  .loader-spinner {
      width: 60px;
      height: 60px;
      border: 4px solid #e0e0e0;
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spin 1s linear infinite;
  }

  @keyframes spin {
      to { transform: rotate(360deg); }
  }

  .loader-text {
      font-size: 16px;
      color: var(--text);
      font-weight: 500;
  }

  /* Config panel header and close button */
  .config-panel-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
  }

  .config-panel-header h4 {
      font-size: 1rem;
      font-weight: 600;
      color: var(--secondary);
      margin: 0;
      display: flex;
      align-items: center;
      gap: 8px;
  }

  .config-close-btn {
      background: none;
      border: none;
      color: var(--text-light);
      cursor: pointer;
      font-size: 16px;
      padding: 5px;
      border-radius: 4px;
      transition: all 0.2s ease;
  }

  .config-close-btn:hover {
      color: var(--danger);
      background: rgba(255, 107, 107, 0.1);
  }

  /* Small loader animation */
  @keyframes spin-fast {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
  }

  .fa-spin-fast {
      animation: spin-fast 0.8s linear infinite;
      display: inline-block;
  }

  /* MOBILE PANELS */
  .mobile-tools-panel {
      display: none;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(255, 255, 255, 0.98);
      backdrop-filter: blur(10px);
      border-top: 1px solid var(--border);
      z-index: 100;
      padding: 10px;
      box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.1);
  }

  .mobile-color-palette {
      display: none;
      background: rgba(255, 255, 255, 0.98);
      backdrop-filter: blur(10px);
      border-top: 1px solid var(--border);
      padding: 12px;
      overflow-x: auto;
      max-height: 120px;
      position: fixed;
      bottom: 80px;
      left: 0;
      right: 0;
      z-index: 99;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  }

  .mobile-color-palette-container {
      display: flex;
      gap: 10px;
      align-items: center;
      min-width: max-content;
      padding: 0 5px;
  }

  .mobile-color-box {
      width: 30px;
      height: 30px;
      min-width: 30px;
      min-height: 30px;
      border-radius: 8px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: all 0.2s ease;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .mobile-color-box:hover {
      border: 2px solid var(--primary);
      transform: scale(1.05);
  }

  .mobile-color-box.selected {
      border: 2px solid white;
      box-shadow: 0 0 0 3px var(--primary), 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .mobile-current-color {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      border: 3px solid white;
      box-shadow: 0 0 0 1px var(--border), 0 2px 8px rgba(0, 0, 0, 0.15);
      margin-right: 10px;
      flex-shrink: 0;
      position: relative;
  }

  .mobile-tools-row {
      display: flex;
      justify-content: space-around;
      align-items: center;
      gap: 10px;
  }

  .mobile-tool-btn {
      width: 50px;
      height: 50px;
      border-radius: 10px;
      border: none;
      background: white;
      color: var(--text);
      font-size: 18px;
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  .mobile-tool-btn:hover {
      background: #f8f9fa;
      color: var(--primary);
      transform: translateY(-2px);
  }

  .mobile-tool-btn.active {
      background: linear-gradient(135deg, var(--primary), var(--primary-dark));
      color: white;
      box-shadow: 0 4px 12px rgba(27, 164, 200, 0.3);
  }

  .mobile-tool-btn.danger {
      background: var(--danger);
      color: white;
  }

  /* Responsive */
  @media (max-width: 1024px) {
      .main-area {
          margin: 0 70px 60px 20px;
          width: calc(100vw - 90px);
      }

      .main-area.expanded-right {
          margin-right: 250px;
          width: calc(100vw - 270px);
      }

      .bottom-panel {
          min-width: 500px;
      }

      .right-panel.expanded {
          width: 280px;
      }

      .toast {
          right: 120px;
      }
  }

  @media (max-width: 768px) {
      .main-area {
          margin: 0 60px 60px 20px;
          width: calc(100vw - 80px);
      }

      .main-area.expanded-right {
          margin-right: 220px;
          width: calc(100vw - 240px);
      }

      .bottom-panel {
          min-width: 450px;
          padding: 10px 15px;
          gap: 10px;
      }

      .bottom-tool-btn {
          width: 48px;
          height: 48px;
          font-size: 16px;
      }

      .color-box-vertical {
          width: 30px;
          height: 30px;
          min-width: 30px;
          min-height: 30px;
      }

      .right-panel.expanded {
          width: 260px;
      }

      .toast {
          right: 100px;
      }
  }

  @media (max-width: 480px) {
      .app-container {
          flex-direction: column;
          overflow-y: auto;
          height: auto;
          min-height: 100vh;
      }

      .main-area {
          margin: 10px;
          width: calc(100vw - 20px);
          height: auto;
          min-height: 300px;
          max-height: 60vh;
          padding: 10px;
          order: 1;
          overflow: visible;
      }

      .main-area.expanded-right {
          margin-right: 10px;
          width: calc(100vw - 20px);
      }

      /* Hide desktop panels on mobile */
      .right-panel,
      .bottom-panel {
          display: none !important;
      }

      /* Show mobile panels */
      .mobile-tools-panel {
          display: block;
          order: 3;
          position: relative;
          margin-top: auto;
      }

      .mobile-color-palette {
          display: block;
          position: relative;
          bottom: auto;
          order: 2;
          margin-top: 10px;
          max-height: 100px;
      }

      .canvas-wrapper {
          height: auto;
          max-height: 60vh;
          min-height: 300px;
      }

      #drawingCanvas {
          max-height: 60vh;
          min-height: 300px;
      }

      .toast {
          right: 20px;
          max-width: calc(100vw - 40px);
      }

      .status-bar {
          left: 20px;
          bottom: 10px;
          font-size: 10px;
          padding: 6px 12px;
          gap: 10px;
          display: none;
      }

      .zoom-controls {
          bottom: 10px;
          right: 10px;
          padding: 8px;
      }

      .zoom-btn {
          width: 40px;
          height: 40px;
          font-size: 14px;
      }

      .upload-area-main {
          padding: 30px 20px;
          max-width: 90vw;
          margin: 20px;
      }
  }

  /* Extra small devices */
  @media (max-width: 360px) {
      .mobile-tool-btn {
          width: 45px;
          height: 45px;
          font-size: 16px;
      }

      .mobile-color-box {
          width: 30px;
          height: 30px;
          min-width: 30px;
          min-height: 30px;
      }

      .mobile-current-color {
          width: 40px;
          height: 40px;
      }

      .status-bar {
          display: none;
      }
  }