/* Driftwood Raft: ink, cream, river teal, vermilion accents. */
.dr{--ink:#10222a;--cream:#f4e8cb;--teal:#1b4a56;--teal2:#2a6470;--red:#d9482b;--gold:#f1c35a;--sand:#c8ab72;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;color:var(--cream)}
.dr button{font-family:inherit;touch-action:manipulation;-webkit-tap-highlight-color:transparent;cursor:pointer}
.dr button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.dr-stage{position:relative;width:100%;min-height:400px;background:var(--teal);border:3px solid var(--ink);border-radius:14px;overflow:hidden;
  box-shadow:0 4px 0 #0a161b;overscroll-behavior:contain}
#field{display:block;touch-action:none;cursor:crosshair;background:var(--teal)}

.dr-hud{position:absolute;left:0;right:0;top:0;padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) 0 max(8px,env(safe-area-inset-left));pointer-events:none}
.dr-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.dr-reg{background:rgba(16,34,42,.82);border:2px solid var(--ink);border-radius:10px;padding:5px 10px;display:flex;flex-direction:column;line-height:1.2;min-height:44px;justify-content:center}
.dr-reg b{font-size:.95rem}.dr-reg span{font-size:.72rem;color:var(--sand);font-variant-numeric:tabular-nums}
.dr-ico{pointer-events:auto;width:44px;height:44px;border-radius:10px;border:2px solid var(--ink);background:var(--cream);color:var(--ink);display:grid;place-items:center}
.dr-ico .x{display:none}.dr-ico.off .x{display:inline}.dr-ico.off .w{display:none}
.dr-bar{height:8px;margin-top:6px;background:rgba(16,34,42,.8);border:2px solid var(--ink);border-radius:6px;overflow:hidden}
.dr-bar i{display:block;height:100%;width:0;background:var(--gold)}
.dr-res{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.dr-res .r{display:inline-flex;align-items:center;gap:6px;background:rgba(16,34,42,.82);border:2px solid var(--ink);border-radius:8px;padding:2px 8px;font-size:.85rem;min-height:26px}
.dr-res .r b{font-variant-numeric:tabular-nums}
.dr-res .r i{width:12px;height:12px;border-radius:3px;border:2px solid var(--ink);display:inline-block}
.r-plank i{background:#e6cd98}.r-reed i{background:#3f6b3a}.r-tin i{background:#9aa7ab;border-radius:50%}
.r-score{margin-left:auto}
.dr-tags{display:flex;gap:6px;margin-top:6px}
.tag{font-size:.72rem;font-weight:700;padding:3px 8px;border-radius:6px;border:2px solid var(--ink);color:var(--ink)}
.tag.bad{background:var(--red);color:#fff}.tag.warn{background:var(--gold)}

.dr-hint{position:absolute;left:50%;transform:translateX(-50%);bottom:12px;max-width:92%;background:var(--cream);color:var(--ink);border:2px solid var(--ink);border-radius:10px;padding:8px 12px;font-weight:700;font-size:.9rem;text-align:center;pointer-events:none;animation:drpulse 1.4s ease-in-out infinite}
@keyframes drpulse{50%{transform:translateX(-50%) translateY(-3px)}}
.dr-toast{position:absolute;left:50%;top:46%;transform:translate(-50%,6px);background:rgba(16,34,42,.92);border:2px solid var(--sand);border-radius:10px;padding:8px 12px;font-size:.88rem;text-align:center;max-width:90%;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none}
.dr-toast.on{opacity:1;transform:translate(-50%,0)}

.dr-ov{position:absolute;inset:0;background:rgba(16,34,42,.78);display:flex;align-items:flex-start;justify-content:center;overflow-y:auto;padding:max(10px,env(safe-area-inset-top)) 10px max(10px,env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
.dr-ov[hidden]{display:none}
.card{width:100%;max-width:360px;background:var(--cream);color:var(--ink);border:3px solid var(--ink);border-radius:14px;padding:14px;margin:auto 0;box-shadow:0 4px 0 #0a161b}
.card h2{font-size:1.6rem;line-height:1.1;letter-spacing:.01em}
.card h3{font-size:.8rem;text-transform:uppercase;letter-spacing:.08em;margin:12px 0 6px;color:#5b4a2a}
.card .sub{margin:4px 0 10px;font-size:.95rem}
.voy{display:flex;flex-direction:column;background:#e6d5a8;border:2px solid var(--ink);border-radius:10px;padding:8px 10px;margin-bottom:10px;font-size:.85rem}
.voy b{font-size:1rem}
.big{width:100%;min-height:52px;font-size:1.1rem;font-weight:800;background:var(--red);color:#fff;border:3px solid var(--ink);border-radius:12px;box-shadow:0 3px 0 var(--ink)}
.big:active{transform:translateY(2px);box-shadow:0 1px 0 var(--ink)}
.ghost{width:100%;min-height:44px;margin-top:8px;font-weight:700;background:transparent;color:var(--ink);border:2px solid var(--ink);border-radius:10px}
.bp{margin-top:8px;font-size:.82rem;font-weight:700;color:#7a5a12}
.stats{display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:10px;font-size:.82rem}.stats b{font-variant-numeric:tabular-nums}
.how{margin-top:10px;font-size:.76rem;line-height:1.4;color:#4a3d22}
.perks{display:grid;gap:6px}
.perk{display:grid;grid-template-columns:1fr auto;grid-template-areas:'t c' 'p c';align-items:center;gap:2px 8px;min-height:48px;text-align:left;background:#fff8e6;border:2px solid var(--ink);border-radius:10px;padding:6px 10px;color:var(--ink)}
.perk .pt{grid-area:t;display:flex;flex-direction:column;line-height:1.2}.perk .pt i{font-style:normal;font-size:.72rem;color:#5b4a2a}
.perk .pips{grid-area:p;display:flex;gap:3px}.perk .pips u{width:10px;height:10px;border:2px solid var(--ink);border-radius:50%;display:block}.perk .pips u.on{background:var(--red)}
.perk .pc{grid-area:c;font-weight:800;font-size:.8rem}
.perk:disabled{opacity:.5;cursor:default}
.res{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:8px 0}
.res div{background:#e6d5a8;border:2px solid var(--ink);border-radius:8px;padding:6px 8px}
.res dt{font-size:.7rem;text-transform:uppercase;letter-spacing:.06em;color:#5b4a2a}.res dd{font-size:1.05rem;font-weight:800;font-variant-numeric:tabular-nums}
.goals{list-style:none;margin:8px 0;display:grid;gap:4px}
.goals li{font-weight:700;font-size:.9rem;padding:4px 8px;border:2px solid var(--ink);border-radius:8px;background:#e6d5a8}
.goals li.ok{background:var(--gold)}.goals li.no{opacity:.75}
.goals[hidden]{display:none}
.goalpre{margin-top:4px;font-size:.78rem;color:#5b4a2a}
.dr-ov.win .card h2{color:#9a2f16}

.dr-pal{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:8px;padding-bottom:max(0px,env(safe-area-inset-bottom))}
.pal{position:relative;min-height:62px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;background:var(--cream);color:var(--ink);border:3px solid var(--ink);border-radius:10px;padding:3px 2px;touch-action:none!important}
.pal .pal-ic{display:block}
.pal .n{font-size:.72rem;font-weight:800;line-height:1.1}
.pal .k{font-size:.68rem;line-height:1.1;display:flex;gap:3px;align-items:center;min-height:13px}
.pal.sel{background:var(--gold);box-shadow:0 0 0 3px var(--red)}
.pal.poor{opacity:.62}.pal.locked{opacity:.4}
.cost{display:inline-flex;align-items:center;gap:2px;font-weight:800}
.cost::before{content:'';width:8px;height:8px;border:1.5px solid var(--ink);display:inline-block}
.c-plank::before{background:#e6cd98;border-radius:2px}.c-reed::before{background:#3f6b3a;border-radius:2px}.c-tin::before{background:#9aa7ab;border-radius:50%}
.dr-ghost{position:fixed;z-index:50;width:44px;height:44px;margin:-22px 0 0 -22px;pointer-events:none;opacity:.85}

@media (prefers-reduced-motion:reduce){.dr-hint{animation:none}.dr-toast{transition:none}}
@media (min-width:480px){.dr-pal{grid-template-columns:repeat(8,1fr)}}

/* full screen: fill the stage, no scroll */
html.pip-immersive .game-wrap,html.pip-native .game-wrap,.game-wrap:fullscreen{max-width:none;width:100%;height:100%;padding:6px;display:flex;flex-direction:column;overflow:hidden}
html.pip-immersive .game-wrap .dr,.game-wrap:fullscreen .dr{flex:1;min-height:0;display:flex;flex-direction:column}
html.pip-immersive .dr-stage,.game-wrap:fullscreen .dr-stage{flex:1;min-height:0;min-width:0;height:auto}
html.pip-immersive .dr-pal,.game-wrap:fullscreen .dr-pal{flex:none;padding-bottom:max(2px,env(safe-area-inset-bottom))}
html.pip-immersive .dr-pal .pal,.game-wrap:fullscreen .dr-pal .pal{min-height:56px}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .game-wrap .dr,.game-wrap:fullscreen .dr{flex-direction:row;gap:6px}
  html.pip-immersive .dr-pal,.game-wrap:fullscreen .dr-pal{grid-template-columns:repeat(2,minmax(0,1fr));width:170px;margin-top:0;overflow-y:auto;align-content:start}
  html.pip-immersive .dr-pal .pal,.game-wrap:fullscreen .dr-pal .pal{min-height:48px}
}
/* full screen landscape: title card in two columns so the crew upgrades sit beside Set off */
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive #ovTitle,html.pip-native #ovTitle{align-items:center}
  html.pip-immersive #ovTitle .card,html.pip-native #ovTitle .card{max-width:760px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);column-gap:14px;align-content:start;margin:0}
  html.pip-immersive #ovTitle .card>*,html.pip-native #ovTitle .card>*{grid-column:1}
  html.pip-immersive #ovTitle .card>h3,html.pip-native #ovTitle .card>h3{grid-column:2;grid-row:1;margin-top:0}
  html.pip-immersive #ovTitle .perks,html.pip-native #ovTitle .perks{grid-column:2;grid-row:2 / span 6;max-height:calc(100vh - 110px);overflow-y:auto;align-content:start}
  html.pip-immersive #ovTitle .how,html.pip-native #ovTitle .how{display:none}
  html.pip-immersive #ovTitle .card h2,html.pip-native #ovTitle .card h2{font-size:1.3rem}
  html.pip-immersive #ovTitle .card .bp[hidden],html.pip-native #ovTitle .card .bp[hidden]{display:none}
}
