#initializeSession {
  position: fixed;
  inset: 0;
  z-index: 10050;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: none;
  place-items: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  padding-left: 12px;
  padding-right: 12px;
  background: #f2f2f7;
}

#initializeSession.active {
  display: grid;
}

.init-card {
  width: 92vw;
  max-width: 960px;
  border-radius: 16px;
  border: 1px solid #e6ebf1;
  background: #ffffff;
  box-shadow:
    0 1px 3px rgba(16, 24, 40, 0.05),
    0 12px 32px rgba(16, 24, 40, 0.08);
  padding: 29px;
  position: relative;
  display: grid;
  grid-template-columns: 240px 1fr;
  column-gap: 32px;
  row-gap: 14px;
  align-items: start;
  box-sizing: border-box;
  max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 36px);
  overflow: auto;
}

.init-card { grid-template-rows: 1fr auto auto 1fr; }
.init-card > .init-cover { grid-column: 1; grid-row: 1 / 5; align-self: center; }
.init-card > .init-title { grid-column: 2; grid-row: 2; align-self: end; justify-self: start; }
.init-card > .init-start { grid-column: 2; grid-row: 3; align-self: start; justify-self: start; }
.init-card > .init-level-group { display: none !important; }
.init-card > .init-secondary-actions { display: none !important; }

@media (max-width: 720px) {
  .init-card {
    grid-template-columns: 1fr;
    max-width: 540px;
    padding: 18px;
  }
  .init-card > .init-cover { grid-column: 1; grid-row: 1; justify-self: center; align-self: center; }
  .init-card > .init-title { grid-column: 1; grid-row: 2; justify-self: center; text-align: center; }
  .init-card > .init-start { grid-column: 1; grid-row: 3; justify-self: center; }
}

.init-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #e6ebf1;
  background: #ffffff;
  color: #4b5563;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  transition: transform 120ms ease, background 160ms ease, color 160ms ease;
}

.init-close:hover { background: #f3f4f6; color: #111928; }
.init-close:active { transform: scale(0.96); }

.init-cover {
  width: 240px;
  aspect-ratio: 250 / 333;
  height: auto;
  border-radius: 17.5px;
  overflow: hidden;
  background: #f9fafb;
  box-shadow: 0 10px 30px rgba(17, 25, 40, 0.12);
}

@media (max-width: 720px) {
  .init-cover { width: 200px; }
}

.init-cover-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.init-title {
  max-width: 100%;
  text-align: left;
  margin-top: 0;
  display: grid;
  gap: 6px;
  line-height: 1.2;
}

.init-title-main { display: none; }

.init-title-book {
  color: #111928;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.52px;
  line-height: 1.2;
}

@media (max-width: 720px) {
  .init-title-book { font-size: 28px; }
}

.init-start {
  width: auto;
  max-width: none;
  height: auto;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: #5750f1;
  color: #ffffff;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(87, 80, 241, 0.3);
  transition: transform 120ms ease, box-shadow 160ms ease, background 160ms ease;
}

.init-start:hover {
  transform: translateY(-1px);
  background: #4338ca;
  box-shadow: 0 4px 14px rgba(87, 80, 241, 0.4);
}

.init-start:active {
  transform: scale(0.98);
}

.init-secondary-actions {
  width: 86vw;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.init-secondary-btn {
  width: 100%;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid #e6ebf1;
  background: #f9fafb;
  color: #111928;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.init-secondary-btn:hover {
  border-color: #c7d2fe;
  background: #ffffff;
}

.init-secondary-btn:active {
  transform: scale(0.98);
}

.init-secondary-btn-bonus {
  background: rgba(255, 193, 92, 0.08);
}

.init-secondary-btn-share {
  background: rgba(87, 80, 241, 0.06);
}

.init-secondary-media {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.init-secondary-ico {
  font-size: 18px;
}

.init-secondary-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.init-secondary-title {
  font-weight: 900;
  font-size: 14.5px;
  line-height: 1.1;
  color: #111928;
}

.init-secondary-sub {
  font-size: 12px;
  line-height: 1.3;
  color: #4b5563;
}

@media (max-width: 520px) {
  .init-card { padding: 14px; }
  .init-cover { width: 130px; height: 130px; border-radius: 22px; }
  .init-title-book { font-size: 18px; }
  .init-secondary-btn { min-height: 60px; }
}

/* ===== Level selector (preA1 / A1 / A2) ===== */
.init-level-group {
  width: 86vw;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.init-level-label {
  color: #4b5563;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.init-level-options {
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.init-level-opt {
  position: relative;
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.init-level-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.init-level-opt span {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 9px 8px;
  border-radius: 999px;
  border: 1px solid #e6ebf1;
  background: #f9fafb;
  color: #4b5563;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.3px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.init-level-opt:hover span {
  background: #ffffff;
  border-color: #c7d2fe;
}

.init-level-opt input[type="radio"]:checked + span {
  background: #5750f1;
  border-color: #5750f1;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(87, 80, 241, 0.3);
}

.init-level-opt input[type="radio"]:focus-visible + span {
  outline: 2px solid rgba(87, 80, 241, 0.4);
  outline-offset: 2px;
}

.init-level-error {
  color: #ff7b7b;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  margin-top: 2px;
  min-height: 1em;
}

.init-level-error[hidden] { display: none; }

@keyframes initStartShake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-7px); }
  40%  { transform: translateX(7px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
  100% { transform: translateX(0); }
}

.init-start.shake {
  animation: initStartShake 0.42s ease-in-out;
}
