/* 고슴도치 나이 계산기 전용 CSS (2026-10-22). '생애 달력판': 답 띠 → 입력 줄 → [생애 달력(한 칸 = 한 달, 지난 달이 단계 색으로 차오름) | 단계 패널(다섯 단계를 겹쳐 높이 고정)]. 공용 부품은 assets/v2.css */
.hga-work{container:hga / inline-size;display:flex;flex-direction:column}
.hga-work [hidden]{display:none !important}
/* 답 띠 */
.hga-ans{display:grid;grid-template-columns:minmax(0,1fr);gap:4px 24px;padding:16px 18px 18px}
.hga-main{min-width:0;display:flex;flex-direction:column}
.hga-main > .v2-label{display:block;margin-bottom:6px}
.hga-main .v2-big{flex-wrap:wrap;row-gap:6px}
.hga-main .v2-big > span i{font-style:normal;font-size:.5em;font-weight:700;margin-left:4px;color:var(--muted)}
.hga-main .v2-big small{flex-basis:100%;display:block;margin:0;font-family:var(--sans);font-size:12.5px;font-weight:600;color:var(--muted)}
.hga-main .v2-big.is-empty span{font-size:18px;font-weight:600;color:var(--muted)}
.hga-side{min-width:0;display:flex;flex-direction:column}
.hga-caveat{margin:auto 0 0;padding-top:10px;font-family:var(--sans);font-size:12px;line-height:1.55;color:var(--muted)}
.hga-foot{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:auto;padding-top:14px}
.hga-foot .v2-status{margin-left:auto}
.hga-rows{margin-top:10px;min-width:0}
.hga-rows li span{min-width:0;flex:1 1 auto}
.hga-rows li span em{display:block;margin-top:2px;font-style:normal;font-size:11.5px;color:var(--muted)}
.hga-rows li b{flex:0 1 auto;max-width:58%;white-space:normal;text-align:right}
/* 입력 줄 */
.hga-in{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px 14px;padding:14px 18px;border-top:1px solid var(--soft);border-bottom:1px solid var(--soft)}
.hga-in .v2-f > .v2-label{display:block;margin:0 0 5px}
.hga-seg{display:flex;flex-wrap:nowrap}
.hga-mode{flex-shrink:0}
.hga-seg button{flex:1 1 auto;min-width:0;height:var(--v2-ctl,42px);padding:0 12px;font-family:var(--sans);font-size:13px;font-weight:700;white-space:nowrap}
.hga-fields{display:flex;gap:12px;min-width:0;flex:1 1 248px}
#hgaBdBox{flex-basis:172px}
#hgaAdBox{flex-basis:320px} /* 입력칸은 기본 폭에서 남는 폭까지 늘어나 줄 안에 빈 곳을 남기지 않는다 */
.hga-fields .v2-f{flex:1 1 118px;width:auto;min-width:0}
.hga-fields .v2-f.hga-aa{flex-basis:136px}
.hga-fields .v2-f:has(.hga-date){flex-basis:172px}
.hga-date{display:block;width:100%;height:var(--v2-ctl,42px);padding:0 10px;border:1px solid var(--line);border-radius:var(--radius);background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:14px;font-weight:600}
.hga-date:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.hga-date[aria-invalid="true"]{border-color:var(--accent);color:var(--accent)}
.hga-lab{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 8px}
.hga-lab label{white-space:nowrap}
.hga-unit{display:inline-flex;gap:6px}
.hga-unit button{padding:0;border:0;background:none;font:inherit;color:var(--muted);cursor:pointer}
.hga-unit button[aria-pressed="true"]{color:var(--ink);font-weight:800;text-decoration:underline;text-underline-offset:3px}
.hga-unit button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.hga-acts{display:flex;gap:6px;align-items:center;height:var(--v2-ctl,42px);margin-left:auto}
.hga-in.is-wrap > .hga-mode{flex:1 1 100%}
.hga-in.is-wrap .hga-fields{flex:1 1 0;min-width:min(100%,300px)}
/* 생애 달력 */
.hga-life{display:grid;grid-template-columns:minmax(0,1fr)}
.hga-calbox{display:flex;flex-direction:column;padding:16px 18px 16px;min-width:0}
.hga-calhead{display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 10px;margin-bottom:10px}
.hga-calhead small{font-family:var(--sans);font-size:11.5px;line-height:1.5;color:var(--muted)}
.hga-cal{--hga-lab:50px;--hga-gap:3px;position:relative;flex:1 1 auto;display:grid;grid-template-rows:auto;grid-auto-rows:minmax(26px,1fr);gap:var(--hga-gap)} /* 줄은 26px 이상, 옆 단계 패널이 더 길면 그 높이까지 늘어난다(달력 아래 빈 공간 없음) */
.hga-mh,.hga-row{display:grid;grid-template-columns:var(--hga-lab) repeat(12,minmax(0,1fr));gap:var(--hga-gap);align-items:stretch}
.hga-mh{align-items:end}
.hga-mh span{font-family:var(--mono);font-size:9.5px;line-height:1;color:var(--muted);text-align:center}
.hga-yr{display:flex;flex-direction:column;justify-content:center;min-width:0;line-height:1.1;font-family:var(--sans);white-space:nowrap}
.hga-yr b{font-size:12px;font-weight:700;color:var(--ink)}
.hga-yr small{font-size:10.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.hga-c{--a:6%;--b:32%;position:relative;display:block;width:100%;min-width:0;min-height:24px;padding:0;border:1px solid color-mix(in srgb, var(--fill) calc(var(--a) + 14%), var(--paper));border-radius:var(--radius);background:color-mix(in srgb, var(--fill) var(--a), var(--paper));cursor:pointer;transition:background-color 200ms ease, border-color 200ms ease}
.hga-c.st-young{--a:8%;--b:42%}
.hga-c.st-adult{--a:10%;--b:54%}
.hga-c.st-senior{--a:13%;--b:68%}
.hga-c.st-long{--a:17%;--b:82%}
.hga-c.is-past{background:color-mix(in srgb, var(--fill) var(--b), var(--paper));border-color:transparent}
.hga-c.is-cur{background:var(--accent);border-color:var(--accent)}
.hga-c:hover{border-color:var(--ink)}
.hga-c:focus-visible{outline:2px solid var(--ink);outline-offset:1px;z-index:1}
.hga-c.has-ev::after{content:"";position:absolute;top:3px;right:3px;width:4px;height:4px;border-radius:50%;background:var(--ink)}
.hga-c.is-past.has-ev::after,.hga-c.is-cur.has-ev::after{background:var(--paper)}
.hga-c.is-past.has-ev.st-baby::after,.hga-c.is-past.has-ev.st-young::after{background:var(--ink)} /* 옅게 칠한 지난 칸(아기·어린 시기)은 밝은·다크 모두 글자색 점이 잘 보인다 */
.hga-c:disabled{cursor:default;opacity:.35}
.hga-tip{position:absolute;z-index:3;left:0;top:0;max-width:min(260px,100%);padding:6px 9px;border-radius:var(--radius);background:var(--fill);color:var(--on-fill);font-family:var(--sans);font-size:12px;line-height:1.45;pointer-events:none;box-shadow:0 2px 10px rgba(0,0,0,.18)}
.hga-tip b,.hga-tip span,.hga-tip em{display:block}
.hga-tip em{font-style:normal;opacity:.82}
.hga-legend{display:flex;flex-wrap:wrap;gap:4px 12px;margin:12px 0 0;padding:0;list-style:none;font-family:var(--sans);font-size:11.5px;color:var(--muted)}
.hga-legend li{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.hga-legend i{display:block;width:13px;height:10px;border-radius:2px}
.hga-legend .lg-baby i{background:color-mix(in srgb, var(--fill) 32%, var(--paper))}
.hga-legend .lg-young i{background:color-mix(in srgb, var(--fill) 42%, var(--paper))}
.hga-legend .lg-adult i{background:color-mix(in srgb, var(--fill) 54%, var(--paper))}
.hga-legend .lg-senior i{background:color-mix(in srgb, var(--fill) 68%, var(--paper))}
.hga-legend .lg-long i{background:color-mix(in srgb, var(--fill) 82%, var(--paper))}
.hga-legend .lg-cur i{background:var(--accent)}
.hga-legend .lg-ev i{width:5px;height:5px;border-radius:50%;background:var(--ink)}
/* 단계 패널: 다섯 단계를 한 칸에 겹쳐 가장 긴 단계 높이로 고정 */
.hga-panel{display:grid;padding:16px 18px 18px;border-top:1px solid var(--soft);min-width:0}
.hga-st{grid-area:1 / 1;min-width:0;visibility:hidden}
.hga-st.is-on{visibility:visible}
.hga-st > .v2-label{display:block}
.hga-st-name{display:block;margin:4px 0 2px;font-family:var(--serif);font-size:20px;font-weight:900;letter-spacing:-.02em;color:var(--ink)}
.hga-st-r{display:block;font-family:var(--sans);font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.hga-st ul{list-style:none;margin:10px 0 0;padding:0}
.hga-st li{position:relative;margin:0 0 7px;padding-left:12px;font-size:13px;line-height:1.55;color:var(--ink)}
.hga-st li:last-child{margin-bottom:0}
.hga-st--none p{margin:8px 0 0;font-family:var(--sans);font-size:13px;line-height:1.6;color:var(--muted)}
.hga-live{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.hga-st li::before{content:"";position:absolute;left:1px;top:.62em;width:5px;height:5px;background:var(--line)}
@container hga (min-width:640px){
  /* 두 열 답 띠: 행이 적은 나이 모드는 어림 안내를 오른쪽 아래, 행이 많은 날짜 모드(is-date)는 문장 아래로 옮겨 양쪽 높이를 맞춘다(초점 없는 글이라 Tab 순서 영향 없음) */
  .hga-ans{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:auto auto auto 1fr auto;grid-template-areas:"lab rows" "big rows" "sen rows" "sp rows" "foot cav"}
  .hga-ans.is-date{grid-template-areas:"lab rows" "big rows" "sen rows" "cav rows" "foot rows"}
  .hga-main,.hga-side{display:contents}
  .hga-main > .v2-label{grid-area:lab}
  .hga-main > .v2-big{grid-area:big}
  .hga-main > .v2-sub{grid-area:sen}
  .hga-foot{grid-area:foot;align-self:end}
  .hga-rows{grid-area:rows;margin-top:0}
  .hga-caveat{grid-area:cav;margin:0;align-self:end}
  .hga-ans.is-date .hga-caveat{align-self:start;padding-top:12px}
  .hga-life{grid-template-columns:minmax(0,1fr) minmax(216px,.5fr)}
  .hga-panel{border-top:0;border-left:1px solid var(--soft)}
  .hga-st{position:sticky;top:calc(var(--hd-h,52px) + 14px);align-self:start} /* 달력이 패널보다 길면(6살 넘음) 단계 설명이 스크롤을 따라온다 */
}
@container hga (max-width:560px){
  .hga-in{gap:12px}
  .hga-in > .hga-mode{flex:1 1 100%}
  .hga-in .hga-fields{flex:1 1 100%}
  .hga-fields .v2-f,.hga-fields .v2-f.hga-aa,.hga-fields .v2-f:has(.hga-date){flex:1 1 0}
  .hga-acts{margin-left:0}
}
@container hga (max-width:420px){
  .hga-calbox{padding-left:12px;padding-right:12px} /* 360px에서도 칸 간격 24px 이상(누르는 칸 크기) */
  .hga-cal{--hga-lab:34px;--hga-gap:2px}
  .hga-yr b{font-size:11px}
  .hga-yr small{font-size:9.5px}
  .hga-mh span{font-size:8.5px}
  .hga-c.has-ev::after{top:2px;right:2px;width:3px;height:3px}
}
@media (prefers-reduced-motion:reduce){
  .hga-c{transition:none}
}
