/* Explore: the world canvas and its HTML overlays. Sizes are screen px (960 x 540 desktop, 540 wide on phones). */
.explore { background: #05060d; overflow: hidden; }
.ex-world { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.ex-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--gold); }
.ex-loading b { font: 700 24px/1 var(--font); }
.ex-loading .bar { width: min(360px, 70%); height: 18px; padding: 3px; border: 3px solid var(--gold); background: #05060d; }
.ex-loading .bar i { display: block; width: 0; height: 100%; background: repeating-linear-gradient(90deg, var(--gold) 0 10px, #ffe58a 10px 12px); transition: width 0.15s steps(4); }
.ex-loading span { font: 700 16px/1 var(--font); color: var(--dim); }
.explore.ex-fade::after { content: ""; position: absolute; inset: 0; background: #000; animation: ex-fade 0.22s steps(4) forwards; pointer-events: none; z-index: 30; }
@keyframes ex-fade { from { opacity: 0; } to { opacity: 1; } }
.ex-x { position: absolute; right: 10px; top: 10px; z-index: 20; width: 40px; height: 40px; font: 700 20px/1 var(--font); color: #fff; background: #0009; border: 2px solid #fff6; }
.ex-x:hover { color: var(--gold); border-color: var(--gold); }

/* A prompt over whatever the player faces, and the cover card over project displays */
.ex-prompt { position: absolute; z-index: 10; transform: translate(-50%, -100%); pointer-events: none; animation: bob 0.6s steps(2) infinite; }
.ex-prompt b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #ff3b30; color: #fff; font: 700 16px/1 var(--font); border: 3px solid #fff; box-shadow: 0 3px 0 #000; }
.ex-preview { position: absolute; z-index: 11; transform: translate(-50%, calc(-100% - 40px)); display: grid; justify-items: center; gap: 2px; padding: 4px 6px 6px; border-width: 8px; pointer-events: none; }
.ex-preview img { width: 160px; height: 90px; image-rendering: pixelated; display: block; }
.ex-preview b { font: 700 12px/1.2 var(--font); color: var(--gold); max-width: 170px; text-align: center; }
.ex-preview span { font-size: 12px; color: var(--dim); }

/* Dialog box */
.ex-dialog { position: absolute; left: 24px; right: 24px; bottom: 16px; z-index: 25; min-height: 120px; max-height: 70%; overflow: auto; padding: 10px 16px 14px; font-size: 16px; line-height: 1.5; color: #fff; }
.ex-dialog .who { display: inline-block; margin-bottom: 6px; padding: 2px 8px; background: var(--gold); color: #000; font: 700 16px/1.2 var(--font); }
.ex-dialog .txt { margin: 0; min-height: 48px; white-space: pre-wrap; }
.ex-dialog .more { position: absolute; right: 14px; bottom: 6px; font-style: normal; color: var(--gold); animation: bob 0.5s steps(2) infinite; }
.ex-dialog .more[hidden] { display: none; }
.ex-dialog .pic { display: block; max-width: 100%; max-height: 300px; margin: 4px auto 8px; image-rendering: pixelated; }
.ex-dialog .choices { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.ex-dialog .choices button { padding: 6px 10px; font: 700 14px/1.2 var(--font); color: #fff; background: #0b0f24; border: 2px solid #2a3570; text-align: left; }
.ex-dialog .choices button.on { color: #000; background: var(--gold); border-color: #000; }
.ex-dialog .card { display: grid; gap: 4px; margin: 4px 0 6px; padding: 8px 10px; background: #f4ecd8; color: #1c1a2b; }
.ex-dialog .card b { font: 700 16px/1.2 var(--font); }
.ex-dialog .card a { color: #0b4fb3; }
.ex-dialog .ctrl { margin: 6px 0; padding: 6px 10px; background: #0b0f24; border: 2px solid #2a3570; color: var(--dim); font-size: 14px; }
.ex-dialog .ctrl b { color: var(--gold); font-weight: 400; }
.ex-dialog .ctrl .key { width: 18px; height: 18px; }

/* Toasts and notes */
.ex-toast { position: absolute; left: 50%; top: 56px; z-index: 28; transform: translateX(-50%); display: grid; justify-items: center; gap: 2px; padding: 6px 14px; animation: ex-drop 0.3s steps(5); text-align: center; }
.ex-toast small { font-size: 12px; color: var(--sky); } .ex-toast b { font: 700 18px/1.2 var(--font); color: var(--gold); } .ex-toast span { font-size: 14px; }
.ex-toast.out { opacity: 0; transition: opacity 0.4s steps(4); }
@keyframes ex-drop { from { transform: translate(-50%, -40px); } }
.ex-note { position: absolute; left: 50%; top: 60px; z-index: 27; transform: translateX(-50%); padding: 6px 12px; background: #000c; color: var(--gold); font-size: 16px; white-space: nowrap; }

/* Destination drawer */
.ex-drawer { position: absolute; left: 50%; top: 0; z-index: 22; transform: translateX(-50%); display: grid; justify-items: center; }
.ex-drawer .tab { padding: 4px 14px 6px; font: 700 14px/1 var(--font); color: #000; background: var(--gold); border: 2px solid #000; border-top: 0; }
.ex-drawer { max-height: 100%; grid-template-rows: minmax(0, auto) auto; }
.ex-drawer .list { display: none; grid-template-columns: 1fr 1fr; gap: 4px 8px; padding: 8px; min-height: 0; overflow-y: auto; position: relative; } /* scrolls, so its close tab always stays on screen */
.ex-drawer.open .list { display: grid; }
.ex-drawer .list button { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font: 700 14px/1.2 var(--font); color: #fff; text-align: left; border: 2px solid transparent; }
.ex-drawer .list button img { flex: none; width: 48px; height: 36px; object-fit: contain; object-position: bottom; image-rendering: pixelated; }
.ex-drawer .list button span { display: grid; gap: 2px; }
.ex-drawer .list button small { font: 400 11px/1.25 var(--font); color: var(--dim); }
.ex-drawer .list button.clear { grid-column: 1 / -1; justify-content: center; }
.ex-drawer .list button.on, .ex-drawer .list button:hover { color: var(--gold); border-color: var(--gold); background: #1c2a6b; }

/* Look picker */
.ex-picker { position: absolute; inset: 40px 50px; z-index: 26; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 14px 18px; }
.ex-picker h2 { margin: 0; font: 700 24px/1.1 var(--font); color: var(--gold); }
.pk-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; width: 100%; max-width: 640px; }
.pk-row button { padding: 8px 4px; background: #0f1640; border: 3px solid #2a3570; cursor: pointer; }
.pk-row button.on, .pk-row button:hover { border-color: var(--gold); background: #1c2a6b; }
.pk-row canvas { display: block; width: 50%; margin: 0 auto; height: auto; aspect-ratio: 1 / 2; image-rendering: pixelated; }
.pk-hint { margin: 0; font: 700 14px/1 var(--font); color: var(--dim); }
.tall .ex-picker { inset: 12px; } .tall .pk-row { grid-template-columns: repeat(3, 1fr); } .tall .ex-picker h2 { font-size: 28px; } .tall .pk-hint { font-size: 20px; }

/* ME screen */
.ex-creator, .ex-me { position: absolute; inset: 24px 60px; z-index: 26; display: flex; flex-direction: column; gap: 10px; padding: 12px 18px; overflow: auto; }
.ex-creator h2, .ex-me h2 { margin: 0; font: 700 24px/1.1 var(--font); color: var(--gold); text-align: center; }
.cc-body, .me-body { display: flex; gap: 24px; align-items: center; justify-content: center; flex: 1; min-height: 0; }
.cc-pic { width: 96px; height: 192px; image-rendering: pixelated; background: radial-gradient(#2a3570, #0b0f24); border: 2px solid #2a3570; flex: none; }
.cc-rows { display: grid; gap: 6px; }
.cc-row { display: grid; grid-template-columns: 100px 32px 70px 32px; align-items: center; gap: 6px; padding: 2px 6px; border: 2px solid transparent; font-size: 16px; }
.cc-row.on, .ex-creator .cc-btns button.on { border-color: var(--gold); }
.cc-row button { height: 28px; color: var(--gold); background: #0b0f24; border: 2px solid #2a3570; }
.cc-row b { text-align: center; font-weight: 400; }
.cc-name { grid-template-columns: 100px 1fr; }
.cc-name input { font: 700 16px/1 var(--font); padding: 6px 8px; background: #f4ecd8; color: #1c1a2b; border: 2px solid #000; text-transform: uppercase; width: 100%; }
.cc-btns { display: flex; justify-content: center; gap: 16px; }
.cc-btns button, .ex-me .ok { padding: 8px 16px; font: 700 16px/1 var(--font); color: #fff; background: #1c2a6b; border: 2px solid #2a3570; }
.cc-btns .ok { background: var(--gold); color: #000; }
.ex-me dl { display: grid; grid-template-columns: auto auto; gap: 6px 16px; margin: 0; font-size: 16px; }
.ex-me dt { color: var(--sky); } .ex-me dd { margin: 0; color: var(--gold); }
.ex-me .ach { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; overflow: auto; max-height: 140px; }
.ex-me .ach li { display: grid; font-size: 12px; color: var(--dim); } .ex-me .ach li b { font: 700 14px/1.2 var(--font); }
.ex-me .ach li.got b { color: var(--gold); } .ex-me .ok { align-self: center; }

/* Typewriter */
.ex-typewriter { position: absolute; inset: 16px 70px; z-index: 27; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: ex-up 0.35s steps(7); }
@keyframes ex-up { from { transform: translateY(110%); } }
.ex-typewriter .desk { position: relative; width: 100%; flex: 1; min-height: 0; display: grid; place-items: center; }
.ex-typewriter .paper { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 16px 22px; background: #f7f1df; color: #24203a; box-shadow: 0 0 0 4px #c9bfa3, 6px 6px 0 #0008; font: 700 22px/1.45 "Courier New", Courier, monospace; transform-origin: 50% 50%; }
.ex-typewriter .paper p { margin: 0; color: #5a2a1e; }
.ex-typewriter textarea { flex: 1; min-height: 60px; resize: none; border: 0; padding: 0; background: repeating-linear-gradient(transparent 0 calc(1.45em - 2px), #d8cfb5 calc(1.45em - 2px) 1.45em); background-attachment: local; font: inherit; line-height: 1.45; color: #24203a; outline: none; }
.ex-typewriter textarea::placeholder, .ex-typewriter input::placeholder { color: #8a8270; }
.ex-typewriter label { display: grid; gap: 6px; font: 700 14px/1.2 var(--font); color: #5a5470; }
.ex-typewriter input { font: 700 20px/1.2 "Courier New", Courier, monospace; color: #24203a; padding: 6px 8px; border: 2px solid #24203a; background: #fff; }
.ex-typewriter .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ex-typewriter .machine { display: flex; gap: 16px; padding: 10px 24px; background: linear-gradient(#3a3550, #1c1a2b); border: 3px solid #000; box-shadow: 0 4px 0 #000; }
.ex-typewriter .machine button { padding: 10px 20px; font: 700 18px/1 var(--font); color: #000; background: var(--gold); border: 2px solid #000; }
.ex-typewriter .machine .cancel { background: #c9c3d8; }
.ex-typewriter .status { margin: 0; padding: 8px 14px; font: 700 18px/1.2 var(--font); color: #fff; background: #0b0f24e6; border: 2px solid var(--gold); text-align: center; }
.ex-typewriter .status[hidden] { display: none; }
/* sending, one step per status line: 1 the paper folds into thirds, 2 it is in the envelope, 3 stamped, 4 off it goes */
.ex-typewriter .envelope { position: relative; width: 240px; height: 150px; background: #efe4c4; border: 4px solid #24203a; box-shadow: 6px 6px 0 #0008; opacity: 0; transform: scale(0.6); }
.ex-typewriter .envelope .flap { position: absolute; left: 0; top: 0; width: 0; height: 0; border-left: 116px solid transparent; border-right: 116px solid transparent; border-top: 78px solid #d9caa0; }
.ex-typewriter .envelope .flap::after { content: ""; position: absolute; left: -116px; top: -78px; width: 232px; height: 78px; background: linear-gradient(to bottom right, transparent calc(50% - 2px), #24203a calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) left / 50% 100% no-repeat, linear-gradient(to bottom left, transparent calc(50% - 2px), #24203a calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) right / 50% 100% no-repeat; }
.ex-typewriter .envelope .stamp { position: absolute; right: 12px; top: 12px; width: 40px; height: 48px; background: #d23b3b; border: 3px dotted #f7f1df; outline: 3px solid #d23b3b; opacity: 0; transform: scale(2); }
.ex-typewriter .paper > * { transition: opacity 0.2s steps(2); }
.ex-typewriter[data-step] .paper > * { opacity: 0; }
.ex-typewriter[data-step] .paper { transition: transform 0.5s steps(4), opacity 0.3s steps(2) 0.45s; transform: scaleY(0.34); }
.ex-typewriter[data-step="2"] .paper, .ex-typewriter[data-step="3"] .paper, .ex-typewriter[data-step="4"] .paper { transform: scale(0.3, 0.12); opacity: 0; }
.ex-typewriter[data-step="2"] .envelope, .ex-typewriter[data-step="3"] .envelope { opacity: 1; transform: none; transition: transform 0.3s steps(3), opacity 0.2s steps(2); }
.ex-typewriter[data-step="3"] .stamp, .ex-typewriter[data-step="4"] .stamp { opacity: 1; transform: rotate(-8deg); transition: transform 0.2s steps(2), opacity 0.1s; }
.ex-typewriter[data-step="4"] .envelope { opacity: 0; transform: translate(260px, -220px) rotate(18deg) scale(0.4); transition: transform 0.7s steps(6), opacity 0.3s steps(2) 0.4s; }
.ex-typewriter[data-step] .machine { visibility: hidden; }

/* Phones: the 540 px screen is shown at about half size, so everything runs larger. */
.tall .ex-x { width: 56px; height: 56px; font-size: 28px; }
.tall .ex-prompt b { width: 40px; height: 40px; font-size: 22px; }
.tall .ex-preview img { width: 240px; height: 135px; } .tall .ex-preview b { font-size: 18px; max-width: 250px; } .tall .ex-preview span { font-size: 16px; }
.tall .ex-dialog { left: 12px; right: 12px; bottom: 12px; font-size: 24px; min-height: 180px; max-height: calc(100% - 76px); } /* stays below the GO TO tab */
.tall .ex-dialog .who { font-size: 22px; } .tall .ex-dialog .choices { gap: 6px; } .tall .ex-dialog .choices button { font-size: 18px; padding: 8px 12px; } .tall .ex-dialog .ctrl { font-size: 20px; }
.tall .ex-toast b { font-size: 24px; } .tall .ex-toast span { font-size: 20px; } .tall .ex-note { font-size: 22px; }
.tall .ex-drawer .tab { font-size: 22px; padding: 8px 18px 10px; } .tall .ex-drawer .list { grid-template-columns: 1fr; } .tall .ex-drawer .list button { font-size: 22px; padding: 10px 14px; } .tall .ex-drawer .list button small { font-size: 16px; } .tall .ex-drawer .list button img { width: 64px; height: 48px; }
.tall .ex-creator, .tall .ex-me { inset: 12px; }
.tall .cc-body { flex-direction: column; gap: 12px; } .tall .cc-pic { width: 112px; height: 224px; }
.tall .cc-row { grid-template-columns: 130px 48px 1fr 48px; font-size: 22px; } .tall .cc-row button { height: 44px; font-size: 20px; }
.tall .cc-name { grid-template-columns: 130px 1fr; } .tall .cc-name input { font-size: 22px; }
.tall .cc-btns button, .tall .ex-me .ok { font-size: 22px; padding: 12px 18px; }
/* phones: the panel scrolls as one column; nothing inside shrinks or overlaps */
.tall .ex-me { gap: 14px; } .tall .ex-me > * { flex: none; }
.tall .ex-me .me-body { flex: none; gap: 16px; } .tall .ex-me .cc-pic { width: 80px; height: 160px; }
.tall .ex-me dl { font-size: 18px; gap: 10px 14px; } .tall .ex-me .ach li { font-size: 18px; } .tall .ex-me .ach { grid-template-columns: 1fr; gap: 10px; max-height: none; overflow: visible; }
.tall .ex-typewriter { inset: 12px; } .tall .ex-typewriter .paper { font-size: 30px; padding: 18px 20px; } .tall .ex-typewriter label { font-size: 20px; } .tall .ex-typewriter input { font-size: 28px; }
.tall .ex-typewriter .machine button { font-size: 24px; padding: 14px 24px; } .tall .ex-typewriter .status { font-size: 24px; } .tall .ex-typewriter .envelope { width: 300px; height: 190px; }
@media (prefers-reduced-motion: reduce) { .ex-prompt, .ex-dialog .more, .ex-toast, .ex-typewriter { animation: none; } }
/* the cards set display, so [hidden] needs restating or they never hide */
.ex-preview[hidden], .ex-prompt[hidden], .ex-dialog .more[hidden] { display: none; }
