/* doodle.css — hand-drawn UI for Doodle Flyer (menus, cards, buttons, overlays). */
:root {
  --paper: #f3ead6;
  --paper-light: #f8f2e2;
  --ink: #2a2622;
  --pencil: #6d665c;
  --yellow: #f7d54a;
  --orange: #f08a2e;
  --red: #d8432b;
  --green: #8aa65e;
  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --hand: 'Patrick Hand', 'Comic Sans MS', 'Segoe Print', cursive;
  --marker: 'Permanent Marker', 'Patrick Hand', 'Comic Sans MS', cursive;
}

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--hand); font-size: 20px; }
* { box-sizing: border-box; }

#wf-loader {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--paper) repeating-linear-gradient(0deg, transparent 0 35px, rgba(120, 140, 170, 0.14) 35px 36px);
  font-family: var(--marker); font-size: 42px; color: var(--ink); z-index: 50;
}
#wf-loader .pencil { width: 120px; height: 10px; border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; }
#wf-loader .pencil i { display: block; height: 100%; width: 40%; background: var(--yellow); animation: fill 1.4s ease-in-out infinite alternate; }
@keyframes fill { from { width: 10%; } to { width: 95%; } }
#wf-loader.hidden { display: none; }

.wf { position: fixed; inset: 0; overflow: hidden; }
.montage { width: 100%; height: 100%; display: block; cursor: pointer; }

.paper-bg {
  position: absolute; inset: 0;
  background: var(--paper) repeating-linear-gradient(0deg, transparent 0 35px, rgba(120, 140, 170, 0.14) 35px 36px);
}
.paper-bg::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(60, 40, 20, 0) 55%, rgba(60, 40, 20, 0.18) 100%);
}

.card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-0.6deg);
  width: min(94vw, 880px); max-height: 94vh; overflow: auto;
  background: var(--paper-light); padding: 26px 40px 30px;
  border: 3px solid var(--ink); border-radius: var(--wobble);
  box-shadow: 9px 9px 0 rgba(42, 38, 34, 0.22), 0 0 0 6px rgba(255, 255, 255, 0.35);
}
.card::before {
  content: ''; position: absolute; inset: 6px; pointer-events: none;
  border: 1.5px solid rgba(42, 38, 34, 0.45); border-radius: 225px 25px 255px 25px / 25px 255px 25px 225px;
}
.card h1.title {
  font-family: var(--marker); font-size: 46px; margin: 0 0 8px; color: var(--red);
  text-shadow: 3px 3px 0 var(--ink); transform: rotate(-1.2deg); letter-spacing: 1px;
}
.card h2 { font-family: var(--marker); font-size: 26px; margin: 18px 0 6px; color: var(--ink); }
.card p { margin: 6px 0; line-height: 1.35; }
.muted { color: var(--pencil); }

