:root {
  color-scheme: light dark;
  --bg: #f6f5f9; --card: #fff; --text: #1f1c28; --muted: #635e70; --line: #e3e0ea;
  --accent: #5b3fd4; --accent-text: #4c32bd; --accent-soft: #eeeafc; --on-accent: #fff;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --grid: #ece9f1; --base: #bdb9c8; --tick: #6f6a7c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15141a; --card: #1f1e24; --text: #f0eef5; --muted: #aca7b8; --line: #36343e;
    --accent: #5b3fd4; --accent-text: #b3a2f7; --accent-soft: #2a2545;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --grid: #2c2b33; --base: #4a4853; --tick: #9d98a8; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.65; word-break: keep-all; overflow-wrap: anywhere;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }
a { color: var(--accent-text); }
.inner { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--text); text-decoration: none; }
.site-nav { display: flex; gap: 14px; font-size: 14px; }
.site-nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav a:hover { color: var(--accent-text); }
main { padding: 26px 0 40px; }
h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.25; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 21px; line-height: 1.35; margin: 34px 0 10px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 17px; }
.small { font-size: 13.5px; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 16px; }
label.fld { display: block; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
input[type=text], input[type=date], select { display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 10px 12px; font: inherit; font-weight: 400; font-size: 17px;
  color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
select { font-size: 15px; min-height: 42px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, svg:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border: 0; padding: 0; margin: 0 0 6px; }
.seg legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 6px; }
.seg label { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 10px 4px; border: 1px solid var(--line); border-radius: 10px; font-size: 14.5px; }
.seg input:checked + span { background: var(--accent-soft); border-color: var(--accent-text); color: var(--accent-text); font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.seg.ratio { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.error { color: #c42626; font-size: 14px; font-weight: 600; margin: 0; }
.error:empty { display: none; }
@media (prefers-color-scheme: dark) { .error { color: #f08a8a; } }
.prompt { color: var(--muted); text-align: center; margin: 4px 0 0; font-size: 15px; }
.big { font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: var(--accent-text); margin: 0; }
.btn { display: inline-block; font: inherit; font-weight: 700; text-align: center; text-decoration: none; padding: 11px 18px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(.93); }
.install { padding: 6px 12px; font-size: 13.5px; white-space: nowrap; }

.hero { text-align: center; padding: 22px 12px; margin: 14px 0; border-radius: 12px; background: var(--accent-soft); }
.hero p { margin: 0; }
.hero-when { font-weight: 700; font-size: 15px; }
.hero .big { font-size: clamp(52px, 15vw, 76px); margin: 4px 0; }
.hero-cap { font-size: 13.5px; color: var(--muted); }
.hero-sum { font-size: 16px; font-weight: 600; margin-top: 8px !important; }

.rcards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.rcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.rcard-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.rcard h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.rcard-trend { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.rcard-val { margin: 2px 0 6px; font-size: 32px; font-weight: 800; line-height: 1.2; }
.rcard-text { margin: 10px 0 6px; font-size: 13.5px; }
.rcard-next { margin: 0; font-size: 12.5px; color: var(--muted); }
.gauge { position: relative; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.gauge::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--base); }
.gauge.plain::after { display: none; }
.gauge i { position: absolute; top: 0; bottom: 0; display: block; }
.gauge i.s1 { background: var(--s1); } .gauge i.s2 { background: var(--s2); } .gauge i.s3 { background: var(--s3); }

.lg-mark { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; flex: none; }
.lg-mark.s1 { background: var(--s1); } .lg-mark.s2 { background: var(--s2); } .lg-mark.s3 { background: var(--s3); }
.chart-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; }
.chart-bar .btn { padding: 7px 12px; font-size: 14px; font-weight: 600; min-height: 40px; }
.chart-bar input[type=date] { width: auto; flex: 1 1 150px; margin: 0; min-height: 40px; padding: 6px 10px; font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13.5px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.readout { min-height: 22px; margin: 6px 0 2px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
#chart { width: 100%; min-height: 260px; }
.chart { display: block; touch-action: pan-y; cursor: crosshair; }
.c-grid { stroke: var(--grid); stroke-width: 1; }
.c-base { stroke: var(--base); stroke-width: 1; }
.c-today { stroke: var(--base); stroke-width: 1; }
.c-cross { stroke: var(--text); stroke-width: 1; opacity: .55; }
.c-tick { fill: var(--tick); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.c-end { fill: var(--muted); font-size: 12px; font-weight: 600; }
.c-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-line.s1 { stroke: var(--s1); } .c-line.s2 { stroke: var(--s2); } .c-line.s3 { stroke: var(--s3); }
.c-dot { stroke: var(--card); stroke-width: 2; }
.c-dot.s1 { fill: var(--s1); } .c-dot.s2 { fill: var(--s2); } .c-dot.s3 { fill: var(--s3); }
details.tbl { margin: 8px 0 0; font-size: 14px; }
details.tbl summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

.mrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 0 0 12px; }
.mrow-name { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mrow-val { font-weight: 800; }
.mrow .gauge { grid-column: 1 / -1; }
.pick { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }
.person { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 2px; min-width: 0; }
.person h2 { font-size: 15px; margin: 0 0 8px; }

.note-box { border-left: 3px solid var(--accent-text); background: var(--bg); padding: 10px 14px; margin: 14px 0; font-size: 13.5px; border-radius: 0 8px 8px 0; }
.result-actions { display: flex; gap: 8px; margin: 14px 0 0; }
.result-actions .btn { flex: 1; }
.studio { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 8px; }
.studio h3 { margin: 0 0 8px; font-size: 14px; }
#card { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); }
.opt { margin: 0 0 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; min-height: 36px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.studio .btn { display: block; width: 100%; margin-bottom: 8px; }
.note { font-size: 13px; color: var(--muted); margin: 4px 0 0; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.dcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px 8px; min-width: 0; }
.dcard h3 { margin: 0; font-size: 16px; }
.dcard-sub, .dcard-next { margin: 0; font-size: 14px; color: var(--muted); }
.dcard-next { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dcard.is-today { background: var(--accent-soft); border-color: var(--accent-text); }
.dcard-actions { display: flex; gap: 2px; margin: 6px 0 0 -8px; }
.link { font: inherit; font-size: 13.5px; color: var(--muted); background: none; border: 0; padding: 8px; min-height: 36px; cursor: pointer; }
.link:hover { color: var(--accent-text); }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; padding: 24px 16px; text-align: center; margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0 14px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 13.5px; color: var(--muted); }
#r-rows td { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.is-next { background: var(--accent-soft); font-weight: 700; }
.more { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.more a { display: block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; text-decoration: none; font-size: 14.5px; background: var(--card); }
.ad-slot { margin: 22px 0; min-height: 100px; }
.ad-slot.preview { border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.ad-label { display: block; font-size: 11px; color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); padding: 22px 0 34px; font-size: 13.5px; color: var(--muted); }
.site-footer p { margin: 0 0 8px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-footer a { color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  background: #1f1c28; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14.5px; z-index: 9; display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
#toast button { font: inherit; font-weight: 700; color: #c7b9ff; background: none; border: 0; padding: 2px; cursor: pointer; }
@media (max-width: 560px) {
  .site-nav { display: none; }
  .two { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .rcards { grid-template-columns: minmax(0, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  #card { max-width: 340px; margin: 0 auto; }
  .card { padding: 16px; }
}
