@media (max-width: 960px) {
  body.webperky-home.studio-v2,
  body.studio-page {
    --compact-header-height: 64px;
    --compact-header-top: max(8px, env(safe-area-inset-top));
    --compact-header-side: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  body.webperky-home.studio-v2 .header,
  body.studio-page .header {
    height: var(--compact-header-height);
    min-height: var(--compact-header-height);
    gap: 10px;
    padding: 5px 12px;
    flex-wrap: nowrap;
  }

  body.webperky-home.studio-v2 .header {
    top: var(--compact-header-top);
    width: calc(100% - 2 * var(--compact-header-side));
  }

  body.studio-page .header {
    position: relative;
    z-index: 40;
    margin-top: env(safe-area-inset-top);
  }

  body.webperky-home.studio-v2 .header .brand,
  body.studio-page .header .brand {
    flex: 0 0 auto;
    gap: 4px;
    font-size: clamp(17px, 4.8vw, 23px);
    white-space: nowrap;
  }

  .header .brand img {
    inline-size: clamp(23px, 7vw, 30px);
    block-size: auto;
  }

  body.webperky-home.studio-v2 .header-tools,
  body.studio-page .header-tools {
    flex: 0 0 auto;
    gap: 6px;
  }

  body.webperky-home.studio-v2 .header select {
    width: clamp(37px, 10vw, 55px);
    min-height: 44px;
    padding: 0 1px;
    font-size: 11px;
  }

  body.webperky-home.studio-v2 .header .button,
  body.studio-page .header .button {
    min-height: 44px;
    padding: 8px 11px;
    font-size: 11px;
    white-space: nowrap;
  }

  body.webperky-home.studio-v2 .header #menu,
  body.studio-page .header #menu {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #ffffff35;
    border-radius: 50%;
    background: #ffffff0c;
    color: #fff;
    cursor: pointer;
  }

  body.webperky-home.studio-v2 .header nav,
  body.studio-page .header nav {
    display: none;
  }

  body.webperky-home.studio-v2 .header.menu-open nav,
  body.studio-page .header.menu-open nav {
    position: absolute;
    inset: calc(100% + 8px) 0 auto;
    display: grid;
    gap: 0 !important;
    align-items: stretch;
    max-height: calc(100dvh - var(--compact-header-height) - var(--compact-header-top) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 7px 12px;
    border: 1px solid #ffffff36;
    border-radius: 18px;
    background: #171717;
    box-shadow: 0 16px 32px #0007;
  }

  .header.menu-open nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 5px 6px;
    border-bottom: 1px solid #ffffff18;
    font-size: 15px;
    white-space: normal;
  }

  .header.menu-open nav a:last-child { border-bottom: 0; }

  body.studio-page footer.wrap,
  body.studio-page footer.wrap > div {
    max-width: 100%;
    flex-wrap: wrap;
  }

  body.studio-page footer.wrap > div { gap: 8px 16px; }

  body.webperky-home.studio-v2 .studio-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    align-items: center;
    gap: 22px 8px;
    height: auto;
    min-height: 100svh;
    max-height: none;
    padding: calc(var(--compact-header-height) + var(--compact-header-top) + clamp(24px, 5svh, 54px)) max(16px, var(--compact-header-side))
      calc(74px + env(safe-area-inset-bottom));
  }

  body.webperky-home.studio-v2 .hero-center {
    grid-column: 1 / -1;
    width: min(100%, 41rem);
    justify-self: center;
    padding: 0;
  }

  body.webperky-home.studio-v2 .studio-hero h1 {
    font-size: clamp(28px, 10.5vw, 76px);
    margin-bottom: 20px;
  }

  .studio-v2 .hero-pill { margin-bottom: 20px; }
  .studio-v2 .hero-description { margin-bottom: 0; padding: 0 4px; line-height: 1.58; }
  .studio-v2 .hero-center .actions { gap: 8px; margin-top: 16px; }
  .studio-v2 .hero-center .actions .button { min-height: 44px; }
  .studio-v2 .hero-proof { flex-wrap: wrap; gap: 6px 12px; margin-top: 18px; }
  .studio-v2 .hero-proof span + span { margin: 0; padding: 0; border: 0; }

  body.webperky-home.studio-v2 .studio-hero .hero-foot {
    position: relative;
    inset: auto;
    width: auto;
    min-width: 0;
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    justify-content: flex-start;
  }

  .studio-v2 .hero-foot > span { display: none; }
  .studio-v2 .hero-foot a { min-height: 44px; gap: 8px; }
  .studio-v2 .hero-foot i { height: 18px; }

  body.webperky-home.studio-v2 .video-toggle {
    position: relative;
    inset: auto;
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    min-height: 44px;
    padding: 8px 12px;
  }

  .webperky-home .chat-dock {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    gap: 5px;
    padding: 4px;
    z-index: 35;
  }

  .webperky-home .chat-dock > span { display: none; }
  .webperky-home .chat-dock a, .webperky-home .chat-dock button { width: 44px; height: 44px; }
  .webperky-home .chat-window {
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: min(390px, calc(100% - 20px));
  }
  .webperky-home .chat-window iframe { height: min(430px, 59dvh); }
  .webperky-home footer { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
}