.doodle-btn {
  font-family: var(--marker); font-size: 22px; color: var(--ink);
  background: var(--yellow); border: 3px solid var(--ink); border-radius: var(--wobble);
  padding: 10px 24px; cursor: pointer; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s ease-out, background .1s; transform: rotate(-0.5deg);
}
.doodle-btn:hover { transform: rotate(-1.5deg) scale(1.05); background: #ffe27a; }
.doodle-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.doodle-btn.go { font-size: 30px; background: var(--orange); padding: 12px 40px; }
.doodle-btn.go:hover { background: #ffa04e; }
.doodle-btn.link { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline wavy var(--red); font-size: 20px; }
.doodle-btn.link:hover { background: transparent; }

.diff-row { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 10px 0 6px; }
.diff-row .doodle-btn { display: flex; flex-direction: column; align-items: center; min-width: 190px; background: #fff; padding: 12px 14px; }
.diff-row .doodle-btn:nth-child(2) { transform: rotate(0.8deg); }
.diff-row .doodle-btn:nth-child(3) { transform: rotate(-1.1deg); }
.diff-row .doodle-btn.selected { background: var(--yellow); transform: scale(1.08) rotate(-1deg); box-shadow: 6px 6px 0 var(--ink); }
.diff-row .big { font-size: 28px; }
.diff-row .small { font-family: var(--hand); font-size: 19px; }
.diff-row .best { font-family: var(--hand); font-size: 16px; color: var(--pencil); margin-top: 4px; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2px 26px; font-size: 19px; margin: 4px 0 14px; }
.controls div { display: flex; justify-content: space-between; border-bottom: 1.5px dashed rgba(42, 38, 34, 0.35); padding: 2px 0; }
.controls b { font-family: var(--marker); font-weight: normal; color: var(--red); font-size: 17px; }

.actions { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; }

.game-host { position: absolute; inset: 0; background: var(--paper); }
.game-canvas, .hud-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game-canvas { cursor: none; }
.hud-canvas { pointer-events: none; }

.overlay { position: absolute; inset: 0; background: rgba(243, 234, 214, 0.5); }
.overlay .card { text-align: center; width: min(92vw, 560px); }
.overlay .card.debrief { width: min(94vw, 760px); }

.score-big { font-family: var(--marker); font-size: 72px; line-height: 1; color: var(--ink); text-shadow: 4px 4px 0 var(--yellow); margin: 6px 0; }
.stat-row { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin: 8px 0 4px; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 90px; }
.stat .n { font-family: var(--marker); font-size: 30px; }
.stat .l { font-size: 17px; color: var(--pencil); }
.stamp {
  display: inline-block; border: 4px solid var(--red); color: var(--red); font-family: var(--marker);
  padding: 2px 16px; transform: rotate(-7deg); font-size: 30px; border-radius: 8px; margin: 6px 0;
  box-shadow: inset 0 0 0 2px var(--paper-light), inset 0 0 0 4px var(--red); animation: stampIn .35s cubic-bezier(.2, 1.6, .5, 1) both;
}
@keyframes stampIn { from { transform: rotate(-20deg) scale(2.2); opacity: 0; } to { transform: rotate(-7deg) scale(1); opacity: 1; } }

.scores { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.scores ol { padding-left: 26px; margin: 4px 0; min-width: 160px; }
.scores li { font-size: 18px; }
.scores h3 { font-family: var(--marker); font-weight: normal; margin: 6px 0 2px; font-size: 20px; }

/* ---- missions screen */
.missions { position: absolute; inset: 0; overflow: auto; padding: 18px 28px 30px; text-align: center; }
.missions h1.title {
  font-family: var(--marker); font-size: 54px; margin: 4px 0 0; color: var(--red); text-shadow: 3px 3px 0 var(--ink); transform: rotate(-1deg); display: inline-block;
}
.missions .sub { margin: 0 0 12px; font-size: 20px; }
.mission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px 20px; max-width: 1700px; margin: 0 auto; }
.mission-card {
  position: relative; background: var(--paper-light); border: 3px solid var(--ink); border-radius: var(--wobble);
  box-shadow: 7px 7px 0 rgba(42, 38, 34, 0.25); padding: 10px 12px 12px; cursor: pointer; text-align: left;
  transition: transform .1s ease-out, box-shadow .1s;
}
.mission-card:hover { transform: scale(1.04) rotate(0deg) !important; box-shadow: 10px 10px 0 rgba(42, 38, 34, 0.3); background: #fff8e4; }
.mission-card canvas.mission-art { display: block; width: 100%; aspect-ratio: 16 / 10; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper); }
.mission-card .mc-title { font-family: var(--marker); font-size: 22px; margin-top: 8px; color: var(--ink); }
.mission-card .mc-title .num { display: inline-block; background: var(--yellow); border: 2px solid var(--ink); border-radius: 50%; width: 30px; height: 30px; line-height: 26px; text-align: center; font-size: 18px; margin-right: 4px; }
.mission-card .mc-tag { font-size: 17px; color: var(--pencil); line-height: 1.2; min-height: 40px; }
.mission-card .mc-stamps { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.mission-card .mc-stamps span { font-size: 14px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 0 8px; background: #fff; transform: rotate(-1deg); }
.mission-card .mc-stamps span:nth-child(2n) { transform: rotate(1.2deg); background: var(--yellow); }
.mission-card .mc-best { font-size: 15px; color: var(--pencil); }
.mission-card .stamp.small { position: absolute; right: 14px; top: 14px; font-size: 22px; padding: 0 10px; border-width: 3px; background: rgba(248, 242, 226, 0.85); transform: rotate(-14deg); }

/* keyboard-and-mouse notice pinned in the missions screen's top-right corner (clear of the cards): a sticky note that
   rocks gently, with an arrow nudging at it. Below 1100 px it drops into the flow under the subtitle instead. */
.kbm-note-row { position: absolute; top: 14px; right: 18px; z-index: 6; display: flex; align-items: center; gap: 6px; margin: 0; pointer-events: none; }
.kbm-note {
  display: inline-flex; align-items: center; gap: 10px; max-width: 330px; padding: 5px 12px 6px; text-align: left;
  background: #fff6c4; border: 2.5px solid var(--ink); border-radius: var(--wobble); box-shadow: 4px 4px 0 rgba(42, 38, 34, 0.22);
  font-size: 17px; line-height: 1.25; color: var(--ink); transform: rotate(-1.2deg); animation: kbmRock 3.2s ease-in-out infinite;
}
.kbm-note b { font-family: var(--marker); font-weight: normal; color: var(--red); }
.kbm-icon { flex: 0 0 auto; width: 50px; height: 27px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.kbm-arrow { flex: 0 0 auto; display: inline-block; width: 60px; height: 38px; }
.kbm-arrow svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--red); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.kbm-arrow.left { animation: kbmNudgeL 1.1s ease-in-out infinite; }
@keyframes kbmRock { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(0.4deg) scale(1.015); } }
@keyframes kbmNudgeL { 0%, 100% { transform: translateX(-4px) rotate(-4deg); } 50% { transform: translateX(5px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .kbm-note, .kbm-arrow.left { animation: none; } }
@media (max-width: 1100px) { .kbm-note-row { position: static; justify-content: center; margin: 0 0 16px; } .kbm-note { max-width: 560px; } }
@media (max-width: 700px) { .kbm-note { font-size: 15px; } .kbm-icon { display: none; } .kbm-arrow { width: 30px; height: 19px; } }

/* ---- briefing extras */
.card .meta { margin: -4px 0 10px; font-size: 18px; }
.orders { margin: 4px 0 8px; padding-left: 28px; }
.orders li { margin: 2px 0; }
.orders li.optional { color: var(--pencil); }
.aircraft { display: flex; gap: 18px; align-items: stretch; flex-wrap: wrap; margin: 6px 0 8px; }
.aircraft canvas.aircraft-art { width: 300px; height: 160px; border: 2.5px solid var(--ink); border-radius: var(--wobble); background: var(--paper); flex: 0 0 auto; }
.aircraft .ac-info { flex: 1 1 280px; }
.aircraft .ac-name { font-family: var(--marker); font-size: 24px; }
.aircraft p { margin: 2px 0 6px; font-size: 18px; }
.stat-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
.stat-bar { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.stat-bar span { width: 82px; color: var(--pencil); }
.stat-bar i { flex: 1; height: 12px; border: 2px solid var(--ink); border-radius: 6px 10px 8px 12px; background: #fff; overflow: hidden; }
.stat-bar b { display: block; height: 100%; background: var(--green); }
.loadout { font-family: var(--marker); font-size: 17px; color: var(--red); margin-top: 6px; }
.repair { background: rgba(247, 213, 74, 0.35); border: 1.5px dashed var(--ink); border-radius: 10px; padding: 4px 10px; font-size: 18px; }

/* ---- debrief extras */
.stamp.green { border-color: var(--green); color: var(--green); box-shadow: inset 0 0 0 2px var(--paper-light), inset 0 0 0 4px var(--green); }
.obj-list { list-style: none; padding: 0; margin: 8px auto 4px; text-align: left; display: inline-block; }
.obj-list li { font-size: 19px; }
.obj-list li b { display: inline-block; width: 26px; font-family: var(--marker); }
.obj-list li.done b { color: var(--green); }
.obj-list li.failed b { color: var(--red); }
.obj-list li.optional { color: var(--pencil); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--yellow); border-top: 3px solid var(--ink); padding: 10px 20px; font-family: var(--hand); z-index: 100; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }

@media (max-width: 700px) {
  html, body { font-size: 17px; }
  .card { padding: 18px 18px 22px; }
  .card h1.title { font-size: 34px; }
  .score-big { font-size: 56px; }
}

/* corner link on the missions screen to the experimental bonus levels (Descent): a lab-specimen label, readable but low-key */
.descent-link { position: relative; display: flex; flex-direction: column; gap: 2px; width: fit-content; margin: 28px auto 16px; padding: 6px 12px 7px; text-decoration: none; color: #2f3a33; background: rgba(243, 240, 228, .88); border: 1.5px dashed #4a6a5a; border-left: 6px solid #4a6a5a; font-family: 'Courier New', ui-monospace, monospace; transition: background .2s, transform .2s, border-color .2s; }
.descent-link .dl-tag { font-size: 10px; letter-spacing: .14em; color: #a0481c; font-weight: 700; }
.descent-link .dl-name { font-size: 14px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.descent-link:hover, .descent-link:focus-visible { background: #fffdf2; border-color: #a0481c; transform: translateY(-2px); }

/* ---- title screen: "View the trailer" button + the trailer popup.
   The button sits in the montage's own 1600x900 layout (it is letterboxed like the canvas: --u = one layout px), in the
   bottom-left corner under the BAIL OUT panel, lined up with its left edge, clear of the blinking CLICK TO FLY.
   On tall/portrait screens it drops below the montage, centred. */
.trailer-spot {
  --u: min(calc(100vw / 1600), calc(100vh / 900));
  position: absolute; left: calc(50% - 750 * var(--u)); top: calc(50% + 412 * var(--u)); transform: translateY(-50%); z-index: 2;
}
.trailer-btn {
  display: inline-flex; align-items: center; gap: .4em; white-space: nowrap;
  font-size: max(13px, calc(22 * var(--u))); padding: .2em .9em .2em .35em; box-shadow: .16em .16em 0 var(--ink);
}
.trailer-btn .tb-play { width: 1.55em; height: 1.55em; flex: 0 0 auto; overflow: visible; animation: tbNudge 2.6s ease-in-out infinite; }
.trailer-btn .tb-play .c { fill: var(--red); stroke: var(--ink); stroke-width: 2.6; }
.trailer-btn .tb-play .t { fill: #fff; stroke: var(--ink); stroke-width: 2.2; stroke-linejoin: round; }
.trailer-btn:focus-visible { outline: 3px dashed var(--red); outline-offset: 5px; }
@keyframes tbNudge { 0%, 70%, 100% { transform: scale(1) rotate(0); } 78% { transform: scale(1.18) rotate(-8deg); } 86% { transform: scale(.96) rotate(5deg); } }
@media (max-aspect-ratio: 1/1) { .trailer-spot { left: 50%; top: calc(50% + 450 * var(--u) + 46px); transform: translate(-50%, -50%); } .trailer-btn { font-size: 20px; } }

.trailer-pop {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 3vmin;
  background: rgba(42, 38, 34, 0.74); cursor: pointer; animation: tpFade .18s ease-out;
}
.trailer-card {
  position: relative; cursor: default; width: min(94vw, calc((94vh - 26px) * 16 / 9 + 26px)); padding: 10px;
  background: var(--paper-light); border: 3px solid var(--ink); border-radius: 18px 8px 16px 10px / 10px 16px 8px 18px;
  box-shadow: 9px 9px 0 rgba(0, 0, 0, 0.35); transform: rotate(-0.4deg); animation: tpPop .28s cubic-bezier(.2, 1.4, .5, 1) both;
}
.trailer-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; }
.trailer-card video:focus { outline: none; }
.trailer-close {
  position: absolute; top: -20px; right: -16px; width: 46px; height: 46px; padding: 0 0 3px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--yellow); color: var(--ink); font-family: var(--marker); font-size: 30px; line-height: 1;
  cursor: pointer; box-shadow: 3px 3px 0 var(--ink); transform: rotate(6deg); transition: transform .08s ease-out, background .1s;
}
.trailer-close:hover { background: #ffe27a; transform: rotate(-6deg) scale(1.08); }
.trailer-close:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.trailer-close:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }
@keyframes tpFade { from { opacity: 0; } }
@keyframes tpPop { from { transform: rotate(-3deg) scale(.85); opacity: 0; } }
@media (max-width: 700px) { .trailer-close { top: -18px; right: -6px; width: 40px; height: 40px; font-size: 26px; } }
@media (prefers-reduced-motion: reduce) { .trailer-btn .tb-play, .trailer-pop, .trailer-card { animation: none; } }
