.view-top > div:first-child { min-width: 0; }
.view-actions { display: flex; align-items: flex-start; gap: 10px; flex-shrink: 0; }
.view-actions #fullscreen { pointer-events: auto; min-height: 40px; background: #fffffff0; color: #171717; font-size: 12px; padding: 9px 12px; }
@media (max-width: 1099px) {
  .view-actions { gap: 5px; }
  .view-actions #fullscreen { min-width: 40px; padding: 6px; font-size: 20px; }
  .view-actions #fullscreen span { display: none; }
}
@media (max-width: 480px) {
  .view-actions .live-pill { display: none; }
}
/* Desktop studio: the design fills the viewport; only the options scroll. */
@media (min-width: 721px) {
  body {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  .studio {
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }
  .visual {
    position: relative;
    top: auto;
    height: 100%;
    min-height: 0;
    max-height: none;
  }
  .configuration {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
  }
  .config-heading { padding: 16px 22px 12px; }
  .config-heading h2 { font-size: 20px; margin-block: 7px; }
  .config-heading p { margin-bottom: 0; }
  #steps {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px 12px;
    overflow: visible;
  }
  #steps button { padding: 10px 5px; text-align: left; }
  #panel {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scroll-padding-block: 20px;
    padding: 20px 22px 28px;
  }
  #panel:focus-visible { outline: 3px solid var(--ram-orange); outline-offset: -3px; }
  .config-footer { position: static; padding: 14px 22px; }
  .view-top { top: 20px; left: 24px; right: 24px; }
  .visual:fullscreen { height: 100dvh; }
}
@media (min-width: 1600px) {
  .studio { grid-template-columns: minmax(0, 1fr) 440px; }
}
@media (min-width: 721px) and (max-width: 1099px) {
  .studio { grid-template-columns: minmax(0, 1fr) 340px; }
  .config-heading, #panel { padding-inline: 16px; }
  .config-footer { padding-inline: 16px; }
}
@media (min-width: 721px) and (max-height: 650px) {
  .masthead { height: 70px; }
  .config-heading { padding-block: 10px; }
  .config-heading > .eyebrow, .config-heading > p { display: none; }
  .config-heading h2 { margin: 0; font-size: 18px; }
  .config-footer { padding-block: 10px; }
  .view-top { top: 12px; }
  .view-top h1 { font-size: 24px; }
  .gesture { display: none; }
}

