/* =====================================================================
   map-game.css – the map game "Hvor ligger det?" (flagg-kart.html)
   ---------------------------------------------------------------------
   The buttons, score bar, packs and end screen come from game.css;
   this file adds:
     1. The question (flag + "Where is Kenya?")
     2. The map: sea, land, small-country dots, right / almost / wrong
     3. Zoom buttons and + / −
     4. The answer box ("Right!", "Almost!", "Wrong")
     5. Phones
     6. Learn the map: the two modes, flag pins, the country card,
        hints and peeks, the lit-up region
     7. A big look at the flag (tap a small flag)
   ===================================================================== */


/* ---------- 1. The question ---------- */
.ask { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 16px auto 12px; }
.ask img { width: 120px; height: auto; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.ask p { margin: 0; font-size: 1.15rem; line-height: 1.3; color: var(--dark); text-align: left; }
.ask p strong { font-size: 1.5rem; }
.ask.enter { animation: dropIn .45s cubic-bezier(.3, 1.4, .5, 1); }


/* ---------- 2. The map ---------- */
.map-box { position: relative; height: min(62vh, 520px); border-radius: 18px; overflow: hidden; background: #cbe4f3; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.world { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.world.dragging { cursor: grabbing; }
.world .sea { fill: url(#seaFade); }
/* --unit is set by js/map-game.js: one screen pixel in map units, so lines keep the same width at every zoom */
.world .latitudes path { fill: none; stroke: rgba(255, 255, 255, .6); stroke-width: calc(var(--unit, 1) * 1px); }
.world .latitudes .equator { stroke: rgba(255, 255, 255, .95); stroke-dasharray: calc(var(--unit, 1) * 6px) calc(var(--unit, 1) * 4px); }
.world .coast path { fill: none; stroke: #a9cfe6; stroke-width: calc(var(--unit, 1) * 5px); stroke-linejoin: round; }
.world .other path { fill: #ecebe6; stroke: rgba(40, 50, 40, .3); stroke-width: calc(var(--unit, 1) * .8px); }
/* each country's colour comes from js/map-game.js (--land): its continent's colour, a shade unlike its neighbours */
.world .lands path { fill: var(--land, #a8d5a2); stroke: rgba(40, 50, 40, .5); stroke-width: calc(var(--unit, 1) * .8px); stroke-linejoin: round; transition: fill .25s ease, filter .2s ease; }
.world .dots circle { fill: #f08a3c; stroke: #fff; stroke-width: calc(var(--unit, 1) * 1.5px); }
@media (hover: hover) {
	.world .lands path:hover { filter: brightness(.9) saturate(1.15); }
	.world .dots circle:hover { fill: #d86d1f; }
}
/* names of continents and oceans on the world view; they fade away when you zoom in */
.world .labels { pointer-events: none; transition: opacity .4s ease; }
.world.zoomed-in .labels { opacity: 0; }
.world .label-continent { font-size: calc(var(--unit, 1) * 11px); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; fill: rgba(33, 37, 41, .5); text-anchor: middle; paint-order: stroke; stroke: rgba(255, 255, 255, .5); stroke-width: calc(var(--unit, 1) * 2px); }
.world .label-ocean { font-size: calc(var(--unit, 1) * 10px); font-style: italic; letter-spacing: .08em; fill: rgba(40, 90, 130, .55); text-anchor: middle; }
/* the answer */
.world .is-right { fill: #1a9e4b !important; stroke: #0d5c2b; stroke-width: calc(var(--unit, 1) * 1.6px); }
.world .is-almost { fill: #f5b100 !important; }
.world .is-wrong { fill: #e63946 !important; stroke: #8f1520; stroke-width: calc(var(--unit, 1) * 1.6px); }
/* the right country flashes after a mistake */
.world .show-me { animation: showMe 1s ease-in-out infinite; }
@keyframes showMe { 0%, 100% { fill: #1a9e4b; } 50% { fill: #7fe0a3; } }
.world .ring { fill: none; stroke: #1a9e4b; stroke-width: calc(var(--unit, 1) * 3px); opacity: 0; pointer-events: none; }
.world .ring.on { opacity: 1; animation: ringPulse 1.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ringPulse { 0% { opacity: 1; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.6); } }


/* ---------- 3. Zoom buttons and + / − ---------- */
.zoom-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0 0; }
.zoom-buttons button {
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 99px;
	background: #fff;
	color: var(--dark);
	font: inherit;
	font-size: .8rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color .2s ease, background .2s ease;
}
.zoom-buttons button:hover { border-color: var(--primary); }
.zoom-buttons button:focus-visible, .zoom-plus button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.zoom-plus { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom-plus button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #fff; color: var(--dark); font-size: 1.3rem; font-weight: 700; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.zoom-plus button:hover { color: var(--primary); }


/* ---------- 4. The answer box ---------- */
.result { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); box-sizing: border-box;
	display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: 16px;
	box-shadow: 0 8px 22px rgba(0, 0, 0, .18); animation: resultIn .35s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes resultIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.result[hidden] { display: none; }
.result p { margin: 0; font-weight: 600; color: var(--dark); }
.result.right { background: #e6f5ec; }
.result.almost { background: #fff4d6; }
.result.wrong { background: #fde8ea; }
.result .big-button { padding: 9px 24px; font-size: .85rem; }
.result p { font-size: .9rem; text-align: center; }
.result .big-button[hidden] { display: none; }
.map-game .hint { font-size: .8rem; margin-top: 10px; }


/* ---------- 5. Phones ---------- */
@media (max-width: 640px) {
	.ask { gap: 12px; margin: 12px 0 10px; }
	.ask img { width: 84px; }
	.ask p { font-size: .95rem; }
	.ask p strong { font-size: 1.2rem; }
	.map-box { height: 52vh; margin: 0 -10px; border-radius: 12px; }
	.zoom-buttons button { padding: 6px 10px; font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
	.world .show-me, .world .ring.on { animation: none; }
}


/* ---------- 6. Learn the map ---------- */

/* the two modes on the start screen */
.mode-tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 14px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); }
.mode-tabs button { padding: 9px 20px; border: 0; border-radius: 99px; background: none; color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; transition: background .2s ease, color .2s ease; }
.mode-tabs button[aria-pressed="true"] { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(0, 136, 204, .3); }
.mode-tabs button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* flag pins: drawn in screen pixels (js/map-game.js scales them with the zoom) */
.world .pin { cursor: pointer; transition: opacity .3s ease; }
.world .pin-pole { stroke: #333; stroke-width: 2; }
.world .pin-frame { fill: #fff; stroke: rgba(0, 0, 0, .25); stroke-width: 1; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .25)); }
.world .pin-tick, .world .pin-tick-mark { display: none; }
.world .pin-tick { fill: #1a9e4b; stroke: #fff; stroke-width: 1.5; }
.world .pin-tick-mark { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.world .pin.seen .pin-tick, .world .pin.seen .pin-tick-mark { display: inline; }
@media (hover: hover) { .learning:not(.placing) .world .pin:hover .pin-frame { stroke: var(--primary); stroke-width: 2.5; } }
/* step 2: flags not placed yet are hidden (a peek shows them faintly), placed ones pop in */
.world .pin.hidden-pin { opacity: 0; pointer-events: none; }
.world .pin.hidden-pin.peek { opacity: .85; }
.placing .world .pin { pointer-events: none; }
.world .pin.new image, .world .pin.new rect { animation: pinIn .5s cubic-bezier(.3, 1.6, .5, 1); transform-box: fill-box; transform-origin: center bottom; }
@keyframes pinIn { from { transform: translateY(-14px) scale(.3); opacity: 0; } }
/* a placed country stays light green; the region lights up for hint 2 */
.world .placed-land { fill: #3fb36b !important; stroke: #0d5c2b; stroke-width: calc(var(--unit, 1) * 1.2px); }
.world .hint-area { fill: #ffd84d !important; }

/* the card for a country you tapped while exploring */
.info-card { position: absolute; left: 10px; top: 10px; z-index: 3; display: flex; align-items: center; gap: 12px; max-width: min(360px, calc(100% - 70px)); padding: 10px 40px 10px 10px; border-radius: 14px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.info-card[hidden] { display: none; }
.info-card.pop { animation: noteIn .4s cubic-bezier(.3, 1.4, .5, 1); }
.info-card img { flex: none; width: 74px; height: auto; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.info-text { display: flex; flex-direction: column; gap: 1px; text-align: left; line-height: 1.3; }
.info-text strong { color: var(--dark); font-size: 1.05rem; }
.info-text span { color: var(--dark); font-size: .8rem; }
.info-text small { color: var(--text); font-size: .72rem; }
.info-close { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; font-size: 18px; color: var(--text); cursor: pointer; }
.info-close:hover { background: var(--soft); }

/* hints and peeks, and "Ready? Place the flags" */
.learn-tools { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.learn-tools[hidden] { display: none; }
.tool-button { padding: 9px 18px; border: 2px solid #f5c518; border-radius: 99px; background: #fffbea; color: var(--dark); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.tool-button:hover:not(:disabled) { background: #f5c518; transform: translateY(-1px); }
.tool-button:disabled { opacity: .45; cursor: default; }
.tool-button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ready-button { display: block; margin: 12px auto 0; background: #1a9e4b; box-shadow: 0 8px 20px rgba(26, 158, 75, .3); animation: noteIn .45s cubic-bezier(.3, 1.4, .5, 1); }
.ready-button:hover { background: #158a40; }
.ready-button[hidden] { display: none; }
.result.hint { background: #eef7fc; }
#playScreen.learning > p.hint { display: none; }   /* the general map hint line isn't needed while learning */
.ask img[hidden] { display: none; }

@media (max-width: 640px) {
	.mode-tabs button { padding: 8px 14px; font-size: .82rem; }
	.info-card { left: 6px; top: 6px; gap: 10px; padding: 8px 36px 8px 8px; }
	.info-card img { width: 58px; }
	.tool-button { padding: 8px 14px; font-size: .8rem; }
}


/* ---------- 7. A big look at the flag ---------- */
.ask img, .info-card img { cursor: zoom-in; }
.flag-zoom { position: absolute; left: 50%; top: 50%; z-index: 6; width: min(66%, 520px); margin: 0; transform-origin: center; translate: -50% -50%;
	display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 14px 12px; border-radius: 16px; background: #fff;
	box-shadow: 0 20px 50px rgba(0, 0, 0, .35); cursor: zoom-out; }
.flag-zoom[hidden] { display: none; }
.flag-zoom img { display: block; width: 100%; height: auto; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.flag-zoom span { color: var(--dark); font-weight: 700; font-size: 1.1rem; }
@media (max-width: 640px) {
	.flag-zoom { width: 84%; padding: 10px; }
	.flag-zoom span { font-size: .95rem; }
}
