#appShellHeader {
  display: none;
}

:root {
  --app-control-surface: #f5f5f3;
  --app-control-hover: #e9e9e6;
  --app-control-border: #d8dadd;
  --app-control-border-hover: #bbbfc3;
  --app-control-radius: 12px;
  --app-shell-header-height: 64px;
}

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

body.app-shell-active {
  background: #fbfbfa;
  background-image: none;
}

body.app-shell-active #appShellHeader {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(240px, 1fr) auto;
  column-gap: 20px;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: var(--app-shell-header-height);
  padding: 0 clamp(22px, 4vw, 64px);
  border-bottom: 0;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.app-shell-active #appShellHeader::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: 18px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .78), transparent);
  pointer-events: none;
}

body.app-shell-active #mainContainer {
  box-sizing: border-box;
  min-height: 100vh;
  margin-top: 0;
  padding-top: var(--app-shell-header-height);
}

/* The media shell owns project identity and actions; keep the legacy controls
   mounted as behavior targets without presenting a second header underneath. */
body.app-shell-media :is(#titleContainer, #mediaMetadata) {
  display: none !important;
}

body.app-shell-media #panelContainers {
  padding-top: 22px;
}

@media (min-width: 1111px) {
  body.app-shell-media #accessoryPanelContainer {
    /* The base side-by-side layout predates the fixed app header. Keep the
       sticky panel below it without moving the panel into the player area. */
    top: calc(var(--app-shell-header-height) + 10px);
    height: calc(100vh - 200px - var(--app-shell-header-height));
  }
}

.appShellWordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
  justify-self: start;
  color: #151618;
  font-family: var(--system-ui);
  font-size: clamp(25px, 2vw, 32px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1;
  text-decoration: none;
}

.appShellWordmark::before {
  content: "";
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  background: url("/assets/favicon/android-chrome-512x512.png") center / contain no-repeat;
}

.appShellWordmark:hover,
.appShellWordmark:focus-visible {
  color: #151618;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.appShellContext {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
}

.appShellProjectsWorkspace {
  min-width: 0;
}

/* On wide Projects views, the page toolbar occupies the contextual area of
   the shared app header. The username remains fixed at the right edge. */
body.projects-toolbar-in-shell #appShellHeader {
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
}

body.projects-toolbar-in-shell :is(.appShellContext, .appShellActions) {
  display: none;
}

body.projects-toolbar-in-shell .appShellProjectsWorkspace {
  position: absolute;
  right: calc(clamp(22px, 4vw, 64px) + 130px);
  left: clamp(220px, 18vw, 360px);
  display: block;
  min-width: 0;
  margin-right: 0;
}

.appShellIdentity {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  justify-items: start;
  gap: 1px;
}

.appShellTitle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 32px;
  min-width: 0;
  margin: 0 0 0 -7px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #151618;
  cursor: default;
  font-family: var(--system-ui);
  font-size: 15px;
  font-weight: 720;
  line-height: 1.25;
  text-align: left;
  transition: background-color 140ms ease;
}

.appShellTitleText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appShellTitleEditIcon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-left: 7px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity 130ms ease, transform 130ms ease;
}

.appShellTitle:not(.canEdit) .appShellTitleEditIcon {
  display: none;
}

.appShellTitle.canEdit:hover .appShellTitleEditIcon,
.appShellTitle.canEdit:focus-visible .appShellTitleEditIcon {
  opacity: 1;
  transform: translateX(0);
}

