/* 생활 도구(만 나이 계산기 · 디데이 계산기 · 글자수 세기) 공통 모양. 색은 공통 변수를 쓴다(어두운 화면 자동). */
.tl {
  margin-top: 22px;
}
.tl-card {
  padding: clamp(16px, 4vw, 24px);
}
.tl-card + .tl-card,
.tl > * + .tl-card {
  margin-top: 14px;
}
.tl-h {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 12px;
}
.tl-row {
  display: grid;
  gap: 10px;
}
.tl-row.c3 {
  grid-template-columns: 1.3fr 1fr 1fr;
}
.tl-row.c2 {
  grid-template-columns: 1fr 1fr;
}
.tl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tl-field > span,
.tl-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}
.tl-in {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  font: inherit;
  font-size: 1.06rem; /* 16px 이상: 아이폰에서 누를 때 화면이 확대되지 않게 */
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
}
select.tl-in {
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
input[type='date'].tl-in {
  min-height: 50px;
}
.tl-in:focus {
  border-color: var(--brand);
  background-color: var(--surface);
}
.tl-in[aria-invalid='true'] {
  border-color: var(--wait);
}
.tl-in::placeholder {
  color: var(--muted);
  font-weight: 500;
  opacity: 0.75;
}
.tl-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.tl-inline .chip {
  min-height: 36px;
  font-size: 0.86rem;
  padding: 4px 12px;
  touch-action: manipulation;
}
.tl-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  min-height: 40px;
}
.tl-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  margin: 0;
  flex: none;
}
.tl-err {
  color: var(--wait);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 10px 0 0;
}
.tl-help {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 10px 0 0;
}
.tl-safe {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.84rem;
  margin: 12px 0 0;
}

/* 결과 머리: 큰 숫자 */
.tl-out {
  text-align: center;
}
.tl-cap {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}
.tl-big {
  font-size: clamp(2.8rem, 14vw, 4.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 6px;
  color: var(--ink);
}
.tl-big small {
  font-size: 0.36em;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}
.tl-sub {
  color: var(--muted);
  margin: 4px auto 0;
  max-width: 30em;
}
.tl-sub b {
  color: var(--ink);
}
.tl-empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 6px;
  margin: 0;
}

/* 숫자 칸 묶음 */
.tl-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.tl-grid.c3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tl-grid li {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
  min-width: 0;
}
.tl-grid b {
  display: block;
  font-size: 1.28rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.tl-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.tl-grid li.hi {
  background: var(--brand-soft);
}
.tl-grid li.hi b {
  color: var(--brand);
}
.tl-grid a {
  color: inherit;
  text-decoration: none;
  display: block;
}
.tl-grid a b {
  color: var(--brand);
}
.tl-grid a:hover span {
  text-decoration: underline;
}

/* 자세한 줄 목록 */
.tl-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 6px;
  text-align: left;
}
.tl-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.tl-list li > span:first-child {
  color: var(--muted);
  font-weight: 600;
  flex: none;
}
.tl-list li > b,
.tl-list li > span:last-child {
  text-align: right;
}
.tl-list li.past {
  opacity: 0.62;
}
.tl-list li.next {
  background: var(--brand-soft);
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.tl-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tl-list li.next .tl-tag {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.tl-note {
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--surface-2);
  border-left: 4px solid var(--early);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 14px 0 0;
}
.tl-note b {
  color: var(--ink);
}
.tl-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.tl-actions .btn {
  touch-action: manipulation;
}
.tl-toast {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 8px 0 0;
  text-align: center;
}

/* 글자수 세기 */
.tl-text {
  display: block;
  width: 100%;
  min-height: clamp(220px, 38vh, 380px);
  resize: vertical;
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.15s;
}
.tl-text:focus {
  border-color: var(--brand);
  background: var(--surface);
}
.tl-text::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.tl-live {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 10px 2px 0;
  font-size: 0.92rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tl-live b {
  color: var(--ink);
}
.tl-goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.tl-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 14px 0 6px;
}
.tl-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: var(--go);
  transition: width 0.2s ease;
}
.tl-bar[data-state='near'] > span {
  background: var(--early);
}
.tl-bar[data-state='over'] > span {
  background: var(--wait);
}
.tl-bar-text {
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.tl-bar-text b[data-state='over'] {
  color: var(--wait);
}

.tl-dc {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
}
@media (max-width: 560px) {
  .tl-dc {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .tl-dc > :first-child {
    grid-column: 1 / -1;
  }
  .tl-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .tl-list li > b,
  .tl-list li > span:last-child {
    text-align: left;
  }
  .tl-list li > span:first-child {
    font-size: 0.82rem;
  }
  .tl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tl-grid.c3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tl-grid.c3 b {
    font-size: 1.08rem;
  }
  .tl-row.c3 {
    grid-template-columns: 1.25fr 1fr 1fr;
    gap: 8px;
  }
  .tl-row.c3 select.tl-in {
    padding-left: 10px;
    padding-right: 24px;
    background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%;
  }
  .tl-list li {
    padding: 9px 12px;
    font-size: 0.9rem;
  }
}
@media (max-width: 380px) {
  .tl-row.c2 {
    grid-template-columns: 1fr;
  }
}
