* { box-sizing: border-box; }
:root {
  --bg:#eef3f9; --card:#fff; --text:#071225; --muted:#64748b; --line:#dbe4f0;
  --blue:#2563eb; --red:#ef1111; --green:#10b981; --navy:#071528; --shadow:0 14px 34px rgba(15,23,42,.08);
}
html, body { margin:0; min-height:100%; color:var(--text); font-family:Arial,"Malgun Gothic","맑은 고딕",sans-serif; background:radial-gradient(circle at 20% 0%, rgba(37,99,235,.12), transparent 28%), radial-gradient(circle at 90% 10%, rgba(16,185,129,.12), transparent 24%), var(--bg); }
.note-page { max-width:1560px; margin:0 auto; padding:22px 24px 34px; }
.note-topbar { display:flex; justify-content:space-between; gap:18px; align-items:flex-start; margin-bottom:16px; }
.eyebrow { margin:0 0 8px; color:var(--blue); font-size:12px; font-weight:900; letter-spacing:.14em; }
h1 { margin:0; font-size:36px; letter-spacing:-.06em; }
.sub { margin:8px 0 0; color:var(--muted); }
.note-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
select, button, .main-link { height:42px; border:1px solid #cbd5e1; border-radius:12px; padding:0 13px; background:#fff; color:var(--text); font-weight:900; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
button { cursor:pointer; }
button:disabled { opacity:.45; cursor:not-allowed; }
.ghost-btn { color:#334155; }
.main-link { color:#fff; background:linear-gradient(135deg,#0f172a,#1d4ed8); border:0; }
.note-summary { display:grid; grid-template-columns: 180px 180px 180px minmax(0,1fr); gap:12px; margin-bottom:14px; }
.summary-card { min-height:104px; background:rgba(255,255,255,.94); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow); padding:16px; }
.summary-card.dark { background:linear-gradient(135deg,#071528,#1d4ed8); color:#fff; }
.summary-card span, .summary-card em { display:block; color:var(--muted); font-size:12px; font-style:normal; font-weight:800; }
.summary-card.dark span, .summary-card.dark em { color:#cbd5e1; }
.summary-card strong { display:block; font-size:30px; margin:5px 0; }
.summary-card.help strong { font-size:18px; margin:0 0 6px; }
.summary-card.help p { margin:0; color:#475569; line-height:1.55; font-size:13px; }
.filter-row { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.filter-btn { height:38px; border-radius:999px; font-size:12px; color:#334155; }
.filter-btn.active { background:#eff6ff; border-color:#2563eb; color:#1d4ed8; }
.note-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.note-card { background:rgba(255,255,255,.96); border:1px solid var(--line); border-radius:22px; box-shadow:var(--shadow); padding:18px; min-width:0; }
.note-card-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:12px; }
.rank-line { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rank { width:28px; height:28px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; background:#06142b; color:#fff; font-weight:900; }
.rank-line strong { font-size:20px; letter-spacing:-.04em; }
.rank-line small { color:var(--muted); font-weight:800; }
.tags { display:flex; gap:5px; flex-wrap:wrap; margin-top:8px; }
.tags span { border-radius:999px; background:#eff6ff; color:#1d4ed8; padding:4px 8px; font-size:11px; font-weight:900; }
.score-badge { min-width:82px; border-radius:18px; padding:10px; text-align:center; background:#f1f5f9; }
.score-badge span { display:block; color:var(--muted); font-size:11px; font-weight:900; }
.score-badge strong { display:block; font-size:26px; }
.score-badge.hot { background:#fee2e2; color:#b91c1c; }
.score-badge.warm { background:#ffedd5; color:#c2410c; }
.score-badge.cool { background:#dbeafe; color:#1d4ed8; }
.type-line { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
.type-line b { color:#0f172a; }
.type-line span, .type-line em { border-radius:999px; padding:5px 9px; background:#f1f5f9; color:#475569; font-size:12px; font-weight:900; font-style:normal; }
.metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:14px; }
.metric-grid div { background:#f8fafc; border:1px solid #e2e8f0; border-radius:14px; padding:9px 10px; min-width:0; }
.metric-grid span { display:block; color:var(--muted); font-size:11px; font-weight:900; margin-bottom:3px; }
.metric-grid strong { display:block; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.note-columns { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.note-columns h3 { margin:0 0 8px; font-size:15px; }
ul { margin:0; padding:0; list-style:none; }
.check-list li, .todo-list li { display:flex; gap:8px; align-items:flex-start; border-bottom:1px solid #edf2f7; padding:7px 0; font-size:12.5px; line-height:1.35; }
.check-list b { width:18px; flex:0 0 18px; }
.check-list li.ok b { color:#16a34a; }
.check-list li.no { color:#94a3b8; }
.check-list span { flex:1; }
.check-list em { color:#64748b; font-style:normal; font-size:11.5px; text-align:right; max-width:120px; }
.todo-list li::before { content:"•"; color:#2563eb; font-weight:900; }
.pos { color:var(--red) !important; }
.neg { color:var(--blue) !important; }
.note-guide { margin-top:18px; background:rgba(255,255,255,.92); border:1px solid var(--line); border-radius:22px; box-shadow:var(--shadow); padding:18px; }
.note-guide h2 { margin:0 0 12px; font-size:20px; }
.guide-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.guide-grid div { background:#f8fafc; border:1px solid #e2e8f0; border-radius:16px; padding:12px; }
.guide-grid strong { display:block; margin-bottom:5px; }
.guide-grid p { margin:0; color:#64748b; font-size:12.5px; line-height:1.5; }
.empty { grid-column:1/-1; text-align:center; color:#64748b; background:#fff; border:1px solid var(--line); border-radius:20px; padding:36px; }
.empty.error { color:#b91c1c; }
@media (max-width:1100px) { .note-list{grid-template-columns:1fr;} .note-summary{grid-template-columns:repeat(3,1fr);} .summary-card.help{grid-column:1/-1;} .guide-grid{grid-template-columns:repeat(2,1fr);} }
@media (max-width:720px) { .note-page{padding:14px 12px 24px;} .note-topbar{flex-direction:column;} h1{font-size:30px;} .note-actions{width:100%; justify-content:flex-start;} .note-actions select{flex:1; min-width:150px;} .note-summary{grid-template-columns:1fr 1fr;} .metric-grid{grid-template-columns:1fr 1fr;} .note-columns{grid-template-columns:1fr;} .guide-grid{grid-template-columns:1fr;} .note-card{padding:14px;} .rank-line strong{font-size:18px;} }

/* ===============================
   Stock link + chart modal
================================ */
.stock-note-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.04em;
  cursor: pointer;
}
.stock-note-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.chart-modal.hidden {
  display: none !important;
}
.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.50);
}
.chart-modal-card {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100vw - 28px));
  height: min(920px, calc(100vh - 28px));
  margin: 14px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.30);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chart-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 18px 10px;
  border-bottom: 1px solid #e5e7eb;
}
.chart-modal-head h3 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.04em;
}
.chart-modal-meta {
  color: #475569;
  font-size: 13px;
  line-height: 1.75;
}
.chart-modal-controls {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chart-modal-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chart-modal-controls label span {
  color: #64748b;
  font-size: 12px;
}
.chart-modal-controls select {
  width: 92px;
  padding: 10px 12px;
  height: 42px;
}
.chart-modal-controls input {
  width: 110px;
  padding: 10px 12px;
  height: 42px;
}
.chart-modal-controls button {
  width: auto;
  padding: 10px 13px;
  border-radius: 10px;
  height: 42px;
}
.chart-modal-close {
  min-width: 42px;
  background: #fff;
  color: #111827;
  border: 1px solid #cbd5e1;
}
.chart-modal-note {
  padding: 10px 18px 0;
  color: #64748b;
  font-size: 12px;
}
.chart-popup {
  width: 100%;
  flex: 1;
  min-height: 0;
}
.break {
  color: #16a34a;
  font-weight: 900;
}
.fail {
  color: #dc2626;
  font-weight: 900;
}

@media (max-width: 900px) {
  .chart-modal-card {
    height: calc(100vh - 16px);
    width: calc(100vw - 16px);
    margin: 8px auto;
  }
  .chart-modal-head {
    flex-direction: column;
  }
  .chart-modal-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .chart-popup {
    min-height: 660px;
  }
  .stock-note-link {
    font-size: 18px;
  }
}

/* =========================================================
   Mobile chart modal scroll fix
   - 모바일에서 차트 팝업 내부를 상하/좌우로 스크롤 가능하게 함
   - 차트 영역은 모바일에서도 충분한 캔버스 폭/높이를 유지
========================================================= */
body.chart-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .chart-modal {
    overflow: hidden !important;
    touch-action: none;
  }

  .chart-modal-card {
    width: calc(100vw - 10px) !important;
    height: calc(100dvh - 10px) !important;
    max-width: none !important;
    max-height: none !important;
    margin: 5px auto !important;
    border-radius: 14px !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    display: block !important;
  }

  .chart-modal-head,
  .chart-modal-note,
  .chart-popup {
    min-width: 1040px !important;
  }

  .chart-modal-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    flex-direction: row !important;
    align-items: flex-start !important;
  }

  .chart-modal-controls {
    width: auto !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
  }

  .chart-modal-note {
    padding: 8px 16px 0 !important;
    white-space: nowrap;
  }

  .chart-popup {
    width: 1040px !important;
    height: 760px !important;
    min-height: 760px !important;
    flex: 0 0 auto !important;
  }
}

@media (max-width: 520px) {
  .chart-modal-head,
  .chart-modal-note,
  .chart-popup {
    min-width: 980px !important;
  }

  .chart-popup {
    width: 980px !important;
    height: 740px !important;
    min-height: 740px !important;
  }

  .chart-modal-head h3 {
    font-size: 20px !important;
  }

  .chart-modal-meta {
    font-size: 12px !important;
  }

  .chart-modal-controls select,
  .chart-modal-controls input,
  .chart-modal-controls button {
    height: 38px !important;
    padding: 8px 10px !important;
  }
}


/* ===============================
   Trading note help modal + footer
================================ */
.help-btn {
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 0 16px;
  background: #fff;
  color: #071225;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}
.help-btn:hover { filter: brightness(1.03); }

.footer-note {
  margin: 18px 0 0;
  padding: 14px 10px 4px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.help-modal.hidden { display: none !important; }
.help-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}
.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}
.help-modal-card {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  margin: 14px auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.30);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.help-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
}
.help-modal-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: -0.04em;
}
.help-modal-head p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}
.help-modal-close {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #111827;
  font-size: 20px;
}
.help-modal-body {
  overflow: auto;
  padding: 18px 20px 20px;
  -webkit-overflow-scrolling: touch;
}
.help-section + .help-section { margin-top: 18px; }
.help-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: -0.03em;
}
.help-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.help-section li {
  position: relative;
  padding-left: 14px;
  color: #475569;
  line-height: 1.55;
  font-size: 13px;
}
.help-section li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2563eb;
  font-weight: 900;
}
.type-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.type-help-grid article {
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: #f8fafc;
  padding: 13px 14px;
}
.type-help-grid strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #0f172a;
}
.type-help-grid p,
.muted-help p {
  margin: 0;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.55;
}
.muted-help {
  border-top: 1px dashed #dbe4f0;
  padding-top: 14px;
}


/* 유형 도움말 상세 설명 */
.type-help-detail-grid article {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.type-help-list {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.type-help-list li {
  position: relative;
  padding-left: 14px;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.45;
}
.type-help-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #2563eb;
  font-weight: 900;
}
.type-help-note {
  margin-top: 2px !important;
  color: #0f172a !important;
  font-weight: 800;
}

body.help-modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .help-btn { height: 42px; padding: 0 13px; }
  .help-modal-card {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
    border-radius: 16px;
  }
  .help-modal-head {
    padding: 15px 16px 12px;
  }
  .help-modal-head h2 {
    font-size: 21px;
  }
  .help-modal-body {
    padding: 15px 16px 18px;
  }
  .type-help-grid {
    grid-template-columns: 1fr;
  }
}


/* ===============================
   Minervini 8/8 note section
================================ */
.minervini-note-section {
  margin-top: 18px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.minervini-note-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.minervini-note-head h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -0.04em;
}
.minervini-note-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.minervini-note-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 32px;
  border-radius: 999px;
  background: #d1fae5;
  color: #047857;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.minervini-note-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.minervini-note-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 13px;
  min-width: 0;
}
.minervini-note-rank {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #06142b;
  color: #fff;
  font-weight: 900;
}
.minervini-note-main {
  min-width: 0;
}
.minervini-note-name {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.minervini-note-name .stock-note-link {
  font-size: 17px;
  line-height: 1.15;
}
.minervini-note-name small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  padding-top: 3px;
}
.minervini-note-tags {
  margin-top: 8px;
}
.minervini-note-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}
.minervini-note-metrics div {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 7px 8px;
  min-width: 0;
  overflow: hidden;
}
.minervini-note-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
  margin-bottom: 2px;
}
.minervini-note-metrics strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.minervini-pass {
  color: #047857;
}
.minervini-empty {
  grid-column: 1 / -1;
  padding: 20px;
}

@media (max-width: 1200px) {
  .minervini-note-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .minervini-note-section { padding: 14px; }
  .minervini-note-head { flex-direction: column; }
  .minervini-note-list { grid-template-columns: 1fr; }
  .minervini-note-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* 도움말: 준비점수/미너비니 박스 정리 */
.help-score-box {
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  padding: 14px;
}
.help-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.help-score-grid article {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 15px;
  padding: 12px;
}
.help-score-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 14px;
}
.help-score-grid p {
  margin: 0;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.55;
}
.minervini-help-box {
  border: 1px solid #bbf7d0;
  border-radius: 18px;
  background: linear-gradient(135deg, #ecfdf5, #f8fafc);
  padding: 14px;
}
.minervini-help-box h3 {
  color: #065f46;
}
.minervini-help-box ul {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 15px;
  padding: 12px 12px 12px 14px;
}
.minervini-condition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: minervini-cond;
}
.minervini-condition-list li {
  counter-increment: minervini-cond;
  position: relative;
  min-height: 42px;
  padding: 10px 12px 10px 42px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  color: #475569;
  font-size: 12.5px;
  line-height: 1.45;
}
.minervini-condition-list li::before {
  content: counter(minervini-cond);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #06142b;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 720px) {
  .help-score-grid,
  .minervini-condition-list {
    grid-template-columns: 1fr;
  }
}

/* Kullamagi trading note section */
.kullamagi-note-section {
  border-color: #bfdbfe;
  background: rgba(248, 251, 255, .96);
}
.kullamagi-note-card {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}
.kullamagi-help-box {
  border-color: #bfdbfe !important;
  background: linear-gradient(180deg, #f8fbff, #eff6ff) !important;
}