@media (max-width: 365px) {
  body.webperky-home.studio-v2 .header {
    --compact-header-side: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
    gap: 5px;
    padding-inline: 8px;
  }

  body.webperky-home.studio-v2 .header-tools { gap: 3px; }
  body.webperky-home.studio-v2 .header .button { padding-inline: 8px; }

  body.webperky-home.studio-v2 .studio-hero {
    gap: 13px 8px;
    padding-top: calc(var(--compact-header-height) + var(--compact-header-top) + 18px);
  }

  .studio-v2 .hero-pill { margin-bottom: 14px; }
  .studio-v2 .hero-proof { margin-top: 12px; }
  body.webperky-home.studio-v2 .studio-hero .hero-foot { letter-spacing: .45px; }
  .studio-v2 .hero-foot a { gap: 5px; }
  body.webperky-home.studio-v2 .video-toggle { padding-inline: 9px; }
}

@media (max-width: 365px) and (max-height: 610px) {
  .studio-v2 .hero-proof { display: none; }
}

.room-toolbar, .room-utilities { display: contents; }

@media (max-width: 760px), (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  body.portfolio-room {
    --room-inline: max(12px, env(safe-area-inset-left), env(safe-area-inset-right));
    --room-top: max(8px, env(safe-area-inset-top));
    --room-bottom: max(8px, env(safe-area-inset-bottom));
    --room-content-top: calc(var(--room-top) + 62px);
    --room-content-bottom: calc(var(--room-bottom) + 108px);
  }

  body.portfolio-room .room-header {
    inset: var(--room-top) var(--room-inline) auto;
    min-height: 52px;
    gap: 8px;
    padding: 4px 8px;
    border: 1px solid #51463340;
    border-radius: 14px;
    background: #f3e4cbe8;
    color: #272117;
    z-index: 30;
  }

  body.portfolio-room .hg-logo,
  body.portfolio-room .room-header .hg-logo {
    flex: 0 0 auto;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    border-radius: 0;
    background: transparent;
    font-size: 24px;
  }

  body.portfolio-room .hg-logo .brand-expansion { display: none; }
  body.portfolio-room .room-header-right { min-width: 0; gap: 8px; }
  body.portfolio-room .room-header .room-time {
    display: grid;
    min-width: 0;
    align-items: start;
    white-space: nowrap;
  }

  body.portfolio-room .room-time button,
  body.portfolio-room .room-time b { grid-area: 1 / 1; }
  body.portfolio-room .room-time button {
    height: 44px;
    padding: 0 0 17px;
    overflow: hidden;
    color: #382d20;
    line-height: 1.22;
    text-overflow: ellipsis;
  }
  body.portfolio-room .room-time b {
    align-self: end;
    justify-self: end;
    padding-bottom: 4px;
    font-size: 13px;
    pointer-events: none;
  }
  body.portfolio-room #roomMenu {
    min-width: 66px;
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid #52432e50;
    border-radius: 10px;
    color: #2f2619;
    white-space: nowrap;
  }

  body.portfolio-room .room-header .room-map {
    top: calc(100% + 8px);
    inset-inline: 0;
    width: 100%;
    max-height: calc(100dvh - var(--room-content-top) - var(--room-bottom) - 10px);
    overscroll-behavior: contain;
    padding: 10px 12px 14px;
  }

  body.portfolio-room .room-map .map-rooms button {
    grid-template-columns: 22px 65px minmax(0, 1fr);
    align-items: center;
    min-height: 44px;
    padding-block: 6px;
    font-size: 13px;
  }

  body.portfolio-room .room-map .room-social a,
  body.portfolio-room .room-map .map-exit {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  body.portfolio-room .room-chapters, body.portfolio-room .room-hint { display: none; }

  body.portfolio-room .room-toolbar {
    position: fixed;
    z-index: 26;
    inset: auto var(--room-inline) var(--room-bottom);
    display: grid;
    grid-template-rows: 44px 44px;
    gap: 2px;
    padding: 4px 6px;
    border: 1px solid #46382251;
    border-radius: 16px;
    background: #efe1c8f2;
    color: #30271d;
    box-shadow: 0 10px 30px #21170b40;
  }

  body.portfolio-room .room-controls {
    position: static;
    transform: none;
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: minmax(54px, 1fr) minmax(0, 1.6fr) minmax(68px, 1fr);
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }

  body.portfolio-room .room-controls > button {
    min-height: 44px;
    padding: 3px 4px;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }

  body.portfolio-room #roomPrevious[hidden] { display: block; visibility: hidden; }
  body.portfolio-room .room-controls > div {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
  }
  body.portfolio-room .room-controls > div button { width: 100%; height: 44px; }

  body.portfolio-room .room-utilities {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    gap: 3px;
    border-top: 1px solid #4d3c2530;
  }

  body.portfolio-room .room-utilities > :is(button, a) {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: auto;
    height: auto;
    min-height: 44px;
    padding: 0 4px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #352b20;
    font-size: 10px;
    letter-spacing: .015em;
    line-height: 1.14;
    text-align: center;
    transform: none;
  }

  body.portfolio-room .room-utilities .room-view { background: #30271d; color: #fff2db; }
  body.portfolio-room .room-utilities .hello-orbit::after { display: none; }
  body.portfolio-room .room-utilities .hello-orbit span { font-size: 13px; }
  body.portfolio-room .room-utilities .hello-orbit br { display: none; }

  body.portfolio-room .room-entrance:not([hidden]) {
    position: fixed;
    inset: var(--room-content-top) var(--room-inline) var(--room-content-bottom);
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 4px 19px;
  }

  body.portfolio-room .room-entrance::before {
    background: radial-gradient(ellipse at 5% 12%, #22180f77, transparent 56%);
  }

  body.portfolio-room .room-entrance .entrance-name {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  body.portfolio-room .room-entrance .entrance-name h1 {
    max-width: 100%;
    margin: 0;
    font-size: clamp(38px, min(18vw, 12svh), 84px);
    line-height: .88;
  }

  body.portfolio-room .room-entrance .entrance-name > span {
    display: block;
    text-align: left;
    font-size: 8px;
  }

  body.portfolio-room .room-entrance .entrance-role > p {
    font-size: clamp(22px, 6.8vw, 36px);
    margin: 0;
  }

  body.portfolio-room .room-entrance .entrance-role { margin-top: auto; }
  body.portfolio-room .room-entrance .entrance-role-rule { margin-top: 8px; }
  body.portfolio-room .room-entrance .entrance-role > div { margin-top: 8px; }
  body.portfolio-room .room-entrance .enter-circle { width: 58px; height: 58px; font-size: 8px; }
  body.portfolio-room .room-entrance .entrance-bottom {
    display: block;
    align-self: stretch;
    margin: 0;
  }
  body.portfolio-room .room-entrance .entrance-bottom p {
    width: fit-content;
    max-width: 100%;
    margin-top: 4px;
    padding: 6px 9px;
    border-radius: 8px;
    background: #f3e4cbee;
    color: #392819;
    font-size: 11px;
    line-height: 1.35;
    text-shadow: none;
  }
  body.portfolio-room .room-entrance .entrance-bottom .room-pill { display: none; }

  body.portfolio-room .room-panel {
    inset: var(--room-content-top) var(--room-inline) var(--room-content-bottom);
    padding: 0 0 5px;
    background: transparent;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    pointer-events: auto;
    touch-action: pan-y;
  }

  body.portfolio-room .room-panel .panel-copy {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: clamp(15px, 4.5vw, 24px);
    border-radius: 12px;
    overflow-wrap: anywhere;
    background: #f0e2ccf7;
  }

  body.portfolio-room .panel-copy h2 { margin: 12px 0; font-size: clamp(26px, 8vw, 38px); }
  body.portfolio-room .panel-copy p { margin-block: 12px; font-size: 13px; line-height: 1.62; }
  body.portfolio-room .room-work-links a { min-height: 44px; padding-block: 10px; }
  body.portfolio-room .room-panel .contact-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  body.portfolio-room .room-panel .room-pill { min-height: 44px; }
  body.portfolio-room .room-panel .portrait-mobile img { height: auto; max-height: 360px; object-fit: cover; }

  body.portfolio-room .room-loader { padding: var(--room-top) var(--room-inline) var(--room-bottom); }
  body.portfolio-room .room-loader .loader-name {
    top: max(12px, env(safe-area-inset-top));
    left: var(--room-inline);
    font-size: clamp(45px, min(19vw, 14svh), 96px);
  }
  body.portfolio-room .room-loader .loader-door { margin-top: min(54px, 9svh); height: min(140px, 25svh); }
  body.portfolio-room .room-loader h2 { font-size: clamp(18px, 5.5vw, 25px); }
}

@media (max-width: 760px) and (max-height: 590px) {
  body.portfolio-room .room-entrance .entrance-name > span,
  body.portfolio-room .room-entrance .entrance-bottom { display: none; }
  body.portfolio-room .room-entrance .entrance-role { margin-top: 0; }
}

@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  body.portfolio-room { --room-content-bottom: calc(var(--room-bottom) + 62px); }
  body.portfolio-room .room-toolbar {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: 44px;
    column-gap: 8px;
  }
  body.portfolio-room .room-utilities { border-top: 0; border-inline-start: 1px solid #4d3c2530; }

  body.portfolio-room .room-entrance:not([hidden]) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }

  body.portfolio-room .room-entrance .entrance-bottom { display: none; }
  body.portfolio-room .room-entrance .entrance-name h1 { font-size: clamp(30px, 12svh, 62px); }
  body.portfolio-room .room-entrance .entrance-role > p { font-size: clamp(20px, 7.5svh, 28px); }
  body.portfolio-room .room-entrance .enter-circle { width: 50px; height: 50px; }
  body.portfolio-room .room-loader .loader-door { margin-top: 0; }
}
