/* Compact desktop shell inspired by classic browser RPG proportions.
   This file is intentionally isolated so the redesign can be reverted safely. */
@media (min-width: 761px) {
  :root {
    --compact-shell: 1080px;
    --compact-sidebar: 182px;
    --compact-gap: 7px;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    font-size: 12px;
  }

  .app-shell {
    width: 100%;
    height: 100vh;
    min-height: 0;
    display: grid;
    grid-template-rows: 56px minmax(0, 1fr);
    overflow: hidden;
  }

  .topbar {
    position: relative;
    top: auto;
    width: min(var(--compact-shell), calc(100% - 16px));
    height: 56px;
    min-height: 56px;
    margin: 0 auto;
    padding: 4px 9px;
    gap: 10px;
    border-right: 1px solid #79552c;
    border-left: 1px solid #79552c;
  }

  .brand {
    gap: 7px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    font-size: 11px;
  }

  .brand strong {
    font-size: 14px;
  }

  .brand small {
    margin-top: 2px;
    font-size: 8px;
  }

  .resource-row {
    gap: 5px;
  }

  .resource {
    min-width: 78px;
    min-height: 38px;
    padding: 4px 6px;
    gap: 5px;
  }

  .resource-icon {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  .resource small {
    font-size: 7px;
  }

  .resource strong {
    font-size: 11px;
  }

  .account-button {
    min-height: 36px;
    padding: 4px 8px;
    font-size: 9px;
  }

  .game-layout {
    width: min(var(--compact-shell), 100%);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: 6px 8px 8px;
    display: grid;
    grid-template-columns: var(--compact-sidebar) minmax(0, 1fr);
    gap: var(--compact-gap);
    overflow: hidden;
  }

  .side-column {
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
  }

  .hero-panel {
    position: relative;
    top: auto;
    padding: 7px;
    margin: 0 0 5px;
  }

  .portrait-wrap {
    width: 60px;
    margin: 0 auto 4px;
  }

  .portrait {
    width: 60px;
    height: 68px;
    border-radius: 2px;
    box-shadow: inset 0 0 0 3px #17100c, 0 5px 12px rgba(0,0,0,.48);
  }

  .level-badge {
    right: -7px;
    bottom: 3px;
    padding: 2px 4px;
    font-size: 7px;
  }

  .hero-name-label {
    font-size: 7px;
  }

  .hero-name {
    margin-top: 2px;
    font-size: 14px;
  }

  .hero-title {
    margin: 2px 0 5px;
    font-size: 8px;
  }

  .bar-block {
    margin: 4px 0;
  }

  .bar-label {
    font-size: 8px;
  }

  .meter,
  .combat-bar {
    height: 5px;
    margin-top: 2px;
  }

  .stat-list {
    margin: 5px 0;
  }

  .stat-list div {
    padding: 3px 1px;
    font-size: 8px;
  }

  .hero-panel .button.full {
    min-height: 28px;
    padding: 4px 5px;
    font-size: 8px;
  }

  .desktop-nav {
    gap: 1px;
    margin: 0;
    padding: 4px;
  }

  .nav-button {
    min-height: 27px;
    padding: 4px 6px;
    font-size: 9px;
  }

  .nav-button span {
    margin-right: 5px;
  }

  .nav-button + .nav-button {
    margin-top: 1px;
  }

  .notification {
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    font-size: 7px;
  }

  .main-panel {
    height: 100%;
    min-height: 0;
    padding: 4px;
    overflow: hidden;
  }

  .tab-view.active {
    height: 100%;
    min-height: 0;
    padding-right: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
  }

  .section-heading {
    min-height: 64px;
    padding: 8px 11px;
  }

  .section-heading h1 {
    margin: 1px 0;
    font-size: 20px;
    line-height: 1.05;
  }

  .section-heading p {
    font-size: 9px;
    line-height: 1.3;
  }

  .eyebrow {
    font-size: 7px;
    letter-spacing: .12em;
  }

  .button {
    min-height: 29px;
    padding: 5px 8px;
    font-size: 9px;
  }

  /* Character screen: portrait left, compact equipment and inventory right. */
  .character-subnav {
    gap: 3px;
    margin-top: 5px;
    padding-top: 5px;
  }

  .character-subnav button {
    min-height: 25px;
    padding: 4px 9px;
    font-size: 8px;
  }

  .character-redesign-v1 .character-dossier {
    grid-template-columns: 204px minmax(0, 1fr);
    gap: 6px;
    min-height: 0;
    margin-top: 5px;
    padding: 6px;
  }

  .character-redesign-v1 .hero-profile-column,
  .character-redesign-v1 .hero-equipment-column {
    gap: 5px;
  }

  .character-redesign-v1 .hero-showcase {
    min-height: 238px;
    height: 238px;
  }

  .character-redesign-v1 .hero-showcase img {
    min-height: 238px;
    height: 238px;
    transform: scale(1.01);
  }

  .character-redesign-v1 .showcase-rank {
    top: 6px;
    right: 6px;
    left: 6px;
    padding: 4px 6px;
    font-size: 7px;
  }

  .character-redesign-v1 .hero-showcase > div:last-child {
    right: 7px;
    bottom: 5px;
    left: 7px;
    padding: 7px 6px 5px;
  }

  .character-redesign-v1 .hero-showcase h2 {
    font-size: 15px;
  }

  .character-redesign-v1 .hero-showcase p {
    font-size: 8px;
  }

  .character-redesign-v1 .attribute-row {
    grid-template-columns: 55px 26px 1fr;
    min-height: 21px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .character-redesign-v1 .attribute-row > div {
    height: 5px;
  }

  .character-redesign-v1 .hero-equipment-column {
    grid-template-rows: auto auto;
  }

  .character-redesign-v1 .loadout-heading,
  .character-redesign-v1 .quick-inventory-heading {
    padding-bottom: 5px;
  }

  .loadout-heading h2,
  .quick-inventory-heading h2 {
    font-size: 13px;
  }

  .equipment-power {
    min-width: 68px;
    padding: 5px;
  }

  .equipment-power strong {
    font-size: 18px;
  }

  .character-redesign-v1 .gear-board {
    grid-template-columns: repeat(4, minmax(74px, 1fr));
    grid-template-rows: repeat(3, 76px);
    gap: 4px;
    min-height: 0;
    padding: 5px;
  }

  .character-redesign-v1 .gear-slot {
    min-height: 72px;
    padding: 37px 3px 4px;
  }

  .character-redesign-v1 .gear-slot small {
    font-size: 7px;
  }

  .character-redesign-v1 .gear-slot strong {
    margin-top: 1px;
    font-size: 8px;
  }

  .character-redesign-v1 .gear-slot b {
    font-size: 7px;
  }

  .character-redesign-v1 .gear-img-frame {
    top: 2px;
    width: 48px;
    height: 48px;
  }

  .character-redesign-v1 .weapon-slot .gear-img-frame,
  .character-redesign-v1 .armor-slot .gear-img-frame,
  .character-redesign-v1 .shield-slot .gear-img-frame {
    top: 7px;
    width: 76px;
    height: 76px;
  }

  .character-redesign-v1 .quick-inventory-grid {
    grid-template-columns: repeat(8, minmax(38px, 1fr));
    gap: 3px;
    padding: 5px 0 6px;
  }

  .character-redesign-v1 .quick-inventory-slot {
    min-height: 43px;
  }

  .quick-inventory-board {
    padding: 7px;
  }

  /* Compact the rest of the game without changing its content model. */
  .scene-card {
    min-height: 165px;
  }

  .scene-copy,
  .city-scene-copy {
    left: 18px;
    bottom: 13px;
  }

  .scene-copy h1,
  .city-scene-copy h1 {
    font-size: 25px;
  }

  .character-grid,
  .equipment-slots,
  .inventory-grid,
  .contract-grid,
  .message-list,
  .city-grid {
    gap: 5px;
    margin-top: 5px;
  }

  .info-card,
  .equipment-slots article {
    min-height: 88px;
    padding: 9px;
  }

  .loot-card,
  .quest-card,
  .message-card,
  .contract-card {
    padding: 9px;
  }

  .contract-card {
    min-height: 230px;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  :root {
    --compact-shell: 100%;
    --compact-sidebar: 168px;
  }

  .topbar {
    width: calc(100% - 8px);
  }

  .game-layout {
    padding-right: 4px;
    padding-left: 4px;
  }

  .character-redesign-v1 .character-dossier {
    grid-template-columns: 188px minmax(0, 1fr);
  }
}

/* Desktop viewport model: the game frame itself never moves. Long legacy
   screens may still scroll inside their content panel until they are compacted. */
@media (min-width: 761px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body {
    overscroll-behavior: none;
  }

  .app-shell {
    width: 100%;
    height: 100vh;
    min-height: 0;
    display: grid;
    grid-template-rows: 56px minmax(0, 1fr);
    overflow: hidden;
  }

  .topbar {
    position: relative;
    inset: auto;
    z-index: 30;
    transform: none;
  }

  .game-layout {
    height: 100%;
    min-height: 0;
    padding-top: 6px;
    overflow: hidden;
    align-items: stretch;
  }

  .side-column {
    position: relative;
    inset: auto;
    width: auto;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  .main-panel {
    grid-column: auto;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .tab-view.active {
    height: 100%;
    min-height: 0;
    padding-right: 2px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .tab-view[data-tab="character"].active {
    padding-right: 0;
    overflow: hidden;
  }
}

/* Height calibration for common laptop/browser viewports. */
@media (min-width: 761px) and (max-height: 820px) {
  .app-shell {
    grid-template-rows: 48px minmax(0, 1fr);
  }

  .topbar {
    height: 48px;
    min-height: 48px;
    padding: 3px 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .brand strong {
    font-size: 12px;
  }

  .brand small,
  .resource small {
    font-size: 7px;
  }

  .resource {
    min-width: 70px;
    min-height: 32px;
    padding: 3px 5px;
  }

  .resource-icon {
    width: 19px;
    height: 19px;
  }

  .account-button {
    min-height: 30px;
  }

  .game-layout {
    padding-top: 4px;
    padding-bottom: 5px;
  }

  .hero-panel {
    padding: 5px;
    margin-bottom: 4px;
  }

  .portrait-wrap {
    width: 48px;
    margin-bottom: 2px;
  }

  .portrait {
    width: 48px;
    height: 54px;
  }

  .hero-name {
    margin-top: 1px;
    font-size: 12px;
  }

  .hero-title {
    margin: 1px 0 3px;
    font-size: 7px;
  }

  .bar-block {
    margin: 2px 0;
  }

  .bar-label {
    font-size: 7px;
  }

  .meter,
  .combat-bar {
    height: 4px;
    margin-top: 1px;
  }

  .stat-list {
    margin: 3px 0;
  }

  .stat-list div {
    padding: 2px 1px;
    font-size: 7px;
  }

  .hero-panel .button.full {
    min-height: 23px;
    padding: 3px;
    font-size: 7px;
  }

  .desktop-nav {
    padding: 3px;
  }

  .nav-button {
    min-height: 22px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .nav-button + .nav-button {
    margin-top: 1px;
  }

  .section-heading {
    min-height: 50px;
    padding: 5px 8px;
  }

  .section-heading h1 {
    font-size: 17px;
  }

  .section-heading p {
    font-size: 8px;
  }

  .character-heading p {
    display: none;
  }

  .character-subnav {
    margin-top: 3px;
    padding-top: 3px;
  }

  .character-subnav button {
    min-height: 21px;
    padding: 3px 7px;
    font-size: 7px;
  }

  .character-redesign-v1 .character-dossier {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 4px;
    height: calc(100% - 56px);
    min-height: 0;
    margin-top: 4px;
    padding: 4px;
    overflow: hidden;
  }

  .character-redesign-v1 .hero-profile-column,
  .character-redesign-v1 .hero-equipment-column {
    gap: 4px;
    min-height: 0;
  }

  .character-redesign-v1 .hero-profile-column {
    grid-template-rows: 190px minmax(0, 1fr);
  }

  .character-redesign-v1 .hero-showcase,
  .character-redesign-v1 .hero-showcase img {
    height: 190px;
    min-height: 190px;
  }

  .character-redesign-v1 .showcase-rank {
    top: 4px;
    right: 4px;
    left: 4px;
    padding: 3px 4px;
  }

  .character-redesign-v1 .hero-showcase > div:last-child {
    right: 4px;
    bottom: 3px;
    left: 4px;
    padding: 5px 4px 3px;
  }

  .character-redesign-v1 .hero-showcase h2 {
    font-size: 13px;
  }

  .character-redesign-v1 .attributes-board {
    min-height: 0;
    overflow: hidden;
  }

  .character-redesign-v1 .board-title {
    padding: 4px 6px;
  }

  .character-redesign-v1 .board-title h2 {
    font-size: 11px;
  }

  .character-redesign-v1 .attribute-row {
    grid-template-columns: 48px 22px 1fr;
    min-height: 18px;
    padding: 1px 4px;
    font-size: 7px;
  }

  .character-redesign-v1 .record-panel {
    padding: 4px 6px;
  }

  .character-redesign-v1 .hero-equipment-column {
    grid-template-rows: 250px minmax(0, 1fr);
  }

  .character-redesign-v1 .loadout-board,
  .character-redesign-v1 .quick-inventory-board {
    min-height: 0;
    overflow: hidden;
  }

  .character-redesign-v1 .loadout-heading,
  .character-redesign-v1 .quick-inventory-heading {
    padding-bottom: 3px;
  }

  .loadout-heading h2,
  .quick-inventory-heading h2 {
    font-size: 11px;
  }

  .equipment-power {
    min-width: 60px;
    padding: 3px;
  }

  .equipment-power strong {
    font-size: 15px;
  }

  .character-redesign-v1 .gear-board {
    grid-template-rows: repeat(3, 61px);
    gap: 3px;
    padding: 4px;
  }

  .character-redesign-v1 .gear-slot {
    min-height: 58px;
    padding: 29px 2px 3px;
  }

  .character-redesign-v1 .gear-slot small,
  .character-redesign-v1 .gear-slot b {
    font-size: 6px;
  }

  .character-redesign-v1 .gear-slot strong {
    font-size: 7px;
  }

  .character-redesign-v1 .gear-img-frame {
    width: 38px;
    height: 38px;
  }

  .character-redesign-v1 .weapon-slot .gear-img-frame,
  .character-redesign-v1 .armor-slot .gear-img-frame,
  .character-redesign-v1 .shield-slot .gear-img-frame {
    top: 4px;
    width: 58px;
    height: 58px;
  }

  .quick-inventory-board {
    padding: 5px;
  }

  .character-redesign-v1 .quick-inventory-grid {
    gap: 2px;
    padding: 3px 0 4px;
  }

  .character-redesign-v1 .quick-inventory-slot {
    aspect-ratio: auto;
    height: 35px;
    min-height: 35px;
  }

  .character-redesign-v1 .quick-inventory-slot .gear-img-frame {
    inset: 2px;
    width: auto;
    height: auto;
  }

  .character-redesign-v1 .quick-inventory-board .button {
    min-height: 22px;
    padding: 3px 6px;
  }
}
