/* ============================================================
   深海炮手 · 横屏街机布局
   只在横屏视口生效，竖屏保留原有铺满布局，互不影响。
   ============================================================ */
@media (orientation: landscape) {
  :root {
    --dock-h: clamp(76px, 23vh, 122px);
    --hud-h: clamp(44px, 12vh, 58px);
    --rail-ico: clamp(32px, 9vh, 52px);
    --rail-gap: clamp(3px, 1.1vh, 9px);
    --side-safe-l: max(10px, env(safe-area-inset-left, 0px));
    --side-safe-r: max(10px, env(safe-area-inset-right, 0px));
  }

  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #01080f;
  }

  .app {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    background: #02121f url("images/gen/gptimg_1795363900_look.png") 50% 50% / cover no-repeat;
  }

  /* ---------- 顶部 HUD：头像钱包 / 中央等待加入 / 右侧声音与设置 ---------- */
  .app .hud {
    padding: calc(env(safe-area-inset-top, 0px) + 8px) var(--side-safe-r) 0 var(--side-safe-l);
    z-index: 32;
  }

  .app .hud-top {
    align-items: flex-start;
    gap: 10px;
  }

  .app .player-chip {
    flex: 0 0 auto;
    width: clamp(172px, 25vw, 250px);
    height: var(--hud-h);
    padding: 4px 10px 4px 4px;
    border-radius: 15px;
    gap: 7px;
  }

  .app .player-chip .avatar {
    width: calc(var(--hud-h) - 10px);
    height: calc(var(--hud-h) - 10px);
    font-size: clamp(13px, 3.4vh, 19px);
  }

  .app .p-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .app .p-meta > b {
    max-width: 112px;
    font-size: clamp(9px, 2.4vh, 12px);
  }

  .app .p-wallet {
    gap: 5px;
  }

  .app .p-coin b {
    font-size: clamp(15px, 4vh, 22px);
  }

  .app .p-gem b {
    font-size: clamp(9px, 2.5vh, 13px);
  }

  .app .p-gem em {
    display: none;
  }

  .app .wallet-plus {
    width: clamp(21px, 5.6vh, 29px);
    height: clamp(21px, 5.6vh, 29px);
  }

  .app .seat-pill {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 50%;
    transform: translateX(-50%);
    height: clamp(32px, 8.4vh, 44px);
    padding: 0 clamp(8px, 1.6vw, 16px);
    border-radius: 13px;
  }

  .app .seat-pill:active {
    transform: translateX(-50%) scale(.95);
  }

  .app .seat-pill .mp-icon {
    width: clamp(13px, 3.4vh, 18px);
    height: clamp(13px, 3.4vh, 18px);
  }

  .app .seat-pill span {
    font-size: clamp(8px, 2.2vh, 11px);
  }

  .app .hud-tools {
    margin-left: auto;
    gap: clamp(5px, 1vw, 9px);
  }

  .app .hud-tools .icon-btn {
    width: clamp(34px, 9.2vh, 46px);
    height: clamp(34px, 9.2vh, 46px);
  }

  .app .hud-tools .icon-btn .mp-icon {
    width: clamp(16px, 4.4vh, 22px);
    height: clamp(16px, 4.4vh, 22px);
  }

  /* ---------- 左右街机技能栏 ---------- */
  .app .side-rails {
    top: calc(env(safe-area-inset-top, 0px) + var(--hud-h) + 14px);
    bottom: calc(var(--dock-h) + 12px + env(safe-area-inset-bottom, 0px));
    left: var(--side-safe-l);
    right: var(--side-safe-r);
    align-items: center;
    z-index: 24;
  }

  .app .side-rails .rail-col {
    justify-content: center;
    gap: var(--rail-gap);
  }

  .app .side-rails .skill {
    width: var(--rail-ico);
    min-height: 0;
    height: auto;
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .app .side-rails .skill .s-ico {
    width: var(--rail-ico);
    height: var(--rail-ico);
    border-width: 2px;
  }

  .app .side-rails .skill .mp-icon {
    width: calc(var(--rail-ico) * .48);
    height: calc(var(--rail-ico) * .48);
  }

  .app .side-rails .skill .s-name {
    margin-top: 1px;
    padding: 0 3px;
    font-size: clamp(7px, 1.65vh, 9px);
    line-height: 1.3;
    border-radius: 4px;
    background: rgba(1, 12, 23, .78);
  }

  .app .side-rails .skill .s-cd {
    top: -2px;
    right: -4px;
    min-width: 14px;
    line-height: 12px;
    font-size: 7px;
  }

  /* ---------- 底部街机操作台 ---------- */
  .app .dock {
    height: var(--dock-h);
    padding: 0 var(--side-safe-r) env(safe-area-inset-bottom, 0px) var(--side-safe-l);
    border-radius: 16px 16px 0 0;
    background:
      linear-gradient(180deg, rgba(8, 37, 58, .38) 0%, rgba(3, 20, 35, .93) 28%, rgba(1, 11, 21, .99) 100%);
    border-top: 1px solid rgba(255, 198, 110, .52);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .52), inset 0 1px rgba(255, 255, 255, .08);
    backdrop-filter: blur(8px) saturate(1.05);
    -webkit-backdrop-filter: blur(8px) saturate(1.05);
    display: block;
  }

  .app .dock::before {
    left: 20%;
    right: 20%;
    height: 2px;
  }

  .app .power-strip {
    position: absolute;
    left: var(--side-safe-l);
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    gap: clamp(4px, 1vh, 8px);
    align-items: flex-end;
  }

  .app .dock .skill.power {
    width: calc(var(--rail-ico) + 2px);
    height: auto;
    min-height: 0;
  }

  .app .dock .skill.power .s-ico {
    width: calc(var(--rail-ico) + 1px);
    height: calc(var(--rail-ico) + 1px);
  }

  .app .dock .skill.power .mp-icon {
    width: calc(var(--rail-ico) * .52);
    height: calc(var(--rail-ico) * .52);
  }

  .app .dock .skill.power .s-name {
    font-size: clamp(7px, 1.6vh, 9px);
    padding: 0 3px;
  }

  .app .dock .skill.power .s-cd {
    top: -2px;
    right: -3px;
    min-width: 14px;
    line-height: 12px;
    font-size: 7px;
  }

  /* 聚宝盆贴右下，给中央炮台让位 */
  .app .pot-btn {
    position: absolute;
    right: var(--side-safe-r);
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    min-width: clamp(62px, 11vw, 118px);
    height: clamp(44px, 15vh, 62px);
    padding: 3px 8px 3px 3px;
    border-radius: 14px;
    gap: 5px;
  }

  .app .pot-jar {
    width: clamp(32px, 11vh, 48px);
    height: clamp(32px, 11vh, 48px);
  }

  .app .pot-jar .mp-icon {
    width: 56%;
    height: 56%;
  }

  .app .pot-meta em {
    font-size: 7px;
  }

  .app .pot-meta b {
    font-size: clamp(10px, 2.9vh, 15px);
  }

  .app .pot-badge {
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    line-height: 14px;
    font-size: 8px;
  }

  .app .dock .ctrl-row {
    position: absolute;
    left: 50%;
    bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(400px, 54vw);
    margin: 0;
    gap: clamp(4px, .8vw, 8px);
    align-items: end;
  }

  .app .dock .tier-ctl {
    height: clamp(40px, 12vh, 54px);
    border-radius: 13px;
    justify-self: end;
    width: 100%;
    max-width: 148px;
  }

  .app .dock .tier-arrow {
    width: clamp(28px, 4.2vw, 40px);
    margin: 4px;
    border-radius: 9px;
  }

  .app .dock .tier-arrow .mp-icon {
    width: clamp(16px, 4.2vh, 21px);
    height: clamp(16px, 4.2vh, 21px);
  }

  .app .dock .tier-num b {
    font-size: clamp(16px, 4.4vh, 23px);
  }

  .app .dock .tier-cap {
    font-size: 7px;
  }

  .app .dock .fire-btn {
    width: clamp(48px, 15vh, 66px);
    height: clamp(48px, 15vh, 66px);
    transform: translateY(-4px);
  }

  .app .dock .fire-btn .mp-icon {
    width: clamp(20px, 6vh, 28px);
    height: clamp(20px, 6vh, 28px);
  }

  .app .dock .fire-btn > span:last-child {
    font-size: clamp(8px, 2.1vh, 10px);
  }

  .app .dock .ad-pill {
    justify-self: start;
    min-height: clamp(36px, 10.5vh, 46px);
    max-width: clamp(82px, 13vw, 124px);
    padding: 4px clamp(5px, .9vw, 10px);
    border-radius: 12px;
    font-size: clamp(8px, 1.9vh, 10.5px);
    line-height: 1.2;
  }

  .app .dock .ad-pill .mp-icon {
    width: clamp(14px, 4vh, 20px);
    height: clamp(14px, 4vh, 20px);
  }

  .app .dock-hint {
    display: none;
  }

  /* 提示条与连击上移，避开炮口 */
  .app .toast-wrap {
    top: calc(env(safe-area-inset-top, 0px) + var(--hud-h) + 12px);
    bottom: auto;
    padding: 0 60px;
  }

  .app .combo {
    top: calc(env(safe-area-inset-top, 0px) + var(--hud-h) + 6px);
  }

  .app .battle-hud {
    left: 50%;
    top: calc(env(safe-area-inset-top, 0px) + var(--hud-h) + 16px);
    width: 150px;
    transform: translateX(-50%);
  }

  .app.in-battle .battle-hud {
    transform: translateX(-50%);
  }

  /* ---------- 首页 / 再来一局：沿用真实对局铺底，只落开局按钮 ---------- */
  .app .start-screen {
    align-items: flex-end;
    padding: 0 20px calc(var(--dock-h) + 5vh);
    background: radial-gradient(52% 44% at 50% 72%, rgba(1, 12, 22, .42), rgba(1, 12, 22, 0) 78%);
  }

  .app .start-screen::before {
    height: 40%;
    background: linear-gradient(180deg, rgba(1, 9, 17, 0) 0%, rgba(1, 9, 17, .26) 52%, rgba(1, 9, 17, .58) 100%);
  }

  .ready-glow {
    bottom: calc(var(--dock-h) + 2vh);
    width: clamp(260px, 38vw, 420px);
    height: 150px;
  }

  .ready-wrap {
    max-width: 440px;
    gap: 5px;
    padding-bottom: 0;
  }

  .ready-brand b {
    font-size: clamp(24px, 5.8vh, 38px);
  }

  .app .start-screen .arcade-start {
    width: min(252px, 34vw);
    height: clamp(46px, 12.5vh, 58px);
    font-size: clamp(15px, 3.6vh, 20px);
    border-radius: 14px;
  }

  .app .start-screen .arcade-start .mp-icon {
    width: clamp(20px, 5.2vh, 27px);
    height: clamp(20px, 5.2vh, 27px);
  }

  .app .start-screen .start-note {
    font-size: clamp(8px, 2vh, 10px);
  }

  /* ---------- 弹层：横屏下加宽并压缩高度，避免卡片越过屏幕 ---------- */
  .modal-mask {
    padding: 14px;
  }

  .modal {
    max-width: min(520px, 92vw);
    max-height: 92vh;
    padding: 18px 18px 14px;
  }

  .modal h3 {
    font-size: 19px;
    margin: 2px 0 10px;
  }

  .how-card {
    max-width: min(720px, 94vw);
  }

  .how-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .how-item {
    padding: 6px 8px;
  }

  .how-item p {
    font-size: 10.5px;
    line-height: 1.45;
  }

  .props-card {
    max-width: min(640px, 94vw);
  }

  .prop-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .prop-item {
    padding: 7px 8px;
    gap: 6px;
  }

  .end-card {
    max-width: 440px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 14px 18px 12px;
  }

  .end-crown {
    width: 42px;
    height: 42px;
    margin-bottom: 4px;
  }

  .end-crown .mp-icon {
    width: 23px;
    height: 23px;
  }

  .end-card h2 {
    font-size: 21px;
  }

  .end-desc {
    margin-bottom: 9px;
  }

  .end-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 9px;
  }

  .save-card {
    max-width: min(620px, 94vw);
  }
}