.appShellMetadata {
  max-width: 100%;
  overflow: hidden;
  color: #777b81;
  font-family: var(--system-ui);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appShellTitle.canEdit {
  cursor: pointer;
}

.appShellTitle.canEdit:hover,
.appShellTitle.canEdit:focus-visible {
  padding: 0 7px;
  border: 0;
  background: #fff6df;
  color: #151618;
  transform: none;
}

.appShellTitle:not(.canEdit):hover {
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: #151618;
  transform: none;
}

body.app-shell-projects .appShellTitle {
  min-width: 82px;
}

.appShellTitle:focus-visible {
  outline: 2px solid #9a9da1;
  outline-offset: 2px;
}

.appShellTitleTooltip {
  position: fixed;
  z-index: 1120;
  box-sizing: border-box;
  max-width: min(440px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: 8px;
  background: #202124;
  color: #fff;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.35;
  overflow-wrap: anywhere;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(20, 21, 23, .16);
}

.appShellTitleTooltip[hidden],
.appShellTitleEditor[hidden] {
  display: none !important;
}

.appShellTitleEditor {
  position: fixed;
  z-index: 1130;
  box-sizing: border-box;
  width: min(380px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid var(--app-control-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 36px rgba(20, 21, 23, .14), 0 2px 8px rgba(20, 21, 23, .08);
}

.appShellTitleEditor form {
  display: grid;
  gap: 10px;
}

.appShellTitleEditorHeading {
  color: #17181a;
  font-size: 16px;
  font-weight: 740;
}

.appShellTitleEditor label {
  color: #5f6368;
  font-size: 12px;
  font-weight: 650;
}

.appShellTitleEditor input {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cdd0d3;
  border-radius: 9px;
  background: #fff;
  color: #17181a;
  font-family: var(--system-ui);
  font-size: 14px;
  font-weight: 560;
}

.appShellTitleEditor input:focus {
  border-color: #7f8388;
  outline: 3px solid rgba(32, 33, 36, .09);
}

.appShellTitleEditorActions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 2px;
}

.appShellTitleEditorActions button {
  min-width: 72px;
  height: 36px;
  margin: 0;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: #ededeb;
  color: #26282b;
  font-family: var(--system-ui);
  font-size: 13px;
  font-weight: 700;
}

.appShellTitleEditorActions button:hover,
.appShellTitleEditorActions button:focus-visible {
  border: 0;
  background: #dfdfdc;
  color: #17181a;
  transform: none;
}

#appShellTitleSave {
  background: #191a1c;
  color: #fff;
}

#appShellTitleSave:hover,
#appShellTitleSave:focus-visible {
  background: #303236;
  color: #fff;
}

.appShellActions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
  margin-right: clamp(104px, 9vw, 138px);
}

.appShellUtilityGroup {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  box-sizing: border-box;
  height: 40px;
  border: 1px solid var(--app-control-border);
  border-radius: var(--app-control-radius);
  background: var(--app-control-surface);
}

.appShellAction,
button.appShellAction {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  min-width: 78px;
  height: 40px;
  padding: 0 14px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--app-control-radius);
  background: transparent;
  color: #24272b;
  font-family: var(--system-ui);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.appShellActionIcon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appShellAction.appShellProjectsLink {
  min-width: 88px;
  padding: 0 15px;
  border: 1px solid var(--app-control-border);
  background: var(--app-control-surface);
  font-size: 14px;
  font-weight: 680;
}

.appShellProjectsLink .appShellActionIcon {
  display: none;
}

.appShellSaveAction {
  min-width: 82px;
  padding-right: 8px;
  padding-left: 8px;
  color: #666b70;
}

.appShellSaveAction .appShellActionIcon {
  color: #4d8a5c;
}

.appShellSaveAction.hasUnsavedChanges {
  border-color: transparent;
  background: #fff7e5;
  color: #684700;
}

.appShellSaveAction.hasUnsavedChanges .appShellActionIcon,
.appShellSaveAction.saveFailed .appShellActionIcon {
  color: currentColor;
}

.appShellUtilityGroup .appShellAction {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.appShellUtilityGroup .appShellAction + .appShellAction {
  border-left: 1px solid var(--app-control-border);
}

.appShellUtilityGroup .appShellOptionsAction {
  min-width: 76px;
}

.appShellAction[data-app-shell-tooltip]::after {
  content: attr(data-app-shell-tooltip);
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 1140;
  width: max-content;
  max-width: 170px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #202124;
  color: #fff;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

@media (hover: hover) {
  .appShellAction[data-app-shell-tooltip]:hover::after,
  .appShellAction[data-app-shell-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.appShellSaveAction.saveFailed {
  border-color: transparent;
  background: #fff1ef;
  color: #8c2921;
}

button.appShellAction:disabled {
  border-color: transparent;
  background: transparent;
  color: #73777c;
  opacity: 1;
}

.appShellAction:hover,
.appShellAction:focus-visible,
button.appShellAction:hover,
button.appShellAction:focus-visible {
  border-color: transparent;
  background: var(--app-control-hover);
  color: #111;
  box-shadow: none;
  transform: none;
}

.appShellUtilityGroup .appShellAction + .appShellAction:hover,
.appShellUtilityGroup .appShellAction + .appShellAction:focus-visible {
  border-left-color: var(--app-control-border);
}

.appShellProjectsLink:hover,
.appShellProjectsLink:focus-visible {
  border-color: var(--app-control-border-hover);
}

.appShellAction:focus-visible,
button.appShellAction:focus-visible,
body.app-shell-active #signInButton:focus-visible {
  outline: 3px solid rgba(245, 173, 18, .28);
  outline-offset: 3px;
}

body.app-shell-active :is(.projectsUploadAction, .projectsStateAction) {
  border-radius: var(--app-control-radius);
}

body.app-shell-active #signInButton {
  position: fixed;
  z-index: 1010;
  top: 12px;
  right: clamp(22px, 4vw, 64px);
  display: inline-flex;
  box-sizing: border-box;
  width: auto;
  max-width: 112px;
  height: 40px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--app-control-border);
  border-radius: var(--app-control-radius);
  background: var(--app-control-surface);
  box-shadow: none;
  color: #34373b;
  font-size: 14px;
  font-weight: 680;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

body.app-shell-active #profileName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.app-shell-active #signInButton:hover,
body.app-shell-active #signInButton:focus-visible {
  border-color: var(--app-control-border-hover);
  background: var(--app-control-hover);
  box-shadow: none;
  transform: none;
}

body.app-shell-active #profileLogo {
  display: none !important;
}

