/* 텐버거 가즈아 웹 — 버거 테마 2종 (색 값은 PC stock_app.pyw THEMES 그대로) */
:root, .theme-bun {
  --bg:#fbf4e6; --panel:#fffaf0; --card:#fffaf0; --line:#ecdcc0; --text:#3a2a1a; --muted:#8c7558;
  --accent:#8a5a24; --hover:#5a3510; --filing:#b0651a; --up:#d43c3c; --down:#2563c9;
  --upfill:#f6d9cf; --downfill:#d6e0f0; --movebg:#f8ead2; --signal:#e0892b;
  --head:#c98a3e; --onhead:#fffaf0; --headbtn:#e2ad69; --sub:#f3e3c3; --main:#f2c230; --onmain:#3a2a1a;
  --bun:#d79a4f; --seed:#fff4d8; --cheese:#f2c230; --lettuce:#6aa84f; --shade:rgba(40,25,10,.45);
}
.theme-dark {
  --bg:#2b2118; --panel:#33271d; --card:#3a2d21; --line:#4d3c2c; --text:#efe3d0; --muted:#a8957c;
  --accent:#f6c453; --hover:#ffe08a; --filing:#f0a050; --up:#ff6b5e; --down:#5ea0ff;
  --upfill:#4a2c27; --downfill:#25324a; --movebg:#45362a; --signal:#ff9f40;
  --head:#22190f; --onhead:#f6c453; --headbtn:#4a3a2b; --sub:#4a3a2b; --main:#f6c453; --onmain:#2b2118;
  --bun:#8a5a2b; --seed:#d9b98a; --cheese:#f6c453; --lettuce:#5c8f45; --shade:rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: "Pretendard", system-ui, sans-serif; font-size: 14px; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
a { color: var(--accent); text-decoration: none; } a:hover { color: var(--hover); }
.up { color: var(--up); } .dn { color: var(--down); } .mu { color: var(--muted); } .filing { color: var(--filing); }
.hidden { display: none !important; }

/* 알약 버튼 */
.pill { border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; background: var(--sub); white-space: nowrap; }
.pill.main { background: var(--main); color: var(--onmain); }
.pill.head { background: var(--headbtn); color: var(--onhead); }
.pill:disabled { opacity: .5; cursor: default; }
.pill:not(:disabled):hover { filter: brightness(1.05); }

/* 머리띠 + 치즈·양상추 띠 */
.hd { background: var(--head); color: var(--onhead); display: flex; align-items: center; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
.hd .title { font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd .sp { flex: 1; }
.stripes::before, .stripes::after { content: ""; display: block; }
.stripes::before { height: 4px; background: var(--cheese); }
.stripes::after { height: 3px; background: var(--lettuce); }

/* 카드 + 깨 박힌 번 띠 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.bun { height: 7px; background: var(--bun) radial-gradient(var(--seed) 1px, transparent 1.6px) 0 0 / 14px 7px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }

.ico { width: 30px; height: 30px; border-radius: 50%; background: var(--sub); display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.tk { font-weight: 800; color: var(--accent); }
.ses { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 8px; padding: 1px 7px; border: 1px solid var(--line); color: var(--muted); background: var(--panel); white-space: nowrap; }
.ses.on { border-color: var(--accent); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); display: inline-block; }

/* ---------- 로그인 ---------- */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; text-align: center; }
.login .logo { font-size: 72px; line-height: 1; }
.login h1 { margin: 0; font-size: 26px; }
.login p { margin: 0; color: var(--muted); line-height: 1.6; }
.authform { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; margin-top: 6px; }
.authform input { width: 100%; padding: 12px 14px; }
.authform .hint { text-align: left; margin: 0; }
.pill.big { padding: 13px 0; font-size: 15px; border-radius: 12px; }
.small { font-size: 12px; }

/* ---------- 처음 설정 ---------- */
.setup { max-width: 560px; margin: 0 auto; padding: 28px 16px 40px; }
.setup h2 { font-size: 22px; margin: 0 0 6px; }
.setup .lead { color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.setup label { display: block; font-weight: 700; margin: 16px 0 6px; }
.setup input[type=text] { width: 100%; }
.preview { margin-top: 18px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.preview .hd { padding: 12px 16px; }
.steps { display: flex; gap: 6px; margin-bottom: 16px; } .steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); } .steps i.on { background: var(--accent); }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* 종목 검색 */
.search input { width: 100%; }
.results { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); max-height: 300px; overflow: auto; }
.results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.results button:last-child { border-bottom: 0; }
.results button:hover, .results button:focus { background: var(--sub); outline: none; }
.results .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .ex { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.5; min-height: 18px; }
.hint.err { color: var(--down); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--sub); border-radius: 999px; padding: 4px 6px 4px 10px; font-weight: 700; font-size: 13px; }
.chip button { width: 20px; height: 20px; border-radius: 50%; color: var(--muted); }
.chip button:hover { background: var(--line); }

