/* ============================================================
   深海炮手 · 炮台就位层
   炮台/炮塔从海底升回原「开炮」键的位置：
   不再保留单独的开炮按钮，炮台底座本身就是开炮键。
   ============================================================ */

/* 炮台绘制层抬高到操作台之上，让炮座真正坐进原开炮键的位置；
   HUD 与技能栏再抬一层，保证信息永远不被炮管遮住。 */
#turret {
  z-index: 31;
}

.app .hud {
  z-index: 36;
}

.app .side-rails {
  z-index: 33;
}

.app .dock {
  z-index: 30;
}

/* 原开炮键在操作台中央留下的空位，由真实炮座覆盖 */
.app .dock .ctrl-row {
  grid-template-columns: minmax(0, 1fr) clamp(80px, 24vw, 104px) minmax(0, 1fr);
}

.app .turret-slot {
  display: block;
  width: 100%;
  height: 1px;
  pointer-events: none;
}

/* 炮座表面已写明开炮方式，旧的操作台提示条让位给炮座 */
.app .dock-hint {
  display: none !important;
}

/* ---------- 炮座本体 ---------- */
.app .turret-seat {
  position: absolute;
  left: 50%;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  width: clamp(80px, 24vw, 104px);
  height: clamp(50px, 13.5vh, 60px);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: pointer;
  transition: opacity .22s ease, visibility .22s ease;
}

.app.mode-menu .turret-seat {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app .turret-seat:focus-visible .ts-plate {
  outline: 2px solid rgba(156, 238, 255, .9);
  outline-offset: 5px;
}

.ts-halo {
  position: absolute;
  inset: -18px -14px -10px;
  border-radius: 50%;
  background:
    radial-gradient(58% 62% at 50% 54%, rgba(255, 186, 74, .42) 0%, rgba(255, 138, 36, .16) 44%, rgba(255, 120, 20, 0) 72%);
  filter: blur(2px);
  animation: tsHalo 2.6s ease-in-out infinite;
  pointer-events: none;
}

.ts-ring {
  position: absolute;
  inset: -7px -10px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 224, 156, .48);
  animation: tsSpin 18s linear infinite;
  pointer-events: none;
}

.ts-ring::after {
  content: "";
  position: absolute;
  inset: 6px 8px;
  border-radius: 50%;
  border: 1px solid rgba(140, 238, 255, .16);
}

.ts-plate {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-radius: 46% / 50%;
  border: 2.5px solid #FFF0C4;
  background:
    radial-gradient(72% 88% at 50% 0%, rgba(255, 255, 255, .7) 0%, rgba(255, 249, 218, .24) 38%, rgba(255, 236, 170, 0) 68%),
    radial-gradient(60% 74% at 50% 108%, rgba(255, 244, 196, .55) 0%, rgba(255, 202, 96, .16) 46%, rgba(120, 60, 0, 0) 76%),
    linear-gradient(180deg, #FFF8D8 0%, #FFE396 20%, #FFC451 48%, #EE9C20 72%, #B96806 100%);
  box-shadow:
    0 0 0 3px rgba(72, 34, 0, .62),
    0 0 0 5px rgba(255, 220, 138, .5),
    0 0 28px rgba(255, 168, 48, .58),
    0 5px 16px rgba(0, 0, 0, .56),
    inset 0 3px 3px rgba(255, 255, 255, .8),
    inset 0 -9px 16px rgba(146, 72, 0, .38);
  transition: transform .09s ease, box-shadow .18s ease, border-color .18s ease;
}

.ts-plate::before {
  content: "";
  position: absolute;
  inset: 4px 7px;
  border-radius: 46% / 50%;
  border: 1px solid rgba(255, 245, 206, .62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, 0) 44%),
    radial-gradient(52% 40% at 50% 100%, rgba(151, 76, 0, .14), rgba(151, 76, 0, 0) 74%);
  pointer-events: none;
}

