    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

    body {
      background-color: var(--bg);
      color: var(--fg);
      font-family: var(--font-body);
      overflow-x: hidden;
      min-height: 100vh;
      min-height: 100dvh;
      width: 100%;
      max-width: 100%;
      transition: background-color 0.3s, color 0.3s;
    }

    .app-container {
      display: grid;
      grid-template-columns: 1fr 400px;
      height: 100vh;
      height: 100dvh;
      width: 100%;
    }

    .sidebar-toggle { display: none; }

    @media (max-width: 1180px) {
      .app-container {
        grid-template-columns: 1fr;
        height: auto;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
      }
      .sidebar {
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
        width: 100%;
        box-sizing: border-box;
      }
      .preview-header { padding: 40px 30px 16px; }
      .site-nav { gap: 16px; font-size: 8px; letter-spacing: 0.15em; }
      .preview-content { padding: 64px 40px 100px; }

      .sidebar-toggle {
        position: fixed;
        right: 16px;
        bottom: 16px;
        z-index: 20;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 44px;
        padding: 10px 15px;
        border: 1px solid var(--fg);
        border-radius: 99px;
        background: var(--fg);
        color: var(--bg);
        box-shadow: 0 8px 24px rgba(0,0,0,0.2);
        font: 700 12px var(--font-body);
        cursor: pointer;
      }
      .sidebar-toggle-icon { font-size: 18px; line-height: 12px; }
      .sidebar-collapsed .sidebar { display: none; }
      .sidebar-collapsed .preview-area { min-height: 100vh; min-height: 100dvh; }
      .sidebar-collapsed .preview-content { min-height: calc(100vh - 120px); min-height: calc(100dvh - 120px); }
    }

    @media (max-width: 768px) {
      .preview-area { padding: 0; overflow-x: hidden; min-height: 100vh; min-height: 100dvh; }
      .preview-header { padding: 24px 20px; }
      .preview-content {
        padding: 48px 10px 60px;
        width: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - 120px);
        min-height: calc(100dvh - 120px);
      }
      .art-wrapper { 
        margin: 20px auto !important; 
        max-width: 100%;
      }
      .print-screen-btn { display: none; }
    }

    /* Snapshot Mode Overrides */
    body.snapshot-active {
      overflow: hidden;
      background-color: white !important;
    }

    body.snapshot-active .sidebar,
    body.snapshot-active .preview-header,
    body.snapshot-active .print-screen-btn,
