/* Styles for the features in their own ui/ modules: 👻 ghost races (ui/ghost.js), 🤝 co-op (ui/coop.js),
   the tutorial (ui/tutorial.js) and the hideout's storage (ui/storage.js). Uses the colours from style.css (:root). */

/* ---------- 👻 Ghost races ---------- */
.lb-race { margin-left: 6px; padding: 1px 6px; font-size: 13px; line-height: 1.4; border-radius: 99px; border: 1px solid #6c5ab8; background: rgba(140, 110, 255, .15); color: inherit; cursor: pointer; vertical-align: middle; }
.lb-race:hover { background: rgba(140, 110, 255, .35); }

/* ---------- 🤝 Co-op ---------- */
.coop-box { max-width: 620px; }
.coop-err { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(229, 83, 75, .15); border: 1px solid rgba(229, 83, 75, .5); }
.coop-day { display: flex; gap: 10px; align-items: center; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.coop-day-ico { font-size: 26px; }
.coop-day small { display: block; color: var(--muted); }
.coop-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.coop-join { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 6px; }
.coop-join label { flex: 1 0 100%; font-weight: 700; }
.coop-join input { flex: 1; min-width: 0; max-width: 160px; font: 700 20px/1 monospace; letter-spacing: 4px; text-transform: uppercase; text-align: center; padding: 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.coop-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.coop-wait { color: var(--muted); }
.coop-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; }
.coop-maps button { text-align: left; padding: 8px 10px; }
.coop-maps small { display: block; color: var(--muted); text-transform: capitalize; }
.coop-back { margin-top: 10px; }
.coop-code-box { display: flex; align-items: center; gap: 12px; margin: 10px 0; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px dashed var(--accent); }
.coop-code-box small { color: var(--muted); }
.coop-code { font: 800 30px/1 monospace; letter-spacing: 6px; color: var(--accent); flex: 1; }
.coop-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.coop-side { padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.coop-side h4 { margin: 0 0 6px; }
.coop-team { display: flex; flex-wrap: wrap; gap: 2px; min-height: 40px; margin-bottom: 6px; }
.coop-team img { width: 40px; height: 40px; image-rendering: pixelated; }
.coop-team i { color: var(--muted); font-size: 12px; }
#coop-start { width: 100%; }
.coop-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 5px 10px; margin-bottom: 6px; border-radius: 10px; background: linear-gradient(90deg, rgba(60, 110, 220, .25), rgba(60, 200, 120, .18)); border: 1px solid rgba(110, 170, 255, .45); font-size: 13px; }
main:has(> .coop-bar:not(.hidden)) { --coop-h: 42px; }
.coop-bar small { color: var(--muted); margin-left: 4px; }
.cb-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e5534b; vertical-align: middle; }
.cb-dot.on { background: #5ee07a; box-shadow: 0 0 6px #5ee07a; }
.cb-money { font-weight: 800; color: #ffd84a; }
.cb-emotes { margin-left: auto; display: flex; gap: 4px; }
.cb-emotes button { padding: 2px 7px; font-size: 16px; line-height: 1.2; border-radius: 8px; }
#shop .card.coop-partner { display: none; }
@media (max-width: 560px) {
  .coop-choices, .coop-sides { grid-template-columns: 1fr; }
  .coop-bar { font-size: 12px; gap: 8px; }
  .cb-emotes button { padding: 2px 5px; font-size: 14px; }
}
.coop-theirs { margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; font-size: 12px; background: rgba(110, 170, 255, .15); border: 1px dashed rgba(110, 170, 255, .6); }
/* Whose Pokémon is whose (the bar's key), inviting friends, and invites to you. */
.cb-legend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.cb-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #fff; }
.cb-legend .cb-you { background: rgb(40, 150, 70); }
.cb-legend .cb-them { background: rgb(50, 100, 200); margin-left: 6px; }
.coop-invite { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.coop-invite h4 { margin: 10px 0 6px; }
.coop-lock { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.coop-friends { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 30vh; overflow: auto; }
.coop-friends li { display: flex; align-items: center; gap: 8px; }
.coop-friends li span { font-weight: 700; }
.coop-friends li small { color: var(--muted); }
.coop-friends li button { margin-left: auto; padding: 4px 12px; }
.coop-invites { position: fixed; right: 12px; bottom: 12px; z-index: 60; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 24px)); }
.coop-invite-card { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid rgba(110, 170, 255, .7); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.coop-invite-card > div { flex: 1; min-width: 150px; }
.fr-btn.fr-coop { white-space: nowrap; }

/* ---------- 🗄️ Hideout storage (ui/storage.js) ---------- */
.store-box { max-width: 680px; }
.store-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 10px; }
.store-tabs button { flex: 1 1 0; min-width: 0; padding: 6px 4px; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.store-tabs button span { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.store-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.store-body { max-height: min(62vh, 560px); overflow: auto; padding-right: 2px; }
.store-body h4 { margin: 12px 0 6px; }
.store-body h4 small { color: var(--muted); font-weight: 400; }
.store-body .bd-search { width: 100%; margin: 4px 0; }
.st-note { font-size: 12px; color: var(--muted); margin: 6px 0; }
.st-cap { display: flex; align-items: center; gap: 10px; }
.st-meter { flex: 1; height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--border); }
.st-meter i { display: block; height: 100%; background: linear-gradient(90deg, #7ac74c, #f7d02c); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.st-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); text-align: center; }
.st-ico { height: 52px; display: flex; align-items: center; justify-content: center; }
.st-ico img { max-height: 52px; max-width: 72px; image-rendering: pixelated; }
.st-name { font-size: 12px; font-weight: 700; line-height: 1.2; }
.st-card small { color: var(--muted); font-size: 11px; }
.st-acts { display: flex; gap: 4px; margin-top: 4px; }
.st-acts button { padding: 3px 8px; font-size: 12px; }
.st-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.st-stats.st-stats-5 { grid-template-columns: repeat(5, 1fr); }
.st-filter { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.st-filter button { padding: 4px 10px; font-size: 12px; border-radius: 99px; }
.st-filter button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.st-card.st-out { border-color: rgba(247, 208, 44, .6); }
.st-tower .tw-trophies h3 { display: none; }
.st-tower .tw-trophies { margin: 0; }
.st-stats div { padding: 8px 4px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); text-align: center; }
.st-stats b { display: block; font-size: 20px; }
.st-stats small { color: var(--muted); font-size: 11px; }
.st-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.st-item { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.st-item img { width: 32px; height: 32px; image-rendering: pixelated; }
.st-item small { display: block; color: var(--muted); font-size: 11px; }
@media (max-width: 560px) {
  .store-tabs button span { display: none; }
  .store-tabs button { font-size: 18px; }
  .st-stats, .st-stats.st-stats-5 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 🎓 Tutorial (ui/tutorial.js) ---------- */
.tut-bubble { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9000; width: min(520px, calc(100vw - 24px));
  padding: 12px 14px; border-radius: 14px; background: var(--panel); color: var(--text); border: 2px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 14px; line-height: 1.45; }
.tut-bubble.tut-top { bottom: auto; top: max(12px, env(safe-area-inset-top)); }
.tut-bubble.tut-pop { animation: tut-pop .25s ease-out; }
@keyframes tut-pop { from { opacity: 0; transform: translate(-50%, 8px); } }
.tut-n { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 99px; background: var(--accent); color: #fff; font-weight: 800; font-size: 11px; }
.tut-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.tut-btns button { padding: 6px 12px; }
.tut-spot { outline: 3px solid var(--accent) !important; outline-offset: 3px; border-radius: 10px; animation: tut-glow 1.4s ease-in-out infinite; position: relative; z-index: 5; }
@keyframes tut-glow { 50% { outline-color: #f7d02c; box-shadow: 0 0 18px rgba(247, 208, 44, .55); } }
body.reduce-motion .tut-spot, body.reduce-motion .tut-bubble { animation: none; }
.help-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.help-top span { color: var(--muted); font-size: 13px; }

/* ---------- 👕 Trainer look: grouped rows (src/game.js renderLook) ---------- */
.look-options .look-group { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 2px; }
.look-options .look-group:first-child { margin-top: 0; }
.look-box { max-height: 92vh; overflow: auto; }
.look-random { display: block; margin: 12px auto 0; }
/* Co-op: who's ready for the next wave, and emotes/notes floating over the map (real seconds, not game time). */
.cb-ready { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; }
.cb-rt { padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--muted); }
.cb-rt.on { background: rgba(94, 224, 122, .2); color: #a8f0b8; }
.coop-floats { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 6; width: max-content; max-width: 92%; }
.coop-float { padding: 5px 14px; border-radius: 999px; background: rgba(10, 20, 45, .85); border: 1px solid rgba(110, 170, 255, .5); color: #fff; font-size: 14px; text-align: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); animation: coop-float var(--ms, 4500ms) ease-out both; }
.coop-float.emote { font-size: 15px; font-weight: 800; }
.coop-float .cf-emote { font-size: 28px; vertical-align: middle; }
@keyframes coop-float { 0% { opacity: 0; transform: translateY(8px) scale(.9); } 6% { opacity: 1; transform: none; } 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .coop-float { animation: none; } }
