:root {
  --blue: #0b2aa6;
  --blue-deep: #081f80;
  --blue-light: #1a3fc4;
  --yellow: #ffb800;
  --white: #ffffff;
  --ink: #0a1645;
  --muted: #5a6488;
  --field: #f1f4fd;
  --field-border: #d5dcf3;
  --danger: #c4281c;
  --bracket: 5px;
  --font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--white);
  background-color: var(--blue);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(120% 90% at 85% 10%, var(--blue-light) 0%, var(--blue) 45%, var(--blue-deep) 100%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding:
    max(28px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 36px;
}

/* ---------- Logo ---------- */

.logo {
  position: relative;
  display: inline-block;
  padding: 0.42em 0.5em 0.3em 0.42em;
  font-size: clamp(2.6rem, 11vw, 4rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
  border-radius: 4px;
}
.logo-le { color: var(--yellow); }
.logo-seg { color: var(--white); }

.logo::before,
.logo::after {
  content: "";
  position: absolute;
  width: 0.5em;
  height: 0.42em;
  border: 0 solid;
}
.logo::before {
  top: 0;
  right: 0;
  border-color: var(--yellow);
  border-top-width: 0.085em;
  border-right-width: 0.085em;
}
.logo::after {
  bottom: 0;
  left: 0;
  border-color: var(--white);
  border-bottom-width: 0.085em;
  border-left-width: 0.085em;
}

/* ---------- Intro ---------- */

.intro h1 {
  margin: 28px 0 0;
  font-size: clamp(1.9rem, 7.4vw, 3.5rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  margin: 14px 0 0;
  max-width: 34ch;
  font-size: clamp(1rem, 3.9vw, 1.2rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

/* ---------- Framed panel ---------- */

.frame {
  position: relative;
  width: 100%;
  max-width: 460px;
  justify-self: center;
  padding: 12px;
}

.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 56px;
  height: 56px;
  border: 0 solid;
  pointer-events: none;
}
.frame::before {
  top: 0;
  right: 0;
  border-color: var(--yellow);
  border-top-width: var(--bracket);
  border-right-width: var(--bracket);
}
.frame::after {
  bottom: 0;
  left: 0;
  border-color: var(--white);
  border-bottom-width: var(--bracket);
  border-left-width: var(--bracket);
}

.panel {
  background: var(--white);
  color: var(--ink);
  border-radius: 6px;
  padding: 28px 22px;
  box-shadow: 0 24px 60px -20px rgba(3, 12, 60, 0.65);
}

/* ---------- Form ---------- */

.field + .field { margin-top: 18px; }

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

input {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  font: inherit;
  font-size: 1.125rem; /* >=16px: no iOS zoom on focus */
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: var(--field);
  border: 2px solid var(--field-border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: #9aa3c4; font-weight: 400; }
input:hover { border-color: #b4bfe6; }
input:focus {
  background: var(--white);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(11, 42, 166, 0.16);
}
input[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fff6f5;
}
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(196, 40, 28, 0.16); }

.error {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--danger);
}
.error:not(:empty) { margin-top: 7px; }

.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 26px;
  padding: 0 20px;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, transform 0.08s;
}
.btn:hover { background: #ffc629; }
.btn:active { transform: scale(0.985); }
.btn:focus-visible,
.logo:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
.panel .btn:focus-visible { outline-color: var(--blue); }

.btn-ghost {
  color: var(--blue);
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--field-border);
}
.btn-ghost:hover { background: var(--field); }

/* ---------- Result ---------- */

.result { text-align: center; padding: 6px 0 0; }
.result[hidden], form[hidden] { display: none; }

.result-icon {
  width: 56px;
  height: 56px;
  color: var(--blue);
}

.result h2 {
  margin: 14px 0 0;
  font-size: clamp(1.5rem, 6.4vw, 1.9rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--blue);
  text-wrap: balance;
  outline: none;
}

.result p {
  margin: 12px auto 0;
  max-width: 30ch;
  line-height: 1.5;
  color: var(--muted);
}

.swap-in { animation: swap-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes swap-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Larger screens ---------- */

@media (min-width: 600px) {
  :root { --bracket: 6px; }
  .page { gap: 48px; padding-top: 48px; }
  .frame { padding: 18px; }
  .frame::before, .frame::after { width: 72px; height: 72px; }
  .panel { padding: 36px 32px; }
}

@media (min-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 460px);
    align-content: center;
    align-items: center;
    gap: 72px;
    padding-top: 40px;
    padding-bottom: 40px;
  }
  .intro h1 { margin-top: 44px; }
  .lead { margin-top: 18px; }
  .frame { justify-self: end; }
}

/* Short landscape phones: keep everything reachable */
@media (max-height: 520px) and (min-width: 600px) {
  .page {
    grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
    align-items: center;
    gap: 32px;
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .logo { font-size: 2.2rem; }
  .intro h1 { margin-top: 16px; font-size: 1.7rem; }
  .lead { font-size: 0.95rem; margin-top: 8px; }
  .panel { padding: 20px; }
  input, .btn { height: 48px; min-height: 48px; }
  .field + .field { margin-top: 12px; }
  .btn { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