body.snapshot-active .print-screen-row,
    body.snapshot-active .vision-toggle {
      display: none !important;
    }

    body.snapshot-active .sidebar-toggle { display: none !important; }

    body.snapshot-active .app-container {
      grid-template-columns: 1fr;
      height: 100vh;
      height: 100dvh;
      width: 100vw;
    }

    body.snapshot-active .preview-area {
      height: 100vh;
      height: 100dvh;
      background: white !important;
      cursor: pointer;
    }

    body.snapshot-active .preview-content {
      padding: 0;
      height: 100vh;
      height: 100dvh;
      width: 100vw;
    }

    /* Preview Area */
    .preview-area {
      display: flex;
      flex-direction: column;
      background: var(--bg);
      position: relative;
      overflow-x: hidden;
      overflow-y: auto;
      min-height: 500px;
      -webkit-overflow-scrolling: touch;
      transition: background-color 0.3s;
    }

    .preview-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 48px 60px 100px;
      min-height: min-content;
      position: relative;
    }

    .preview-header {
      position: relative;
      top: 0;
      left: 0;
      width: 100%;
      padding: 32px 40px;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 20px;
      z-index: 10;
      transition: background-color 0.3s;
      background: var(--bg);
    }

    .site-logo {
      height: 50px;
      width: auto;
      transition: filter 0.3s;
    }

    [data-theme='dark'] .site-logo {
      filter: invert(1) brightness(1.5);
    }

    .art-wrapper {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
      margin: auto;
      flex-shrink: 0;
    }

    [data-theme='dark'] .art-wrapper {
      box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    }


    .frame {
      padding: var(--frame-width-y) var(--frame-width-x);
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--frame-color, #1a1a1a); 
    }
    
    .frame-side {
      position: absolute;
      background-color: var(--frame-color, #1a1a1a);
      z-index: 2;
      background-repeat: no-repeat;
      background-size: cover;
    }

    .frame-top {
      top: 0; left: 0; right: 0; height: var(--frame-width-y);
      clip-path: polygon(0 0, 100% 0, calc(100% - var(--frame-miter)) 100%, var(--frame-miter) 100%);
      background-image: 
        linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.2) 100%),
        var(--frame-tex-h);
      background-position: bottom center;
    }

    .frame-bottom {
      bottom: 0; left: 0; right: 0; height: var(--frame-width-y);
      clip-path: polygon(var(--frame-miter) 0, calc(100% - var(--frame-miter)) 0, 100% 100%, 0 100%);
      background-image: 
        linear-gradient(0deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.3) 100%),
        var(--frame-tex-h);
      background-position: top center;
    }

    .frame-left {
      top: 0; left: 0; bottom: 0; width: var(--frame-width-x);
      clip-path: polygon(0 0, 100% var(--frame-miter), 100% calc(100% - var(--frame-miter)), 0 100%);
      background-image: 
        linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.25) 100%),
        var(--frame-tex-v);
      background-position: center right;
    }

    .frame-right {
      top: 0; right: 0; bottom: 0; width: var(--frame-width-x);
      clip-path: polygon(0 var(--frame-miter), 100% 0, 100% 100%, 0 calc(100% - var(--frame-miter)));
      background-image: 
        linear-gradient(270deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.25) 100%),
        var(--frame-tex-v);
      background-position: center left;
    }

    .matting {
      position: relative;
      z-index: 1;
      padding: var(--mat-width-y) var(--mat-width-x);
      background: var(--mat-color, #f4f4f4);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: none;
    }

    .artwork-container {
      position: relative;
      display: block;
      box-shadow: none;
    }

    .artwork-img {
      display: block;
      width: var(--art-width-px);
      height: var(--art-height-px);
      object-fit: cover;
      background: var(--bg);
    }

    .preview-placeholder {
      display: flex;
      align-items: center;
      justify-content: center;
      width: var(--art-width-px);
      height: var(--art-height-px);
      background: var(--bg);
      color: var(--muted);
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      text-align: center;
    }

    /* Shared control, hint, and mobile presentation rules live in assets/image-builder-ui-shared.css. */

    .standard-edition .upload-area,
    .standard-edition .vision-toggle,
    .standard-edition .sidebar-toggle,
    .standard-edition .format-grid,
    .standard-edition .refresh-btn,
    .standard-edition .control-group:first-of-type > .reset-btn:not(.reset-primary) { display: none !important; }

    .login-overlay { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
    .login-box { width: min(440px, 100%); padding: 60px 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; text-align: center; box-shadow: 0 50px 100px -20px rgba(0,0,0,.4); }
    .login-box img { height: 48px; width: auto; margin-bottom: 32px; }
    .login-box h1 { margin: 0 0 8px; font-size: 16px; letter-spacing: .24em; }
    .login-box p { margin: 0 0 24px; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
    .login-form { display: grid; gap: 16px; }
    .login-form input { width: 100%; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--fg); font: 16px var(--font-mono); text-align: center; letter-spacing: .1em; outline: none; }
    .login-form button { width: 100%; padding: 20px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; cursor: pointer; }
    .login-error { min-height: 16px; margin-top: 12px; color: var(--danger); font-size: 11px; }
    .builder-switch-fixed { display: none; position: fixed; top: 24px; right: 24px; z-index: 10001; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font: 700 10px var(--font-mono); letter-spacing: .08em; text-decoration: none; text-transform: uppercase; }
    body.standard-authenticated .builder-switch-fixed { display: inline-flex; }
    .builder-switch-fixed:hover { border-color: var(--accent); color: var(--accent); }
    .standard-logout { display: none; position: fixed; top: 24px; right: 130px; z-index: 10001; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font: 700 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
    body.standard-authenticated .standard-logout { display: inline-flex; }
    .standard-logout:hover { border-color: var(--accent); color: var(--accent); }
    @media (max-width: 480px) { .login-box { padding: 40px 24px; } .standard-logout { top: 68px; right: 24px; } }

    /* Brief non-blocking feedback for browser-local Standard settings persistence. */
    .standard-autosave-status {
      display: inline-flex;
      align-items: center;
      min-height: 20px;
      margin-left: auto;
      padding: 4px 7px;
      border: 1px solid var(--border);
      border-radius: 99px;
      color: var(--muted);
      background: var(--surface);
      font: 700 8px var(--font-mono);
      letter-spacing: .08em;
      opacity: 0;
      transform: translateY(-2px);
      pointer-events: none;
      transition: opacity .2s ease, transform .2s ease;
    }
    .standard-autosave-status.is-visible {
      opacity: 1;
      transform: translateY(0);
    }
    @media (max-width: 480px) {
      .standard-autosave-status {
        position: absolute;
        right: 22px;
        top: 70px;
      }
    }
