/* Physical-phone corrections, scoped to the owner-requested surfaces. */
.sojourner-page .sojourner-status,
.sojourner-page .theme-helper { color: #f4dfaf; }
.sojourner-page .sojourner-table { overflow: visible; }
.sojourner-page .sojourner-column {
  height: calc(var(--sojourner-card-height) + var(--face-up-before, 0) * var(--sojourner-faceup-offset) + var(--face-down-before, 0) * var(--sojourner-facedown-offset));
}
.sojourner-road-end-panel { max-width: min(520px, calc(100vw - 32px)); }
.sojourner-road-end-panel::backdrop, .sojourner-win::backdrop { background: rgba(4, 18, 36, .78); }
.sojourner-win { width: min(460px, calc(100vw - 32px)); max-height: 90dvh; overflow-y: auto; text-align: center; background: #0a3161; color: #fff0cd; border: 2px solid #d7b66a; border-radius: 12px; padding: 20px; }
.sojourner-win:not([open]) { display: none; }
.sojourner-win h2 { color: #f7d66a; }
.sojourner-win form { display: inline; }
.sojourner-win-flag { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; max-width: 260px; margin: 24px auto; overflow: visible; }
.sojourner-win-card { border-radius: 2px; border: 1px solid #d7b66a; height: 15px; font: bold 10px Georgia, serif; animation: sojourner-card-firework 4s ease-out both; }
.sojourner-win-card.is-canton { color: #fff9ef; background: #123e75; }
.sojourner-win-card.is-red { color: #fff9ef; background: #bf0d3e; }
.sojourner-win-card.is-cream { color: #0a3161; background: #fff9ef; }
@keyframes sojourner-card-firework {
  0%, 40% { transform: none; opacity: 1; }
  80% { transform: translate(var(--burst-x), var(--burst-y)) rotate(var(--burst-rotation)); opacity: 0; }
  81% { transform: none; opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* The same soft radial light as the approved cabinet/planner, without a frame. */
body :is(.miles-return-ticket, .road-ideas-hotspot)::before {
  background: radial-gradient(ellipse at center, rgba(255, 216, 125, .78), rgba(232, 184, 91, .4) 38%, transparent 72%);
  box-shadow: none; filter: blur(4px); opacity: .88;
  animation: bureau-glow-pulse 3.2s ease-in-out infinite;
  pointer-events: none;
}
body .miles-return-ticket { animation: bureau-ticket-glow 3.2s ease-in-out infinite; }
body .miles-scene:has(.miles-filing-drawer.is-open) .miles-return-ticket { visibility: visible; z-index: 4; }
.miles-state-story-hint { display: none; }
.miles-state-sheet[data-planner-mode="stateStory"] .miles-state-story-hint { display: block; position: absolute; bottom: 100%; left: 0; width: 100%; margin: 0 0 8px; text-align: center; color: #e8b85b; font-size: .78rem; }
.promises-book-stage:has(.promises-book.has-overlay-open) > .promises-turn-button { visibility: hidden; pointer-events: none; }
.promises-book-stage:has(.promises-supply-panel) > .promises-turn-button { visibility: hidden; pointer-events: none; }
.promises-book { touch-action: pan-y; }

@media (max-width: 760px), (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  .games-page .game-tile-crossword::before { inset: 0; background-size: cover; }
  .sojourner-page .sojourner-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .sojourner-page .sojourner-actions .game-action-button { flex: 0 1 auto; width: auto; min-height: 44px; padding: 8px 10px; }
  .sojourner-page .sojourner-actions a { flex-basis: 100%; }
  body .miles-filing-drawer.is-open { top: calc(100% - 50px); left: 2%; width: 82%; height: 350px; min-height: 350px; }
  body .miles-scene:has(.miles-filing-drawer.is-open) { margin-bottom: 350px; }
  body .miles-drawer-index { top: 22%; right: -6%; width: 44px; gap: 3px; }
  body .miles-drawer-index__tab, body .miles-drawer-index__tab[aria-selected="true"] { min-height: 36px; font-size: .68rem; }
  body .miles-drawer-paging { bottom: 0; right: 8%; left: 0; gap: 4px; }
  body .miles-drawer-paging button { min-height: 44px; font-size: .65rem; padding-inline: 5px; }
  body .miles-filing-drawer__close { min-height: 44px; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__clippings-panel { height: 41%; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-add { left: 110%; width: 85%; font-size: .58rem; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-controls { left: 50%; right: auto; width: 50%; }
  body .promises-book[data-page-mode="single"] { aspect-ratio: 2 / 3; height: auto; }
  body .promises-book[data-page-mode="single"] .promises-story-page.promises-template-page { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  body .promises-book[data-page-mode="single"] .promises-template-body { min-height: 0; overflow-y: auto; overflow-x: hidden; }
  body .promises-book[data-page-mode="single"] .promises-template-field textarea { overflow-y: auto; }
  body .promises-book[data-page-mode="single"] :is(.promises-photo-placeholder, .promises-template-helper, .promises-story-hint) { font-size: .6rem; line-height: 1.2; }
  body .promises-book[data-page-mode="single"] :is(input, textarea)::placeholder { font-size: .65rem; }
  body .promises-book[data-page-mode="single"] .promises-photo-mat > span { font-size: .65rem; line-height: 1.2; }
  body .promises-book[data-page-mode="single"] .promises-archive-bookmark-top {
    border-color: #234f79;
    background: linear-gradient(90deg, #123555, #467fb0 38%, #729bc0 48%, #285981 65%, #163c62);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 5px 8px rgba(4,24,43,.24);
  }
  body .promises-book[data-page-mode="single"] .promises-archive-bookmark-top .bookmark-ribbon__label { font-size: .54rem; letter-spacing: .01em; line-height: 1; max-height: 76px; }
}
@media (max-width: 600px) and (orientation: portrait) {
  .sojourner-page[data-layout="compact-table"] .sojourner-orientation-prompt { display: block; padding: 8px; text-align: center; color: #0a3161; }
  .sojourner-page[data-layout="compact-table"] .sojourner-orientation-prompt .eyebrow { display: none; }
  .sojourner-page[data-layout="compact-table"] .sojourner-orientation-prompt h2 { font-size: 1rem; margin: 0 0 5px; }
  .sojourner-page[data-layout="compact-table"] .sojourner-orientation-prompt p { font-size: .85rem; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sojourner-win-card, body :is(.miles-return-ticket, .road-ideas-hotspot)::before { animation: none; }
  body .miles-return-ticket { animation: none; filter: drop-shadow(0 0 18px rgba(255,216,125,.85)); }
}

/* Phone/tablet finishing: keep the existing room, paper art and data controls. */
body .miles-scene-copy { align-items: flex-start; gap: 8px; }
body .miles-scene-copy :is(h1,.miles-room-hint) { text-align: left; }
body .miles-state-sheet[data-planner-mode="stateStory"] { overflow: visible; }
@media (min-width: 761px) and (max-width: 1280px) {
  body .miles-state-sheet[data-planner-mode="myPlans"] {
    top: 12px; left: 50%; width: min(calc(100% - 12px), calc((100dvh - 220px) * 1.3333));
    min-width: 0; max-width: none; transform: translateX(-50%);
  }
  body .miles-state-sheet[data-planner-mode="myPlans"].is-open { transform: translateX(-50%); }
  body .miles-scene:has(.miles-state-sheet[data-planner-mode="myPlans"].is-open) { min-height: calc(100dvh - 196px); }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field :is(input,textarea) { font-size: 14px; line-height: 1.25; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field > span { font-size: 11px; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-heading { font-size: 12px; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-add { min-height: 44px; font-size: 11px; }
  body .miles-filing-drawer.is-open { left: 2%; top: 30%; width: 48%; min-width: 310px; height: 360px; transform: none; }
}
@media (max-width: 1280px) {
  body .miles-filing-drawer.is-open .miles-drawer-index { top: 20%; right: -5%; width: 48px; gap: 4px; }
  body .miles-filing-drawer.is-open .miles-drawer-index__tab { min-height: 44px; font-size: 11px; transform: none; }
  body .miles-filing-drawer.is-open .miles-drawer-index__tab[aria-selected="true"] { transform: translateX(3px); }
}
@media (min-width: 761px) and (max-width: 1280px) and (orientation: portrait) {
  body .miles-scene { height: max(580px, calc(100dvh - 220px)); min-height: 0; max-height: none; }
}

/* Samsung portrait follow-up: preserve integrated control coordinates while
   keeping paper separation, visible overflow and usable field interiors. */
@media (max-width: 760px) and (orientation: portrait) {
  body .miles-filing-drawer.is-open .miles-filing-drawer__close { top: 3%; }
  body .miles-filing-drawer.is-open .miles-folder-stack { right: 26%; }
  body .miles-filing-drawer.is-open .miles-state-folder { min-width: 60px; }
  body .miles-state-sheet[data-planner-mode="stateStory"] { top: calc(100% + 48px); }
  body .miles-state-sheet[data-planner-mode="stateStory"] .miles-state-story-hint { margin-bottom: 16px; line-height: 1.3; }
  body .miles-state-sheet[data-planner-mode="myPlans"] { overflow: visible; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field { display: block; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field > span { position: absolute; bottom: 100%; margin-bottom: 2px; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field :is(input,textarea) { font-size: 12px; line-height: 1.15; padding: 2px 3px; }
}

/* Phone Planner: the pocket note owns collection entry; keep the approved
   Close control coordinates and give its existing state artwork the space. */
@media (max-width: 760px) {
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-add,
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-controls { display: none; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .pocket-empty-card { margin-top: 0; height: 100%; min-height: 0; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon { grid-template-rows: minmax(0, 1fr) auto; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon svg { width: 96%; height: 96%; }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon-label { font-size: 6px; line-height: 1; letter-spacing: 0; padding-bottom: 2px; }
}

/* The phone hit target is 14% wide/min-height 40px; the painted medallion
   retains the original 8.6% width at 66.4% left. Fit contents to the artwork,
   not the enlarged target. Restore the compact 905edcf label/row balance. */
.miles-state-sheet__state-icon-content { display: contents; }
@media (max-width: 760px) and (orientation: portrait) {
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon-content {
    display: grid;
    position: absolute;
    left: 19.285714%; /* (66.4 - 63.7) / 14 */
    top: 0;
    width: 61.428571%; /* 8.6 / 14 */
    aspect-ratio: 1;
    /* Normalize the historical .78/.16 weights to fill the available space. */
    grid-template-rows: minmax(0, 78fr) auto minmax(5px, 16fr);
    place-items: center;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon-label {
    width: auto;
    /* The historical .34rem label is wider than the phone's painted circle. */
    font-size: clamp(.25rem, .36vw, .4rem);
    line-height: 1;
    letter-spacing: 0;
    padding: 0;
    margin: 0;
  }
  body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__state-icon-label > span { display: block; }
}
/* Pre-advertising polish: same illustrated discovery language, scoped objects. */
body .road-ideas-hotspot::before { inset: -10%; background: radial-gradient(ellipse, rgba(255,244,188,.95), rgba(255,207,94,.7) 45%, transparent 74%); filter: blur(5px); }
body .miles-state-sheet__mixtape { filter: drop-shadow(0 0 9px rgba(255,216,125,.95)) drop-shadow(0 0 18px rgba(232,184,91,.65)); }
body .miles-remove-plan-tab span { opacity: 1; bottom: 0; background: #9c1737; color: #fff8eb; padding: 4px; font-size: .7rem; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector { max-width: 100%; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__menu { width: 100%; min-width: 0; left: 0; right: auto; max-height: min(26dvh, 176px); }
@media (min-width: 761px) and (max-width: 1180px) and (orientation: portrait) {
  body .miles-my-plans-workspace { left: auto; right: 18px; width: min(46%, 540px); min-width: min(370px, calc(100% - 36px)); }
}
@media (max-width: 760px) and (orientation: portrait) {
  body .miles-filing-drawer.is-open { height: 290px; min-height: 290px; }
  body .miles-scene:has(.miles-filing-drawer.is-open) { margin-bottom: 300px; }
  body .miles-filing-drawer.is-open .miles-drawer-index { top: 15%; right: -3%; gap: 2px; }
  body .miles-drawer-paging { bottom: 4%; left: 8%; right: 16%; }
}

body .miles-state-sheet:not([data-planner-mode="myPlans"]) > .miles-state-file-tab {
 display:grid;place-items:center;position:absolute;z-index:2;left:10%;top:7.3%;width:20%;height:4%;margin:0;
 background:#ead9b5;color:#17334c;font-size:clamp(7px,.85vw,13px);font-weight:800;letter-spacing:.02em;line-height:1;text-transform:uppercase;transform:rotate(-3deg);pointer-events:none;
}
body .miles-state-sheet[data-planner-mode="myPlans"] > .miles-state-file-tab {display:none;}

/* Reserve the red tab's column; menu stays below its own compact selector. */
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__header { width: 23%; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab { z-index: 70; }
body .miles-remove-plan-tab span { position: absolute; top: 0; bottom: auto; right: 0; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab span { opacity: 1; background: #9c1737; color: #fff8eb; padding: 4px; font-size: .65rem; }
@media (max-width: 760px) {
 body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__button { font-size: .62rem; gap: 2px; padding: 4px; }
 body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__label { white-space: nowrap; }
}
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__menu { width: max(100%, 128px); }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__option { min-height: 44px; overflow-wrap: anywhere; }

/* Owner physical corrections: paint/layout only; existing handlers and art retained. */
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__header h2 {
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
}
body .miles-state-sheet__mixtape::before { content:""; position:absolute; inset:-12%; z-index:-1; pointer-events:none; background:radial-gradient(ellipse,rgba(255,244,188,.95),rgba(255,207,94,.7) 45%,transparent 74%); filter:blur(5px); }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__button { min-height:44px; background:linear-gradient(transparent 8px,rgba(255,249,233,.4) 8px,rgba(255,249,233,.4) calc(100% - 8px),transparent calc(100% - 8px)); padding:2px 4px; line-height:1.1; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__menu { background:rgba(255,249,233,.95); }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-field { translate:0 4px; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab span { top:50%;right:0;left:0;transform:translateY(-50%);background:transparent;color:white;padding:0;font-size:.58rem;text-align:center;text-shadow:0 1px 2px #14243a; }
@media (max-width:760px) and (orientation:portrait) {
 body .miles-filing-drawer.is-open { height:194px;min-height:194px; }
 body .miles-scene:has(.miles-filing-drawer.is-open) { margin-bottom:220px; }
 body .miles-filing-drawer.is-open .miles-drawer-index { top:0;right:calc(-10.6667% - 38px);width:38px;gap:2px; }
 body .miles-filing-drawer.is-open .miles-drawer-index__tab { min-height:44px;padding:4px 2px; }
 body .miles-filing-drawer.is-open .miles-state-folder { left:calc(var(--folder-index) * 21%);bottom:calc(var(--folder-index) * 11%); }
 body .miles-filing-drawer.is-open .miles-drawer-paging { bottom:0; }
}

/* Final phone corrections: align to the existing drawer edge, not the selection. */
@media (max-width:760px) and (orientation:portrait) {
 body .miles-filing-drawer.is-open .miles-drawer-index__tab[aria-selected="true"] { transform:none; }
 body .miles-state-sheet[data-planner-mode="myPlans"] .miles-plan-state-selector__button {
  height:44px; min-height:44px; box-sizing:border-box; border-color:transparent; box-shadow:none;
  background:linear-gradient(transparent 12px,rgba(255,249,233,.55) 12px,rgba(255,249,233,.55) calc(100% - 12px),transparent calc(100% - 12px));
 }
 body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab span { font-size:.42rem; letter-spacing:0; line-height:1; white-space:nowrap; }
}

/* Center the smaller label inside the unchanged red-tab hit area. */
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab { left: 73%; }
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-remove-plan-tab span {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none;
  padding: 0;
  font-size: clamp(.42rem, .65vw, .5rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  pointer-events: none;
}

/* Only the opened briefing changes; the accepted State File stays untouched. */
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__photo-slot { z-index: 13; }
.miles-plan-photo-dialog { max-width: min(340px, calc(100vw - 32px)); padding: 20px; border: 2px solid #9d763d; border-radius: 6px; background: #fff7df; color: #17334c; }
.miles-plan-photo-dialog::backdrop { background: rgb(0 15 30 / 65%); }
.miles-plan-photo-dialog button { display: block; width: 100%; min-height: 44px; margin-top: 8px; }
.miles-plan-photo-error:not([hidden]) { position: absolute; z-index: 80; bottom: 0; left: 10%; width: 80%; padding: 8px; background: #fff7df; color: #7c1930; font-size: .875rem; }
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    position: fixed;
    inset: 68px auto auto 50%;
    width: min(calc(100vw - 24px), calc((100dvh - 84px) * 1448 / 1086));
    min-width: 0;
    max-width: 720px;
    height: auto;
    max-height: none;
    aspect-ratio: 1448 / 1086;
    transform: translateX(-50%);
    background-size: contain;
    z-index: 880;
  }
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__safe-area { inset: 19% 11% 8% 14%; width: auto; height: auto; }
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__state,
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet h2 { width: 100%; }
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__body { flex: 1; width: auto; min-height: 0; margin: 8px 0; font-size: 1rem; overscroll-behavior: contain; }
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__return { position: static; min-height: 44px; flex-shrink: 0; font-size: .875rem; }

/* Rotate only the image and its clip, leaving the printed frame fixed. */
body .miles-state-sheet[data-planner-mode="myPlans"] .miles-state-sheet__photo-slot img { transform: rotate(8deg); clip-path: inset(0); }

/* On tablets, place the Cabinet briefing on the opened file below the room. */
@media (min-width: 761px) and (max-width: 1280px) and (min-height: 601px) and (hover: none) and (pointer: coarse) {
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    position: absolute;
    inset: 26% auto auto 31%;
    width: 46%;
    min-width: 430px;
    max-width: 720px;
    transform: translate(0, -4%) rotate(.8deg);
  }
}
@media (min-width: 761px) and (max-width: 1280px) and (min-height: 601px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    top: calc(100% + 48px);
    left: 50%;
    width: min(calc(100% - 16px), 1000px);
    min-width: 0;
    max-width: none;
    transform: translateX(-50%);
  }
}

/* Keep both entry paths on the same folder stack at every supported size.
   Override the old viewport-fixed/mobile-stretch treatment, not the artwork. */
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
  position: absolute;
  inset: 26% auto auto 31%;
  width: 46%;
  min-width: 430px;
  max-width: 720px;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 1448 / 1086;
  background-size: contain;
  transform: translate(0, -4%) rotate(.8deg);
  z-index: 10;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__safe-area {
  inset: 19% 11% 6% 14%;
  width: auto;
  height: auto;
  min-height: 0;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__state {
  width: 100%;
  font-size: .625rem;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet h2 {
  width: 100%;
  margin-top: 4px;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__body {
  flex: 1 1 0;
  width: auto;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 6px 0;
  overflow: auto;
  font-size: 1rem;
  overscroll-behavior: contain;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__bridge {
  flex: 0 0 auto;
  margin: 2px 0;
  font-size: .75rem;
  line-height: 1.2;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet .miles-tip-detail-sheet__return {
  position: static;
  flex: 0 0 auto;
  min-height: 44px;
  margin-top: 4px;
  font-size: .875rem;
}
@media (max-width: 760px) {
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    inset: calc(100% + 14px) auto auto 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    transform: none;
  }
}
@media (max-width: 760px) and (orientation: portrait) {
  /* Preserve the accepted 365 x 274 file at 412 CSS px on real mobile
     viewports too; desktop emulation previously supplied a 15px scrollbar. */
  body .miles-state-sheet:not([data-planner-mode="myPlans"]),
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    width: min(100%, calc(100vw - 47px));
  }
  /* Cabinet's existing hint leaves its file 34px lower than Return Ticket.
     Follow that file without moving either accepted folder position. */
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet[data-planner-mode="stateStory"] ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    top: calc(100% + 48px);
  }
}
@media (max-width: 760px) and (max-height: 600px) and (orientation: landscape) {
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    width: min(100%, calc((100dvh - 80px) * 1448 / 1086));
  }
}
@media (min-width: 761px) and (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    width: min(46%, calc((100dvh - 80px) * 1448 / 1086));
    min-width: 0;
  }
}
@media (min-width: 761px) and (max-width: 1280px) and (orientation: portrait) {
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet],
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) ~ .miles-tip-detail-sheet[data-tip-detail-sheet].is-open {
    inset: calc(100% + 48px) auto auto 50%;
    width: min(calc(100% - 16px), 1000px);
    min-width: 0;
    max-width: none;
    transform: translateX(-50%);
  }
}

/* Compact paint inside a full-height tap target. Reserve a separate note row;
   long saved notes keep their existing internal scroll instead of growing. */
body .miles-state-sheet:not([data-planner-mode="myPlans"]) {
  --folder-actions-bottom: 5%;
  --folder-note-room: calc(100% - var(--folder-actions-bottom) - 44px - var(--dossier-notes-label-top, 58.5%) - 16px);
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__actions {
  top: auto;
  bottom: var(--folder-actions-bottom);
  height: 44px;
  gap: 8px;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__actions button {
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding: 2px 5px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: clamp(.625rem, .7vw, .75rem);
  line-height: 1.1;
  letter-spacing: .04em;
  white-space: normal;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__actions button::before {
  content: "";
  position: absolute;
  inset: 6px 0;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(73, 24, 38, .72);
  border-radius: 2px;
  background: linear-gradient(180deg, #bf0d3e, #7d0d2d);
  box-shadow: 0 2px 4px rgba(39, 14, 8, .16), inset 0 1px 0 rgba(255, 235, 208, .28);
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__actions .miles-state-sheet__file::before {
  border-color: rgba(89, 55, 22, .7);
  background: linear-gradient(180deg, #e3bb68, #a9712a);
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__actions .is-added::before {
  background: linear-gradient(180deg, #8b5b22, #593511);
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__story-readout {
  max-height: min(15.5%, var(--folder-note-room));
  overscroll-behavior: contain;
}
body .miles-state-sheet:not([data-planner-mode="myPlans"]) .miles-state-sheet__note textarea {
  top: calc(var(--dossier-notes-label-top, 58.5%) + 12px);
  min-height: 0;
  max-height: calc(var(--folder-note-room) - 12px);
}
@media (max-width: 380px) and (orientation: portrait) {
  body .miles-state-sheet:not([data-planner-mode="myPlans"]) {
    --dossier-notes-label-top: 55%;
    --folder-actions-bottom: 2%;
  }
}
