/* 한도조회 — 간편 입력 + 완료 모달 */
:root {
  --header-from: #5b7cff;
  --header-via: #7a5fe0;
  --header-to: #a44fd6;
  --title: #2b3d8f;
  --text: #222;
  --muted: #888;
  --line: #d8d8d8;
  --placeholder: #b0b0b0;
  --red: #e53935;
  --btn: #8a8a8a;
  --btn-active: #5c6bc0;
  --sheet: #fff;
  --bg: #f3f3f5;
  --accent: #5c6bc0;
  --font: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --max: 430px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: #ddd;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

button,
input {
  font: inherit;
  color: inherit;
}

.app {
  max-width: var(--max);
  min-height: 100%;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 64px;
}

/* Header gradient block */
.header {
  background: linear-gradient(90deg, var(--header-from) 0%, var(--header-via) 48%, var(--header-to) 100%);
  color: #fff;
  flex-shrink: 0;
  padding-bottom: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 6px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn--spacer {
  pointer-events: none;
  visibility: hidden;
}

.stepbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 18px 0;
}

.stepbar-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* White sheet overlapping header */
.sheet {
  flex: 1;
  margin-top: -2px;
  background: var(--sheet);
  border-radius: 28px 28px 0 0;
  padding: 28px 20px 32px;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 110px);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--title);
  letter-spacing: -0.03em;
}

.required-badge {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.required-badge em {
  color: var(--red);
  font-style: normal;
  margin-right: 2px;
}

.section-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

/* Underline field */
.field {
  margin-bottom: 28px;
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  color: #222;
}

.field-label .star {
  color: var(--red);
}

.field-input {
  width: 100%;
  height: 44px;
  padding: 0 2px 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.02em;
  outline: none;
}

.field-input::placeholder {
  color: var(--placeholder);
}

.field-input:focus {
  border-bottom-color: #6b7cff;
}

.field-input.is-error {
  border-bottom-color: var(--red);
}

.field-error {
  display: none;
  margin-top: 8px;
  font-size: 12px;
  color: var(--red);
}

.field-error.is-show {
  display: block;
}

/* Touch fund chips */
.fund-hint {
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 14px;
  letter-spacing: -0.02em;
}

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

.fund-chip {
  height: 48px;
  border: 1.5px solid #e0e0e6;
  border-radius: 12px;
  background: #fafafa;
  color: #444;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fund-chip:active {
  transform: scale(0.97);
}

.fund-chip.is-selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(91, 124, 255, 0.12), rgba(164, 79, 214, 0.1));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.fund-grid.is-error .fund-chip {
  border-color: #f5b5b5;
}

/* Bottom CTA */
.bottombar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--max));
  z-index: 20;
}

.btn-next {
  width: 100%;
  height: 56px;
  border: 0;
  background: var(--btn);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.btn-next.is-ready {
  background: linear-gradient(90deg, var(--header-from), var(--header-to));
}

.btn-next:active {
  opacity: 0.9;
}

/* Success modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 40, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: modalFadeIn 0.22s ease;
}

.modal-dialog {
  position: relative;
  width: min(100%, 340px);
  background: #fff;
  border-radius: 22px;
  padding: 36px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(40, 40, 80, 0.22);
  animation: modalPopIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-icon {
  display: inline-flex;
  margin-bottom: 16px;
}

.modal-icon-ring {
  stroke: #5c6bc0;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: ringDraw 0.55s ease 0.08s forwards;
}

.modal-icon-check {
  stroke: #5c6bc0;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: checkDraw 0.35s ease 0.4s forwards;
}

.modal-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--title);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.modal-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.modal-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--header-from), var(--header-to));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.modal-btn:active {
  opacity: 0.92;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ringDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

body.modal-open {
  overflow: hidden;
}

@media (min-width: 480px) {
  .app {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
  }
}