/* 两侧铆钉 */
.ts-plate::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  background:
    radial-gradient(circle at 0 50%, #FFFBE4 0 1.6px, #8C4B00 1.8px 2.6px, transparent 2.8px),
    radial-gradient(circle at 100% 50%, #FFFBE4 0 1.6px, #8C4B00 1.8px 2.6px, transparent 2.8px);
  pointer-events: none;
}

.ts-cap {
  position: relative;
  z-index: 1;
  font-size: 7.5px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .2em;
  text-indent: .2em;
  color: #733800;
  text-shadow: 0 1px 0 rgba(255, 249, 216, .92);
}

.ts-num {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 1px;
  margin: -1px 0 -1px;
  line-height: 1;
}

.ts-num b {
  font-size: clamp(20px, 5.4vh, 27px);
  line-height: .98;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #0A3550;
  -webkit-text-fill-color: #0A3550;
  text-shadow:
    0 1px 0 rgba(255, 249, 216, .95),
    0 -1px 0 rgba(255, 249, 216, .8),
    0 0 5px rgba(4, 40, 64, .18);
}

.ts-num em {
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  color: #0A3550;
  text-shadow: 0 1px 0 rgba(255, 249, 216, .8);
  transform: translateY(-1px);
}

.ts-fire {
  position: relative;
  z-index: 1;
  font-size: 6.5px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .04em;
  color: #5C2C00;
  text-shadow: 0 1px 0 rgba(255, 249, 216, .7);
  white-space: nowrap;
}

.ts-fire em {
  font-style: normal;
  margin: 0 2px;
  color: rgba(92, 44, 0, .58);
}

.ts-bolt {
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 26px;
  height: 7px;
  margin-left: -13px;
  border-radius: 50%;
  background: radial-gradient(50% 100% at 50% 0%, rgba(255, 222, 150, .8), rgba(255, 160, 50, 0) 78%);
  filter: blur(.4px);
  pointer-events: none;
}

/* 按压：炮台整体下沉，金光收紧 */
.app .turret-seat.is-pressed .ts-plate,
.app .turret-seat:active .ts-plate {
  transform: scale(.94) translateY(1px);
  border-color: #FFFBE0;
  box-shadow:
    0 0 0 3px rgba(2, 18, 32, .76),
    0 0 0 5px rgba(255, 226, 150, .55),
    0 0 34px rgba(255, 178, 58, .72),
    0 2px 9px rgba(0, 0, 0, .5),
    inset 0 2px 2px rgba(255, 255, 255, .4),
    inset 0 -6px 12px rgba(0, 8, 18, .55);
}

.app .turret-seat.is-pressed .ts-halo,
.app .turret-seat:active .ts-halo {
  opacity: 1;
  filter: blur(1px) brightness(1.25);
}

.app .turret-seat.is-firing .ts-ring {
  border-color: rgba(255, 240, 190, .9);
}

.app.laser-on .ts-plate {
  box-shadow:
    0 0 0 3px rgba(2, 18, 32, .72),
    0 0 0 5px rgba(168, 244, 255, .55),
    0 0 34px rgba(90, 220, 255, .6),
    0 5px 16px rgba(0, 0, 0, .56),
    inset 0 3px 3px rgba(255, 255, 255, .34),
    inset 0 -9px 16px rgba(0, 8, 18, .66);
}

@keyframes tsHalo {
  0%, 100% { opacity: .58; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes tsSpin {
  to { transform: rotate(360deg); }
}

/* 横屏：给炮座让出真正的中央位置，两侧倍率与广告各归一边 */
@media (orientation: landscape) {
  .app .dock .ctrl-row {
    width: min(600px, 76vw);
    grid-template-columns: minmax(0, 1fr) clamp(120px, 27.5vh, 210px) minmax(0, 1fr);
  }

  .app .turret-seat {
    width: clamp(96px, 16vh, 140px);
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));
    height: clamp(46px, 13vh, 58px);
  }
}

/* 竖屏：炮座落在原开炮键的同一纵向位置 */
@media (orientation: portrait) {
  .app .turret-seat {
    bottom: calc(9px + env(safe-area-inset-bottom, 0px));
  }

  .app .turret-slot {
    height: 1px;
  }
}

/* 短横屏与小竖屏：压缩两侧控件，炮座保持完整 */
@media (orientation: landscape) and (max-height: 380px) {
  .app .dock .ctrl-row {
    width: min(440px, 70vw);
  }

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

  .app .dock .tier-pill {
    min-width: 40px;
  }

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

  .app .turret-seat {
    width: 98px;
    height: 46px;
  }

  .ts-cap {
    font-size: 6.5px;
  }

  .ts-num b {
    font-size: 18px;
  }

  .ts-fire {
    display: none;
  }
}

@media (orientation: portrait) and (max-width: 360px) {
  .app .dock .ctrl-row {
    grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr);
  }

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

  .app .dock .tier-pill {
    min-width: 42px;
  }

  .app .turret-seat {
    width: 80px;
    height: 50px;
  }

  .ts-fire {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ts-halo,
  .ts-ring {
    animation: none;
  }
}