/* 短横屏（如 568×320）：进一步压缩技能栏与操作台 */
@media (orientation: landscape) and (max-height: 380px) {
  :root {
    --dock-h: 72px;
    --hud-h: 42px;
    --rail-ico: 30px;
    --rail-gap: 2px;
  }

  .app .player-chip {
    width: 188px;
  }

  .app .p-meta {
    gap: 1px;
  }

  .app .p-meta > b {
    font-size: 8.5px;
    max-width: 70px;
  }

  .app .side-rails .skill .s-name {
    display: none;
  }

  .app .side-rails .skill {
    height: 32px;
  }

  .app .dock .skill.power .s-name {
    display: none;
  }

  .app .dock .skill.power {
    width: 34px;
    height: 34px;
  }

  .app .dock .skill.power .s-ico {
    width: 34px;
    height: 34px;
  }

  .app .pot-btn {
    min-width: 58px;
    height: 42px;
  }

  .app .pot-jar {
    width: 30px;
    height: 30px;
  }

  .app .dock .ctrl-row {
    width: min(330px, 56vw);
  }

  .app .dock .tier-arrow {
    width: 24px;
    margin: 3px;
  }

  .app .dock .tier-num b {
    font-size: 15px;
  }

  .app .dock .ad-pill {
    max-width: 84px;
    min-height: 34px;
  }
}
