/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  padding-top: max(72px, calc(52px + env(safe-area-inset-top)));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  -webkit-text-size-adjust: 100%;
}

/* ===== Navigation ===== */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 0 20px;
  padding-top: env(safe-area-inset-top);
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.nav-inner {
  max-width: 820px; margin: 0 auto;
  display: flex; align-items: center; height: 52px;
}
.nav-logo {
  font-size: 1.15rem; font-weight: 800; color: #4299e1;
  text-decoration: none; margin-right: auto; letter-spacing: -0.5px;
}
.nav-links {
  display: flex; gap: 4px; list-style: none;
}
.nav-links a {
  text-decoration: none; font-size: 0.82rem; font-weight: 500;
  color: #718096; padding: 6px 12px; border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: #edf2f7; color: #2d3748; }
.nav-links a.active { background: #ebf8ff; color: #2b6cb0; font-weight: 700; }
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 1.4rem; color: #4a5568; padding: 6px;
}

/* ===== Layout ===== */
.container { max-width: 820px; margin: 0 auto; }

/* ===== Card ===== */
.card {
  background: #fff; border-radius: 12px; padding: 22px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card-title {
  font-size: 0.95rem; font-weight: 700; color: #2d3748;
  margin-bottom: 14px; padding-bottom: 7px; border-bottom: 2px solid #e2e8f0;
}

/* ===== Form Inputs ===== */
.input-group { margin-bottom: 14px; }
.input-group:last-child { margin-bottom: 0; }
.input-group > label {
  display: block; font-size: 0.84rem; font-weight: 600; color: #4a5568; margin-bottom: 5px;
}
.hint { font-weight: 400; color: #a0aec0; font-size: 0.76rem; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-row .field { flex: 1; text-align: center; }
.input-row .field label { font-size: 0.76rem; color: #718096; margin-bottom: 3px; display: block; }
input[type="number"] {
  width: 100%; padding: 9px 11px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 16px; color: #2d3748; transition: border-color 0.2s; text-align: right;
  -webkit-appearance: none; appearance: none;
}
input[type="number"]:focus {
  outline: none; border-color: #4299e1; box-shadow: 0 0 0 3px rgba(66,153,225,0.15);
}
.slider-container { display: flex; align-items: center; gap: 12px; }
input[type="range"] {
  flex: 1; height: 6px; -webkit-appearance: none; appearance: none;
  background: #e2e8f0; border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
  background: #4299e1; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.slider-value {
  min-width: 52px; text-align: center; font-size: 1rem; font-weight: 700; color: #4299e1;
}

/* ===== Tables ===== */
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th {
  background: #f7fafc; padding: 7px 9px; text-align: center;
  font-weight: 600; color: #4a5568; border-bottom: 2px solid #e2e8f0;
}
td {
  padding: 7px 9px; text-align: right;
  border-bottom: 1px solid #edf2f7; color: #2d3748;
}
td:first-child { text-align: center; font-weight: 600; color: #4a5568; }

/* ===== Ad Container ===== */
.ad-container {
  margin: 14px 0; text-align: center; min-height: 50px;
  overflow: hidden; border-radius: 8px;
}
.ad-container ins { display: block; }

/* ===== Footer ===== */
.footer {
  text-align: center; font-size: 0.7rem; color: #a0aec0;
  margin-top: 14px; line-height: 1.5;
}

/* ===== Home: Tool Grid ===== */
.hero { text-align: center; margin-bottom: 24px; }
.hero h1 { font-size: 1.8rem; font-weight: 800; color: #2d3748; margin-bottom: 6px; }
.hero p { font-size: 0.9rem; color: #718096; }

.tool-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px; margin-bottom: 14px;
}
.tool-card {
  display: flex; flex-direction: column; align-items: center;
  background: #fff; border-radius: 14px; padding: 28px 20px;
  text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.tool-icon { font-size: 2.2rem; margin-bottom: 10px; }
.tool-name { font-size: 0.95rem; font-weight: 700; color: #2d3748; margin-bottom: 4px; }
.tool-desc { font-size: 0.76rem; color: #718096; text-align: center; line-height: 1.4; }
.tool-badge {
  position: absolute; top: 10px; right: 10px;
  background: #fbd38d; color: #c05621; font-size: 0.65rem;
  font-weight: 700; padding: 2px 8px; border-radius: 10px;
}

/* ===== Placeholder Page ===== */
.placeholder {
  text-align: center; padding: 60px 20px;
}
.placeholder-icon { font-size: 3rem; margin-bottom: 16px; }
.placeholder h2 { font-size: 1.3rem; color: #2d3748; margin-bottom: 8px; }
.placeholder p { font-size: 0.88rem; color: #718096; margin-bottom: 20px; }
.placeholder a {
  display: inline-block; padding: 10px 20px; background: #4299e1; color: #fff;
  border-radius: 8px; text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.placeholder a:hover { background: #3182ce; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  body {
    padding: 12px;
    padding-top: max(64px, calc(52px + env(safe-area-inset-top)));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .card { padding: 14px; }
  .input-row { flex-direction: column; gap: 8px; }
  .tool-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }

  /* Mobile nav */
  .nav-links {
    display: none; position: absolute; top: 52px; left: 0; right: 0;
    flex-direction: column; background: #fff; padding: 8px 16px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; font-size: 0.88rem; }
  .nav-toggle { display: block; }
}

@media (max-width: 360px) {
  .card { padding: 12px; }
  .hero h1 { font-size: 1.3rem; }
}

@media (display-mode: standalone) {
  body { padding-top: max(72px, calc(52px + env(safe-area-inset-top))); }
}
