* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Inter", Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.2;
}
button, a { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.laboratory-shell { min-height: 100vh; padding-top: calc(65px + env(safe-area-inset-top)); }
.app-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  width: min(var(--content-width), calc(100% - 40px));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { display: block; width: 148px; height: 34px; }
.header-actions { display: flex; align-items: center; gap: 24px; }
.header-action-form { margin: 0; }
.header-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}
.header-action__icon { width: 24px; height: 24px; flex: 0 0 24px; }
.header-action--support { color: var(--ink); text-decoration: none; }
.header-action--logout { color: var(--muted); }
.header-action:not(:disabled):hover { color: #000; }
.header-action:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }
.profile-menu { position: relative; }
.profile-menu__trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 0; border: 0; background: transparent; cursor: pointer; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
.profile-menu__trigger:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 3px; }
.profile-menu__icon { width: 24px; height: 24px; flex: 0 0 24px; }
.profile-menu__popover { position: absolute; top: calc(100% + 10px); right: -16px; z-index: 20; width: 360px; padding: 24px; border-radius: 25px; background: var(--surface); box-shadow: 0 14px 34px rgb(0 0 0 / 15%); }
.profile-menu__email { margin: 0 0 24px; overflow-wrap: anywhere; color: #333; font-size: 17px; font-weight: 700; line-height: 1.2; }
.profile-menu__actions { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(110px, 1fr); gap: 10px; }
.profile-menu__actions .secondary-button { width: 100%; min-height: 52px; padding-inline: 14px; font-size: 15px; }
.profile-menu__logout-form { margin: 0; }
.profile-menu__logout { color: #999; border-color: #d5d5d5; }
.profile-menu__logout:hover, .profile-menu__logout:focus-visible { color: var(--ink); }
.profile-edit-dialog { width: min(calc(100% - 32px), 440px); padding: 0; border: 0; border-radius: var(--radius-card); background: transparent; color: var(--ink); }
.profile-edit-dialog::backdrop { background: rgb(0 0 0 / 32%); }
.profile-edit-dialog__form { position: relative; display: grid; gap: 22px; padding: 30px; border-radius: var(--radius-card); background: var(--surface); }
.profile-edit-dialog__form h2 { margin: 0; padding-right: 38px; font-size: 28px; line-height: 1; letter-spacing: -.04em; }
.profile-edit-dialog__close { position: absolute; top: 17px; right: 17px; width: 38px; height: 38px; padding: 0; border: 0; background: transparent; cursor: pointer; font-size: 30px; line-height: 1; }
.profile-edit-dialog__field { display: grid; gap: 8px; }
.profile-edit-dialog__field label { font-size: 14px; font-weight: 700; }
.profile-edit-dialog__field input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); font: inherit; }
.profile-edit-dialog__field input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgb(0 0 0 / 8%); }
.profile-edit-dialog__error { margin: 0; color: #9c2020; font-size: 13px; line-height: 1.3; }
.mobile-profile { display: none; }
.menu-trigger { display: none; }
.laboratory-main {
  width: min(var(--content-width), calc(100% - 40px));
  margin: 30px auto 64px;
}
.program-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  gap: 40px;
  align-items: start;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.module-card {
  position: relative;
  min-height: 186px;
  overflow: hidden;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.module-card--current { border-color: var(--ink); }
.module-card--locked { background: var(--surface); }
.module-card--locked .module-card__title,
.module-card--locked .module-card__description,
.module-card--locked .module-card__time { color: var(--locked); opacity: 1; }
.module-card--locked .module-card__image-slot { opacity: .8; }
.module-card--waiting { border-color: #b7b7b7; color: #636363; }
.module-card--paused { border-color: #d8d8d8; }
.module-card--paused .module-card__content { height: auto; }
.module-card__content {
  position: relative;
  height: 100%;
  min-height: 182px;
  padding: 27px 20px 20px;
}
.module-card__link { position: absolute; inset: 0; border-radius: inherit; }
.module-card:not(.module-card--locked):has(.module-card__link):hover,
.module-card:not(.module-card--locked):has(.module-card__link):focus-within { box-shadow: 0 5px 16px rgb(0 0 0 / 10%); }
.module-card__copy { padding-right: 86px; }
.module-card__image-slot {
  position: absolute;
  top: 17px;
  right: 17px;
  width: 80px;
  height: 63px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.module-card__image-slot img { display: block; width: 80px; height: 63px; object-fit: contain; }
.module-status { display: flex; align-items: center; gap: 8px; color: #9a9a9a; font-size: 15px; }
.module-status__icon { width: 24px; height: 24px; flex: 0 0 24px; }
.module-card--waiting .module-status { color: #777; }
.module-card__title { margin: 7px 0 5px; font-size: clamp(23px, 2.2vw, 32px); line-height: .98; letter-spacing: -.04em; }
.module-card__description { max-width: 370px; margin: 0; font-size: 16px; line-height: 1.15; }
.module-status--paused { color: #acacac; }
.module-card__pause-note { margin: 24px 0 0; color: #989898; font-size: 15px; line-height: 1.2; }
.module-card__pause-note p { margin: 0; }
.module-card__pause-note p:first-child { font-size: 13px; }
.module-card__pause-note p + p { margin-top: 4px; }
.module-card__time { margin: 13px 0 0; color: currentColor; font-size: 13px; opacity: .7; }
.resource-card {
  padding: 21px 30px 22px;
  margin-bottom: 10px;
  border-radius: var(--radius-card);
  background: var(--surface);
}
.resource-card__title { margin: 0 0 4px; font-size: 26px; line-height: 1; letter-spacing: -.04em; }
.resource-card__description { min-height: 54px; margin: 0 0 16px; color: #585858; font-size: 16px; line-height: 1.08; }
.empty-state { grid-column: 1 / -1; padding: 40px; text-align: center; color: #686868; }
.empty-state--program { background: var(--surface); border-radius: var(--radius-card); }
.mobile-menu { display: none; }

@media (max-width: 767px) {
  .laboratory-shell { padding-top: calc(63px + env(safe-area-inset-top)); }
  .app-header__inner, .laboratory-main { width: min(100% - 32px, var(--content-width)); }
  .app-header__inner { min-height: 62px; }
  .header-actions { display: none; }
  .menu-trigger {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
  }
  .menu-trigger__icon { width: 22px; display: grid; gap: 5px; }
  .menu-trigger__icon span { height: 2px; width: 100%; background: var(--ink); border-radius: 2px; }
  .laboratory-main { margin-top: 16px; }
  .program-layout { display: block; }
  .module-grid { grid-template-columns: 1fr; gap: 8px; }
  .desktop-rail { display: none; }
  .module-card { min-height: 173px; }
  .module-card__content { min-height: 169px; padding: 23px 18px 18px; }
  .module-card__title { font-size: 27px; }
  .module-card__description { font-size: 15px; }
  .mobile-menu { position: fixed; inset: 0; z-index: 100; display: block; }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu__backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgb(0 0 0 / 32%); cursor: default; }
  .mobile-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(88vw, 360px);
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: calc(74px + env(safe-area-inset-top)) 18px 28px;
    background: var(--canvas);
    box-shadow: -8px 0 24px rgb(0 0 0 / 12%);
  }
  .mobile-menu__topline { position: fixed; top: calc(9px + env(safe-area-inset-top)); right: 0; left: auto; width: min(88vw, 360px); z-index: 1; display: flex; align-items: center; justify-content: space-between; padding-left: 18px; padding-right: 16px; }
  .mobile-menu__topline .header-action { min-height: 44px; }
  .mobile-menu__close { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; font-size: 32px; line-height: 1; cursor: pointer; }
  .mobile-menu__resources .resource-card { margin-bottom: 8px; }
  .mobile-menu__actions { display: grid; gap: 4px; margin-top: 20px; padding: 0 4px; }
  .mobile-menu__actions .header-action { width: 100%; justify-content: flex-start; }
  .mobile-menu__actions .header-action-form { width: 100%; }
  .mobile-profile { display: block; margin-top: auto; padding: 28px 4px 0; }
  .mobile-profile__identity { display: flex; align-items: center; gap: 10px; }
  .mobile-profile__icon { width: 36px; height: 36px; flex: 0 0 36px; }
  .mobile-profile__name { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.035em; }
  .mobile-profile__email { margin: 8px 0 20px; overflow-wrap: anywhere; color: #777; font-size: 15px; line-height: 1.2; }
  .mobile-profile__actions { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(100px, 1fr); gap: 10px; }
  .mobile-profile__actions .secondary-button { width: 100%; min-height: 52px; padding-inline: 12px; font-size: 15px; }
  .mobile-profile__logout-form { margin: 0; }
  .mobile-profile__logout { color: #999; border-color: #d5d5d5; }
  .profile-edit-dialog__form { padding: 27px 22px; }
  body.menu-open { overflow: hidden; }
}

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