:root {
  --bg: #1e1e2f;
  --card: #25253b;
  --card-hover: #2f2f49;
  --border: #333356;    /* 카드 테두리 */
  --text: #e7e9f3;      /* 본문 텍스트 */
  --muted: #a3a6c2;     /* 보조 텍스트 */
  --accent: #6366f1;    /* 포커스/포인트 */
  --badge-pre: #6b7280; /* 장전 */
  --badge-am: #06b6d4; /* 오전 */
  --badge-pm: #f59e0b; /* 오후 */
}

/* ===== Base ===== */
body { background: var(--bg); color: var(--text); }

.strategy-container {
  width: 1000px; margin: 0 auto; padding: 30px 16px 120px;
}
.strategy-header h1 { margin: 0; font-size: 24px; font-weight: 700; text-align: left; }
.strategy-sub { margin-top: 6px; color: var(--muted); font-size: 14px; }

/* 리스트형 (한 줄에 하나) */
.strategy-grid { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.strategy-card {
  position: relative; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 60px 14px 14px; /* 뱃지 자리 확보 */
  cursor: pointer; transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.strategy-card:hover { background: var(--card-hover); transform: translateY(-2px); border-color: #2e3340; }

/* 카드 내 뱃지 (우상단 고정) */
.strategy-card .badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px;
  border: 1px solid #ffffff1a; text-align: center; white-space: nowrap;
}
.badge.pre { background: color-mix(in hsl, var(--badge-pre) 24%, transparent); color: #d1d5db; }
.badge.am  { background: color-mix(in hsl, var(--badge-am) 24%, transparent);  color: #d1f5fb; }
.badge.pm  { background: color-mix(in hsl, var(--badge-pm) 24%, transparent);  color: #fff2cc; }

.card-title { margin: 8px 0 6px; font-size: 16px; font-weight: 700; line-height: 1.35; }
.card-datetime { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

/* ===== Modal 공통 ===== */
.strategy-modal {
  position: fixed; inset: 0; background: #00000099;
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 1000;
}
.strategy-modal[aria-hidden="false"] { display: flex; }

.strategy-modal__dialog {
  width: min(880px, 92vw); background: var(--card);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 10px 36px #00000080; max-height: 86vh; overflow: auto; position: relative;
}

/* 데스크탑 닫기(X) 버튼 */
.strategy-modal__close {
  position: absolute; right: 18px; top: 16px;
  background: #ffffff10; border: 1px solid #ffffff1a; color: #fff;
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 18px; line-height: 1;
}
.strategy-modal__close:hover { background: #ffffff20; }

/* 데스크탑 헤더(제목+메타) */
.strategy-modal__head {
  padding: 22px 22px 12px; background: linear-gradient(180deg, #14171f 0%, #111318 100%);
  border-bottom: 1px solid var(--border);
}
.strategy-modal__head h2 { margin: 0 42px 8px 0; font-size: 20px; font-weight: 800; }
.modal-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.modal-meta .badge { margin-left: auto; }

.strategy-modal__body {
  padding: 20px 22px 26px; white-space: pre-wrap; line-height: 1.6; font-size: 15px;
}

/* 접근성 포커스 */
.strategy-card:focus-visible,
.strategy-modal__close:focus-visible,
.topbar-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }

/* ===== 모바일 상단바(기본은 숨김) ===== */
.strategy-modal__topbar { display: none; }   /* 데스크탑 완전 숨김 */
.topbar-back { display: none; }              /* 데스크탑 완전 숨김 */

/* ===== Mobile (<=640px) ===== */
@media (max-width: 640px) {

  /* 메인 페이지 타이틀 */
  .strategy-header h1 { font-size: 18px; text-align: center; }

  /* 모달 풀스크린 */
  .strategy-modal { padding: 0; }
  .strategy-modal__dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }

  /* 상단바: ← + 날짜 + 뱃지 (모바일에서만 보임) */
  .strategy-modal__topbar {
    display: flex;
    position: fixed; top: 0; left: 0; right: 0; height: 52px;
    align-items: center; gap: 10px; padding: 0 12px;
    background: linear-gradient(180deg, #14171f 0%, #111318 100%);
    border-bottom: 1px solid var(--border); z-index: 2000;
  }
  .topbar-back {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 999px;
    background: #ffffff10; border: 1px solid #ffffff1a; color: #fff; font-size: 18px; cursor: pointer;
  }
  .topbar-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
  .topbar-datetime {
    font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw;
  }
  .strategy-modal__topbar .badge { border: 1px solid #ffffff1a; white-space: nowrap; }

  /* 모바일에선 X 버튼 숨김 */
  .strategy-modal__close { display: none !important; }

  /* 제목은 본문 헤더로 내려가고, 상단바 아래에서 시작 */
  .strategy-modal__head {
    position: static; background: none; border-bottom: none;
    padding: 16px 14px 10px; margin-top: 52px;   /* 상단바 높이만큼 여백 */
  }
  .strategy-modal__head h2 { margin: 0 0 6px 0; font-size: 18px; line-height: 1.35; word-break: keep-all; }

  /* 모바일에서는 헤더의 메타 숨김(중복 방지) */
  .strategy-modal__head .modal-meta { display: none; }

  /* 본문 패딩 약간 축소 */
  .strategy-modal__body { padding: 14px; }
}
