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

:root {
  --navy: #1b2a4a;
  --navy-2: #113d6e;
  --teal: #00c8c8;
  --teal-mid: #00a5a5;
  --off-white: #f4f3f8;
  --panel-bg: #ffffff;
  --border: #e2e0ec;
  --accent: #5c4fc3;
  --accent-dk: #4739a8;
  --text: #1a1a2e;
  --muted: #7a7a99;
  --danger: #da5b5b;
  --danger-soft: #fff8f8;
  --success-bg: #dff5e4;
  --success-bd: #9bd7a8;
  --success-tx: #1e6d38;
  --shadow: 0 4px 24px rgba(28, 26, 60, 0.1);
  --radius: 10px;
  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--off-white);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

body.am-startup-active { overflow: hidden; }

.am-startup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top left, rgba(255, 194, 77, 0.35), transparent 32%),
    linear-gradient(145deg, #fbf9f0 0%, #eff4fb 52%, #f4f3f8 100%);
}

.am-startup--hidden { display: none; }

.am-startup-card {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 2rem;
  padding: 2.25rem;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(17, 61, 110, 0.1);
  box-shadow: 0 28px 80px rgba(17, 45, 83, 0.16);
  backdrop-filter: blur(10px);
}

.am-startup-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 260px;
}

.am-startup-logo {
  width: 148px;
  max-width: 42%;
  opacity: 0;
  transform: scale(0.72);
  animation: am-logo-pop 0.62s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.am-startup-wordmark {
  display: flex;
  align-items: center;
  min-height: 3.2rem;
  color: var(--navy-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}

.am-startup-type { min-width: 12ch; }

.am-login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.95rem;
  padding: 1.25rem 1.3rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(17, 61, 110, 0.08);
}

.am-login-copy h1 {
  margin-bottom: 0.28rem;
  font-size: 1.35rem;
  color: var(--navy-2);
}

.am-login-copy p,
.am-login-status {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

.am-login-hint {
  margin-top: 0.8rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 236, 214, 0.95), rgba(235, 244, 255, 0.96) 52%, rgba(236, 228, 255, 0.98));
  border: 1px solid rgba(162, 173, 243, 0.35);
  color: var(--navy-2);
  box-shadow: 0 10px 24px rgba(135, 150, 232, 0.14);
}

.am-login-status { min-height: 1.2rem; }

.am-widget {
  display: flex;
  width: 100%;
  max-width: 1060px;
  min-height: 620px;
  background: var(--panel-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.am-left {
  flex: 1 1 55%;
  display: flex;
  flex-direction: column;
  background: var(--off-white);
  padding: 1.5rem 1.75rem 1.25rem;
  border-right: 1px solid var(--border);
  min-width: 0;
}

.am-header { margin-bottom: 1.25rem; }

.am-logo {
  display: flex;
  align-items: center;
}

.am-logo-image {
  display: block;
  width: 126px;
  max-width: 100%;
  height: auto;
}

.am-design-name-bar {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.am-design-name-bar--invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(218, 91, 91, 0.12);
  background: var(--danger-soft);
}

.am-design-name-input {
  width: 100%;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
}

.am-design-name-input::placeholder { color: #c46363; }

.am-template-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.18rem;
  font-weight: 400;
}

.am-template-label--invalid { color: #b14c4c; }

.am-zoom-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.am-zoom-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.15rem;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.am-zoom-btn:hover { color: var(--accent); }
.am-zoom-btn svg { width: 20px; height: 20px; }

.am-zoom-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 50%, var(--border) 50%);
  outline: none;
  cursor: pointer;
}

.am-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(92, 79, 195, 0.3);
}

.am-canvas-area {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem 0;
}

.am-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  transform-origin: top center;
  transition: transform 0.2s ease;
}

.am-card {
  width: 380px;
  height: 212px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 6px 24px rgba(27, 42, 74, 0.22);
  flex-shrink: 0;
}

.am-card-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  font-weight: 400;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.am-card-bg {
  position: absolute;
  inset: 0;
}

.am-card-bg-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.am-card-content {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
}

.am-card-layer {
  position: absolute;
  margin: 0;
  user-select: none;
  touch-action: none;
  cursor: grab;
}

.am-card-layer:active { cursor: grabbing; }

