.course-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.course-title-row h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bookmark-button {
  flex: none;
  min-width: 64px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--deep);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  touch-action: manipulation;
}

.bookmark-button[aria-pressed="true"] {
  border-color: var(--green);
  background: #e4f4e7;
}

.bookmark-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.vocabulary-nav-button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--deep);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  touch-action: manipulation;
}

.vocabulary-nav-button:hover {
  border-color: var(--green);
  background: #f0f8f1;
}

.vocabulary-save-button,
.vocabulary-open-button {
  width: 100%;
  margin-top: 9px;
}

.vocabulary-save-button[aria-pressed="true"] {
  border-color: var(--green);
  background: #e4f4e7;
}

.vocabulary-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(86dvh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf8;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(18, 42, 25, 0.28);
}

.vocabulary-dialog::backdrop {
  background: rgba(18, 36, 23, 0.58);
}

.vocabulary-dialog-shell {
  padding: 22px;
}

.vocabulary-dialog .study-header {
  margin-bottom: 16px;
}

.vocabulary-list {
  display: grid;
  gap: 9px;
  max-height: 65dvh;
  overflow: auto;
}

.vocabulary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vocabulary-item > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.vocabulary-item strong {
  font: 700 15px Manrope, sans-serif;
}

.vocabulary-item p {
  margin: 5px 0;
  font-size: 14px;
}

.vocabulary-item small {
  color: var(--muted);
  font-size: 12px;
}

.vocabulary-item button {
  flex: none;
  min-height: 44px;
}

@media (max-width: 700px) {
  .vocabulary-dialog {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .vocabulary-dialog-shell {
    padding: calc(12px + env(safe-area-inset-top)) 17px calc(16px + env(safe-area-inset-bottom));
  }

  .vocabulary-item {
    align-items: flex-start;
    padding: 12px;
  }
}

@media (max-width: 850px) {
  .desktop-nav {
    display: none;
  }

  .desktop-nav.is-open {
    position: absolute;
    top: calc(100% + 1px);
    right: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(18, 42, 25, 0.14);
  }

  .desktop-nav.is-open a {
    min-height: 48px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--line);
  }

  .desktop-nav.is-open a:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .header-actions #trialButton {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .header-actions #loginButton {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px;
  }
}

.auth-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: min(90dvh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbf8;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(18, 42, 25, 0.28);
}

.auth-dialog::backdrop {
  background: rgba(18, 36, 23, 0.58);
}

.auth-dialog[hidden],
.auth-dialog [hidden] {
  display: none !important;
}

.auth-dialog-shell {
  padding: 22px;
}

.auth-dialog .study-header {
  margin-bottom: 18px;
}

.auth-dialog .study-header h2 {
  font: 700 21px Manrope, sans-serif;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-height: 48px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3ed;
}

.auth-mode-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.auth-mode-switch button[aria-selected="true"] {
  background: #fff;
  color: var(--deep);
  box-shadow: 0 1px 4px rgba(18, 42, 25, 0.12);
}

#authForm {
  display: grid;
  gap: 15px;
}

.auth-field {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #b8c9ba;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.auth-field input:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.auth-field small {
  color: #53665a;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.auth-field > span:first-child small {
  display: inline;
  margin-left: 4px;
}

.auth-password-control {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.auth-password-control input {
  flex: 1;
}

.auth-password-control button {
  min-width: 64px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--deep);
  cursor: pointer;
}

.auth-error-summary,
.auth-transport-notice {
  margin: 0;
  padding: 12px;
  border: 1px solid #d98b85;
  border-radius: 8px;
  background: #fff3f1;
  color: #782c27;
  font-size: 13px;
  line-height: 1.5;
}

.auth-error-summary p {
  margin: 4px 0 0;
}

.auth-transport-notice {
  margin-bottom: 14px;
  border-color: #dfc98a;
  background: #fff9e8;
  color: #634d12;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
  font-size: 14px;
}

.auth-submit:disabled,
.auth-logout-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

#accountPanel {
  display: grid;
  gap: 10px;
  padding: 8px 0 4px;
}

#accountPanel[hidden] {
  display: none !important;
}

.auth-account-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-account-phone {
  font: 700 18px Manrope, sans-serif;
  overflow-wrap: anywhere;
}

.auth-logout-button {
  min-height: 48px;
  margin-top: 10px;
}

@media (max-width: 700px) {
  .auth-dialog {
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .auth-dialog-shell {
    padding: calc(12px + env(safe-area-inset-top)) 17px calc(16px + env(safe-area-inset-bottom));
  }
}