/* Door symbols identify live 3D choices without implying a catalogue photo. */
.option-preview > svg { display:block; width:100%; height:100%; }
[data-live-preview] .option-preview-status { inset:auto 0 0; border-radius:0; background:#ffffffe8; font-size:10px; }

/* Phones use two real regions: image above, independently scrollable choices below. */
@media (max-width: 899px) {
  html { height: 100%; }
  body { height: 100vh; height: var(--ram-viewport-height,100dvh); display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
  .masthead { height: 68px; min-height: 68px; padding: 6px max(12px,env(safe-area-inset-right)) 6px max(12px,env(safe-area-inset-left)); gap: 10px; }
  .wordmark { gap: 7px; min-width: 0; }
  .wordmark img { width: 38px; height: 38px; flex: none; }
  .wordmark strong { font-size: 13px; letter-spacing: .2px; }
  .wordmark small { font-size: 8px; letter-spacing: 1px; }
  .studio-links { display: none; }
  .masthead .text-button { min-height: 44px; max-width: none; font-size: 12px; padding: 10px; }
  .studio { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(180px,45vh) minmax(0,1fr); grid-template-rows: minmax(180px,min(48svh,calc(var(--ram-viewport-height,100dvh) - 288px))) minmax(0,1fr); overflow: hidden; }
  .visual { position: relative; top: auto; height: 100%; min-height: 0; max-height: none; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto; z-index: 1; }
  .view-top,
  .photo-active .view-top { grid-area: 1/1; position: relative; inset: auto; display: flex; min-height: 52px; padding: 5px 10px; background: #f7f7f1; color: #171717; text-shadow: none; }
  .view-top .eyebrow { display: none; }
  .view-top h1,
  .photo-active .view-top h1 { font-size: 15px; font-weight: 800; line-height: 1.2; letter-spacing: -.2px; margin: 3px 0; }
  #dimensions-label { font-size: 11px; line-height: 1.3; }
  .view-actions { gap: 4px; }
  .view-actions .live-pill { display: none; }
  .view-actions #fullscreen { min-width: 44px; min-height: 44px; padding: 5px; }
  #viewer,#photo-stage,#render-stage,#plan { grid-area: 2/1; position: relative; inset: auto; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
  #plan { padding: 12px 24px; }
  #hero-render { object-fit: contain; background: #e6e7e1; }
  #photo-stage:after { background: none; }
  #photo-caption { left: 8px; right: 8px; bottom: 6px; padding: 6px 8px; max-height: 64px; overflow-y: auto; background: #151515c9; border-radius: 5px; }
  #photo-caption strong { font-size: 12px; }
  #photo-caption p { font-size: 11px; line-height: 1.4; margin: 4px 0 6px; max-width: none; }
  #photo-caption button { min-height: 44px; font-size: 12px; }
  .no-render #photo-caption { inset: 8px; max-height: none; background: #f7f7f1; }
  #photo-load-status { font-size: 11px; }
  .view-bottom,
  .photo-active .view-bottom { grid-area: 3/1; position: relative; inset: auto; padding: 4px 6px 6px; gap: 4px; width: 100%; background: #f7f7f1; }
  .view-tabs { width: 100%; padding: 2px; gap: 2px; border: 1px solid #ddd; box-shadow: none; }
  .view-tabs button,
  .view-tabs .extra-view { flex: 1; min-width: 0; min-height: 44px; font-size: 12px; padding: 8px 5px; margin: 0; border-left: 0; }
  .toolbar { display: flex; flex-wrap: nowrap; justify-content: flex-start; width: 100%; max-width: none; overflow-x: auto; overscroll-behavior-x: contain; gap: 5px; padding: 1px; }
  .toolbar > * { flex: none; }
  .toolbar button,.toolbar select { min-height: 44px; min-width: 44px; font-size: 13px; padding: 8px 10px; }
  .toolbar select { font-size: 16px; max-width: 150px; }
  .toolbar #minus,.toolbar #plus { display: inline-block; }
  .visual-note,.gesture { display: none; }
  #render-status { left: 8px; right: 8px; bottom: 8px; max-width: calc(100% - 16px); font-size: 11px; }
  #render-options { top: 60px; right: 8px; max-width: 220px; }
  #render-options summary { min-height: 44px; padding: 12px; font-size: 12px; }
  #render-options[open] { width: 260px; max-height: calc(100% - 120px); overflow-y: auto; }
  #render-options dl,#render-options p { font-size: 12px; }
  .configuration { min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; border-left: 0; overflow: hidden; }
  .config-heading { display: none; }
  #steps { position: relative; top: auto; display: flex; justify-content: flex-start; overflow-x: auto; padding: 0 6px; min-width: 0; overscroll-behavior-x: contain; }
  #steps button { flex: none; min-height: 44px; font-size: 12px; padding: 10px; }
  #panel { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding: 16px 14px 24px; scroll-padding-block: 16px; }
  #panel input,#panel textarea { scroll-margin-block: 20px; }
  .config-footer { position: relative; padding: 8px 12px max(8px,env(safe-area-inset-bottom)); gap: 8px; }
  .config-footer button { min-height: 44px; font-size: 13px; padding: 9px 12px; }
  .config-footer strong { font-size: 12px; }
  .config-footer small { font-size: 10px; }
  .visual-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .visual-option strong { font-size: 12px; }
  .visual-field legend { font-size: 14px; }
  .field input:not([type=range]),.field select,textarea { font-size: 16px; min-height: 44px; }
  .render-filters button,.point-row button { min-height: 44px; }
  .point-row input { min-height: 44px; font-size: 16px; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) .studio { grid-template-rows: minmax(80px,calc(var(--ram-viewport-height,100dvh) * .22)) minmax(0,1fr); }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) .view-top { display: none; }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) .visual { grid-template-rows: minmax(0,1fr) auto; }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) :is(#viewer,#photo-stage,#render-stage,#plan) { grid-area: 1/1; }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) .view-bottom { grid-area: 2/1; }
  body:has(#panel input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,#panel textarea:focus) :is(.toolbar,#photo-caption,#render-options) { display: none; }
}
@media (min-width: 600px) and (max-width: 899px) and (max-height: 540px) {
  .masthead { height: 54px; min-height: 54px; }
  .wordmark img { width: 34px; height: 34px; }
  .studio,
  body:has(#panel input:focus,#panel textarea:focus) .studio { grid-template-columns: minmax(0,1.1fr) minmax(250px,1fr); grid-template-rows: minmax(0,1fr); }
  .visual { height: 100%; }
  #panel { padding: 12px; }
  .config-footer { padding-inline: 8px; }
}

body.ram-fullscreen-open { overflow: hidden; }
.visual.ram-fullscreen-fallback {
  position: fixed !important; inset: 0 !important; z-index: 100001 !important;
  width: 100% !important; height: 100vh !important; height: 100dvh !important;
  min-height: 0 !important; max-height: none !important; margin: 0 !important;
  display: grid !important; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto;
  padding: max(50px,env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #e6e7e1; overflow: hidden;
}
.visual.ram-fullscreen-fallback .view-top { grid-area: 1/1; position: relative; inset: auto; padding: 8px 12px; }
.visual.ram-fullscreen-fallback :is(#viewer,#photo-stage,#render-stage,#plan) { grid-area: 2/1; position: relative; inset: auto; min-height: 0; width: 100%; height: 100%; }
.visual.ram-fullscreen-fallback #plan { padding: 20px; }
.visual.ram-fullscreen-fallback .view-bottom { grid-area: 3/1; position: relative; inset: auto; padding: 8px; }
.visual.ram-fullscreen-fallback .toolbar { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; justify-content: flex-start; }
.visual.ram-fullscreen-fallback .toolbar > * { flex: none; }
.visual.ram-fullscreen-fallback .toolbar button,
.visual.ram-fullscreen-fallback .view-tabs button { min-height: 44px; }
.visual.ram-fullscreen-fallback .visual-note { display: none; }
[data-ram-fullscreen-close] { position: absolute; top: max(6px,env(safe-area-inset-top)); right: max(8px,env(safe-area-inset-right)); z-index: 8; min-width: 44px; min-height: 44px; padding: 10px 14px; background: #fff; color: #171717; border: 1px solid #d6d6d0; border-radius: 8px; font: 700 14px Arial,sans-serif; }
.ram-fullscreen-active #fullscreen { display: none !important; }
.ram-fullscreen-active:fullscreen .view-top { padding-right: 105px; }

