/* Balanced header tracks keep the meter on the centerline of the app. */
.app-nav {
  grid-template-columns: minmax(0, 1fr) minmax(140px, 300px) minmax(0, 1fr);
  padding-inline: 18px;
}
.app-nav .project-progress { position: relative; display: block; }
.app-nav .party {
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 80px;
  flex-wrap: nowrap;
  gap: 8px;
}
.app-nav .account-avatar { cursor: default; padding: 0; }
.app-nav .account-avatar:not(:disabled) { cursor: pointer; }
.project-switcher { position: relative; flex: 1; min-width: 0; max-width: 260px; }
.app-nav .project-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid #807354;
  border-radius: 2px;
  background: var(--slate-grain, linear-gradient(transparent, transparent)), linear-gradient(#363c40, #22282c);
  box-shadow: inset 0 1px 0 #c7b78330, inset 0 -1px 0 #090d10, 0 2px 3px #0006;
  color: #ead6a5;
  font-size: 15px;
  text-align: left;
}
.project-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-chevron { width: 7px; height: 7px; flex: none; border-right: 1.5px solid #c9ad6b; border-bottom: 1.5px solid #c9ad6b; transform: translateY(-2px) rotate(45deg); }
.app-nav .project-trigger:is(:hover, [aria-expanded='true']) { border-color: #c3a666; background-color: #3b4245; }
.app-nav .project-trigger:disabled { opacity: .55; }
.project-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: max(100%, 230px);
  max-width: calc(100vw - 64px);
  max-height: min(440px, 65vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid #9a8152;
  border-radius: 3px;
  background: linear-gradient(130deg, #353c40, #20262b);
  box-shadow: 0 0 0 2px #151a1e, inset 0 0 0 1px #d1b47520, 0 12px 28px #0009;
  scrollbar-width: thin;
}
.app-nav .project-menu button {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #d9d2be;
  text-align: left;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.app-nav .project-menu button[aria-checked='true'] { color: #ffe3a0; background: #c5a05417; border-color: #b79b604d; }
.app-nav .project-menu button:is(:hover, :focus-visible) { color: #fff0c5; background: #d1b66d24; outline: none; border-color: #c2a76b80; }
.project-menu-divider { height: 1px; margin: 6px 8px; background: #b79c5c40; }

/* One title row, an aligned action group, and a quieter editor surface. */
.app-shell #quest-prototype .quest-summary { align-items: center; column-gap: 16px; row-gap: 4px; }
.app-shell #quest-prototype .journal-heading { grid-row: 1; max-width: none; flex-wrap: nowrap; align-self: center; gap: 6px; }
.app-shell #quest-prototype .quest-title { margin-bottom: 0; }
.app-shell #quest-prototype .quest-status { margin-top: 4px; }
.app-shell #quest-prototype .title-editor { position: relative; margin: 0; padding-top: 20px; }
.app-shell #quest-prototype .title-editor > span { position: absolute; top: 0; left: 0; margin: 0; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.app-shell #quest-prototype .title-input {
  min-height: 40px;
  padding: 7px 10px;
  font-size: 22px;
  line-height: 1.2;
  background: #fff0c34d;
  border: 1px solid #94612c80;
  box-shadow: inset 0 2px 4px #74491a12, 0 1px 0 #ffedb666;
}
.app-shell #quest-prototype .quest-summary:has(.title-editor:not([hidden])) .journal-heading { align-self: end; padding-bottom: 3px; }
.app-shell #quest-prototype .quest-summary:has(.title-editor:not([hidden])) .reset-quest { display: none; }
.app-shell #quest-prototype .journal-heading .cancel-edit { order: -1; --button-art: url('/assets/buttons/button-dark.png'); }
.app-shell #quest-prototype .editor-toolbar {
  gap: 6px;
  margin: 6px 0 0;
  padding: 12px 0;
  border-top: 1px solid #92612b40;
  border-bottom: 1px solid #92612b40;
}
.app-shell #quest-prototype .editor-toolbar button { --button-art: url('/assets/buttons/button-dark.png'); }
.app-shell #quest-prototype .description-count { margin: 8px 0 12px; font-size: 11px; color: #79582f; }
.app-shell #quest-prototype .journal-document[contenteditable='true'] {
  min-height: 240px;
  padding: 14px;
  border: 1px solid #94612c66;
  border-radius: 2px;
  outline: none;
  background: #ffedc02e;
  box-shadow: inset 0 2px 5px #74491a0d;
}
.app-shell #quest-prototype .journal-document[contenteditable='true']:focus { border-color: #94612cb3; box-shadow: 0 0 0 2px #94612c18; }
.app-shell #quest-prototype .quest-owner .owner-avatar:not(.human):not(.orc) {
  color: #f4ddb0;
  background: radial-gradient(circle at 35% 25%, #59626a, #252d34 80%);
  border-color: #a69061;
}
.app-shell #quest-prototype .quest-owner { width: auto; min-width: 88px; gap: 9px; }
/* Soften halos at the bottom while keeping quests visible at the top frame. */
.app-shell #quest-prototype .tree-viewport {
  mask-image: linear-gradient(to bottom, #000 calc(100% - 10px), transparent);
}

@media (max-width: 1100px) {
  .app-nav { grid-template-columns: minmax(0, 1fr) 224px; grid-template-rows: auto auto; gap: 8px 16px; padding-inline: 16px; }
  .app-nav .project-controls { grid-column: 1; grid-row: 1; }
  .app-nav .project-progress { grid-column: 1 / -1; grid-row: 2; width: min(300px, calc(100% - 100px)); max-width: none; justify-self: center; margin-block: 6px; }
  .app-nav .account-controls { grid-column: 2; grid-row: 1; }
}
@media (max-width: 700px) {
  .app-nav { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; padding: 0 12px 10px; }
  .app-nav .account-controls { grid-column: 1; grid-row: 1; }
  .app-nav .project-controls { grid-column: 1; grid-row: 2; }
  .app-nav .project-progress { grid-column: 1; grid-row: 3; }
  .project-switcher { max-width: none; }
}
@media (max-width: 480px) {
  .app-shell #quest-prototype .quest-summary:has(.title-editor:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; }
  .app-shell #quest-prototype .quest-summary:has(.title-editor:not([hidden])) .journal-heading { grid-column: 2; grid-row: 1; margin: 0; }
  .app-shell #quest-prototype .title-editor:not([hidden]) { grid-column: 1; grid-row: 1; }
  .app-shell #quest-prototype .quest-summary:has(.title-editor:not([hidden])) .quest-status { grid-row: 2; }
  .app-shell #quest-prototype .title-input { font-size: 18px; }
}
@media (pointer: coarse) {
  .app-nav :is(.project-trigger, .project-menu button) { min-height: 44px; }
  .app-shell #quest-prototype .title-input { min-height: 50px; }
}
