/* ============================================================
 * 2. Reset + Typography
 * ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0;
}

body.tactical-v77 {
  -webkit-user-select: none;
  user-select: none;
}

body.tactical-v77 input,
body.tactical-v77 textarea,
body.tactical-v77 [contenteditable="true"],
body.tactical-v77 #log,
body.tactical-v77 .pv-hidden-copy,
body.tactical-v77 .selectable-text {
  -webkit-user-select: text;
  user-select: text;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

strong, b {
  font-weight: bold;
}

em, i {
  font-style: italic;
}

/* ============================================================
 * 3. Body Layout（方案 A：两列 Grid + 窄屏单列流式）
 *
 * 桌面 ≥ 1024px：body 是 grid，主区（决策区）在左 + 侧栏（上下文 + log）在右
 * 移动 < 1024px：.col-* wrapper 用 display:contents 透明化，恢复单列流式
 * ============================================================ */

body {
  color: var(--text-main);
  background: var(--bg-deepest);
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;

  /* 单列默认（< 1024px 沿用） */
  max-width: 820px;
  display: block;
}

/* 单列模式：wrapper 透明，子元素直接 flow 在 body 层 */
.col-side-top,
.col-main,
.col-side-bottom {
  display: contents;
}

/* 两列 Grid 模式 */
@media (min-width: 1024px) {
  body {
    max-width: 1200px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 360px);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "main side-top"
      "main side-bottom";
    gap: 16px 18px;
    align-items: start;
  }

  .col-side-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-area: side-top;
    min-width: 0;
  }

  .col-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-area: main;
    min-width: 0;
  }

  .col-side-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-area: side-bottom;
    min-width: 0;
    align-self: stretch;
  }

  /* 2 列模式下：col 内部用 gap 控制间距，去除子元素 margin-bottom 避免双倍间距 */
  .col-side-top > *,
  .col-main > *,
  .col-side-bottom > * {
    margin-bottom: 0;
  }

  /* bottom-log 在 2 列模式下：可滚动，最大高度由 viewport 决定 */
  .col-side-bottom #bottom-log {
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .col-side-bottom #timeline {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .col-side-bottom #log {
    flex: 1;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
  }
}