.am-card-layer--selected {
  outline: 1px dashed rgba(92, 79, 195, 0.9);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(92, 79, 195, 0.14);
}

.am-card-layer--logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.am-card-layer--logo img,
.am-card-layer--logo svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.am-card-name {
  color: var(--navy-2);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.am-card-name strong { font-weight: 800; }

.am-card-title {
  color: #131313;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.am-card-contact-row {
  color: #131313;
  line-height: 1.18;
  white-space: normal;
}

.am-card-back-company {
  color: var(--navy-2);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: uppercase;
}

.am-card-back-tagline {
  color: var(--navy-2);
  opacity: 0.82;
  text-align: center;
}

.am-logo-placeholder { width: 48px; height: 48px; }
.am-logo-placeholder--back { width: 52px; height: 52px; }

.am-pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  padding-top: 0.75rem;
}

.am-page-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--panel-bg);
  font-size: 0.8rem;
  font-family: var(--font-body);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.am-page-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.am-page-btn:hover:not(.am-page-btn--active) {
  border-color: var(--accent);
  color: var(--accent);
}

.am-right {
  flex: 0 0 390px;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  padding: 1.25rem 1.5rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.am-save-btn {
  position: absolute;
  top: 1rem;
  right: 3.65rem;
  border: 1px solid var(--success-bd);
  background: var(--success-bg);
  color: var(--success-tx);
  border-radius: 999px;
  padding: 0.48rem 0.95rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.am-save-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(51, 142, 79, 0.16);
}

.am-save-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.am-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0.2rem;
  line-height: 0;
  transition: color 0.15s;
}

.am-close-btn:hover { color: var(--text); }
.am-close-btn svg { width: 22px; height: 22px; }

.am-form-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.4rem;
  padding-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.am-form-scroll::-webkit-scrollbar { width: 4px; }
.am-form-scroll::-webkit-scrollbar-track { background: transparent; }
.am-form-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.am-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.am-field-group--half { max-width: 55%; }

.am-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.am-input,
.am-select,
.am-color-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--panel-bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: none;
}

.am-color-input {
  min-height: 44px;
  padding: 0.35rem;
}

.am-input:focus,
.am-select:focus,
.am-color-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(92, 79, 195, 0.12);
}

.am-input::placeholder { color: var(--muted); font-weight: 300; }

.am-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.am-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.2rem;
  cursor: pointer;
}

.am-select-arrow {
  position: absolute;
  right: 0.75rem;
  width: 12px;
  pointer-events: none;
  color: var(--muted);
}

.am-inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.am-layer-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

.am-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  background: var(--off-white);
  user-select: none;
  max-width: 50%;
  align-self: center;
}

.am-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(92, 79, 195, 0.04);
}

.am-upload-btn svg { width: 26px; height: 26px; }
.am-upload-input { display: none; }

.am-upload-filename {
  font-size: 0.72rem;
  color: var(--teal-mid);
  font-weight: 500;
  text-align: center;
  min-height: 1rem;
  display: block;
}

.am-form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.am-btn {
  flex: 1;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s;
  letter-spacing: 0.01em;
}

.am-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.am-btn--outline {
  background: white;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.am-btn--outline:hover:not(:disabled) {
  background: rgba(92, 79, 195, 0.06);
}

.am-btn--primary {
  background: var(--accent);
  border: 1.5px solid var(--accent);
  color: white;
  box-shadow: 0 2px 10px rgba(92, 79, 195, 0.25);
}

.am-btn--primary:hover:not(:disabled) {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  box-shadow: 0 4px 14px rgba(92, 79, 195, 0.35);
}

@keyframes am-logo-pop {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 820px) {
  body { padding: 0.75rem; }

  .am-startup-card {
    grid-template-columns: 1fr;
    padding: 1.3rem;
  }

  .am-startup-brand {
    min-height: 0;
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }

  .am-widget {
    flex-direction: column;
    max-width: 100%;
    min-height: unset;
  }

  .am-save-btn {
    position: static;
    align-self: flex-start;
    margin-bottom: 0.8rem;
  }

  .am-right {
    flex: none;
    border-top: 1px solid var(--border);
  }

  .am-form-scroll { padding-top: 0.25rem; }
  .am-field-group--half { max-width: 100%; }
  .am-card { width: 320px; height: 179px; }
}
