/* =========================================================
   RAIDER · 战术绘制沙盘（2D）
   ========================================================= */
.tb-body {
  margin: 0;
  min-height: 100vh;
  background: #050507;
  color: #f4f4f2;
  font-family: var(--font-cn);
  overflow: hidden;
}

.tb-top {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid #1f1f27;
  background: #08080b;
}

.tb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.tb-brand b {
  display: block;
  font-family: "Anton", var(--font-display);
  font-size: 18px;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.tb-brand i {
  display: block;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.16em;
  color: rgba(244, 244, 242, 0.5);
}

.tb-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid #ff2fae;
  background: #ff2fae;
  color: #08080b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s linear;
}

.tb-btn:hover {
  filter: brightness(1.12);
}

.tb-btn.is-ghost {
  background: transparent;
  border-color: #2c2c36;
  color: rgba(244, 244, 242, 0.75);
}

.tb-btn.is-ghost:hover {
  border-color: #ff2fae;
  color: #fff;
}

.tb-main {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 312px;
  height: calc(100vh - 64px);
  min-height: 0;
}

.tb-panel {
  min-height: 0;
  overflow-y: auto;
  background: #08080b;
  border-right: 1px solid #1f1f27;
  padding: 14px;
  scrollbar-width: thin;
}

.tb-right {
  border-right: 0;
  border-left: 1px solid #1f1f27;
}

.tb-block {
  border: 1px solid #1f1f27;
  background: #0b0b0f;
  padding: 12px;
  margin-bottom: 12px;
}

.tb-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: rgba(244, 244, 242, 0.55);
  margin-bottom: 8px;
}

.tb-label .mono {
  color: rgba(255, 212, 0, 0.75);
  font-size: 9px;
}

.tb-select,
.tb-input {
  width: 100%;
  padding: 8px 9px;
  background: #050507;
  border: 1px solid #2c2c36;
  color: #f4f4f2;
  font-size: 12.5px;
  border-radius: 0;
  outline: none;
}

.tb-select:focus,
.tb-input:focus {
  border-color: #ff2fae;
}

.tb-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tb-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  color: rgba(244, 244, 242, 0.5);
}

.tb-range {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.tb-range input {
  flex: 1;
  accent-color: #ff2fae;
}

.tb-mini {
  padding: 7px 12px;
  border: 1px solid #2c2c36;
  background: #0b0b0f;
  color: rgba(244, 244, 242, 0.72);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s linear;
}

.tb-mini:hover {
  border-color: #ff2fae;
  color: #fff;
}

.tb-factions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tb-fac {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #2c2c36;
  background: #050507;
  color: rgba(244, 244, 242, 0.68);
  padding: 6px 8px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s linear;
}

.tb-fac i {
  width: 9px;
  height: 9px;
  background: var(--fc);
  flex: 0 0 auto;
}

.tb-fac:hover {
  border-color: var(--fc);
  color: #fff;
}

.tb-fac.is-active {
  border-color: var(--fc);
  box-shadow: inset 0 0 0 1px var(--fc);
  color: #fff;
  background: #0f0f14;
}

.tb-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tb-tool {
  padding: 8px;
  border: 1px solid #2c2c36;
  background: #050507;
  color: rgba(244, 244, 242, 0.68);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s linear;
}

.tb-tool:hover {
  border-color: #ffd400;
  color: #fff;
}

.tb-tool.is-active {
  border-color: #ffd400;
  background: rgba(255, 212, 0, 0.12);
  color: #ffd400;
}

.tb-colors {
  gap: 6px;
}

.tb-color {
  width: 22px;
  height: 22px;
  border: 1px solid #2c2c36;
  background: var(--c);
  cursor: pointer;
  padding: 0;
}

.tb-color.is-active {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tb-hint {
  margin: 9px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: rgba(244, 244, 242, 0.38);
}

.tb-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #050507;
  overflow: hidden;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: none;
}

.tb-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  padding: 6px 10px;
  border: 1px solid #2c2c36;
  background: rgba(8, 8, 11, 0.82);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: rgba(244, 244, 242, 0.72);
  pointer-events: none;
}

