:root {
  --bg: #f4f7fb;
  --paper: #ffffff;
  --paper-soft: #f7f9fd;
  --ink: #07111f;
  --ink-soft: #4f5d6b;
  --muted: #78889a;
  --line: #dde6f0;
  --primary: #1d5cff;
  --primary-strong: #122c66;
  --accent: #0ab9d8;
  --gold: #f7c75d;
  --success: #1dbf73;
  --shadow: 0 22px 60px rgba(9, 25, 44, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: linear-gradient(180deg, #eef3fb 0%, #f8fafc 28%, #ffffff 100%);
  color: var(--ink);
}
button, input, textarea { font: inherit; }
button, a { tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: #050c16;
  overflow: hidden;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.intro.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-grid {
  position: absolute;
  inset: -10%;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(700px) rotateX(68deg) translateY(30%);
  animation: gridFloat 7s linear infinite;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.7;
}

.orb-a {
  width: 360px;
  height: 360px;
  left: 8%;
  top: 10%;
  background: radial-gradient(circle, rgba(29, 92, 255, 0.7), rgba(29, 92, 255, 0) 70%);
  animation: floatOrb 6s ease-in-out infinite;
}

.orb-b {
  width: 420px;
  height: 420px;
  right: 7%;
  bottom: 0;
  background: radial-gradient(circle, rgba(10, 185, 216, 0.6), rgba(10, 185, 216, 0) 70%);
  animation: floatOrb 7s ease-in-out infinite reverse;
}

.logo-3d-wrap {
  position: relative;
  text-align: center;
  perspective: 1000px;
  animation: introRise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.logo-3d {
  position: relative;
  width: min(280px, 66vw);
  aspect-ratio: 1.08 / 1;
  transform-style: preserve-3d;
  animation: spin3d 2.3s cubic-bezier(0.2, 0.85, 0.2, 1) 0.2s both;
}

.logo-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backface-visibility: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

.logo-front {
  background: #ffffff;
  transform: translateZ(20px);
}

.logo-front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 22px;
}

.logo-back {
  display: grid;
  place-items: center;
  transform: rotateY(180deg) translateZ(20px);
  background: linear-gradient(135deg, #102549, #07111f);
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-size: clamp(22px, 4vw, 32px);
  letter-spacing: 0.08em;
  font-weight: 800;
}

.logo-edge {
  position: absolute;
  background: rgba(17, 28, 42, 0.9);
}

.e1, .e2 { left: 0; width: 100%; height: 18px; }
.e1 { top: 0; transform: rotateX(90deg); }
.e2 { bottom: 0; transform: rotateX(90deg); }
.e3, .e4 { top: 0; width: 18px; height: 100%; }
.e3 { left: 0; transform: rotateY(90deg); }
.e4 { right: 0; transform: rotateY(90deg); }

.logo-3d-shadow {
  position: absolute;
  left: 50%;
  bottom: -52px;
  width: 72%;
  height: 28px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  filter: blur(18px);
}

.intro-wordmark {
  margin-top: 44px;
  color: #edf4ff;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  letter-spacing: 0.22em;
  font-weight: 800;
}

.intro-location {
  margin-top: 10px;
  color: #9fb1c6;
  font-size: 10px;
  letter-spacing: 0.26em;
  font-weight: 700;
}

.app-shell {
  opacity: 0;
  animation: appIn 0.7s ease 1.6s forwards;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(18px, 4vw, 72px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(7, 17, 31, 0.08);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 12px;
}

.brand strong {
  display: block;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(29, 191, 115, 0.12);
}

.section {
  width: min(1080px, 92%);
  margin: 0 auto;
  padding: 58px 0;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
  min-height: 420px;
}

.eyebrow {
  margin: 0 0 14px;
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.96;
  letter-spacing: -0.055em;
}

.hero h1 span {
  display: block;
  background: linear-gradient(90deg, var(--primary), #0dbbe3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  margin: 20px 0 0;
  max-width: 620px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.7;
}

.glass {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.rating-panel {
  position: relative;
  overflow: hidden;
  padding: 30px 24px 24px;
  border-radius: 28px;
}

.rating-panel::before {
  content: "";
  position: absolute;
  inset: -50px -60px auto auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 185, 216, 0.2), rgba(10, 185, 216, 0) 60%);
}

.panel-label {
  position: relative;
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--muted);
}

.stars {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 24px 0 12px;
}

.stars button {
  border: none;
  background: transparent;
  color: #d7deea;
  font-size: clamp(36px, 8vw, 46px);
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.18s ease;
}

.stars button.active {
  color: var(--gold);
  text-shadow: 0 10px 28px rgba(247, 199, 93, 0.28);
}

.stars button:hover {
  transform: translateY(-2px) scale(1.04);
}

.rating-label {
  position: relative;
  font-family: "Manrope", sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.rating-note {
  position: relative;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.05em;
}

.section-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.sentiment-option {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.sentiment-option.active {
  background: linear-gradient(180deg, #edf4ff 0%, #e4edff 100%);
  border-color: rgba(29, 92, 255, 0.4);
  color: var(--primary-strong);
  box-shadow: 0 8px 20px rgba(29, 92, 255, 0.08);
}

.field-card {
  margin: 18px 0;
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(9, 25, 44, 0.03);
}

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

.field-head label,
.field-label {
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field-subtitle {
  margin: -2px 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.form-error {
  color: #a52a24;
  font-weight: 700;
}

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

.write-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  min-height: 120px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
}

.write-mode-option.active {
  background: linear-gradient(180deg, #edf4ff 0%, #ebf9ff 100%);
  border-color: rgba(29, 92, 255, 0.4);
  color: var(--primary-strong);
  box-shadow: 0 10px 18px rgba(29, 92, 255, 0.08);
}

.mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(29, 92, 255, 0.08);
  font-size: 20px;
  flex-shrink: 0;
}

.mode-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-copy strong {
  font-size: 16px;
  line-height: 1.3;
}

.mode-copy small {
  font-size: 12px;
  line-height: 1.5;
  color: inherit;
}

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

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

.service-option {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-soft);
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.service-option.active {
  background: linear-gradient(180deg, #edf4ff 0%, #ebf9ff 100%);
  color: var(--primary-strong);
  border-color: rgba(29, 92, 255, 0.4);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip.active {
  background: #edf5ff;
  color: var(--primary-strong);
  border-color: rgba(29, 92, 255, 0.4);
}

#ownWords,
#manualReview,
#selectedReview {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
  background: #fbfcff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
}

#ownWords,
#manualReview {
  min-height: 156px;
}

#ownWords {
  min-height: 92px;
}

#manualReviewForm .editor-actions {
  margin-top: 14px;
}

#manualReviewForm .primary-btn,
#manualReviewForm .google-btn {
  width: 100%;
}

.copy-own {
  margin-top: 12px;
}

.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.confirm-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--success);
  flex: 0 0 auto;
}

.review-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.review-control-buttons {
  display: flex;
  gap: 10px;
}

.generation-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.generation-status::before {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  content: "";
  animation: reviewSpin 0.7s linear infinite;
}

.helper-text {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.language-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.segmented {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  background: #edf2f9;
  border-radius: 12px;
}

.lang {
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--ink-soft);
  font-weight: 800;
  cursor: pointer;
}

.lang.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(9, 25, 44, 0.07);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.google-btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 18px;
  background: linear-gradient(135deg, #081421, #183d78);
  color: white;
  box-shadow: 0 18px 28px rgba(8, 20, 38, 0.18);
}

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

.primary-btn i {
  font-style: normal;
  font-size: 18px;
}

.results {
  padding-top: 18px;
}

.review-editor,
.alternatives-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(9, 25, 44, 0.04);
}

.review-editor {
  padding: 18px;
}

.review-header {
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--muted);
}

#selectedReview {
  min-height: 146px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.editor-actions.stacked {
  flex-direction: column;
}

.secondary-btn,
.ghost-btn {
  min-height: 42px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-btn {
  background: transparent;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  background: linear-gradient(135deg, #ffffff, #ecf3ff);
  border: 1px solid rgba(29, 92, 255, 0.18);
  color: var(--ink);
}

.trust-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.alternatives-panel {
  padding: 18px;
}

.alternatives-panel h3 {
  margin: 0 0 12px;
  font-family: "Manrope", sans-serif;
  font-size: 16px;
}

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

.draft-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-height: 170px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.draft-card p {
  flex: 1;
}

.use-review {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(29, 92, 255, 0.22);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.draft-card.selected {
  background: linear-gradient(180deg, #eef7ff 0%, #edf1ff 100%);
  border-color: rgba(29, 92, 255, 0.4);
}

.draft-card-head {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.draft-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.qr-section { padding-top: 22px; }

.qr-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border-radius: 28px;
}

.qr-card h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.05em;
}

.qr-card p {
  margin: 12px 0 14px;
  max-width: 600px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.qr-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qr-meta span {
  display: inline-block;
  border-radius: 999px;
  padding: 8px 10px;
  background: #f0f5ff;
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 800;
}

.qr-box {
  padding: 12px;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(9, 25, 44, 0.08);
}

.qr-box img {
  width: 190px;
  height: 190px;
  object-fit: cover;
  border-radius: 12px;
}

.contact-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.contact-card h2 {
  margin: 0 0 8px;
  font-family: "Manrope", sans-serif;
  font-size: clamp(18px, 3vw, 28px);
}

.contact-card p {
  margin: 0;
  color: var(--muted);
}

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-weight: 800;
  color: var(--ink-soft);
}

footer {
  width: min(1080px, 92%);
  margin: 0 auto;
  padding: 24px 0 50px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px);
  min-width: 220px;
  max-width: 80vw;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.95);
  color: #ffffff;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@keyframes spin3d {
  0% { transform: rotateY(-80deg) rotateX(12deg) scale(0.8); }
  52% { transform: rotateY(20deg) rotateX(-4deg) scale(1.04); }
  100% { transform: rotateY(0) rotateX(0) scale(1); }
}

@keyframes appIn {
  to { opacity: 1; }
}

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

@keyframes gridFloat {
  to { background-position: 0 48px, 48px 0; }
}

@keyframes floatOrb {
  50% { transform: translate3d(18px, -20px, 0) scale(1.04); }
}

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

  .service-grid,
  .draft-grid,
  .write-mode-grid {
    grid-template-columns: 1fr;
  }

  .qr-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .qr-meta {
    justify-content: center;
  }

  .contact-card {
    flex-direction: column;
  }

  .contact-links {
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .section {
    width: min(96%, 100%);
    padding: 44px 0;
  }

  .topbar {
    height: 70px;
    padding: 10px 14px;
  }

  .brand strong { font-size: 10px; }
  .brand small { font-size: 8px; }
  .location-pill { font-size: 8px; }

  .hero p { font-size: 15px; }

  .sentiment-grid,
  .service-grid,
  .write-mode-grid {
    grid-template-columns: 1fr;
  }

  .language-row {
    flex-direction: column;
    align-items: stretch;
  }

  .review-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .review-control-buttons {
    flex-direction: column;
  }

  .primary-btn {
    width: 100%;
  }

  .editor-actions,
  .actions-row {
    flex-direction: column;
  }

  .secondary-btn,
  .ghost-btn,
  .google-btn,
  .review-control-buttons .primary-btn {
    width: 100%;
  }

  .qr-box img {
    width: 160px;
    height: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