/* ---------- 본 화면 ---------- */
.main { min-height: 100%; display: flex; flex-direction: column; }
.content { flex: 1; padding: 16px; max-width: 1280px; width: 100%; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.q { padding: 12px 14px; cursor: pointer; display: block; width: 100%; text-align: left; }
.q .top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.q .top .nm { flex-basis: 100%; }
.q .top .sp { flex: 1; }
.q .px { font-size: 24px; font-weight: 800; margin-top: 8px; letter-spacing: -.3px; }
.q .ch { font-weight: 700; }
.q .own { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.q .nm { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.q-card:hover { border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 8px; }
.lower { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 12px; }
.lower h3 { margin: 0 0 8px; font-size: 15px; }
.tabs { display: none; }

/* ---------- 뉴스·공시 ---------- */
.news { padding: 7px 0; border-bottom: 1px solid var(--line); line-height: 1.55; }
.news:last-child { border-bottom: 0; }
.news .rk { display: inline-block; width: 18px; font-weight: 700; color: var(--muted); }
.news a.nt { color: var(--text); } .news a:hover { color: var(--hover); text-decoration: underline; }
.news .meta { color: var(--muted); font-size: 12px; }
.news .detail { color: var(--muted); font-size: 12.5px; margin: 2px 0 0 18px; }
.bd { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 8px; color: #1a1a1a; margin-right: 5px; font-weight: 700; line-height: 18px; }
.bd.good { background: #f27272; } .bd.bad { background: #6fa3f2; } .bd.neutral { background: #c9c3b8; }
.nsec { margin-bottom: 14px; } .nsec:last-child { margin-bottom: 0; }
.nsec .sh { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 2px solid var(--line); }
.nsec .sh .ico { width: 24px; height: 24px; font-size: 13px; }
.more { color: var(--accent); font-weight: 700; font-size: 13px; padding: 6px 0; }
.nf { margin: 0 0 8px; } .nf button { font-size: 12.5px; padding: 4px 12px; border-radius: 999px; background: var(--sub); font-weight: 700; }
.nf button.on { background: var(--accent); color: var(--panel); }
.box { background: var(--movebg); border-radius: 12px; padding: 10px 12px; line-height: 1.65; margin: 0 0 10px; font-size: 13px; }
.box a { color: var(--text); } .box a:hover { color: var(--hover); }
.earn { font-size: 11px; font-weight: 700; color: var(--filing); white-space: nowrap; }
.lower .side { align-self: start; }
.chartbox { margin: 8px 0 4px; }
.bigchart { width: 100%; height: 220px; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; touch-action: pan-y; cursor: crosshair; }
.cinfo { min-height: 22px; font-size: 13.5px; }
.caxis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; gap: 8px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: calc(100vw - 32px); }
.toast { width: 320px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; font-size: 13px; line-height: 1.5; }
.toast .tb { height: 5px; background: var(--head); border-bottom: 2px solid var(--cheese); }
.toast .tc { padding: 8px 12px 10px; } .toast .th { display: flex; align-items: center; gap: 6px; } .toast .th b { flex: 1; }
.toast .x { width: 24px; height: 24px; font-size: 13px; }
@media (max-width: 760px) { #toasts { left: 16px; right: 16px; bottom: 76px; } .toast { width: auto; } }

/* ---------- 대화상자 ---------- */
.shade { position: fixed; inset: 0; background: var(--shade); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { background: var(--panel); color: var(--text); border-radius: 18px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.dialog .dh { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.dialog .dh h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog .db { padding: 14px 16px 18px; }
.x { width: 32px; height: 32px; border-radius: 50%; font-size: 18px; color: var(--muted); } .x:hover { background: var(--sub); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 120px; } .field span { font-size: 12px; color: var(--muted); }
.sec-title { font-weight: 800; margin: 18px 0 8px; } .sec-title:first-child { margin-top: 0; }
.seg { display: inline-flex; background: var(--sub); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; }
.seg button.on { background: var(--accent); color: var(--panel); }
.big-px { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.spark { width: 100%; height: 120px; display: block; margin: 10px 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.range { height: 8px; border-radius: 4px; background: var(--line); position: relative; margin: 8px 0 4px; }
.range i { position: absolute; top: -3px; width: 4px; height: 14px; border-radius: 2px; background: var(--accent); }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.danger { color: var(--down); }
table.times { border-collapse: collapse; width: 100%; font-size: 13px; } table.times td { padding: 5px 4px; border-bottom: 1px solid var(--line); }

/* ---------- 폰 화면 (좁은 폭) ---------- */
@media (max-width: 760px) {
  .hd .title { font-size: 16px; }
  .hd .wide { display: none; }
  .content { padding: 10px 10px 90px; }
  .grid { grid-template-columns: 1fr; gap: 8px; }
  .q { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
  .q .top { flex: 1; min-width: 0; flex-wrap: wrap; }
  .q .top .dot { order: 3; }
  .q .px { margin: 0; font-size: 17px; text-align: right; }
  .q .ch { font-size: 12px; text-align: right; }
  .q .own { margin: 0; font-size: 11.5px; text-align: right; }
  .q .right { text-align: right; }
  .q .nm { width: 100%; }
  .lower { grid-template-columns: 1fr; }
  .tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
  .tabs button { flex: 1; padding: 8px 0 10px; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
  .tabs button.on { color: var(--accent); font-weight: 800; }
  .shade { align-items: flex-end; padding: 0; }
  .dialog { max-width: none; border-radius: 18px 18px 0 0; max-height: 94vh; }
  [data-tab]:not(.tab-on) { display: none; }
}
@media (min-width: 761px) {
  .phone-only { display: none !important; }
}
