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

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: #172033;
  background: linear-gradient(145deg, #f7fbff 0%, #edf4ff 44%, #f4efff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

img,
svg {
  max-width: 100%;
  display: block;
}

textarea {
  width: 100%;
  min-height: 146px;
  max-width: 100%;
  resize: vertical;
  border: 1px solid #d8dff0;
  border-radius: 20px;
  padding: 15px 16px;
  color: #172033;
  background: #ffffff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea:focus {
  border-color: #6d5dfc;
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.14);
}

.noscript {
  margin: 24px;
  padding: 16px;
  border-radius: 18px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 14px 30px rgba(49, 61, 110, 0.1);
}

.app-root {
  width: 100%;
  min-height: 100%;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom));
}

@supports (padding-bottom: constant(safe-area-inset-bottom)) {
  .app-shell {
    padding-top: calc(12px + constant(safe-area-inset-top));
    padding-bottom: calc(110px + constant(safe-area-inset-bottom));
  }
}

@media (min-width: 430px) {
  .app-shell {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.page-fade {
  animation: pageFade 180ms ease both;
}

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

.splash-page {
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: radial-gradient(circle at 52% 22%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 36%),
    linear-gradient(145deg, #eaf4ff 0%, #f2edff 52%, #f9fbff 100%);
}

.splash-card {
  width: 100%;
}

.splash-logo {
  width: 104px;
  height: 104px;
  margin: 0 auto;
  border-radius: 28px;
  box-shadow: 0 20px 44px rgba(80, 91, 222, 0.24);
}

.float-soft {
  animation: floatSoft 2600ms ease-in-out infinite;
}

@keyframes floatSoft {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

.splash-page h1 {
  margin: 22px 0 8px;
  font-size: clamp(28px, 8vw, 34px);
  line-height: 1.06;
  letter-spacing: 0;
}

.splash-page p {
  max-width: 340px;
  margin: 0 auto;
  color: #526078;
  font-size: 15px;
}

.splash-loading-art {
  width: 82px;
  height: 82px;
  margin: 26px auto 10px;
}

.splash-loading-text {
  color: #63708a;
  font-size: 14px;
  font-weight: 700;
}

.app-header,
.tool-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  margin: -2px -4px 14px;
  padding: 4px;
  border-radius: 0 0 22px 22px;
  background: rgba(247, 251, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.app-header {
  grid-template-columns: 44px minmax(0, 1fr) 94px;
}

.tool-header {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.app-header strong,
.tool-header strong {
  overflow: hidden;
  color: #172033;
  font-size: 16px;
  font-weight: 850;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.header-brand,
.back-button,
.header-icon,
.header-link {
  min-height: 44px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(42, 52, 96, 0.08);
}

.header-brand {
  width: 44px;
  padding: 7px;
}

.header-link {
  padding: 0 10px;
  color: #4f56dc;
  font-size: 12px;
  font-weight: 850;
}

.header-icon {
  width: 44px;
  color: #4f56dc;
  font-size: 15px;
  font-weight: 850;
}

.header-icon img {
  width: 24px;
  height: 24px;
  margin: 10px auto 0;
}

.back-button {
  width: 44px;
  color: #263452;
  font-size: 25px;
  line-height: 1;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(113, 121, 221, 0.12);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(246, 248, 255, 0.76));
  box-shadow: 0 18px 38px rgba(48, 61, 115, 0.12);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #4f56dc;
  background: #eef2ff;
  font-size: 13px;
  font-weight: 850;
}

.hero-copy h1 {
  margin: 12px 0 8px;
  color: #172033;
  font-size: clamp(28px, 8vw, 34px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-copy p {
  margin: 0 0 16px;
  color: #526078;
  font-size: 15px;
}

.hero-visual {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-phone {
  width: min(260px, 82%);
  margin: 0 auto;
  filter: drop-shadow(0 22px 30px rgba(57, 72, 146, 0.18));
}

.hero-assistant {
  position: absolute;
  right: 8px;
  bottom: 5px;
  width: 104px;
  filter: drop-shadow(0 14px 18px rgba(57, 72, 146, 0.12));
}

.primary-action,
.secondary-action,
.copy-button,
.floating-action,
.feature-card,
.app-footer button {
  transition: transform 120ms ease, opacity 120ms ease, filter 120ms ease;
}

.primary-action:active,
.secondary-action:active,
.copy-button:active,
.floating-action:active,
.feature-card:active,
.app-footer button:active,
.back-button:active,
.header-link:active,
.header-icon:active {
  transform: scale(0.98);
}

.primary-action {
  min-height: 48px;
  border-radius: 16px;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #246dff 0%, #7b4dff 100%);
  box-shadow: 0 12px 24px rgba(91, 95, 240, 0.22);
  font-weight: 850;
}

.secondary-action {
  min-height: 48px;
  border-radius: 16px;
  padding: 0 16px;
  color: #47536d;
  background: #eef3ff;
  font-weight: 850;
}

.trust-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 16px 0 22px;
}

@media (min-width: 370px) {
  .trust-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.trust-grid div {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid rgba(104, 108, 242, 0.12);
  border-radius: 999px;
  padding: 8px 10px;
  color: #41506b;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(49, 63, 107, 0.06);
}

.trust-grid div::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #22c58b;
  flex: 0 0 auto;
}

.features-section h2,
.safe-card h2,
.tool-hero h1,
.info-card h1 {
  margin: 0;
  color: #172033;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: 0;
}

.features-section h2 {
  margin-bottom: 12px;
}

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

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

.feature-card {
  position: relative;
  min-height: 158px;
  border: 1px solid rgba(115, 122, 232, 0.12);
  border-radius: 22px;
  padding: 13px 13px 34px;
  color: #172033;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 28px rgba(44, 57, 102, 0.1);
  text-align: left;
}

.feature-card img {
  width: 44px;
  height: 44px;
  margin-bottom: 9px;
}

.feature-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
  line-height: 1.22;
  font-weight: 850;
}

.feature-card p {
  margin: 0;
  color: #5b6680;
  font-size: 13px;
  line-height: 1.35;
}

.feature-card span {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: #666cf2;
  font-size: 22px;
  line-height: 1;
  font-weight: 850;
}

.safe-card,
.input-card,
.result-card,
.info-card {
  border: 1px solid rgba(113, 121, 221, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 30px rgba(49, 61, 110, 0.08);
}

.safe-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
}

.safe-card ul,
.privacy-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.safe-card li,
.privacy-list li {
  position: relative;
  margin-top: 8px;
  padding-left: 18px;
  color: #526078;
  font-size: 14px;
}

.safe-card li::before,
.privacy-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c58b;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  color: #65718a;
  font-size: 13px;
}

.app-footer button {
  min-height: 44px;
  padding: 0 8px;
  color: #4f56dc;
  background: transparent;
  font-weight: 850;
}

.tool-hero {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.tool-hero img {
  width: 74px;
  height: 74px;
}

.tool-hero p {
  margin: 5px 0 0;
  color: #526078;
  font-size: 14px;
}

.chat-shell {
  min-height: 100vh;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.chat-thread {
  flex: 1 1 auto;
  min-height: 360px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding: 8px 2px 14px;
  scroll-behavior: smooth;
}

.chat-welcome {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  text-align: center;
}

.chat-welcome img {
  width: 78px;
  height: 78px;
  margin-bottom: 12px;
}

.chat-welcome h1 {
  margin: 0 0 8px;
  color: #172033;
  font-size: 24px;
  line-height: 1.15;
}

.chat-welcome p {
  max-width: 280px;
  margin: 0;
  color: #526078;
  font-size: 14px;
}

.chat-message {
  display: flex;
  margin: 10px 0;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-message-assistant {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: min(86%, 360px);
  border-radius: 20px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: normal;
  box-shadow: 0 10px 22px rgba(49, 61, 110, 0.08);
}

.chat-message-user .chat-bubble {
  color: #ffffff;
  background: linear-gradient(135deg, #246dff 0%, #7b4dff 100%);
  border-bottom-right-radius: 7px;
}

.chat-message-assistant .chat-bubble {
  color: #22304c;
  background: #ffffff;
  border: 1px solid rgba(113, 121, 221, 0.12);
  border-bottom-left-radius: 7px;
}

.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  min-height: 42px;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6672e8;
  opacity: 0.42;
  animation: typingDot 900ms ease-in-out infinite;
}

.chat-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.chat-typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes typingDot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.38;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chat-composer {
  flex: 0 0 auto;
  border: 1px solid rgba(113, 121, 221, 0.12);
  border-radius: 24px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 34px rgba(49, 61, 110, 0.12);
}

.chat-composer textarea {
  min-height: 72px;
  max-height: 160px;
  border-radius: 18px;
  resize: vertical;
}

.chat-actions {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
  margin-top: 10px;
}

.input-card {
  padding: 14px;
}

.tool-actions {
  display: grid;
  grid-template-columns: 0.84fr 1.16fr;
  gap: 10px;
  margin-top: 12px;
}

.result-section {
  margin-top: 14px;
}

.result-empty {
  min-height: 168px;
  border: 1px dashed rgba(108, 117, 160, 0.26);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #65718a;
  background: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  text-align: center;
}

.result-empty img {
  width: 92px;
  height: 92px;
  margin-bottom: 8px;
}

.loading-state img {
  animation: pulseSoft 1200ms ease-in-out infinite;
}

@keyframes pulseSoft {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.86;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

.result-card {
  padding: 16px;
  background: #ffffff;
}

.result-card p {
  margin: 0;
  color: #22304c;
  font-size: 15px;
  line-height: 1.58;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.copy-button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border-radius: 16px;
  padding: 0 14px;
  color: #4f56dc;
  background: #f0f3ff;
  font-weight: 850;
}

.info-card {
  padding: 18px 16px;
  background: #ffffff;
}

.info-card img {
  width: 150px;
  margin: 0 auto 12px;
}

.info-card h1 {
  margin-bottom: 12px;
  text-align: center;
}

.info-card p {
  margin: 10px 0 0;
  color: #526078;
  font-size: 15px;
}

.floating-action {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 50;
  width: calc(100% - 32px);
  max-width: 440px;
  height: 54px;
  border-radius: 18px;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #246dff 0%, #7b4dff 100%);
  box-shadow: 0 16px 34px rgba(74, 84, 222, 0.28);
  transform: translateX(-50%);
  font-weight: 850;
}

@supports (bottom: constant(safe-area-inset-bottom)) {
  .floating-action {
    bottom: calc(16px + constant(safe-area-inset-bottom));
  }
}

body.input-focused .floating-action {
  position: static;
  display: block;
  width: calc(100% - 32px);
  margin: 8px auto calc(14px + env(safe-area-inset-bottom));
  transform: none;
}

body.input-focused .app-shell {
  padding-bottom: 24px;
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 80;
  width: calc(100% - 32px);
  max-width: 440px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  color: #ffffff;
  background: rgba(24, 32, 54, 0.93);
  box-shadow: 0 16px 28px rgba(12, 17, 31, 0.18);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  animation: toastIn 220ms ease forwards;
}

.toast-success {
  background: rgba(20, 142, 98, 0.94);
}

.toast-error {
  background: rgba(198, 62, 77, 0.95);
}

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 700px) {
  .hero-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .app-header {
    grid-template-columns: 44px minmax(0, 1fr) 84px;
  }

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

  .safe-card img {
    width: 82px;
  }
}