body.app-shell-media #morePostSelections {
  box-sizing: border-box;
  width: 220px;
  padding: 7px;
  border: 1px solid var(--app-control-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 16px 36px rgba(20, 21, 23, .14), 0 2px 8px rgba(20, 21, 23, .08);
}

body.app-shell-media #exportToolbar {
  display: none !important;
}

body.app-shell-media #morePostSelections button {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 13px;
}

body.app-shell-media #morePostSelections hr {
  width: auto;
  margin: 5px 8px;
  border: 0;
  border-top: 1px solid #ececea;
}

.appShellMobilePostAction,
.appShellMobilePostActionDivider {
  display: none !important;
}

body.app-shell-minimal #appShellHeader {
  grid-template-columns: minmax(190px, 1fr) minmax(0, 1.35fr) minmax(190px, 1fr);
}

body.app-shell-minimal .appShellContext {
  display: none;
}

@media (max-width: 900px) {
  body.app-shell-active #appShellHeader {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 0 18px;
  }

  .appShellWordmark {
    font-size: 25px;
  }

  .appShellContext {
    justify-content: flex-start;
    margin-left: 24px;
  }

  .appShellActions {
    margin-right: 82px;
  }

  .appShellTitle {
    max-width: 100%;
  }

  body.app-shell-active #signInButton {
    right: 14px;
    max-width: 76px;
    padding: 0 9px;
  }
}

@media (max-width: 1180px) {
  body.app-shell-media .appShellAction:not(.appShellProjectsLink) {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  body.app-shell-media .appShellActionIcon {
    margin-right: 0;
  }

  body.app-shell-media .appShellAction:not(.appShellProjectsLink) .appShellActionLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

@media (max-width: 700px) {
  body.app-shell-media :is(#appShellShareAction, #appShellExportAction) {
    display: none !important;
  }

  body.app-shell-media #morePostSelections .appShellMobilePostAction {
    display: flex !important;
  }

  body.app-shell-media #morePostSelections .appShellMobilePostActionDivider {
    display: block !important;
  }

  body.app-shell-media #appShellOptionsAction {
    border-left: 0;
  }
}

@media (max-width: 640px) {
  body.app-shell-active #appShellHeader {
    padding: 0 14px;
    column-gap: 12px;
  }

  .appShellWordmark {
    font-size: 0;
    gap: 0;
  }

  .appShellContext {
    gap: 8px;
    margin-left: 0;
  }

  .appShellTitle {
    display: inline-flex;
    width: 100%;
    max-width: 100%;
    font-size: 13px;
  }

  .appShellMetadata {
    display: none;
  }

  .appShellActions {
    gap: 5px;
    margin-right: 70px;
  }

  .appShellAction.appShellProjectsLink {
    min-width: 70px;
    height: 40px;
    padding: 0 11px;
  }

  body.app-shell-active #signInButton {
    right: 10px;
    max-width: 60px;
    padding: 0 8px;
  }

  body.app-shell-media #panelContainers {
    padding-top: 16px;
  }
}

@media (max-width: 480px) {
  body.app-shell-active #appShellHeader {
    column-gap: 8px;
  }

  .appShellAction.appShellProjectsLink {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .appShellProjectsLink .appShellActionIcon {
    display: block;
    margin-right: 0;
  }

  .appShellProjectsLink .appShellActionLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
