:root {
  --entry-bg: #f7f8f5;
  --entry-surface: #ffffff;
  --entry-ink: #20323d;
  --entry-muted: #667b88;
  --entry-accent: #3f746b;
  --entry-accent-hover: #315e57;
  --entry-gold: #dfad4c;
  --entry-border: #dfe7e3;
  --entry-danger: #9b4d43;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.student-entry-page {
  margin: 0;
  min-height: 100svh;
  font-family: var(--littlee-font-ui);
  color: var(--entry-ink);
  background: var(--entry-bg);
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  background: var(--entry-ink);
}

.skip-link:focus {
  transform: translateY(0);
}

.entry-shell {
  width: min(1180px, 100%);
  min-height: calc(100svh - max(24px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.entry-compliance {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #788984;
  font-size: 12px;
  line-height: 1.5;
}

.entry-compliance a {
  color: inherit;
  text-decoration: none;
}

.entry-compliance a:hover,
.entry-compliance a:focus-visible {
  color: var(--entry-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.entry-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid #e5eae7;
  border-radius: 8px;
  background: #fffefa;
  animation: entryBrandIn 180ms ease-out both;
}

.entry-brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.1);
  border-radius: 11px;
  background: #f4ead8;
}

.entry-brand-mark img {
  width: 30px;
  height: 30px;
  display: block;
}

.entry-brand-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.entry-brand-copy strong {
  font-family: var(--littlee-font-display);
  color: #17324d;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.entry-brand-copy span {
  padding-left: 10px;
  border-left: 1px solid rgba(71, 100, 112, 0.2);
  color: #657983;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

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

.entry-main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 12px;
}

.story-stage {
  position: relative;
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--entry-border);
  border-radius: 8px;
  background: #dfe9e3;
}

.story-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 48%;
}

.story-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22, 42, 48, 0), rgba(22, 42, 48, 0.78));
}

.story-title {
  position: absolute;
  left: clamp(20px, 4vw, 46px);
  right: clamp(20px, 4vw, 46px);
  bottom: clamp(20px, 4vw, 38px);
  z-index: 1;
  color: #fff;
  text-shadow: 0 2px 16px rgba(14, 29, 34, 0.28);
}

.story-title h1 {
  margin: 0;
  font-family: var(--littlee-font-display);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.start-panel {
  display: block;
  padding: 22px 24px;
  border: 1px solid var(--entry-border);
  border-radius: 8px;
  background: var(--entry-surface);
  box-shadow: 0 18px 44px -38px rgba(30, 49, 59, 0.42);
}

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

.start-panel-heading h2 {
  margin: 3px 0 0;
  font-family: var(--littlee-font-display);
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.start-panel-heading p {
  margin: 0 0 2px;
  color: var(--entry-muted);
  font-size: 13px;
  line-height: 1.4;
}

.start-kicker {
  color: var(--entry-accent);
  font-size: 12px;
  font-weight: 800;
}

.start-guidance {
  min-width: 0;
  display: flex;
  align-items: center;
}

.start-guidance strong {
  font-size: 18px;
  line-height: 1.45;
}

.student-launch-form {
  width: 100%;
}

.student-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.profile-field {
  min-width: 0;
  display: grid;
  gap: 7px;
  align-content: start;
}

.profile-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #405763;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
}

.profile-char-count {
  color: #8a9ba3;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid #cfdbd6;
  border-radius: 7px;
  color: var(--entry-ink);
  background: #fbfcfb;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.profile-field select {
  cursor: pointer;
}

.profile-field input::placeholder {
  color: #92a1a8;
}

.profile-field input:focus,
.profile-field select:focus {
  border-color: var(--entry-accent);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(63, 116, 107, 0.14);
}

.profile-field input[aria-invalid="true"],
.profile-field select[aria-invalid="true"] {
  border-color: #b66055;
  background: #fffafa;
}

.profile-field-error {
  color: var(--entry-danger);
  font-size: 12px;
  line-height: 1.3;
}

.student-launch-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #e8eeeb;
}

.start-lesson-button {
  width: 100%;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--entry-accent);
  box-shadow: 0 16px 30px -22px rgba(47, 95, 86, 0.92);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.start-lesson-button:hover,
.start-lesson-button:focus-visible {
  background: var(--entry-accent-hover);
  box-shadow: 0 20px 34px -22px rgba(47, 95, 86, 0.98);
  transform: translateY(-1px);
  outline: 3px solid rgba(63, 116, 107, 0.2);
  outline-offset: 2px;
}

.start-lesson-button:disabled {
  opacity: 0.72;
  cursor: wait;
  transform: none;
}

.button-icon {
  width: 21px;
  height: 21px;
}

.entry-feedback {
  min-height: 0;
  margin-top: 10px;
}

.entry-status,
.entry-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.entry-status {
  color: var(--entry-accent-hover);
  background: #f1f7f4;
}

.entry-error {
  color: var(--entry-danger);
  background: #fff2ef;
}

@media (max-width: 700px) {
  body.student-entry-page {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .entry-shell {
    gap: 10px;
  }

  .entry-header {
    min-height: 54px;
    padding: 0 12px;
  }

  .entry-brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 11px;
  }

  .entry-brand-mark img {
    width: 26px;
    height: 26px;
  }

  .entry-brand-copy strong {
    font-size: 19px;
  }

  .entry-brand-copy span {
    display: none;
  }

  .entry-main {
    grid-template-rows: auto auto;
    gap: 10px;
  }

  .story-stage {
    min-height: 0;
  }

  .story-art {
    object-position: 57% 48%;
  }

  .story-stage::after {
    height: 50%;
  }

  .story-title h1 {
    font-size: clamp(30px, 10vw, 34px);
  }

  .start-panel {
    padding: 16px;
  }

  .start-panel-heading {
    align-items: start;
    margin-bottom: 15px;
  }

  .start-panel-heading h2 {
    font-size: 21px;
  }

  .start-panel-heading p {
    max-width: 120px;
    text-align: right;
  }

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

  .profile-field-text {
    grid-column: 1 / -1;
  }

  .profile-field input,
  .profile-field select {
    min-height: 50px;
  }

  .student-launch-actions {
    grid-template-columns: 1fr;
    gap: 13px;
    margin-top: 16px;
    padding-top: 14px;
  }

  .start-guidance {
    justify-content: flex-start;
  }

  .start-guidance strong {
    font-size: 15px;
  }

  .start-lesson-button {
    min-height: 60px;
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .entry-header {
    min-height: 54px;
    padding: 0 12px;
  }

  .entry-brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 11px;
  }

  .entry-brand-mark img {
    width: 26px;
    height: 26px;
  }

  .entry-brand-copy strong {
    font-size: 19px;
  }
}

@media (max-height: 820px) and (min-width: 701px) {
  .entry-shell {
    min-height: calc(100svh - 24px);
  }

  .entry-main {
    grid-template-rows: auto auto;
  }

  .story-stage {
    min-height: 0;
  }

  .start-panel {
    min-height: 96px;
    padding-block: 12px;
  }
}

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