:root {
  --tap: 44px;
  --radius: 14px;
  --shell-scrollbar-comp: 12px;
  --font-display: "Aptos Display", "Segoe UI Variable Display", "SF Pro Display", "Inter", "Noto Sans", "Roboto", sans-serif;
  --type-xs: 0.84rem;
  --type-sm: 0.91rem;
  --type-base: 1rem;
  --type-md: 1.05rem;
  --leading-snug: 1.32;
  --leading-normal: 1.5;
  --leading-relaxed: 1.62;
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom-tappable: env(safe-area-inset-bottom, 0px);
}

#app-root {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow: hidden;
  overflow-x: clip;
}

.app-shell {
  width: min(100%, 430px);
  margin-inline: auto;
  height: 100dvh;
  min-height: 100dvh;
  position: relative;
  min-width: 0;
  overflow: hidden;
  overflow-x: clip;
}

.screen {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding:
    0
    calc(var(--safe-right) + 10px)
    calc(var(--safe-bottom-tappable) + 10px)
    calc(var(--safe-left) + 10px);
}

.screen-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: clip;
  scrollbar-gutter: stable;
  padding-bottom: 12px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  gap: 8px;
  padding-top: max(var(--safe-top), 10px);
  padding-right: var(--shell-scrollbar-comp);
}

.topbar-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--type-md);
  font-weight: 700;
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  line-height: 1;
}

.brand-mark {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-space {
  width: var(--tap);
  height: var(--tap);
}

.icon-ghost,
.open-main,
.open-mini {
  min-width: var(--tap);
  min-height: var(--tap);
  width: var(--tap);
  height: var(--tap);
  border-radius: 11px;
  border: 1px solid rgba(83, 67, 49, 0.9);
  background: linear-gradient(180deg, rgba(31, 24, 19, 0.98), rgba(22, 17, 13, 0.98));
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.05s ease;
  display: grid;
  place-items: center;
}

.icon-ghost {
  background: linear-gradient(180deg, rgba(24, 19, 15, 0.98), rgba(18, 14, 11, 0.98));
}

.open-main,
.open-mini {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(157, 116, 39, 0.28);
}

.open-main {
  font-size: 1.1rem;
  border-radius: 12px;
}

.icon-ghost,
.open-main,
.open-mini {
  border-radius: 12px;
}

.icon-ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.tiny-icon,
.open-mini {
  min-width: 36px;
  min-height: 36px;
  width: 36px;
  height: 36px;
}

.course-actions .icon-ghost,
.course-actions .open-main,
.lesson-actions .icon-ghost,
.lesson-actions .open-mini,
.microsequence-actions .icon-ghost,
.microsequence-actions .open-mini {
  min-width: 48px;
  min-height: 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.clean-card {
  background:
    linear-gradient(180deg, rgba(33, 26, 20, 0.98), rgba(24, 19, 15, 0.99)),
    radial-gradient(circle at top, rgba(228, 186, 104, 0.08), transparent 60%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 240, 217, 0.03);
}

.module-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.course-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  column-gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.course-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.course-actions {
  width: 48px;
  flex: 0 0 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--tap) * 2 + 8px);
}

.corner-btn {
  position: relative;
  z-index: 2;
}

.card-title,
.lesson-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--type-base);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: 0.08em;
  font-variant-caps: all-small-caps;
  text-transform: lowercase;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-subtitle {
  margin: 0;
  color: #d8cdbd;
  font-size: var(--type-sm);
  line-height: var(--leading-relaxed);
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 0.78rem;
  line-height: var(--leading-normal);
}

.progress-meta {
  margin: 0;
  white-space: normal;
}

.progress-card,
.progress-row {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.card-progress-fill,
.row-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(228, 186, 104, 0.14), rgba(228, 186, 104, 0.03));
  z-index: 0;
}

.progress-card > *:not(.card-progress-fill),
.progress-row > *:not(.row-progress-fill) {
  position: relative;
  z-index: 1;
}

.module-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tap);
  align-items: start;
  gap: 8px;
}

.lesson-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(92, 75, 55, 0.82);
  background: linear-gradient(180deg, rgba(27, 21, 16, 0.94), rgba(22, 17, 13, 0.94));
}

.lesson-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 48px;
  flex: 0 0 auto;
}

.lesson-title {
  color: #fff4e4;
}

.lesson-main-button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: block;
  cursor: pointer;
  min-width: 0;
  padding: 0;
}

.lesson-description {
  color: #dbcdb8;
}
