/* 한우지기 앱 스타일 — 단색 표면·얇은 구분선·단계색은 정보에만. (그라데이션·글로우·유리효과·좌측 색띠 없음) */
:root{
  --ground:#f3f0e8; --surface:#fffdf8; --ink:#1f2119; --muted:#6b6d5f; --hair:#dedacd; --hair2:#ece8dc;
  --brand:#1f5c3d; --brand-ink:#ffffff; --brand-soft:#e3ece5;
  --good:#2b8a52; --caution:#b8841a; --warn:#c5652b; --danger:#bf3a2c; --severe:#8c231f; --clear:#4b6e5a;
  --cold1:#3f6fa3; --cold2:#2f5788; --cold3:#1f3f6b;
  --r:14px; --r-s:9px; --tab-h:60px;
  --font:"IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --ground:#151610; --surface:#1d1e17; --ink:#ecebe2; --muted:#a2a394; --hair:#33342b; --hair2:#2a2b23;
    --brand:#7fbf97; --brand-ink:#0f1b14; --brand-soft:#1f2b22;
  }
}
:root[data-theme="dark"]{
  --ground:#151610; --surface:#1d1e17; --ink:#ecebe2; --muted:#a2a394; --hair:#33342b; --hair2:#2a2b23;
  --brand:#7fbf97; --brand-ink:#0f1b14; --brand-soft:#1f2b22;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--font);font-size:16px;line-height:1.5;
  -webkit-font-smoothing:antialiased;overscroll-behavior-y:contain}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
a{color:inherit}
h1,h2,h3{margin:0;font-weight:600;line-height:1.3}
h2{font-size:17px}
h3{font-size:15px}
p{margin:0}
.num{font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}
.small{font-size:13px}
.hidden{display:none !important}