.tb-mortar-read {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.tb-mortar-read > div {
  border: 1px solid #1f1f27;
  background: #050507;
  padding: 8px;
}

.tb-mortar-read span {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: rgba(244, 244, 242, 0.45);
  margin-bottom: 3px;
}

.tb-mortar-read b {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #ffd400;
  letter-spacing: 0.02em;
}

.tb-info {
  display: grid;
  gap: 6px;
  font-size: 11.5px;
}

.tb-info > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed #1f1f27;
  padding-bottom: 4px;
}

.tb-info span {
  color: rgba(244, 244, 242, 0.45);
}

.tb-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 10.5px;
  color: rgba(244, 244, 242, 0.55);
  font-family: var(--font-mono);
}

.tb-toast {
  position: fixed;
  left: 50%;
  top: 78px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 9px 16px;
  background: #ff2fae;
  color: #08080b;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #ff2fae;
  transition: opacity 0.25s linear;
}

.tb-toast.is-bad {
  background: #ff4d4d;
  border-color: #ff4d4d;
  color: #08080b;
}

.tb-toast.is-out {
  opacity: 0;
}

@media (max-width: 1100px) {
  .tb-body {
    overflow: auto;
  }
  .tb-main {
    grid-template-columns: 1fr;
    height: auto;
  }
  .tb-panel {
    border: 0;
    border-bottom: 1px solid #1f1f27;
    max-height: none;
  }
  .tb-stage {
    height: 62vh;
    order: -1;
  }
  .tb-factions {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .tb-top {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
}


.tb-enemy {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #ff8f8f;
  cursor: pointer;
}

.tb-enemy input {
  accent-color: #ff4d4d;
}

/* =========================================================
   战术沙盘 · 房间（密码保护 / 实时协作）
   ========================================================= */
.tb-room-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(700px 420px at 50% 18%, rgba(255, 47, 174, 0.12), transparent 70%), rgba(3, 3, 6, 0.92);
  backdrop-filter: blur(6px);
  overflow: auto;
}
.tb-room-gate[hidden] {
  display: none !important;
}
.tb-room-card {
  width: min(620px, 100%);
  border: 1px solid #2c2c36;
  border-top: 2px solid #ff2fae;
  background: #08080b;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
  padding: 22px 24px 18px;
}
.tb-room-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tb-room-brand b {
  display: block;
  font-size: 19px;
  letter-spacing: 0.02em;
}
.tb-room-brand i {
  display: block;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: rgba(244, 244, 242, 0.45);
  margin-top: 2px;
}
.tb-room-brand .tb-room-secure {
  margin-left: auto;
}
.tb-room-secure {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #ffd400;
  border: 1px solid rgba(255, 212, 0, 0.4);
  background: rgba(255, 212, 0, 0.06);
  padding: 3px 8px;
  white-space: nowrap;
}
.tb-room-desc {
  margin: 14px 0 16px;
  font-size: 12.5px;
  line-height: 1.8;
  color: rgba(244, 244, 242, 0.6);
}
.tb-room-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #1f1f27;
  margin-bottom: 14px;
}
.tb-room-tabs button {
  padding: 9px 16px;
  border: 1px solid #2c2c36;
  border-bottom: 0;
  background: transparent;
  color: rgba(244, 244, 242, 0.6);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tb-room-tabs button.is-active {
  background: #ff2fae;
  border-color: #ff2fae;
  color: #08080b;
}
.tb-room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  margin-bottom: 14px;
}
.tb-room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid #1f1f27;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}
.tb-room-item:hover {
  border-color: rgba(255, 47, 174, 0.55);
  background: rgba(255, 47, 174, 0.06);
}
.tb-room-item b {
  font-size: 13px;
}
.tb-room-item i {
  font-style: normal;
  font-size: 10px;
  color: rgba(244, 244, 242, 0.45);
}
.tb-room-item span {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #4ade80;
  white-space: nowrap;
}
.tb-room-empty {
  padding: 18px 12px;
  border: 1px dashed #2c2c36;
  text-align: center;
  font-size: 12px;
  color: rgba(244, 244, 242, 0.42);
}
.tb-room-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tb-room-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: rgba(244, 244, 242, 0.55);
}
.tb-room-form input[type="text"],
.tb-room-form input[type="password"],
.tb-room-form input:not([type]) {
  padding: 10px 12px;
  border: 1px solid #2c2c36;
  background: #0b0b10;
  color: #f4f4f2;
  font-size: 13px;
  outline: none;
}
.tb-room-form input:focus {
  border-color: #ff2fae;
}
.tb-room-form .tb-btn {
  margin-top: 4px;
  padding: 11px 14px;
}
.tb-room-check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-size: 12px !important;
}
.tb-room-hint {
  font-size: 10.5px;
  line-height: 1.7;
  color: rgba(244, 244, 242, 0.4);
  margin: 0;
}
.tb-room-back {
  display: inline-block;
  margin-top: 16px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(244, 244, 242, 0.42);
  text-decoration: none;
}
.tb-room-back:hover {
  color: #ff2fae;
}

