* {
  box-sizing: border-box;
}

:root {
  --bg: #eef3fb;
  --bg-soft: #f7f9fd;
  --panel: rgba(255,255,255,0.92);
  --panel-strong: rgba(255,255,255,0.98);
  --line: rgba(114,132,168,0.18);
  --text: #1f2a3d;
  --muted: #64748b;
  --title: #1b2a44;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.10);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79,70,229,0.10), transparent 24%),
    radial-gradient(circle at top right, rgba(6,182,212,0.10), transparent 22%),
    linear-gradient(180deg, #dfe7f5 0%, #e9eff9 18%, #f4f7fc 18%, #f7f9fd 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
}

/* header */
.app-header {
  margin-bottom: 18px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(240,245,255,0.92) 100%);
  border: 1px solid rgba(180,194,220,0.45);
  box-shadow: 0 10px 24px rgba(82,98,130,0.10);
  border-radius: 28px;
  backdrop-filter: blur(10px);
}

.app-logo {
  width: 48px;      /* 78 → 48로 줄임 */
  height: 48px;
  object-fit: contain;
  flex: 0 0 48px;

  background: #ffffff;
  border: 1px solid rgba(180,194,220,0.35);
  border-radius: 14px;
  padding: 6px;     /* 10 → 6으로 줄임 */

  max-width: 100%;
  max-height: 100%;
}

.brand-text {
  min-width: 0;
}

.app-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5b6b86;
  margin-bottom: 6px;
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.2;
  color: var(--title);
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* layout */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  background: transparent;
}

/* tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid rgba(148,163,184,0.20);
  background: rgba(255,255,255,0.94);
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: #24324a;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary), #6d5efc) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 12px 24px rgba(79,70,229,0.18);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* status */
.status-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.status-box.is-error {
  background: rgba(254,242,242,0.96);
  border-color: rgba(239,68,68,0.22);
}

.status-box.is-success {
  background: rgba(236,253,245,0.96);
  border-color: rgba(16,185,129,0.22);
}

.status-box.is-warning {
  background: rgba(255,251,235,0.96);
  border-color: rgba(245,158,11,0.22);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(79,70,229,0.10);
  color: #4338ca;
}

.status-box.is-error .status-badge {
  background: rgba(239,68,68,0.12);
  color: #b91c1c;
}

.status-box.is-success .status-badge {
  background: rgba(16,185,129,0.12);
  color: #047857;
}

.status-box.is-warning .status-badge {
  background: rgba(245,158,11,0.14);
  color: #b45309;
}

.status-text {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
  word-break: keep-all;
}

/* cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card h2 {
  margin: 0;
  font-size: 19px;
  color: var(--title);
  letter-spacing: -0.02em;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--title);
}

.card-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #4f46e5;
  background: rgba(79,70,229,0.10);
  white-space: nowrap;
}

/* buttons */
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn,
button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease, opacity .16s ease;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
}

.btn:active,
button:active {
  transform: translateY(0);
}

.btn-primary,
button.primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6d5efc 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 12px 24px rgba(79,70,229,0.18);
}

.btn-primary:hover,
button.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #5d4ef4 100%) !important;
  color: #ffffff !important;
}

.btn-secondary,
button.ghost,
button:not(.primary) {
  background: #fff;
  border: 1px solid rgba(148,163,184,0.22);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.btn-secondary:hover,
button.ghost:hover,
button:not(.primary):hover {
  background: #f8fbff;
}

button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* helper */
.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* map */
.map-box {
  margin-top: 14px;
  width: 100%;
  height: 420px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e2e8f0;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  padding: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.30));
}

/* forms */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

label span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input[type="text"],
select,
input[type="file"] {
  width: 100%;
  border: 1px solid rgba(100,116,139,0.18);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 14px;
  background: rgba(255,255,255,0.97);
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input[type="text"]:focus,
select:focus,
input[type="file"]:focus {
  outline: none;
  border-color: rgba(79,70,229,0.45);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.08);
  background: #fff;
}

input[readonly] {
  background: #f8fafc;
}

input[type="range"] {
  width: 100%;
  margin: 0;
}

/* preview */
.preview-wrap {
  width: 100%;
  overflow: auto;
  background: #eef3f9;
  border-radius: 20px;
  padding: 14px;
  border: 1px solid var(--line);
}

#resultCanvas {
  width: 100%;
  max-width: 540px;
  display: block;
  margin: 0 auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}

/* convert */
.convert-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.preview-card {
  background: rgba(255,255,255,0.74);
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: 18px;
  padding: 14px;
}

.convert-preview img {
  width: 100%;
  min-height: 220px;
  max-height: 480px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15,23,42,0.28);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.app-modal {
  width: min(100%, 420px);
  background: rgba(255,255,255,0.99);
  border-radius: 24px;
  border: 1px solid rgba(148,163,184,0.16);
  box-shadow: 0 24px 60px rgba(15,23,42,0.16);
  padding: 18px;
  transform: translateY(10px) scale(.98);
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
}

.app-modal.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.app-modal-header {
  margin-bottom: 12px;
}

.app-modal-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
  background: rgba(79,70,229,0.10);
  color: #4338ca;
}

.app-modal h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  color: var(--title);
}

.app-modal-body {
  font-size: 14px;
  line-height: 1.7;
  color: #475569;
  margin-bottom: 16px;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-field input {
  flex: 1;
  min-width: 0;
}

.btn-copy {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 12px 14px;
  border-radius: 14px;
  white-space: nowrap;
}

/* responsive */
@media (max-width: 768px) {
  .app {
    padding: 14px;
  }

  .app-brand {
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: 24px;
  }

  .app-logo {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 12px;
    padding: 5px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .map-box {
    height: 320px;
  }

  .info-grid,
  .convert-preview {
    grid-template-columns: 1fr;
  }

  .card,
  .status-box {
    border-radius: 20px;
  }

  .button-row {
    flex-direction: column;
  }

  button,
  .btn {
    width: 100%;
  }

  .card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-modal {
    width: 100%;
    max-width: none;
    border-radius: 22px 22px 18px 18px;
    align-self: end;
  }

  .btn-copy {
    min-width: 64px;
    padding: 11px 12px;
  }
}