#app{max-width:480px;margin:0 auto;min-height:100dvh;padding-bottom:calc(var(--tab-h) + env(safe-area-inset-bottom))}
.screen{padding:0 16px 24px}
.topbar{display:flex;align-items:center;gap:8px;padding:14px 0 10px;position:sticky;top:0;background:var(--ground);z-index:5}
.topbar .title{font-weight:600;font-size:18px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .farmbtn{display:inline-flex;align-items:center;gap:6px;background:none;border:none;padding:4px 0;font-weight:600;font-size:18px;cursor:pointer;max-width:70%}
.topbar .farmbtn svg{width:16px;height:16px;flex:0 0 auto;color:var(--muted)}
.iconbtn{position:relative;width:40px;height:40px;border-radius:50%;border:1px solid var(--hair);background:var(--surface);display:grid;place-items:center;cursor:pointer;padding:0}
.iconbtn svg{width:20px;height:20px}
.iconbtn .cnt{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;border-radius:9px;background:var(--danger);color:#fff;font-size:11px;font-weight:600;display:grid;place-items:center;padding:0 4px}

/* 카드 */
.card{background:var(--surface);border:1px solid var(--hair);border-radius:var(--r);padding:14px 16px;margin-bottom:12px}
.card.flat{background:transparent;border:none;padding:0}
.card h2{margin-bottom:8px}
.row{display:flex;align-items:center;gap:10px}
.row.between{justify-content:space-between}
.stack{display:flex;flex-direction:column;gap:8px}
.hr{height:1px;background:var(--hair2);margin:10px 0}

/* 히어로(실시간 THI) */
.hero{color:#fff;border-radius:var(--r);padding:18px 18px 16px;margin-bottom:12px;background:var(--st,#2b8a52)}
.hero .top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.hero .word{font-size:15px;font-weight:600;opacity:.95}
.hero .big{display:flex;align-items:baseline;gap:6px;margin-top:2px}
.hero .big .v{font-size:72px;font-weight:700;line-height:1;letter-spacing:-1px}
.hero .big .u{font-size:16px;font-weight:600;opacity:.9}
.hero .stage{font-size:26px;font-weight:700;margin-top:4px}
.hero .sub{font-size:13.5px;margin-top:8px;opacity:.95}
.hero .face{width:112px;height:112px;flex:0 0 auto}
.hero .face svg{width:100%;height:100%}
.hero .line{margin-top:12px;padding-top:10px;border-top:1px solid rgba(255,255,255,.35);font-size:14px;font-weight:500}
.hero .line + .line{margin-top:6px;padding-top:6px;border-top:none}
.hero.stale{outline:2px dashed rgba(255,255,255,.5)}

/* 시간별 스트립 */
.strip{display:flex;gap:6px;overflow-x:auto;padding:4px 2px 8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
.strip::-webkit-scrollbar{height:0}
.strip .h{flex:0 0 56px;scroll-snap-align:start;text-align:center;border-radius:var(--r-s);padding:8px 4px 6px;background:var(--ground);border:1px solid var(--hair2)}
.strip .h.now{border-color:var(--ink)}
.strip .h.day{flex-basis:auto;padding:8px 6px;background:transparent;border:none;display:flex;align-items:center;font-size:12px;color:var(--muted);writing-mode:vertical-rl;text-orientation:upright;letter-spacing:2px}
.strip .h .t{font-size:12px;color:var(--muted)}
.strip .h .v{font-size:19px;font-weight:600;line-height:1.2;margin-top:2px}
.strip .h .bar{height:5px;border-radius:3px;margin:5px auto 4px;width:28px}
.strip .h .tp{font-size:12px;color:var(--muted)}
.strip .h .src{font-size:10px;color:var(--muted)}

/* 3일 */
.days{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.days .d{min-width:0;background:var(--ground);border:1px solid var(--hair2);border-radius:var(--r-s);padding:8px 4px;text-align:center;overflow:hidden}
.days .d .n{font-size:12px;color:var(--muted)}
.days .d .v{font-size:20px;font-weight:600}
.days .d .bar{height:5px;border-radius:3px;width:30px;margin:5px auto}
.days .d .tt{font-size:12px;color:var(--muted)}

/* 할 일 */
.todo{list-style:none;margin:0;padding:0}
.todo li{display:flex;gap:10px;align-items:flex-start;padding:8px 0;border-top:1px solid var(--hair2);font-size:15px}
.todo li:first-child{border-top:none}
.todo li .dot{width:10px;height:10px;border-radius:50%;flex:0 0 auto;margin-top:8px;background:var(--st,var(--good))}
.linkrow{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-top:1px solid var(--hair2);cursor:pointer;background:none;border-left:none;border-right:none;border-bottom:none;width:100%;text-align:left}
.linkrow:first-child{border-top:none}
.linkrow svg{width:18px;height:18px;color:var(--muted);flex:0 0 auto}

/* 달력 */
.cal{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
.cal .wd{text-align:center;font-size:12px;color:var(--muted);padding:2px 0}
.cal .c{min-width:0;padding:5px 0 4px;border-radius:8px;background:var(--ground);border:1px solid var(--hair2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:12px;position:relative}
.cal .c.empty{background:transparent;border:none}
.cal .c .dn{font-size:12px;color:var(--muted)}
.cal .c.today .dn{color:var(--ink);font-weight:700}
.cal .c .sq{width:16px;height:16px;border-radius:4px;background:var(--hair)}
.cal .c .tv{font-size:11px;font-weight:600}
.cal .c.fc .sq{opacity:.55;outline:1px dashed var(--muted);outline-offset:-1px}
.cal-nav{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.cal-nav button{background:none;border:1px solid var(--hair);border-radius:8px;width:34px;height:34px;cursor:pointer}
.legend{display:flex;flex-wrap:wrap;gap:8px 12px;font-size:12px;color:var(--muted);margin-top:8px}
.legend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:4px;vertical-align:-1px}

/* 탭 바 */
.tabs{position:fixed;left:0;right:0;bottom:0;height:calc(var(--tab-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);
  background:var(--surface);border-top:1px solid var(--hair);display:flex;justify-content:space-around;z-index:20}
.tabs a{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:11px;font-weight:600;color:var(--muted);text-decoration:none;max-width:120px}
.tabs a svg{width:22px;height:22px}
.tabs a.on{color:var(--brand)}
@media (min-width:481px){.tabs{max-width:480px;margin:0 auto;border-left:1px solid var(--hair);border-right:1px solid var(--hair)}}

/* 폼·버튼 */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--hair);background:var(--surface);border-radius:10px;padding:10px 14px;font-weight:600;cursor:pointer;line-height:1.2}
.btn.primary{background:var(--brand);color:var(--brand-ink);border-color:var(--brand)}
.btn.danger{color:var(--danger);border-color:var(--danger)}
.btn.block{width:100%}
.btn.sm{padding:7px 10px;font-size:13.5px}
.btn:disabled{opacity:.5;cursor:default}
.btn svg{width:16px;height:16px}
.field{display:flex;flex-direction:column;gap:4px;margin-bottom:10px}
.field label{font-size:13px;color:var(--muted);font-weight:500}
.input{width:100%;background:var(--ground);border:1px solid var(--hair);border-radius:10px;padding:11px 12px;outline:none}
.input:focus{border-color:var(--brand)}
.seg{display:flex;border:1px solid var(--hair);border-radius:10px;overflow:hidden}
.seg button{flex:1;border:none;background:var(--surface);padding:9px 6px;cursor:pointer;font-weight:500}
.seg button.on{background:var(--brand);color:var(--brand-ink)}
.switch{appearance:none;width:44px;height:26px;border-radius:13px;background:var(--hair);position:relative;cursor:pointer;flex:0 0 auto;margin:0}
.switch:checked{background:var(--brand)}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:left .15s}
.switch:checked::after{left:21px}
.cands{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.cands li{border:1px solid var(--hair);border-radius:10px;padding:9px 11px;cursor:pointer;background:var(--surface)}
.cands li b{display:block;font-weight:600}
.cands li span{font-size:13px;color:var(--muted)}
.note{font-size:13px;color:var(--muted)}
.err{font-size:13.5px;color:var(--danger);font-weight:500}

/* 배지·상태 */
.badge{display:inline-block;font-size:12px;font-weight:600;padding:2px 8px;border-radius:999px;color:#fff;background:var(--st,var(--muted))}
.badge.outline{background:transparent;color:var(--ink);border:1px solid var(--hair)}
.pill{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;padding:4px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand)}

/* 목록 */
.list{list-style:none;margin:0;padding:0}
.list li{padding:10px 0;border-top:1px solid var(--hair2)}
.list li:first-child{border-top:none}
.item{display:flex;align-items:center;gap:10px;cursor:pointer}
.item .grow{flex:1;min-width:0}
.item .t{font-weight:600}
.item .s{font-size:13px;color:var(--muted)}
.item .sw{width:10px;height:38px;border-radius:5px;flex:0 0 auto;background:var(--st,var(--hair))}
.item > svg{width:18px;height:18px;flex:0 0 auto;color:var(--muted)}
.item .btn{flex:0 0 auto}

/* 확률 막대 */
.bars{display:flex;flex-direction:column;gap:6px}
.bars .b{display:grid;grid-template-columns:36px 1fr 44px;align-items:center;gap:8px;font-size:14px}
.bars .b .track{height:12px;background:var(--hair2);border-radius:6px;overflow:hidden}
.bars .b .fill{height:100%;background:var(--muted);border-radius:6px}
.bars .b.inset .fill{background:var(--brand)}
.bars .b.point .g{font-weight:700}
.bigline{font-size:22px;font-weight:700}

/* 차트 */
.chart{width:100%;height:auto;display:block}
.chart text{font-size:11px;fill:var(--muted)}

/* 시트·토스트 */
.sheet-bg{position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:30;display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:480px;background:var(--surface);border-radius:18px 18px 0 0;padding:14px 16px calc(16px + env(safe-area-inset-bottom));max-height:88dvh;overflow:auto}
.sheet h2{margin-bottom:10px}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--tab-h) + 14px + env(safe-area-inset-bottom));background:var(--ink);color:var(--ground);padding:10px 14px;border-radius:10px;font-size:14px;z-index:40;max-width:90%;text-align:center}
.ctxbar{background:var(--st,var(--muted));color:#fff;border-radius:10px;padding:10px 12px;font-weight:600;font-size:14px;margin-bottom:12px}
.check{display:flex;gap:10px;align-items:flex-start;padding:10px 0;border-top:1px solid var(--hair2);cursor:pointer}
.check:first-child{border-top:none}
.check input{width:20px;height:20px;margin:2px 0 0;accent-color:var(--brand);flex:0 0 auto}
.check.done span{color:var(--muted);text-decoration:line-through}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;font-size:14px}
.kv dt{color:var(--muted)}
.kv dd{margin:0}
table.tbl{width:100%;border-collapse:collapse;font-size:14px}
table.tbl th{text-align:left;font-weight:500;color:var(--muted);padding:6px 4px;border-bottom:1px solid var(--hair)}
table.tbl td{padding:7px 4px;border-bottom:1px solid var(--hair2)}
.sources{font-size:12px;color:var(--muted);margin-top:8px}
.sources li{margin-bottom:2px}
.center{text-align:center}
.empty{padding:28px 10px;text-align:center;color:var(--muted)}
.spin{display:inline-block;width:16px;height:16px;border:2px solid var(--hair);border-top-color:var(--brand);border-radius:50%;animation:sp .8s linear infinite;vertical-align:-3px}
@keyframes sp{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){*{animation:none !important;transition:none !important}}