/* 房间状态条 */
.tb-room-bar {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid #2c2c36;
  border-left: 3px solid #ff2fae;
  background: rgba(8, 8, 11, 0.92);
  backdrop-filter: blur(8px);
  font-size: 12px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}
.tb-room-bar[hidden] {
  display: none !important;
}
.tb-room-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 217, 143, 0.8);
}
.tb-room-bar b {
  font-size: 13px;
}
.tb-room-bar .mono {
  font-size: 10px;
  color: rgba(244, 244, 242, 0.5);
}
.tb-room-bar .tb-room-secure {
  font-size: 9px;
  padding: 2px 6px;
}
.tb-room-bar .tb-mini {
  padding: 5px 9px;
  font-size: 10px;
}

/* 战术讨论聊天 */
.tb-room-chat {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 95;
  width: 300px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  border: 1px solid #2c2c36;
  border-top: 2px solid #ff2fae;
  background: rgba(8, 8, 11, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.tb-room-chat[hidden] {
  display: none !important;
}
.tb-room-chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #1f1f27;
}
.tb-room-chat-head b {
  font-size: 12px;
  letter-spacing: 0.06em;
}
.tb-room-chat-head .mono {
  font-size: 9px;
  color: rgba(244, 244, 242, 0.45);
}
.tb-room-chat-head button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: rgba(244, 244, 242, 0.6);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.tb-room-chat-list {
  flex: 1;
  min-height: 90px;
  overflow: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.tb-chat-msg {
  font-size: 12px;
  line-height: 1.6;
}
.tb-chat-msg i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  color: #ffd400;
  margin-right: 6px;
}
.tb-chat-msg.is-mine i {
  color: #ff2fae;
}
.tb-chat-msg em {
  font-style: normal;
  color: rgba(244, 244, 242, 0.4);
  font-size: 9px;
  margin-left: 6px;
}
.tb-chat-msg p {
  margin: 1px 0 0;
  color: rgba(244, 244, 242, 0.82);
  word-break: break-word;
}
.tb-room-chat-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #1f1f27;
}
.tb-room-chat-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #2c2c36;
  background: #0b0b10;
  color: #f4f4f2;
  font-size: 12px;
  outline: none;
}
.tb-room-chat-form input:focus {
  border-color: #ff2fae;
}
.tb-room-chat-form .tb-mini {
  padding: 6px 10px;
  font-size: 10px;
}

@media (max-width: 720px) {
  .tb-room-bar {
    top: 70px;
    width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
  }
  .tb-room-bar .tb-room-secure {
    display: none;
  }
  .tb-room-chat {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 8px;
  }
}

/* 单人模式入口 */
.tb-room-single {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #2c2c36;
}
.tb-room-single span {
  font-size: 11px;
  color: rgba(244, 244, 242, 0.42);
}
.tb-room-single .tb-btn {
  padding: 8px 14px;
  font-size: 11.5px;
}

/* 沙盘 2.0：共享方案 + 共享倒计时 */
.tb-room-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 2px 8px;
  border: 1px solid var(--separator-strong);
  background: rgba(255, 255, 255, 0.03);
}
.tb-room-timer b {
  font-size: 15px;
  color: #ffd400;
  text-shadow: 0 0 12px rgba(255, 212, 0, 0.45);
}
.tb-room-timer b.is-running {
  color: #4ade80;
  text-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
}
.tb-room-timer b.is-done {
  color: #ff4d4d;
  animation: tbTimerBlink 1s steps(2, start) infinite;
}
@keyframes tbTimerBlink {
  to {
    opacity: 0.35;
  }
}
.tb-room-plans {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  margin: 8px 0;
  overflow: auto;
}
.tb-plan-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid var(--separator);
  background: rgba(255, 255, 255, 0.025);
}
.tb-plan-main {
  flex: 1;
  min-width: 0;
}
.tb-plan-main b {
  display: block;
  font-size: 12px;
}
.tb-plan-main span {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--quaternary);
}
.tb-mini.is-danger {
  color: #ff8a8a;
  border-color: rgba(255, 77, 77, 0.35);
}
.tb-timer-set {
  gap: 8px;
}

