/* BOXY TWIST · ROYAL WORLDS / iOS internal TestFlight only.
   Additive visual layer: approved map art, route nodes, truck and game physics stay frozen. */
:root{--rw-navy:#0a1c39;--rw-midnight:#102e55;--rw-gold:#f3c65e;--rw-cream:#fff3d4;--rw-copper:#a66d29}

/* The map's native route scroll, fixed HUD and stop geometry are not replaced. */
.world-hub.royal-worlds-enabled .royal-world-marker{
  position:absolute;z-index:16;left:50%;top:max(68px,calc(env(safe-area-inset-top) + 62px));
  transform:translateX(-50%);width:min(196px,54vw);min-height:52px;
  display:flex;align-items:center;gap:7px;padding:7px 9px;
  border:1px solid #ffeaba;border-radius:15px;
  background:linear-gradient(147deg,#1c4571fa,#0b2347f8 72%,#07192ee8);
  box-shadow:inset 0 2px #ffffff32,0 4px 0 #a77736,0 9px 19px #071a2b9c;
  color:#fff3ce;pointer-events:none;isolation:isolate;
}
.world-hub.royal-worlds-enabled .royal-world-marker:before{content:'';position:absolute;inset:4px;border:1px solid #eecb6c65;border-radius:11px;pointer-events:none}
.royal-world-emblem{width:29px;height:29px;flex:0 0 29px;display:grid;place-items:center;border:1px solid #fff3b8;border-radius:10px;background:linear-gradient(#fff3bc,#edbc4f 56%,#a77326);color:#754618;font-size:21px;box-shadow:inset 0 2px #fffbd9,0 3px 0 #784b20}
.royal-world-copy{flex:1;min-width:0;text-align:left}
.royal-world-copy small{display:block;font-size:9px;font-weight:850;letter-spacing:1px;color:#ffe3a1}
.royal-world-copy strong{display:block;color:#fff7df!important;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:950}
.royal-world-milestones{display:flex;gap:2px;margin-top:3px}
.royal-world-milestones i{width:8px;height:4px;border-radius:3px;background:#36587b;border:1px solid #b3c7d25c}
.royal-world-milestones i.is-lit{background:linear-gradient(#fff8be,#edae39);border-color:#fff3aa;box-shadow:0 0 5px #ffe38c88}
.royal-world-stage{flex:0 0 36px;text-align:center;display:grid;gap:1px;place-items:center;border-left:1px solid #e2c28377;padding-left:5px}
.royal-world-stage small{font-size:8px;font-weight:900;color:#ffe3a2}
.royal-world-stage b{font-size:16px;color:#fff6d7;text-shadow:0 2px #061f3c}
.world-hub.royal-worlds-enabled .hub-route-world .hub-node.current .stamp{
  border:3px solid #fff5c2!important;background:linear-gradient(155deg,#fff9cb,#ffdf69 50%,#eea636)!important;
  color:#633a13!important;
  box-shadow:inset 0 3px 2px #fffdf0,inset 0 -5px #d98825,0 6px 0 #a96724,0 11px 18px #263a46ad,0 0 25px #ffe68c94!important;
}
.world-hub.royal-worlds-enabled .hub-route-world .hub-node.current:after{
  content:'✦';position:absolute;top:-14px;right:1px;color:#fff5b3;font-size:20px;
  filter:drop-shadow(0 0 6px #f0bb50);pointer-events:none;
}
.world-hub.royal-worlds-enabled .hub-route-world .hub-node.completed .stamp{
  border:2px solid #d0fce3!important;
  box-shadow:inset 0 3px #f2fffa,inset 0 -5px #167866,0 6px 0 #205c57,0 10px 15px #102b3880!important;
}
.world-hub.royal-worlds-enabled .hub-route-world .hub-node.locked .stamp{
  box-shadow:inset 0 2px #eff4fc80,inset 0 -5px #58718e4a,0 5px 0 #45617b,0 9px 17px #18334b75!important;
}
.world-hub.royal-worlds-enabled .hub-world-gate{border:2px solid #f9d680!important;background:linear-gradient(140deg,#173e6c,#092749)!important;box-shadow:inset 0 2px #ffffff28,0 5px 0 #a57533,0 11px 16px #061d3673!important;color:#fff5d7!important}
.world-hub.royal-worlds-enabled .hub-world-gate strong{color:#fff4c4!important;text-shadow:0 1px #06192d!important}
.world-hub.royal-worlds-enabled .hub-world-gate small{color:#dceafa!important}
.world-hub.royal-worlds-enabled .hub-card .pic{box-shadow:inset 0 2px #fffbd3a1,0 4px 0 #bb8f53,0 9px 15px #0b325b40!important}
.world-hub.royal-worlds-enabled .hub-card button:focus-visible{outline:3px solid #fff7c2;outline-offset:3px}
.world-hub.royal-worlds-enabled .hub-bottom-nav button:focus-visible{outline:3px solid #fff2aa;outline-offset:2px}
@media(max-height:740px){.world-hub.royal-worlds-enabled .royal-world-marker{top:max(60px,calc(env(safe-area-inset-top) + 56px));width:min(170px,50vw);min-height:44px;padding:4px 6px;gap:4px}.royal-world-emblem{width:24px;height:24px;flex-basis:24px;font-size:18px}.royal-world-copy strong{font-size:10px}.royal-world-milestones{display:none}}
@media(max-width:360px){.world-hub.royal-worlds-enabled .royal-world-marker{width:160px;padding:5px;gap:4px}.royal-world-emblem{width:22px;height:22px;flex-basis:22px;font-size:16px}.royal-world-stage{flex-basis:31px}.royal-world-copy small{font-size:8px}.royal-world-copy strong{font-size:10px}}
@media(prefers-reduced-motion:no-preference){.world-hub.life-awake.royal-worlds-enabled .hub-route-world .hub-node.current:after{animation:rw-star-breathe 3.3s ease-in-out infinite}@keyframes rw-star-breathe{0%,100%{opacity:.65;transform:scale(.85)}50%{opacity:1;transform:scale(1.14)}}}
@media(prefers-reduced-motion:reduce){.world-hub.royal-worlds-enabled .hub-route-world .hub-node.current:after{animation:none!important}}

/* Premium navy-and-gold modal frame, readable on iPhone and iPad. */
.modal:has(.royal-events),.modal:has(.royal-missions){
 max-width:520px;border:2px solid #efcf7d;border-radius:25px;padding:15px;
 background:radial-gradient(circle at 50% -10%,#335c84,#102b50 47%,#081a34);
 box-shadow:0 27px 75px #020c24ca,inset 0 2px #e8d28b55;color:#fff1d2;
}
.modal:has(.royal-events) .modal-head,.modal:has(.royal-missions) .modal-head{display:flex;align-items:center;margin:0 0 12px}
.modal:has(.royal-events) .modal-head h2,.modal:has(.royal-missions) .modal-head h2{font-size:20px!important;color:#fff0c7!important;text-shadow:0 2px #061c39}
.modal:has(.royal-events) .modal-head .eyebrow,.modal:has(.royal-missions) .modal-head .eyebrow{color:#f9d880!important}
.modal:has(.royal-events) .modal-head .icon-button,.modal:has(.royal-missions) .modal-head .icon-button{background:linear-gradient(#fff2c5,#e3b65a);color:#3f2914;border:1px solid #fff9d5;min-width:34px;min-height:34px}
.royal-events,.royal-missions{isolation:isolate;color:#fff0ce}
.royal-events :is(button,a),.royal-missions :is(button,a){touch-action:manipulation}
.royal-events :is(button,a):focus-visible,.royal-missions :is(button,a):focus-visible{outline:3px solid #ffe69b;outline-offset:3px}

/* Events: rotating royal medallion + tactile floating gem cards. */
.royal-events-banner{position:relative;display:grid;grid-template-columns:82px 1fr;align-items:center;gap:11px;min-height:141px;padding:16px 12px 14px;overflow:hidden;border:2px solid #ebc777;border-radius:20px;background:radial-gradient(circle at 25% 40%,#2c5987,#102947 72%);box-shadow:inset 0 2px #ffffff27,0 5px 0 #855a23,0 10px 21px #03132a80}
.royal-events-banner:before{content:'';position:absolute;inset:5px;border:1px solid #ffe4a747;border-radius:14px;pointer-events:none}
.royal-events-orbit{width:78px;height:83px;display:grid;place-items:center;position:relative;transform:rotate(-9deg);filter:drop-shadow(0 10px 5px #0008)}
.royal-events-orbit:before{content:'';position:absolute;inset:9px;border:2px solid #ffefaf;border-radius:50%;background:linear-gradient(145deg,#fff0ad,#dfa23d 60%,#93601f);box-shadow:inset 0 3px #fffae8,0 5px 0 #905f22,0 0 18px #ffdb7190}
.royal-events-orbit:after{content:'✦';position:absolute;font-size:35px;color:#845015;filter:drop-shadow(0 1px #fff5b4)}
.royal-events-orbit>i{position:absolute;inset:0;border:1px dashed #fff1a36b;border-radius:50%;transform:rotate(17deg)}
.royal-events-orbit>b,.royal-events-orbit>span{position:absolute;color:#ffeba9;font-size:18px}.royal-events-orbit>b{left:-5px;top:0}.royal-events-orbit>span{right:1px;bottom:0}
.royal-events-title{min-width:0;position:relative}
.royal-events-title small{display:block;color:#ffd88a;font-size:10px;letter-spacing:1.15px;font-weight:900}
.royal-events-title h2{color:#fff0b6!important;font-size:clamp(22px,6vw,28px)!important;letter-spacing:-.3px;margin:5px 0;font-weight:1000;text-shadow:0 2px 3px #04162f}
.royal-events-title p{color:#ddeafd;font-size:12px;line-height:1.45;margin:0}
.royal-events-live{grid-column:1/-1;display:inline-flex;justify-self:center;align-items:center;gap:7px;padding:6px 15px;border:1px solid #edce80;border-radius:20px;background:#051e3b;color:#fff0c9;font-size:11px;font-weight:850}
.royal-events-live span{font-size:14px;color:#ffdb77}
.royal-event-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0 4px}
.royal-event-grid .event-tile{
 position:relative;overflow:hidden;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-height:164px;text-align:left;padding:13px 11px;
 border:2px solid #fff0bb;border-radius:20px;
 background:linear-gradient(145deg,#fff9e1,#e9c784 68%,#c69a53);
 box-shadow:inset 0 2px #ffffffec,0 5px 0 #9b682d,0 11px 17px #00182c75;
 color:#172e43;font-weight:800;
}
.royal-event-grid .event-tile:before{content:'';position:absolute;inset:-70% 37% auto auto;height:210%;width:27px;background:linear-gradient(90deg,transparent,#fff9c28c,transparent);transform:rotate(29deg);pointer-events:none;opacity:.4}
.royal-event-grid .event-tile[data-royal-event="golden"],.royal-event-grid .event-tile[data-royal-event="cup"]{background:linear-gradient(140deg,#fff1bc,#efbd55 65%,#c5872b)}
.royal-event-grid .event-tile[data-royal-event="daily"],.royal-event-grid .event-tile[data-royal-event="pass"]{background:linear-gradient(140deg,#eefaff,#b5dce8 65%,#83afb6);border-color:#e5f8ff;box-shadow:inset 0 2px #fff,0 5px 0 #5188a3,0 11px 17px #00182c75}
.royal-event-grid .event-tile[data-royal-event="wheel"],.royal-event-grid .event-tile[data-royal-event="vault"]{background:linear-gradient(145deg,#fff5e5,#eed0b2 65%,#caa384)}
.royal-event-gem{display:grid!important;place-items:center;width:65px;height:66px;flex:0 0 66px;margin:0 0 5px;position:relative;border:2px solid #fffae7;border-radius:19px;background:linear-gradient(145deg,#ffe9a6,#dcaa51 70%,#b47727);box-shadow:inset 0 2px #fffbd6,0 5px 0 #a37634,0 9px 17px #61432380;transform:rotate(-7deg)}
.royal-event-gem>span{display:block;font-size:33px!important;line-height:1.1;filter:drop-shadow(0 3px 2px #6c4f2855)}
.royal-event-grid .event-tile strong{display:block!important;margin:0!important;color:#183147!important;font-size:15px!important;line-height:1.16!important;font-weight:1000!important;text-shadow:none!important}
.royal-event-grid .event-tile small{display:block!important;margin-top:auto!important;border:0!important;border-radius:9px!important;padding:5px 6px!important;background:#172e49!important;color:#fdf1cd!important;font-size:11px!important;line-height:1.25!important;font-weight:800}
.royal-event-grid .event-tile.has-ready-reward{border-color:#ffdf60!important;box-shadow:inset 0 2px #fff,0 5px 0 #a96b25,0 0 19px #ffe26889}
.royal-event-grid .event-tile:active{transform:translateY(3px);box-shadow:inset 0 2px #fff,0 2px 0 #9b682d}
.royal-event-grid .event-tile:disabled{opacity:.7}

/* Missions: interactive progress dashboard using genuine weekly counters. */
.royal-mission-hero{position:relative;display:flex;align-items:center;gap:15px;min-height:141px;padding:14px;border:2px solid #edc979;border-radius:20px;background:radial-gradient(circle at 20% 25%,#315b8a,#0b2549 70%);box-shadow:inset 0 2px #ffffff28,0 5px 0 #86602b,0 11px 19px #02112599}
.royal-mission-medallion{flex:0 0 75px;display:grid;place-items:center;width:75px;height:75px;border:2px solid #fff4af;border-radius:24px;background:linear-gradient(140deg,#fff1b6,#ecb64a 58%,#a87528);box-shadow:inset 0 3px #fffcee,0 6px 0 #966524,0 9px 19px #0008;transform:rotate(-8deg)}
.royal-mission-medallion span{font-size:49px;color:#9a651d;text-shadow:0 2px #fff7c8}
.royal-mission-hero>div:last-child{position:relative;min-width:0}.royal-mission-hero small{display:block;font-size:9px;line-height:1.4;letter-spacing:.7px;color:#f9dfac;font-weight:850}
.royal-mission-hero h2{color:#ffecad!important;font-size:23px!important;line-height:1.06!important;margin:6px 0;font-weight:1000;letter-spacing:-.4px}
.royal-mission-hero p{color:#dce9f8!important;line-height:1.45;font-size:11px;margin:0}
.royal-mission-sparks{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:space-between;padding:9px 20px;color:#ffe8a2;pointer-events:none;opacity:.5}
.royal-mission-dash{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:15px 0}
.royal-mission-dash>div{display:flex;flex-direction:column;gap:2px;align-items:center;justify-content:center;min-height:91px;padding:8px 4px;border:1px solid #f8d68a;border-radius:16px;background:linear-gradient(160deg,#fef0bb,#d8ac5e);box-shadow:inset 0 2px #fff9de,0 4px 0 #9e6e28;color:#493017;text-align:center}
.royal-mission-dash span{font-size:24px}.royal-mission-dash strong{font-size:22px;font-weight:1000;color:#172e48}.royal-mission-dash small{font-size:10px;color:#4a3b28;font-weight:900;line-height:1.1}
.royal-mission-list{display:grid;gap:10px;margin:18px 0}
.royal-mission-card{display:grid;grid-template-columns:53px minmax(0,1fr) auto;align-items:center;gap:10px;padding:13px 10px;border:2px solid #fff4c9;border-radius:17px;background:linear-gradient(145deg,#fffdf0,#e5d5ae 70%,#caaf7e);box-shadow:inset 0 2px #fff,0 5px 0 #93703e,0 10px 17px #00172e66}
.royal-mission-card.is-achieved{border-color:#fff5ae;background:linear-gradient(145deg,#fff9ce,#f1d68a 68%,#d9ad60)}
.royal-mission-gem{width:52px;height:52px;display:grid;place-items:center;border-radius:14px;border:2px solid #fff7dd;background:linear-gradient(140deg,#fff2b9,#deb46d);box-shadow:inset 0 2px #fff6d3,0 4px 0 #9b6b30;font-size:26px}
.royal-mission-text{min-width:0;text-align:left}
.royal-mission-text strong{display:block;color:#203249;font-size:14px;line-height:1.2;font-weight:1000}
.royal-mission-text p{font-size:11px;color:#34495a;line-height:1.35;margin:3px 0 7px}
.royal-mission-meter{height:8px;width:100%;border-radius:12px;background:#7a91a245;box-shadow:inset 0 1px 2px #43566e8a;overflow:hidden}
.royal-mission-meter>span{display:block;height:100%;border-radius:12px;background:linear-gradient(90deg,#eda735,#fff1a6);box-shadow:inset 0 1px #fff9de,0 0 5px #efc35b}
.royal-mission-text small{display:block;font-size:10px;color:#3d4d59;font-weight:900;margin-top:5px}
.royal-mission-seal{width:28px;height:28px;display:grid;place-items:center;border:2px solid #fff4be;border-radius:50%;background:linear-gradient(#ffeaa9,#e1b253);color:#6e491a;font-size:17px;font-weight:1000}
.royal-mission-cta{min-width:66px;min-height:44px;padding:8px 9px;border:2px solid #fff2ae;border-radius:12px;background:linear-gradient(#ffeba3,#dfaa3f);box-shadow:inset 0 2px #fffdde,0 3px 0 #986728;color:#543512;font-size:12px;font-weight:950;cursor:pointer}
.royal-mission-cta:active{transform:translateY(2px)}
.royal-mission-disclaimer{margin:10px 3px 8px;color:#dfe9f5;font-size:11px;line-height:1.5;text-align:center}
@media(max-width:380px){.royal-events-banner{grid-template-columns:65px 1fr;padding:12px 9px;gap:7px}.royal-events-orbit{width:61px;height:69px}.royal-events-title h2{font-size:21px!important}.royal-event-grid{gap:7px}.royal-event-grid .event-tile{padding:10px 8px;min-height:148px}.royal-event-gem{width:55px;height:56px;flex-basis:56px}.royal-event-gem>span{font-size:28px!important}.royal-event-grid .event-tile strong{font-size:13px!important}.royal-event-grid .event-tile small{font-size:10px!important}.royal-mission-hero{gap:9px;padding:11px}.royal-mission-medallion{width:59px;height:59px;flex-basis:59px}.royal-mission-medallion span{font-size:38px}.royal-mission-hero h2{font-size:20px!important}.royal-mission-card{grid-template-columns:43px minmax(0,1fr) auto;gap:6px;padding:10px 7px}.royal-mission-gem{width:42px;height:42px;font-size:23px}.royal-mission-text strong{font-size:12px}.royal-mission-text p{font-size:10px}.royal-mission-cta{min-width:54px;padding:6px;font-size:11px}}
@media(prefers-reduced-motion:no-preference){.royal-events-orbit{animation:rw-royal-hover 5s ease-in-out infinite}.royal-mission-medallion{animation:rw-royal-hover 6s ease-in-out infinite alternate}.royal-event-grid .event-tile.has-ready-reward .royal-event-gem{animation:rw-gem-glow 3.5s ease-in-out infinite}@keyframes rw-royal-hover{0%,100%{translate:0 0;rotate:-2deg}50%{translate:0 -4px;rotate:2deg}}@keyframes rw-gem-glow{0%,100%{filter:drop-shadow(0 0 2px #ffeb9c)}50%{filter:drop-shadow(0 0 9px #ffce64)}}}
@media(prefers-reduced-motion:reduce){.royal-events *, .royal-missions *, .world-hub.royal-worlds-enabled .royal-world-marker{animation:none!important;transition:none!important}}

/* Typography QA: Swedish mission headline must not escape its frame. */
.royal-mission-hero h2{
 max-width:100%;
 font-size:clamp(17px,4.8vw,23px)!important;
 line-height:1.14!important;
 white-space:normal!important;
 overflow-wrap:break-word;
 hyphens:auto;
}
.royal-mission-hero>div:last-child{max-width:calc(100% - 92px);overflow-wrap:break-word}
@media(max-width:380px){.royal-mission-hero>div:last-child{max-width:calc(100% - 68px)}}
