/* Above the toast stack (#toastRoot, z-index 95): when both are up at once the tutorial wins (the player's call, 1 November 2026). */
.campaign-guide { position: absolute; z-index: 96; top: calc(var(--chrome-top) + 54px); right: calc(12px + env(safe-area-inset-right, 0px)); width: 300px; pointer-events: none; display: flex; flex-direction: column; align-items: flex-end; }
.campaign-guide[hidden], .campaign-guide [hidden] { display: none; }
.guide-toggle, .guide-card { pointer-events: auto; }
.guide-toggle { margin: 0 0 8px; border: 1px solid #b99958; border-radius: 18px; padding: 7px 11px; background: #233336; color: #f3e4bd; font: 600 11px var(--font-body); cursor: pointer; box-shadow: 0 3px 10px #0004; }
.guide-toggle span { color: #e9c983; margin-left: 5px; }
.guide-toggle:focus-visible, .guide-card .btn:focus-visible { outline: 3px solid #ffe0a0; outline-offset: 3px; }
.guide-card { width: 100%; padding: 14px 16px 16px; box-sizing: border-box; background: var(--paper); color: var(--ink); border: 1px solid #b99958; border-radius: 12px; box-shadow: 0 8px 28px #0005; max-height: calc(100dvh - var(--chrome-top) - 250px); overflow-y: auto; }
.guide-card-head { display: flex; gap: 11px; align-items: center; }
.guide-icon { position: relative; flex: 0 0 42px; height: 42px; border-radius: 50%; border: 2px solid #c6a568; background: radial-gradient(circle at 35% 25%, #506063, #1b2d30 75%); color: #f0dab0; display: grid; place-items: center; }
.guide-icon svg { width: 26px; height: 26px; }
.guide-check { position: absolute; top: -5px; right: -6px; border-radius: 50%; width: 20px; height: 20px; background: #355442; border: 1px solid #b2d2a3; color: #fff; font: 700 13px/19px sans-serif; text-align: center; }
.guide-card h3 { font: 700 17px/1.3 var(--font-head); margin: 2px 0 0; }
.guide-card p { font-size: 12px; line-height: 1.55; margin: 10px 0 0; }
.guide-card .guide-note { color: var(--ink-soft); font-size: 11px; }
.guide-card .guide-reward { font-weight: 600; color: #4d6a3a; }
.guide-card .guide-done { font-weight: 600; color: #355442; }
.guide-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #775a2d; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.guide-skip { margin-left: auto; }
.guide-card.is-done { border-color: #8eae89; animation: guide-out .5s ease-in .9s both; }
.guide-card.is-done .guide-icon { border-color: #8eae89; color: #c9e0c2; }
.guide-card.is-entering { animation: guide-in .4s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes guide-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes guide-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(28px); } }
@media (prefers-reduced-motion: reduce) { .guide-card.is-entering, .guide-card.is-done { animation-duration: .01s; } }
@media (max-width: 700px) {
  .campaign-guide { right: calc(7px + env(safe-area-inset-right, 0px)); top: calc(var(--chrome-top) + 44px); width: min(280px, calc(100vw - 24px)); }
  .guide-toggle { font-size: 10px; padding: 6px 8px; }
  .guide-card { padding: 12px; }
}
.guide-toggle-task { display: block; max-width: 220px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff1d2; font-weight: 600; }
/* The ring blinks so the eye finds it. The colour and halo are animated through
   custom properties because a keyframe cannot override an !important outline. */
@property --guide-glow { syntax: '<color>'; inherits: false; initial-value: #f1bd49; }
@property --guide-halo { syntax: '<length>'; inherits: false; initial-value: 7px; }
@keyframes guide-blink { 50% { --guide-glow: #f1bd4920; --guide-halo: 0px; } }
.guide-target { outline: 3px solid var(--guide-glow) !important; outline-offset: 3px; box-shadow: 0 0 0 var(--guide-halo) #f1bd4955 !important; animation: guide-blink 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .guide-target { animation: none; } }
.campaign-guide.is-guiding-screen { top: 4px; z-index: 96; }
.is-guiding-screen .guide-card { max-height: none; padding: 8px 12px; }
.is-guiding-screen .guide-card-head, .is-guiding-screen .guide-reward, .is-guiding-screen .guide-note, .is-guiding-screen .guide-actions { display: none; }
.is-guiding-screen .guide-instruction { margin: 0; }
@media (max-width: 700px) {
  .guide-card { max-height: none; padding: 10px; }
  .guide-card .guide-reward, .guide-card .guide-note, .guide-card .guide-icon { display: none; }
  .guide-card h3 { font-size: 14px; }
  .guide-card .guide-actions { margin-top: 8px; }
  .guide-card .guide-actions .btn { min-height: 44px; }
}

/* The guide's pill measured 81x26 on a Pixel 7 — under the 40 px the browser
   gate asks of a thumb, and out-specified by nothing: it simply never had a
   touch floor. See the note at the foot of `campaign-panels.css`. */
@media (pointer: coarse) {
  .guide-toggle { min-height: 44px; }
}

/* --- Merged in from the "thorough tutorial" design (24 October 2026) --------- */
/* Briefings: their explanation, a second paragraph, and Next on the right. */
.guide-card .guide-text, .guide-card .guide-more { margin: 9px 0 0; font-size: 12.5px; line-height: 1.5; }
.guide-card .guide-more { color: var(--ink-soft); }
.guide-card kbd { font: 600 10px var(--font-body); padding: 0 4px; border: 1px solid #b99958; border-radius: 3px; background: #fff8e4; }
.guide-next { margin-left: auto; }

/* The ring over a town on the map. It blinks with the outline on a control
   (.guide-target above), so both read as the same "press here". Above the map
   and its panels (the campaign guide is 66), under the lobby (80); it takes no
   click, so the town under it is clicked through it. */
.guide-pointer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.guide-pointer[hidden] { display: none; }
.guide-ring { position: absolute; box-sizing: border-box; border: 3px solid var(--guide-glow); border-radius: 50%; box-shadow: 0 0 0 var(--guide-halo) #f1bd4955; animation: guide-blink 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .guide-ring { animation: none; } }

/* A card that does not fit sheds detail rather than scroll (`fit` in campaignGuide.js). */
.guide-card.is-tight .guide-more, .guide-card.is-tight .guide-note,
.guide-card.is-tighter .guide-more, .guide-card.is-tighter .guide-note, .guide-card.is-tighter .guide-reward,
.guide-card.is-tightest .guide-more, .guide-card.is-tightest .guide-note, .guide-card.is-tightest .guide-reward,
.guide-card.is-tightest .guide-text { display: none; }
.guide-card.is-tighter, .guide-card.is-tightest { padding: 10px 12px 12px; }
.guide-card.is-tighter p, .guide-card.is-tightest p { margin-top: 7px; font-size: 11px; line-height: 1.45; }
.guide-card.is-tighter .guide-actions, .guide-card.is-tightest .guide-actions { margin-top: 8px; }
.guide-card.is-tighter h3, .guide-card.is-tightest h3 { font-size: 15px; }

/* The tutorial opens upward from its button in the bottom-right corner. */
#campaignGuide.campaign-guide {
  top: auto;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: min(300px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--chrome-top) - 24px);
  flex-direction: column-reverse;
  gap: 8px;
}
#campaignGuide .guide-toggle { margin: 0; flex-shrink: 0; }
#campaignGuide .guide-card { flex: 0 1 auto; min-height: 0; max-height: calc(100dvh - var(--chrome-top) - 90px); }
#campaignGuide.is-guiding-screen { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 700px) {
  #campaignGuide.campaign-guide { right: calc(7px + env(safe-area-inset-right, 0px)); width: min(280px, calc(100vw - 24px)); }
}
/* **Above the open command bar on a narrow screen, not over it.** The bar's
   tabs are what the lessons ask for, and at 320x900 the card (x 33..313,
   y 525..738) lay on the province panel's Build tab (x 22..67, y 643..683):
   the lesson asked for a control its own Back button covered (18 November
   2026). `campaignGuide.js` (`liftAboveBar`) measures the bar and sets
   `--guide-lift`; it does so only when the band left above the bar can hold
   a card. */
@media (max-width: 700px) {
  #app:has(> #commandBar) > #campaignGuide.campaign-guide.is-lifted {
    bottom: var(--guide-lift);
    max-height: calc(100dvh - var(--chrome-top) - var(--guide-lift) - 8px);
  }
  #app:has(> #commandBar) > #campaignGuide.is-lifted .guide-card {
    max-height: calc(100dvh - var(--chrome-top) - var(--guide-lift) - 66px);
  }
}
