* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  background: radial-gradient(1000px 420px at 50% -120px, #1f3350 0%, var(--bg) 58%);
  font-family: "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left));
  display: grid;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: color-mix(in srgb, var(--card) 94%, black 6%);
}

.hidden { display: none; }

h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--fg);
  background: color-mix(in srgb, var(--bg-soft) 84%, black 16%);
}

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.inline-input input {
  width: 100%;
  min-width: 0;
}

.inline-input .btn {
  white-space: nowrap;
  padding: 8px 10px;
}

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

.grid2 > .field {
  min-width: 0;
}

.actions { display: flex; gap: 8px; margin-top: 6px; }

.btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn.primary {
  border-color: color-mix(in srgb, var(--primary) 70%, var(--line));
  background: color-mix(in srgb, var(--primary) 24%, var(--bg-soft));
}

.msg {
  min-height: 18px;
  margin-top: 8px;
  color: #a9d4ff;
  font-size: 12px;
}

.inline-msg {
  margin-top: 4px;
}

.msg.err { color: var(--error); }

.line2 {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.result {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-soft) 82%, black 18%);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.assist {
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed color-mix(in srgb, var(--primary) 65%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-soft) 86%, black 14%);
}

.assist-title {
  font-size: 13px;
  font-weight: 800;
}

.assist-sub {
  margin-top: 4px;
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .grid2 {
    grid-template-columns: 1fr;
  }

  .inline-input {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .actions .btn,
  .inline-input .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* Prevent iOS input zoom and improve touch readability */
  .field input,
  .field select {
    font-size: 16px;
  }
}

