.app-main {
  max-width: 1280px;
  padding-top: 10px;
}

.level-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 4px;
  border: 1px solid #dbe4ee;
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .10);
}

.level-switcher .level-link {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
}

.level-switcher .level-link:hover,
.level-switcher .level-link:focus-visible {
  background: #e2e8f0;
  color: #0f172a;
}

.level-switcher .level-link.is-active {
  background: #0f172a;
  color: #fff;
}

.activity-page-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  max-width: 1120px;
  margin-bottom: 10px;
  text-align: left;
}

.activity-page-header picture {
  grid-row: 1 / span 3;
  width: 54px;
  margin: 0;
}

.activity-tier-badge {
  width: 54px;
}

.activity-page-kicker {
  margin: 0;
  color: #64748b;
  font-size: 11px;
}

.activity-page-header h1 {
  margin: 0;
  font-size: 24px;
}

.activity-page-header p {
  margin: 0;
  max-width: none;
  color: #475569;
  font-size: 14px;
}

.flow-setup-modal .w3-modal-content {
  width: min(100%, 1120px) !important;
  margin: 0 auto 10px !important;
  padding: 12px 16px !important;
  border: 1px solid #e2e8f0;
  border-radius: 8px !important;
  background: #fff !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08) !important;
}

.flow-setup-modal .w3-display-topright {
  display: none;
}

.flow-setup-modal .w3-container[style*="inline-block"] {
  display: grid !important;
  grid-template-columns: auto minmax(220px, 360px) auto minmax(120px, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  text-align: left;
}

.flow-setup-modal h4 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.flow-setup-modal .setup-help {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.3;
}

.flow-setup-modal br {
  display: none;
}

.flow-setup-modal select.w3-input {
  height: 42px;
  min-width: 220px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.flow-setup-modal button.w3-button {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 8px !important;
  background: #0f172a !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .18);
}

#setupSelectionStatus {
  margin-left: auto;
  color: #0f766e;
  font-weight: 800;
}

#get_feedback {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 !important;
}

#get_feedback > br {
  display: none;
}

#theDirections {
  margin-bottom: 10px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
  text-align: left;
}

#theDirections h4 {
  margin: 0;
  color: #0f172a;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 650;
}

#theDirections p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14px;
  text-align: left !important;
}

.targetNumber {
  color: #dc2626;
  font-weight: 900;
}

#selectionStatus {
  margin-top: 8px !important;
  color: #0f766e !important;
  font-size: 13px !important;
  font-weight: 700;
}

.writing-workspace {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 24vw, 320px);
  gap: 14px;
  align-items: stretch;
  justify-items: stretch;
  margin: 0 !important;
}

.writing-workspace::before,
.writing-workspace::after {
  content: none !important;
  display: none !important;
}

.writing-workspace > .w3-threequarter,
.writing-workspace > .w3-quarter {
  float: none !important;
  width: auto !important;
}

.writing-workspace > .w3-threequarter {
  grid-column: 1;
  min-height: 500px;
  padding: 16px !important;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fafc, #eef2f7) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 12px 26px rgba(15, 23, 42, .08);
}

.writing-workspace > .w3-threequarter br {
  display: none;
}

#text_input {
  width: 100%;
  min-height: 468px;
  height: 52vh;
  max-height: 620px;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: 18px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .06);
}

#text_input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .16), inset 0 1px 2px rgba(15, 23, 42, .06);
}

.writing-workspace > .w3-quarter {
  grid-column: 2;
  min-width: 260px;
  padding: 16px !important;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, .08);
  text-align: left !important;
}

.writing-workspace > .w3-quarter h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
}

.writing-workspace > .w3-quarter .setup-help {
  margin: 6px 0 12px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.writing-workspace > .w3-quarter .w3-button {
  width: 100% !important;
  min-height: 44px;
  margin: 0 0 8px !important;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 8px 16px rgba(15, 23, 42, .10);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.writing-workspace > .w3-quarter .w3-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, .14);
  filter: brightness(.98);
}

.writing-workspace > .w3-quarter .w3-red {
  background: #ef4444 !important;
}

.writing-workspace > .w3-quarter .w3-green {
  background: #0f766e !important;
}

#advice_holder .w3-modal-content {
  width: min(92vw, 880px);
  border-radius: 8px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, .24);
}

@media (max-width: 680px) {
  .activity-page-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .activity-page-header picture {
    grid-row: auto;
    margin: 0 auto;
  }

  .flow-setup-modal .w3-container[style*="inline-block"] {
    grid-template-columns: 1fr;
    text-align: center;
  }

  #setupSelectionStatus {
    margin-left: 0;
  }

  .writing-workspace {
    grid-template-columns: 1fr;
  }

  .writing-workspace > .w3-threequarter,
  .writing-workspace > .w3-quarter {
    grid-column: 1;
  }

  .level-switcher {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  #text_input {
    min-height: 360px;
    height: 48vh;
    font-size: 16px;
  }
}
