* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f6f7f9;
  color: #111;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.top-bar {
  display: flex;
  align-items: center;
  padding: 20px;
  margin: 16px 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.brand-logo {
  width: 250px;
  height: auto;
  display: block;
  object-fit: contain;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  margin: 0 0 12px 0;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

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

.select-col {
  display: grid;
  gap: 12px;
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%;
  height: 44px;
  padding: 0 36px 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 14px;
  color: #111;
  appearance: none;
}

.select-wrap select:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #6b7280;
  pointer-events: none;
}

.check-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #111;
}

.check-chip input {
  width: 18px;
  height: 18px;
}

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

.query-block .section-title-row {
  margin-bottom: 6px;
}

.jeonse-fields {
  display: none;
}

.multi-family {
  display: none;
}

.multi-family-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.multi-family-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.multi-family-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}

.multi-family-text {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.multi-family-inline input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 14px;
}

.multi-family-inline input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.multi-family-list {
  margin-top: 12px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
  color: #111;
}

.multi-family-item {
  padding: 6px 4px;
  border-bottom: 1px solid #f3f4f6;
}

.multi-family-item:last-child {
  border-bottom: none;
}

.jeonse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.unit-note {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.detail-link:hover {
  background: #f3f4f6;
}

.jeonse-grid {
  display: grid;
  gap: 12px;
}

.jeonse-item {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #111;
}

.jeonse-item-wide {
  grid-column: 1 / -1;
}

.housing-choice-row {
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
}

.housing-choice-chip {
  gap: 5px;
  font-size: 12px;
}

.housing-choice-chip input {
  width: 14px;
  height: 14px;
}

.housing-choice-chip span {
  white-space: nowrap;
}

.jeonse-label {
  font-weight: 600;
  color: #374151;
}

.jeonse-item input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 14px;
}

.jeonse-item input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

.btn {
  width: 100%;
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.ghost {
  background: #fff;
  color: #111;
  border: 1px solid #e5e7eb;
  box-shadow: none;
}

.action-card {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.result-card {
  padding: 12px 16px;
}

.result-area {
  min-height: 40px;
  transition: all 0.3s ease;
}

.result-area.success {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
}

.result-area.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  border-radius: 12px;
  padding: 12px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
  gap: 12px;
}

.result-meta strong {
  color: #2563eb;
}

.result-apt {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px;
}

.result-apt-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.result-apt-addr {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
}

.price-section {
  margin-top: 12px;
}

.price-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #ef4444;
  margin-bottom: 8px;
}

.price-section-note {
  margin-bottom: 8px;
  font-size: 12px;
  color: #6b7280;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.price-table th,
.price-table td {
  padding: 8px 6px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
}

.price-table th:first-child,
.price-table td:first-child {
  text-align: left;
}

.price-table th {
  color: #6b7280;
  font-weight: 500;
}

.price-table td {
  font-weight: 600;
}

.loan-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}

.loan-title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  margin-bottom: 4px;
}

.loan-subtitle {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 10px;
}

.loan-group {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
}

.loan-group-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loan-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
  text-align: center;
  margin-bottom: 6px;
}

.loan-row-head {
  font-weight: 600;
  color: #111;
}

.loan-row-muted {
  color: #6b7280;
}

.loan-amount {
  font-weight: 700;
  color: #111;
}

.jeonse-limit {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #e5e7eb;
}

.jeonse-limit-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

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

.jeonse-limit-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  background: #fff;
}

.jeonse-limit-name {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.jeonse-limit-value {
  font-size: 14px;
  font-weight: 700;
  color: #111;
}

.jeonse-limit-note {
  margin-top: 8px;
  font-size: 11px;
  color: #9ca3af;
}

.info-text {
  text-align: center;
  margin-top: 24px;
  padding: 12px;
  font-size: 12px;
  color: #6b7280;
}

.info-text p {
  margin: 0;
}

/* 스플래시 스크린 */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
}

.splash-logo-container {
  width: 350px;
  max-width: 80%;
  margin: 0 auto;
  animation: fadeInUp 0.6s ease;
}

.splash-logo-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 모바일 최적화 */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .brand-logo {
    width: 250px;
  }

  .card {
    padding: 16px;
  }

  .select-row {
    grid-template-columns: 1fr;
  }

  .action-card {
    grid-template-columns: 1fr;
  }

  .query-row {
    grid-template-columns: 1fr;
  }
}
