:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: #172033;
  background: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1024px;
  min-height: 100vh;
  background: #f1f5f9;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 2px;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #dbe3ee;
}

.topbar-inner,
.page {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
}

.back-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.page { padding: 28px 0 40px; }

.intro h1 {
  margin: 0;
  color: #0f172a;
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: 0;
}

.intro p {
  margin: 10px 0 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.7;
}

.privacy-note {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
  font-size: 14px;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.tool-card {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  word-break: keep-all;
}

.tool-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-size: 24px;
  font-weight: 900;
}

.tool-icon.stamp { color: #be123c; background: #fff1f2; }
.tool-icon.date { color: #0369a1; background: #f0f9ff; }
.tool-icon.text { color: #047857; background: #ecfdf5; }

.tool-card h2 {
  margin: 18px 0 0;
  color: #0f172a;
  font-size: 21px;
  line-height: 1.35;
}

.tool-card p {
  margin: 10px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
}

.tool-card ul {
  margin: 14px 0 20px;
  padding-left: 18px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.75;
}

.tool-link,
.primary-button,
.secondary-button,
.segment-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 800;
}

.tool-link {
  margin-top: auto;
  border: 2px solid #1e3a5f;
  background: #0f5f9f;
  color: #fff;
  text-decoration: none;
}

.tool-link:hover { background: #0c4a7a; }

.panel {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.panel + .panel { margin-top: 18px; }

.panel h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.panel-description {
  margin: 7px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
  align-items: end;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.field input,
.target-input,
.text-input {
  width: 100%;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  color: #0f172a;
  background: #fff;
}

.field input,
.target-input {
  min-height: 50px;
  padding: 0 12px;
}

.result-band {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid #dbe3ee;
  align-items: center;
}

.result-main {
  color: #0f5f9f;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

.result-detail {
  color: #334155;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.65;
}

.segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segment-button {
  border: 2px solid #94a3b8;
  background: #fff;
  color: #334155;
}

.segment-button[aria-pressed="true"] {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #1e40af;
  box-shadow: inset 0 0 0 1px #1d4ed8;
}

.counter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 24px;
  margin-top: 20px;
}

.text-input {
  min-height: 360px;
  padding: 16px;
  resize: vertical;
  font-size: 17px;
  line-height: 1.7;
}

.counter-side {
  border-left: 1px solid #dbe3ee;
  padding-left: 24px;
}

.stat-list {
  margin: 0;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #e2e8f0;
}

.stat-row dt { color: #475569; font-size: 14px; }
.stat-row dd { margin: 0; color: #0f172a; font-size: 21px; font-weight: 900; }

.target-controls { margin-top: 20px; }

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.progress-track {
  height: 14px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 4px;
  background: #e2e8f0;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: #059669;
  transition: width 160ms ease, background 160ms ease;
}

.progress-bar.near { background: #d97706; }
.progress-bar.over { background: #dc2626; }

.target-status {
  min-height: 48px;
  margin: 12px 0 0;
  color: #334155;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.6;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.primary-button {
  border: 2px solid #172554;
  background: #1d4ed8;
  color: #fff;
  padding: 0 22px;
}

.secondary-button {
  border: 2px solid #94a3b8;
  background: #fff;
  color: #334155;
  padding: 0 18px;
}

.footer-note {
  margin-top: 20px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .tool-grid { gap: 14px; }
  .tool-card { padding: 20px; }
  .counter-layout { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
}
