/* Reward machine styles. Uses the existing :root tokens of hexumi-unlimited.html
   (--ink, --paper, --foam, --glyph, --sea1, --sea2, --sf-red, --sf-yellow, --sf-green, --sf-blue). */

/* ---------- Secret island built from 5 hexes ---------- */
.rm-map{display:block;overflow:visible}
.rm-paper{fill:#F3E2AE}
.rm-shore{fill:#9eb6ef}
.rm-tile{fill:#F6E7B8;stroke:var(--glyph);stroke-width:1.25;stroke-linejoin:round}
.rm-land{fill:#E2BE73;stroke:var(--glyph);stroke-width:1;stroke-linejoin:round}
.rm-hill{fill:#8DC98F;stroke:var(--glyph);stroke-width:.8;stroke-linejoin:round}
.rm-wave{fill:none;stroke:#9C8A57;stroke-width:.8;stroke-linecap:round;opacity:.7}
.rm-route{fill:none;stroke:var(--sf-red);stroke-width:1.3;stroke-linecap:round;stroke-dasharray:.1 3}
.rm-x{fill:none;stroke:var(--sf-red);stroke-width:2;stroke-linecap:round}
.rm-rose path{fill:var(--glyph)}
.rm-rose circle{fill:#F3E2AE;stroke:var(--glyph);stroke-width:.6}
.rm-piece-edge{fill:none;stroke:#B79B5C;stroke-width:.6;stroke-linejoin:round}
.rm-seam{stroke:var(--glyph);stroke-width:.5;opacity:.18}
.rm-rim{fill:none;stroke:var(--glyph);stroke-width:1.6;stroke-linejoin:round}
.rm-q-shadow{fill:rgba(20,20,15,.18)}
.rm-q-plate{stroke:var(--ink);stroke-width:1.15}
.rm-q text{fill:var(--ink);font-family:"BebasNeuePro","BebasPro",Impact,sans-serif;font-size:12px;font-weight:600}
.rm-glow{fill:none;stroke:var(--sf-yellow);stroke-width:5;stroke-linejoin:round;opacity:.9;animation:rmGlow 1.6s ease-in-out infinite}
/* missing pieces: on the blue popup light dashes, on paper dark dashes */
.rm-sea .rm-missing{fill:rgba(255,255,255,.1);stroke:#c5d4f8;stroke-width:1.7;stroke-dasharray:3.2 2.2;stroke-linejoin:round}
.rm-sea .rm-rim{stroke:#14140F}
.rm-paper .rm-missing{fill:rgba(20,20,15,.04);stroke:var(--glyph);stroke-width:1.8;stroke-dasharray:3.2 2;opacity:.72}
/* the piece that just arrived pops in once the map has landed on it */
.rm-fresh{transform-box:fill-box;transform-origin:center;animation:rmPieceIn .72s cubic-bezier(.2,.9,.2,1.2) 2.15s both}
@keyframes rmPieceIn{
  0%{transform:scale(.2) rotate(-12deg);opacity:0}
  58%{transform:scale(1.28) rotate(4deg);opacity:1}
  100%{transform:none;opacity:1}
}
/* the map from the bottle: unrolls, holds so you can read it, then folds onto the new hex */
#rmOffer .rm-card{position:absolute;left:50%;top:38%;width:142px;height:178px;z-index:6;pointer-events:none;filter:drop-shadow(0 10px 12px rgba(20,20,15,.32));animation:rmCardIn 2.8s linear both}
.rm-card-shade{fill:rgba(20,20,15,.22)}
.rm-card-paper{fill:#F6E7B8;stroke:var(--glyph);stroke-width:1.15}
.rm-card-fold{fill:#E7D089;stroke:var(--glyph);stroke-width:.8;stroke-linejoin:round}
.rm-card-ink polygon{fill:#E2BE73;stroke:var(--glyph);stroke-width:.85;stroke-linejoin:round}
.rm-card-ink path{fill:none;stroke:var(--sf-red);stroke-width:1.45;stroke-linecap:round}
@keyframes rmCardIn{
  0%{transform:translate(calc(-50% + 96px),calc(-50% + 78px)) rotate(-36deg) scale(.14);opacity:0;animation-timing-function:cubic-bezier(.2,.7,.2,1)}
  12%{transform:translate(calc(-50% + 62px),calc(-50% + 36px)) rotate(-16deg) scale(.46);opacity:1}
  36%{transform:translate(-50%,-62%) rotate(6deg) scale(1.08);opacity:1}
  46%{transform:translate(-50%,-56%) rotate(-2deg) scale(1);opacity:1}
  76%{transform:translate(-50%,-56%) rotate(0deg) scale(1);opacity:1;animation-timing-function:cubic-bezier(.45,0,.75,.35)}
  100%{transform:translate(-50%,-42%) rotate(0deg) scale(.16);opacity:0}
}
@keyframes rmGlow{0%,100%{opacity:.55}50%{opacity:1}}

/* ---------- Map bottle ---------- */
.rm-glass{fill:#BFE3C9;stroke:var(--glyph);stroke-width:1.15;stroke-linejoin:round}
.rm-scroll{fill:#F3E2AE;stroke:var(--glyph);stroke-width:.8}
.rm-scroll-line{fill:none;stroke:#9C8A57;stroke-width:.7;stroke-linecap:round}
.rm-scroll-hex{fill:var(--sf-red);stroke:var(--glyph);stroke-width:.4}
.rm-cork{fill:#B9773F;stroke:var(--glyph);stroke-width:.9}
.rm-seal{fill:var(--sf-red);stroke:var(--glyph);stroke-width:.9}
.rm-shine{fill:none;stroke:#fff;stroke-width:1.1;stroke-linecap:round;opacity:.8}
.rm-foam{fill:none;stroke:var(--foam);stroke-width:1.4;stroke-linecap:round;opacity:.85}
.rm-bob{transform-origin:0 4px;animation:rmBob 2.4s ease-in-out infinite}
@keyframes rmBob{0%,100%{transform:translateY(0) rotate(0)}50%{transform:translateY(-1.6px) rotate(3deg)}}

/* Bottle washes ashore on the map while the fleet sails (once per day).
   Put the bottle in a positioned element on the map; it drifts in from the
   side of the screen and settles next to the island the fleet sails to. */
.rm-wash{animation:rmWash 3.4s cubic-bezier(.25,.8,.3,1) both}
@keyframes rmWash{
  0%{transform:translate(140px,30px) rotate(25deg);opacity:0}
  20%{opacity:1}
  70%{transform:translate(-6px,-4px) rotate(-6deg)}
  100%{transform:none}
}

/* ---------- Popup (same build as #floatOffer) ---------- */
#rmOffer{width:min(330px,calc(100vw - 36px));max-width:330px;padding:0;overflow:visible;border-radius:26px;text-align:center;background:var(--paper)}
#rmOffer .find-sea{background:linear-gradient(180deg,#3d6fe0 0%,#2a57c4 100%);color:#fff;padding:22px 20px 18px;position:relative;border-radius:26px 26px 0 0}
#rmOffer .rm-stage{position:relative;width:170px;height:170px;margin:0 auto 6px}
#rmOffer .rm-stage .rm-bottle{position:absolute;right:-26px;bottom:-6px}
#rmOffer h2{margin:4px 0 8px;color:#fff;font-size:1.9rem;line-height:.95}
#rmOffer .rm-steps{display:inline-flex;gap:5px;margin:0 0 2px}
#rmOffer .rm-steps i{width:16px;height:16px;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:rgba(255,255,255,.22)}
#rmOffer .rm-steps i.on{background:var(--sf-yellow)}
#rmOffer .rm-steps-label{display:block;margin-top:4px;color:#cfdcfb;font-size:1.02rem;letter-spacing:.02em}
#rmOffer .find-sheet{padding:14px 16px 12px;background:var(--paper);border-radius:0 0 26px 26px}
#rmOffer .rm-steps i.rm-new{animation:rmDot .55s cubic-bezier(.2,.9,.2,1.25) 2.28s both}
@keyframes rmDot{0%{transform:scale(.2)}55%{transform:scale(1.45)}100%{transform:scale(1)}}
#rmOffer .rm-fly{position:absolute;inset:0;z-index:8;overflow:visible;pointer-events:none}
#rmOffer .rm-score-hex{position:absolute;left:0;top:0;pointer-events:none}
#rmOffer .rm-score-hex svg{display:block;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 2px 3px rgba(20,30,60,.38))}
#rmOffer .rm-score-hex polygon{fill:var(--sf-yellow);stroke:var(--ink);stroke-width:7;stroke-linejoin:round}
#rmOffer .rm-gain{position:absolute;z-index:9;display:inline-flex;align-items:center;gap:4px;padding:5px 9px 3px 7px;border:1.5px solid var(--ink);border-radius:999px;background:var(--sf-yellow);color:#000;font-family:"BebasPro",Impact,sans-serif;font-size:1.05rem;line-height:1;letter-spacing:.03em;white-space:nowrap;pointer-events:none;box-shadow:0 2px 6px rgba(20,30,60,.28);animation:scoreGain 1.4s ease-out forwards}
#rmOffer .rm-gain svg{display:block;width:13px;height:15px;margin-top:-2px}
#rmOffer .rm-gain polygon{fill:var(--sf-bg);stroke:var(--ink);stroke-width:8;stroke-linejoin:round}
#rmOffer .find-sheet p{margin:0 0 12px;color:var(--ink);font-size:1.08rem;line-height:1.3}
#rmOffer .act[hidden]{display:none!important}
#rmOffer .act.primary{display:flex;align-items:center;justify-content:center;gap:8px;box-sizing:border-box;width:100%;height:52px;margin:0;padding:0 14px;border:0;border-radius:14px;background:var(--accent);color:#fff;font-family:"BebasPro",Impact,sans-serif;font-size:1.28rem;font-weight:600;letter-spacing:.02em;line-height:1.05;white-space:nowrap}
#rmOffer .act.primary:not([hidden]) + .act.primary{margin-top:8px}
#rmOffer .act.primary .float-play{width:28px;height:28px;flex:none;fill:#fff}
#rmOffer .act.textlink{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:100%;background:transparent;border:0;box-shadow:none;color:var(--accent);height:auto;min-height:0;margin-top:8px;padding:8px 4px 4px;font-family:inherit;font-size:1.02rem;font-weight:500;letter-spacing:0}
#rmOffer .rm-coins{display:inline-flex;align-items:center;gap:4px;padding:2px 9px 1px;border:2px solid #14140F;border-radius:999px;background:var(--sf-yellow);color:#14140F;font-size:1.05rem;line-height:1.1}
#rmOffer .rm-coins i{width:12px;height:12px;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:#14140F}
#rmOffer .rm-note{margin:10px 0 0;color:var(--muted);font-size:.95rem}
/* loading the rewarded video: spinner inside the button, label stays */
#rmOffer .act.primary.rm-busy{opacity:.85;pointer-events:none}
#rmOffer .act.primary .splash-spin{display:none}
#rmOffer .act.primary.rm-busy .splash-spin{display:inline-flex}
#rmOffer .act.primary.rm-busy .float-play{display:none}

/* ---------- Secret islands button (map: bottom right, above Vandaag) ---------- */
.rm-btn{position:relative;box-sizing:border-box;width:64px;height:64px;padding:0;border:2px solid var(--ink);border-radius:18px;background:var(--paper);box-shadow:0 3px 0 var(--ink);display:flex;align-items:center;justify-content:center;cursor:pointer}
.rm-btn:active{transform:translateY(2px);box-shadow:0 1px 0 var(--ink)}
.rm-btn .rm-map{width:54px;height:auto;margin-top:-8px}
.rm-btn .rm-count{position:absolute;left:0;right:0;bottom:2px;font-family:"BebasPro",Impact,sans-serif;font-size:.86rem;line-height:1;color:var(--ink);letter-spacing:.03em}
.rm-btn .rm-badge{position:absolute;top:-8px;left:-8px;min-width:22px;height:22px;padding:0 5px;border:2px solid var(--ink);border-radius:999px;background:var(--sf-red);color:#fff;font-family:"BebasPro",Impact,sans-serif;font-size:.95rem;line-height:19px}
.rm-btn.rm-done{background:var(--paper)}
.rm-btn.rm-done .rm-map{margin-top:0}
/* daily: above the question mark, same gap as the symbol buttons */
.rm-btn.rm-daily{width:var(--rm-daily,52px);height:var(--rm-daily,52px);border-radius:15px}
.rm-btn.rm-daily .rm-map{width:72%;height:auto;margin-top:-6px}
.rm-btn.rm-hint{animation:rmHint 1.6s ease-in-out infinite}
@keyframes rmHint{
  0%,100%{transform:scale(1);box-shadow:0 3px 0 var(--ink),0 0 0 0 rgba(254,226,69,0)}
  50%{transform:scale(1.07);box-shadow:0 3px 0 var(--ink),0 0 0 7px rgba(254,226,69,.5)}
}

/* ---------- Secret milestone boats ---------- */
.rm-red{--rm-hull:#E62731;--rm-sail:#FEFBEF;--rm-flag:#FEE245}
.rm-blue{--rm-hull:#063DA6;--rm-sail:#FEFBEF;--rm-flag:#E62731}
.rm-green{--rm-hull:#28AB64;--rm-sail:#FEFBEF;--rm-flag:#E62731}
.rm-gold{--rm-hull:#F2C230;--rm-sail:#FBE7A1;--rm-flag:#E62731}
.rmhull{fill:var(--rm-hull)}
.rmsail{fill:var(--rm-sail)}
.rmflag{fill:var(--rm-flag);stroke:var(--glyph);stroke-width:.9;stroke-linejoin:round}
.rmflag.rm-red{fill:#E62731}
.rmspark{fill:var(--sf-yellow);stroke:var(--glyph);stroke-width:.5;animation:rmTwinkle 1.4s ease-in-out infinite}
.rmspark.late{animation-delay:.7s}
@keyframes rmTwinkle{0%,100%{opacity:.25}50%{opacity:1}}

/* ---------- Treasure chest ---------- */
.rm-chest .floatwood{fill:#b9773f;stroke:var(--glyph);stroke-width:1.2;stroke-linejoin:round}
.rm-chest .floatband{fill:none;stroke:var(--glyph);stroke-width:1.1}
.rm-chest .floatlock{fill:var(--sf-yellow);stroke:var(--glyph);stroke-width:.9}
.rm-lid-open{transform:translate(-6px,-6px) rotate(-28deg);transform-origin:-10px -4.5px}
.rm-chest-light{fill:var(--sf-yellow);opacity:.7}
#rmOffer .rm-prize{display:flex;align-items:center;justify-content:center;gap:10px;margin:0 0 12px}
#rmOffer .rm-prize span{font-size:1.15rem}

/* ---------- Secret sea ---------- */
.rm-secret-sea{display:block;width:100%;height:100%}
.rm-stars circle{fill:#FEFBEF;opacity:.75}
.rm-mist ellipse{fill:#FEFBEF;opacity:.08}
.rm-waves path{fill:none;stroke:#c9a9c9;stroke-width:1.4;stroke-linecap:round;opacity:.45}
.rm-isle-sand{fill:#E2BE73;stroke:var(--glyph);stroke-width:1.6;stroke-linejoin:round}
.rm-isle-hill{fill:#5FAE73;stroke:var(--glyph);stroke-width:1.3;stroke-linejoin:round}
.rm-isle{cursor:pointer}
.rm-isle-glow{fill:#FEE245;opacity:.16}
.rm-next polygon{fill:#FEFBEF;opacity:.16;stroke:#FEFBEF;stroke-width:1.1;stroke-dasharray:3 3;stroke-linejoin:round}
.rm-next text{fill:#FEFBEF;opacity:.5;font-family:"BebasPro",Impact,sans-serif;font-size:18px}
.rm-solved .rm-isle-sand{opacity:.92}
.rm-isle-hex path{fill:var(--glyph)}
.rm-isle-hex text{fill:var(--sf-yellow);font-family:"BebasPro",Impact,sans-serif;font-size:12px}
.rm-fleet{animation:rmSail 3.2s cubic-bezier(.3,.7,.3,1) both}
@keyframes rmSail{from{transform:translate(-190px,40px)}to{transform:none}}

@media (prefers-reduced-motion:reduce){
  .rm-fresh,.rm-wash,.rm-fleet,.rm-bob,.rm-glow,.rmspark,.rm-boat-rise,.rm-steps i.rm-new,.rm-btn.rm-hint{animation:none}
  .rm-btn.rm-hint{box-shadow:0 3px 0 var(--ink),0 0 0 3px #FEE245}
  .rm-card{display:none}
}

/* ---------- App chrome ---------- */
#rmMapHost,#rmDailyHost{position:fixed;z-index:13;right:max(12px,env(safe-area-inset-right));width:max-content}
#rmMapHost{bottom:calc(env(safe-area-inset-bottom) + 118px)}
#rmDailyHost{bottom:calc(env(safe-area-inset-bottom) + 108px);z-index:24}
#rmMapHost[hidden],#rmDailyHost[hidden]{display:none!important}
html:has(#map[hidden]) #rmMapHost,html:has(#play[hidden]) #rmDailyHost,html.rm-sea #rmMapHost,html.rm-sea #rmDailyHost,html.rm-sea #dailyMapBtn{display:none!important}
#rmOffer{padding:0;border:0;overflow:visible;width:min(330px,calc(100vw - 36px));max-width:330px;background:var(--paper)}
#rmOffer .rm-x{position:absolute;top:12px;right:12px;width:30px;height:30px;border-radius:50%;border:2px solid var(--foam);background:transparent;color:var(--foam);font-size:1rem;line-height:1;cursor:pointer}
#rmOffer .find-sea{position:relative}
.flag.rm-red .flagcloth{fill:var(--sf-red)}
html.rm-sea body,html.rm-sea:has(#map:not([hidden])) body{background:#1B2552;background-image:linear-gradient(180deg,#1B2552 0%,#3A1E48 55%,#5A1626 100%)}
html.rm-sea.sea-look:not(:has(body.guide)):has(#play:not([hidden])),
html.rm-sea.sea-look:not(:has(body.guide)):has(#play:not([hidden])) body,
html.rm-sea.sea-look.board-storm:not(:has(body.guide)):has(#play:not([hidden])),
html.rm-sea.sea-look.board-storm:not(:has(body.guide)):has(#play:not([hidden])) body,
html.rm-sea.sea-look.board-squall:not(:has(body.guide)):has(#play:not([hidden])),
html.rm-sea.sea-look.board-squall:not(:has(body.guide)):has(#play:not([hidden])) body{
  background:#1B2552;background-image:linear-gradient(180deg,#1B2552 0%,#3A1E48 55%,#5A1626 100%);background-attachment:fixed}
html.rm-sea.sea-look:not(:has(body.guide)):has(#play:not([hidden])) #play,
html.rm-sea.sea-look:not(:has(body.guide)):has(#play:not([hidden])) #play.play-cover,
html.rm-sea.sea-look:not(:has(body.guide)):has(#play:not([hidden])) .play-bleed,
html.rm-sea.sea-look.board-storm:not(:has(body.guide)):has(#play:not([hidden])) #play.play-cover,
html.rm-sea.sea-look.board-storm:not(:has(body.guide)):has(#play:not([hidden])) .play-bleed,
html.rm-sea.sea-look.board-squall:not(:has(body.guide)):has(#play:not([hidden])) #play.play-cover,
html.rm-sea.sea-look.board-squall:not(:has(body.guide)):has(#play:not([hidden])) .play-bleed{
  background-color:#1B2552;background-image:linear-gradient(180deg,#1B2552 0%,#3A1E48 55%,#5A1626 100%)}
html.rm-sea .seamap{background:transparent}
.rm-sea-close{position:fixed;z-index:30;top:calc(env(safe-area-inset-top) + 118px);right:max(14px,env(safe-area-inset-right));width:36px;height:36px;border-radius:50%;border:2px solid #FEFBEF;background:rgba(20,16,40,.35);color:#FEFBEF;font-size:1.1rem;cursor:pointer}
.rm-sea-veil{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;background:rgba(12,8,20,.45)}
.rm-sea-veil[hidden]{display:none!important}
.rm-sea-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:#fff;font-family:"BebasPro",Impact,sans-serif;font-size:1.6rem;text-align:center}
.rm-boat-rise{animation:rmBoatRise 1.3s cubic-bezier(.2,.8,.2,1) both}
@keyframes rmBoatRise{0%{transform:translateY(28px) scale(.4);opacity:0}100%{transform:none;opacity:1}}