/* 沙盘 2.0：房间栏 / 方案列表自适应 */
.tb-room-bar {
  flex-wrap: wrap;
  row-gap: 6px;
}
.tb-room-timer {
  margin-left: auto;
}
.tb-room-timer b {
  min-width: 54px;
  text-align: center;
}
.tb-room-plans .tb-plan-row {
  flex-wrap: wrap;
}
.tb-room-plans .tb-plan-main {
  flex: 1 1 100%;
}
.tb-room-plans .tb-plan-row .tb-mini {
  flex: 1 1 auto;
}

/* 沙盘房间栏紧凑布局 */
.tb-room-bar {
  width: min(96vw, 1180px);
  gap: 8px;
  padding: 7px 10px;
}
.tb-room-bar .tb-room-secure {
  display: none;
}
#roomBarName {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-room-timer {
  margin-left: auto;
  gap: 4px;
  padding: 2px 6px;
}
.tb-room-timer .tb-mini {
  padding: 3px 7px;
  font-size: 9px;
}

/* ICU P1：地图显示设置 / 弹道计算器 */
.tb-row .tb-field {
  min-width: 0;
  flex: 1;
}
.tb-row .tb-field .tb-input,
.tb-row .tb-field .tb-select {
  width: 100%;
}
.tb-mortar-read {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.tb-mortar-read div span {
  font-size: 9px;
}
.tb-mortar-read div b {
  font-size: 11px;
}
#mapLayerSel {
  width: 100%;
}

/* RAAS 猜点 */
.tb-lane-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 190px;
  overflow: auto;
  margin-top: 6px;
}
.tb-lane-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--separator);
  font-size: 11px;
}
.tb-lane-row b {
  color: #ffd400;
  min-width: 16px;
}
.tb-lane-row span {
  flex: 1;
  color: var(--tertiary);
}
.tb-lane-row.is-current {
  border-color: rgba(255, 212, 0, 0.5);
  background: rgba(255, 212, 0, 0.08);
}
.tb-mini.is-on {
  color: #ffd400;
  border-color: rgba(255, 212, 0, 0.6);
}

/* Squad 图标库 */
.tb-icon-library {
  display: flex;
  flex-direction: column;
  max-height: 560px;
}
.tb-icon-tools {
  gap: 6px;
  margin-bottom: 6px;
}
.tb-icon-tools .tb-select {
  flex: 0 0 44%;
}
.tb-icon-tools .tb-input {
  flex: 1;
  min-width: 0;
}
.tb-icons-squad {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}
.tb-icon-squad {
  width: auto !important;
  height: auto !important;
  min-height: 54px;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 2px !important;
  border: 1px solid var(--separator);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 2px;
  cursor: pointer;
}
.tb-icon-squad img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
  pointer-events: none;
}
.tb-icon-squad i {
  display: block;
  max-width: 100%;
  font-size: 8px;
  line-height: 1.15;
  font-style: normal;
  color: var(--quaternary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-icon-squad.is-active {
  border-color: #ffd400;
  background: rgba(255, 212, 0, 0.12);
  box-shadow: 0 0 10px rgba(255, 212, 0, 0.25);
}

/* 开局部署 / 阵营颜色 / 进攻路线 */
.tb-sides,
.tb-routes {
  gap: 6px;
  margin-top: 6px;
}
.tb-side {
  flex: 1;
  padding: 7px 4px;
  font-size: 11px;
  color: var(--tertiary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--separator-strong);
  cursor: pointer;
}
.tb-side.is-active[data-side="friendly"] {
  color: #8ab4ff;
  border-color: #5b7cff;
  background: rgba(91, 124, 255, 0.15);
  box-shadow: 0 0 12px rgba(91, 124, 255, 0.3);
}
.tb-side.is-active[data-side="enemy"] {
  color: #ff9a9a;
  border-color: #ff4d4d;
  background: rgba(255, 77, 77, 0.14);
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.3);
}
.tb-route-friendly {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
}
.tb-route-enemy {
  color: #ff6b6b;
  border-color: rgba(255, 77, 77, 0.5);
}
