Skip to content

lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server

JavaScript

feat: introduce World Planner and App Launcher features with new UI, logic, and URL management.

Supun Lakmalc00dce5376b0
diff --git a/demo/demo-8.png b/demo/demo-8.png
new file mode 100644
index 0000000..ad865f0
Binary files /dev/null and b/demo/demo-8.png differ
diff --git a/index.html b/index.html
index ed2a9f4..9c19c3e 100644
--- a/index.html
+++ b/index.html
@@ -109,9 +109,24 @@
<button id="copy-link" type="button">Copy link</button>
<button id="share-qr" type="button">Share QR</button>
<button id="lock-btn" type="button">Lock</button>
- <a class="action-link" href="https://github.com/supunlakmal/hash-calendar" target="_blank" rel="noreferrer">
- <i class="fa-brands fa-github" aria-hidden="true"></i>
- <span>GitHub</span>
+ <button id="world-planner-btn" type="button" class="accent-btn" aria-label="Open World Planner">
+ <i class="fa-solid fa-earth-americas"></i> Planner
+ </button>
+
+ <!-- App Launcher -->
+ <div class="app-launcher-container">
+ <button id="app-launcher-btn" type="button" class="icon-btn" aria-label="Google Apps" aria-expanded="false">
+ <i class="fa-solid fa-grip"></i>
+ </button>
+ <div id="app-launcher-menu" class="app-launcher-menu hidden">
+ <!-- Content injected by JS -->
+ </div>
+ </div>
+
+ <div class="action-divider desktop-only"></div>
+
+ <i class="fa-brands fa-github" aria-hidden="true"></i>
+ <span>GitHub</span>
</a>
</div>
</div>
@@ -364,6 +379,43 @@
</div>
</dialog>
+ <div id="world-planner-modal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="wp-modal-title">
+ <div class="modal-backdrop"></div>
+ <div class="planner-modal-card">
+ <header class="planner-header">
+ <div class="planner-controls-left">
+ <h3 id="wp-modal-title" class="hidden">World Planner</h3>
+ <div class="wp-search-wrapper">
+ <i class="fa-solid fa-earth-americas wp-search-icon"></i>
+ <input id="wp-add-zone" type="text" placeholder="Add timezone (e.g. London)" autocomplete="off">
+ <ul id="wp-tz-results" class="tz-results hidden" role="listbox"></ul>
+ </div>
+ </div>
+ <div class="planner-controls-right">
+ <input id="wp-date-picker" type="date" class="wp-date-picker">
+ <button id="wp-format-toggle" type="button" class="accent-btn" style="min-width: 50px;">12h</button>
+ <button id="wp-close" type="button" class="icon-btn" aria-label="Close">x</button>
+ </div>
+ </header>
+
+ <div id="wp-grid" class="modal-grid-container">
+ <!-- JS will populate this -->
+ <!-- Example Structure for dev reference:
+ <div class="city-col">
+ <div class="wp-row-header home-row">...</div>
+ <div class="wp-row-header">...</div>
+ </div>
+ <div class="timeline-col">
+ <div class="timeline-track">
+ <div class="scrubber-overlay"></div>
+ <div class="wp-row-cells">...</div>
+ </div>
+ </div>
+ -->
+ </div>
+ </div>
+ </div>
+
<div id="toast-container" class="toast-container" aria-live="polite" aria-atomic="true"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
diff --git a/modules/app_launcher.js b/modules/app_launcher.js
new file mode 100644
index 0000000..348cc66
--- /dev/null
+++ b/modules/app_launcher.js
@@ -0,0 +1,115 @@
+/**
+ * AppLauncher Module
+ * Handles the "Waffle" menu for ecosystem apps.
+ */
+export class AppLauncher {
+ constructor() {
+ this.apps = [
+ {
+ name: 'Spreadsheet Live',
+ url: 'https://spreadsheetlive.netlify.app/',
+ icon: 'fa-solid fa-table-cells', // FontAwesome icon
+ color: '#107c41' // Excel-like green
+ }
+ // Future apps can be added here
+ ];
+
+ this.init();
+ }
+
+ init() {
+ this.renderMenu();
+ this.setupEventListeners();
+ }
+
+ renderMenu() {
+ const menuContainer = document.getElementById('app-launcher-menu');
+ if (!menuContainer) return;
+
+ // Clear existing content just in case
+ menuContainer.innerHTML = '';
+
+ // Create the grid
+ const grid = document.createElement('div');
+ grid.className = 'app-launcher-grid';
+
+ this.apps.forEach(app => {
+ const appItem = document.createElement('a');
+ appItem.href = app.url;
+ appItem.target = '_blank';
+ appItem.className = 'app-launcher-item';
+ appItem.rel = 'noopener noreferrer';
+
+ appItem.innerHTML = `
+ <div class="app-icon-wrapper" style="background-color: ${app.color}15; color: ${app.color}">
+ <i class="${app.icon}"></i>
+ </div>
+ <span class="app-name">${app.name}</span>
+ `;
+
+ grid.appendChild(appItem);
+ });
+
+ menuContainer.appendChild(grid);
+
+ // Add a "More apps" placeholder if needed or footer
+ // For now, simple grid is fine.
+ }
+
+ setupEventListeners() {
+ const btn = document.getElementById('app-launcher-btn');
+ const menu = document.getElementById('app-launcher-menu');
+
+ if (!btn || !menu) return;
+
+ // Toggle menu
+ btn.addEventListener('click', (e) => {
+ e.stopPropagation();
+ const isHidden = menu.classList.contains('hidden');
+
+ // Close all other open menus/modals if needed (optional, keeping it simple)
+
+ if (isHidden) {
+ this.openMenu();
+ } else {
+ this.closeMenu();
+ }
+ });
+
+ // Close on click outside
+ document.addEventListener('click', (e) => {
+ if (!menu.classList.contains('hidden') && !menu.contains(e.target) && !btn.contains(e.target)) {
+ this.closeMenu();
+ }
+ });
+
+ // Close on Escape key
+ document.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape' && !menu.classList.contains('hidden')) {
+ this.closeMenu();
+ }
+ });
+ }
+
+ openMenu() {
+ const menu = document.getElementById('app-launcher-menu');
+ const btn = document.getElementById('app-launcher-btn');
+
+ menu.classList.remove('hidden');
+ btn.setAttribute('aria-expanded', 'true');
+
+ // Slight animation class if we want to trigger CSS animations explicitly
+ // CSS transition on opacity/transform is usually enough if not display:none
+ // But since we use 'hidden' (display: none), we might need a small timeout for transition
+ // For simplicity, we'll rely on CSS animation on the 'hidden' removal or separate class.
+ // Let's assume standard toggle for now.
+ }
+
+ closeMenu() {
+ const menu = document.getElementById('app-launcher-menu');
+ const btn = document.getElementById('app-launcher-btn');
+
+ menu.classList.add('hidden');
+ btn.setAttribute('aria-expanded', 'false');
+ }
+}
diff --git a/modules/hashcalUrlManager.js b/modules/hashcalUrlManager.js
index ab2a75d..ae0787d 100644
--- a/modules/hashcalUrlManager.js
+++ b/modules/hashcalUrlManager.js
@@ -4,7 +4,7 @@ const HASH_PREFIX = "ENC:";
const DEFAULT_TITLE = "hash-calendar";
const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];
-const DEFAULT_SETTINGS = { d: 0, m: 0, v: "month" };
+const DEFAULT_SETTINGS = { d: 0, m: 0, v: "month" };
function arraysEqual(a, b) {
return a.length === b.length && a.every((v, i) => v === b[i]);
@@ -43,19 +43,29 @@ function compactState(state) {
});
}
- if (state.s) {
- const hasView = typeof state.s.v === "string" && state.s.v !== DEFAULT_SETTINGS.v;
- if (state.s.d !== DEFAULT_SETTINGS.d || state.s.m !== DEFAULT_SETTINGS.m || hasView) {
- out.s = state.s;
- }
- }
-
- if (Array.isArray(state.timezones) && state.timezones.length) {
- out.z = state.timezones;
- }
-
- return out;
-}
+ if (state.s) {
+ const hasView = typeof state.s.v === "string" && state.s.v !== DEFAULT_SETTINGS.v;
+ if (state.s.d !== DEFAULT_SETTINGS.d || state.s.m !== DEFAULT_SETTINGS.m || hasView) {
+ out.s = state.s;
+ }
+ }
+
+ if (Array.isArray(state.timezones) && state.timezones.length) {
+ out.z = state.timezones;
+ }
+
+ if (state.mp) {
+ const mp = state.mp;
+ const mini = {};
+ if (mp.home) mini.h = mp.home;
+ if (mp.zones && mp.zones.length) mini.z = mp.zones;
+ if (mp.sel) mini.s = mp.sel;
+ if (mp.date) mini.d = mp.date;
+ if (Object.keys(mini).length) out.mp = mini;
+ }
+
+ return out;
+}
function ensureLzString() {
if (!window.LZString) {
diff --git a/planner_logic.js b/planner_logic.js
new file mode 100644
index 0000000..f1710cc
--- /dev/null
+++ b/planner_logic.js
@@ -0,0 +1,451 @@
+
+/* --- World Planner Logic --- */
+
+function initWorldPlanner() {
+ if (ui.worldPlannerBtn) {
+ ui.worldPlannerBtn.addEventListener("click", openWorldPlanner);
+ }
+ if (ui.wpClose) {
+ ui.wpClose.addEventListener("click", closeWorldPlanner);
+ }
+ if (ui.wpAddZone) {
+ ui.wpAddZone.addEventListener("keydown", (e) => {
+ if (e.key === "Enter") handlePlannerAddZone();
+ });
+ }
+ if (ui.wpGrid) {
+ ui.wpGrid.addEventListener("mousemove", handleScrubberMove);
+ ui.wpGrid.addEventListener("click", handleScrubberClick);
+ ui.wpGrid.addEventListener("click", handlePlannerGridClick);
+ }
+ if (ui.wpDatePicker) {
+ ui.wpDatePicker.addEventListener("change", (e) => {
+ if (!state.mp) state.mp = { h: null, z: [], s: null, d: null };
+ state.mp.d = e.target.value;
+ scheduleSave();
+ renderWorldPlanner();
+ });
+ }
+ if (ui.wpCopyLink) {
+ ui.wpCopyLink.addEventListener("click", handleCopyLink);
+ }
+}
+
+function openWorldPlanner() {
+ if (!ui.worldPlannerModal) return;
+
+ // Initialize state if empty
+ if (!state.mp || (!state.mp.home && !state.mp.z.length)) {
+ const local = getLocalZone();
+ state.mp = {
+ h: local,
+ z: ["UTC", "America/New_York", "Asia/Tokyo", "Europe/London"].filter(z => z !== local).slice(0, 3),
+ s: null,
+ d: new Date().toISOString().split("T")[0]
+ };
+ }
+
+ // Set date picker
+ if (ui.wpDatePicker) {
+ ui.wpDatePicker.value = state.mp.d || new Date().toISOString().split("T")[0];
+ }
+
+ ui.worldPlannerModal.classList.remove("hidden");
+ renderWorldPlanner();
+}
+
+function closeWorldPlanner() {
+ if (ui.worldPlannerModal) {
+ ui.worldPlannerModal.classList.add("hidden");
+ }
+ scheduleSave();
+}
+
+function handlePlannerAddZone() {
+ const val = ui.wpAddZone.value.trim();
+ if (!val) return;
+ // Simple search match for now
+ const match = AVAILABLE_ZONES.find(z => z.toLowerCase().includes(val.toLowerCase()));
+
+ if (match) {
+ if (state.mp.h !== match && !state.mp.z.includes(match)) {
+ state.mp.z.push(match);
+ scheduleSave();
+ renderWorldPlanner();
+ ui.wpAddZone.value = "";
+ }
+ } else {
+ showToast("Timezone not found", "error");
+ }
+}
+
+function handlePlannerGridClick(e) {
+ // Handle remove/promote buttons
+ const btn = e.target.closest(".wp-control-btn");
+ if (!btn) return;
+
+ const action = btn.dataset.action;
+ const zone = btn.dataset.zone;
+
+ if (action === "remove") {
+ state.mp.z = state.mp.z.filter(z => z !== zone);
+ scheduleSave();
+ renderWorldPlanner();
+ } else if (action === "promote") {
+ const oldHome = state.mp.h;
+ state.mp.h = zone;
+ state.mp.z = state.mp.z.filter(z => z !== zone);
+ if (oldHome) state.mp.z.unshift(oldHome);
+ scheduleSave();
+ renderWorldPlanner();
+ }
+}
+
+function getPlannerDate() {
+ return state.mp.d ? new Date(state.mp.d) : new Date();
+}
+
+function renderWorldPlanner() {
+ if (!ui.wpGrid) return;
+
+ ui.wpGrid.innerHTML = "";
+
+ // 1. Build City Column
+ const cityCol = document.createElement("div");
+ cityCol.className = "city-col";
+
+ // Home Row
+ if (state.mp.h) {
+ cityCol.appendChild(createPlannerCityHeader(state.mp.h, true));
+ }
+
+ // Zones
+ state.mp.z.forEach(zone => {
+ cityCol.appendChild(createPlannerCityHeader(zone, false));
+ });
+
+ ui.wpGrid.appendChild(cityCol);
+
+ // 2. Build Timeline Column
+ const timelineCol = document.createElement("div");
+ timelineCol.className = "timeline-col";
+
+ const track = document.createElement("div");
+ track.className = "timeline-track";
+
+ // Scrubber Overlay
+ const scrubber = document.createElement("div");
+ scrubber.className = "scrubber-overlay hidden"; // Hidden until hover/select
+ scrubber.id = "wp-scrubber";
+ track.appendChild(scrubber);
+
+ const ghost = document.createElement("div");
+ ghost.className = "ghost-scrubber hidden";
+ ghost.id = "wp-ghost";
+ track.appendChild(ghost);
+
+ // Render Rows
+ const baseDate = getPlannerDate(); // This is "Day 0" at 00:00 relative to Home Zone?
+ // Actually WTB usually shows 24h starting from "now" or 00:00 of selected day.
+ // Let's stick to 00:00 - 23:00 of the selected date in HOME zone.
+
+ if (state.mp.h) {
+ track.appendChild(createPlannerRow(state.mp.h, baseDate, true));
+ }
+ state.mp.z.forEach(zone => {
+ track.appendChild(createPlannerRow(zone, baseDate, false));
+ });
+
+ timelineCol.appendChild(track);
+ ui.wpGrid.appendChild(timelineCol);
+
+ // Restore selection if any
+ if (state.mp.s) {
+ // If selected time exists, position scrubber
+ // Calculate which slot index corresponds to state.mp.s (timestamp)
+ // But wait, the grid is fixed 0-23h of the HOME DAY.
+ // So 's' must be converted to an hour index relative to Home 00:00.
+
+ // We update logic later. For now, let's just render.
+ updateScrubberPositionFromState();
+ }
+}
+
+function createPlannerCityHeader(zone, isHome) {
+ const div = document.createElement("div");
+ div.className = `wp-row-header${isHome ? " home-row" : ""}`;
+
+ const info = getZoneInfo(zone); // existing helper
+
+ // Controls
+ if (!isHome) {
+ const controls = document.createElement("div");
+ controls.className = "wp-row-controls";
+ controls.innerHTML = `
+ <button class="wp-control-btn" data-action="promote" data-zone="${zone}" title="Make Home"><i class="fa-solid fa-arrow-up"></i></button>
+ <button class="wp-control-btn" data-action="remove" data-zone="${zone}" title="Remove"><i class="fa-solid fa-xmark"></i></button>
+ `;
+ div.appendChild(controls);
+ } else {
+ // Home icon
+ const icon = document.createElement("div");
+ icon.style.position = "absolute";
+ icon.style.top = "6px";
+ icon.style.right = "6px";
+ icon.innerHTML = `<i class="fa-solid fa-house wp-home-icon"></i>`;
+ div.appendChild(icon);
+ }
+
+ const nameRow = document.createElement("div");
+ nameRow.className = "wp-city-name";
+ nameRow.textContent = info.name;
+
+ const timeRow = document.createElement("div");
+ timeRow.className = "wp-city-time";
+ timeRow.textContent = info.time; // Current time
+
+ const badge = document.createElement("div");
+ badge.className = "wp-offset-badge";
+ badge.textContent = `UTC${info.offset}`;
+
+ div.append(badge, nameRow, timeRow);
+ return div;
+}
+
+function createPlannerRow(zone, baseDate, isHome) {
+ const row = document.createElement("div");
+ row.className = "wp-row-cells";
+
+ // Calculate offset relative to Home
+ // This is tricky. simpler to just iterate 0..23 hours of the Base Date in Home Zone,
+ // and convert each to the target Zone.
+
+ const homeZone = state.mp.h;
+ if (!homeZone) return row;
+
+ // Construct the 24 hours in Home Zone
+ // Helper to format date in specific zone
+ const fmt = (date, z) => new Intl.DateTimeFormat("en-US", {
+ timeZone: z,
+ hour: "numeric",
+ hour12: true,
+ weekday: "short",
+ day: "numeric",
+ month: "short"
+ });
+
+ const getParts = (date, z) => {
+ const parts = new Intl.DateTimeFormat("en-US", {
+ timeZone: z,
+ hour: "numeric",
+ hourCycle: "h23",
+ weekday: "short",
+ day: "numeric",
+ month: "short"
+ }).formatToParts(date);
+ const p = {};
+ parts.forEach(x => p[x.type] = x.value);
+ return p;
+ };
+
+ const year = baseDate.getFullYear();
+ const month = baseDate.getMonth();
+ const day = baseDate.getDate();
+
+ for (let h = 0; h < 24; h++) {
+ const cell = document.createElement("div");
+
+ // Create a date object that corresponds to Year-Month-Day Hour:00:00 in HOME zone.
+ // We can't just new Date() because that uses local.
+ // We need to find the timestamp that corresponds to that wall time.
+ // Hack: use a library or localized string parsing.
+ // Since we don't have Moment/Luxon, we use the "date string hack".
+
+ const isoString = `${year}-${String(month+1).padStart(2,'0')}-${String(day).padStart(2,'0')}T${String(h).padStart(2,'0')}:00:00`;
+ // Create date as if it's UTC, then shift by offset? No.
+ // Use formatToParts on a guessed timestamp until it matches? Expensive.
+
+ // Easier approach:
+ // 1. Get offset of Home Zone for that date.
+ // 2. Get offset of Target Zone.
+ // 3. Difference is the shift.
+
+ // Actually, simply iterating standard UTC timestamps starting from the Home Zone's start of day is safest.
+ // Let's find Home Zone's start of day timestamp.
+ const homeStartStr = new Date(year, month, day).toLocaleString("en-US", { timeZone: homeZone });
+ // This doesn't give me the timestamp.
+
+ // Let's just mock it by iterating 24 hours from a base UTC time and adjusting display?
+ // No, "Exact Match" requires correct hours.
+
+ // Efficient Native way:
+ // Create an arbitrary UTC date. Format it to Home Zone. See if it matches 00:00.
+ // Better:
+ // `new Date(string)` parses as local.
+ // Use `toLocaleString` to get the wall time in a zone.
+
+ // Optimization:
+ // Just loop 0..23 integers.
+ // For the Home Row, cells are just 0..23.
+ // For Other Rows:
+ // Calculate offset diff.
+ // TargetHour = (HomeHour - HomeOffset + TargetOffset) % 24.
+
+ // Getting offsets in JS native is `getTimezoneOffset` but that's only for local.
+ // For arbitrary zones, we can use the formatted string 'GMT-5' etc from `getZoneInfo` helper.
+ // Helper `getZoneInfo(zone)` returns `{ offset: "+05:30", ... }`.
+
+ const homeInfo = getZoneInfo(homeZone);
+ const targetInfo = getZoneInfo(zone);
+
+ // Parse offsets to minutes
+ const parseOff = (s) => {
+ const sign = s[0] === '-' ? -1 : 1;
+ const [hh, mm] = s.slice(1).split(':').map(Number);
+ return sign * (hh * 60 + mm);
+ };
+
+ const hOff = parseOff(homeInfo.offset); // e.g. +330
+ const tOff = parseOff(targetInfo.offset); // e.g. -300
+
+ const diffMins = tOff - hOff; // Difference in minutes
+
+ // Target time in minutes from start of day = (h * 60) + diffMins
+ let targetMins = (h * 60) + diffMins;
+
+ // Normalize to day boundaries
+ let dayShift = 0;
+ if (targetMins < 0) {
+ targetMins += 24 * 60;
+ dayShift = -1;
+ } else if (targetMins >= 24 * 60) {
+ targetMins -= 24 * 60;
+ dayShift = 1;
+ }
+
+ const tHour = Math.floor(targetMins / 60);
+ const tMin = targetMins % 60; // Usually 0 or 30 or 45
+
+ // Class logic
+ let cls = "wp-cell";
+ // Business: 9-17 (Standard) or 8-18? Req says 8-17 business, 18-22 active.
+ // Using Target Hour.
+ if (tHour >= 8 && tHour <= 17) cls += " business";
+ else if (tHour >= 18 && tHour <= 22) cls += " active";
+ else cls += " sleep";
+
+ if (dayShift !== 0 && h === 0) {
+ // Start of row shows date if different?
+ }
+
+ // Crossing midnight logic for cell style
+ if (tHour === 0 && tMin === 0) {
+ cls += " date-boundary";
+ // Show date
+ // Calculate date string
+ // If dayShift is 1, it's Next Day.
+ }
+
+ cell.className = cls;
+ cell.dataset.h = h; // Home Hour index
+
+ // Content
+ if (tHour === 0 && tMin === 0) {
+ // Show date abbrev
+ const d = new Date(baseDate);
+ d.setDate(d.getDate() + dayShift);
+ cell.textContent = d.toLocaleDateString('en-US', { day: 'numeric', month: 'short' }).toUpperCase();
+ } else {
+ // Format: "9 am" or "14:30"
+ let label = "";
+ const ampm = tHour >= 12 ? "pm" : "am";
+ const h12 = tHour % 12 || 12;
+ if (tMin > 0) {
+ label = `${h12}:${String(tMin).padStart(2,'0')}`; // Space tight
+ } else {
+ label = `${h12} ${ampm}`;
+ }
+ // Compact for cells
+ if (isHome) {
+ cell.textContent = tMin > 0 ? `${h12}:${tMin}` : `${h12} ${ampm}`;
+ } else {
+ cell.textContent = tMin > 0 ? `${h12}:${tMin}` : `${h12}`; // Just number for comparison rows to save space?
+ }
+ }
+
+ row.appendChild(cell);
+ }
+
+ return row;
+}
+
+function handleScrubberMove(e) {
+ const track = ui.wpGrid.querySelector(".timeline-track");
+ const ghost = document.getElementById("wp-ghost");
+ if (!track || !ghost) return;
+
+ // Calculate index
+ const rect = track.getBoundingClientRect();
+ const x = e.clientX - rect.left - track.scrollLeft; // Adjust for scroll?
+ // Wait, track scrolls. `e.clientX` is viewport. `rect.left` is viewport.
+ // Inside `timeline-col`, `timeline-track` might be wide.
+ // Actually the hover is relative to the `timeline-truck` element?
+
+ // The event listener is on `wpGrid`.
+ // We need to find the `.wp-cell` under mouse.
+ const cell = e.target.closest(".wp-cell");
+ if (!cell) {
+ ghost.classList.add("hidden");
+ return;
+ }
+
+ const widthStr = window.getComputedStyle(cell).width; // e.g. "40px"
+ // Actually simpler: cell.offsetLeft
+ ghost.style.left = `${cell.offsetLeft}px`;
+ ghost.classList.remove("hidden");
+}
+
+function handleScrubberClick(e) {
+ const cell = e.target.closest(".wp-cell");
+ if (!cell) return;
+
+ const hIndex = cell.dataset.h;
+ // Set selection state
+ // Convert hIndex (0..23) of Home Zone to Timestamp
+ // We need a timestamp for persistence.
+ // timestamp = startOfBaseDate(HomeZone) + hIndex * 3600 * 1000
+
+ // For now simple numeric logic? The schema calls for 'sel' as timestamp.
+ const baseDate = getPlannerDate();
+ // Assume HomeZone start of day + hIndex hours.
+ // Approximation for prototype:
+ const ts = baseDate.getTime() + (hIndex * 3600 * 1000);
+
+ state.mp.s = ts;
+ scheduleSave();
+
+ updateScrubberPositionFromState();
+}
+
+function updateScrubberPositionFromState() {
+ const scrubber = document.getElementById("wp-scrubber");
+ if (!scrubber || !state.mp.s) {
+ if (scrubber) scrubber.classList.add("hidden");
+ return;
+ }
+
+ // Convert state.mp.s to hour index
+ const baseDate = getPlannerDate();
+ const diff = state.mp.s - baseDate.getTime();
+ const hIndex = Math.floor(diff / (3600 * 1000));
+
+ if (hIndex >= 0 && hIndex < 24) {
+ // Find a cell with this index
+ // Since all rows are aligned, any row's cell works.
+ const cell = ui.wpGrid.querySelector(`.wp-cell[data-h="${hIndex}"]`);
+ if (cell) {
+ scrubber.style.left = `${cell.offsetLeft}px`;
+ scrubber.classList.remove("hidden");
+ }
+ }
+}
diff --git a/script.js b/script.js
index 813a42c..1d0f133 100644
--- a/script.js
+++ b/script.js
@@ -15,6 +15,7 @@ import {
renderYearView,
} from "./modules/calendarRender.js";
import { parseIcs } from "./modules/icsImporter.js";
+import { AppLauncher } from "./modules/app_launcher.js";
const DEFAULT_COLORS = ["#ff6b6b", "#ffd43b", "#4dabf7", "#63e6be", "#9775fa"];
const DEFAULT_VIEW = "month";
@@ -29,6 +30,7 @@ const DEFAULT_STATE = {
v: DEFAULT_VIEW,
},
timezones: [],
+ mp: { h: null, z: [], s: null, d: null },
};
const DEBOUNCE_MS = 500;
@@ -185,6 +187,17 @@ function normalizeState(raw) {
next.timezones = normalizeTimezones(zones);
}
+ if (raw.mp && typeof raw.mp === "object") {
+ next.mp = {
+ h: typeof raw.mp.h === "string" ? raw.mp.h : null,
+ z: Array.isArray(raw.mp.z) ? normalizeTimezones(raw.mp.z) : [],
+ s: Number(raw.mp.s) || null,
+ d: typeof raw.mp.d === "string" ? raw.mp.d : null,
+ };
+ } else {
+ next.mp = cloneState(DEFAULT_STATE.mp);
+ }
+
return next;
}
@@ -272,6 +285,15 @@ function cacheElements() {
ui.tzSidebar = document.getElementById("timezone-ruler");
ui.sidePanelClose = document.getElementById("side-panel-close");
ui.tzSidebarClose = document.getElementById("tz-sidebar-close");
+
+ // World Planner
+ ui.worldPlannerBtn = document.getElementById("world-planner-btn");
+ ui.worldPlannerModal = document.getElementById("world-planner-modal");
+ ui.wpClose = document.getElementById("wp-close");
+ ui.wpAddZone = document.getElementById("wp-add-zone");
+ ui.wpGrid = document.getElementById("wp-grid");
+ ui.wpDatePicker = document.getElementById("wp-date-picker");
+ ui.wpCopyLink = document.getElementById("wp-copy-link");
}
function showToast(message, type = "info") {
@@ -1472,6 +1494,8 @@ async function init() {
updateFocusButton(false);
render();
initTimezones();
+ initWorldPlanner();
+ new AppLauncher();
if (isEncryptedHash() && !lockState.unlocked) {
attemptUnlock();
@@ -1483,3 +1507,424 @@ if (document.readyState === "loading") {
} else {
init();
}
+
+/* --- World Planner Logic --- */
+
+function initWorldPlanner() {
+ if (ui.worldPlannerBtn) {
+ ui.worldPlannerBtn.addEventListener("click", openWorldPlanner);
+ }
+ if (ui.wpClose) {
+ ui.wpClose.addEventListener("click", closeWorldPlanner);
+ }
+ if (ui.wpAddZone) {
+ ui.wpAddZone.addEventListener("input", handleWpTzInput);
+ ui.wpAddZone.addEventListener("keydown", (e) => {
+ // Focus navigation for results? For now simple
+ });
+ }
+
+ if (!ui.wpFormatToggle) {
+ ui.wpFormatToggle = document.getElementById("wp-format-toggle");
+ if (ui.wpFormatToggle) ui.wpFormatToggle.addEventListener("click", togglePlannerFormat);
+ }
+
+ if (ui.wpGrid) {
+ ui.wpGrid.addEventListener("mousemove", handleScrubberMove);
+ ui.wpGrid.addEventListener("click", handleScrubberClick);
+ ui.wpGrid.addEventListener("click", handlePlannerGridClick);
+ }
+ if (ui.wpDatePicker) {
+ ui.wpDatePicker.addEventListener("change", (e) => {
+ if (!state.mp) state.mp = { h: null, z: [], s: null, d: null, f24: false };
+ state.mp.d = e.target.value;
+ scheduleSave();
+ renderWorldPlanner();
+ });
+ }
+ // Copy Link removed from UI
+}
+
+function openWorldPlanner() {
+ if (!ui.worldPlannerModal) return;
+
+ // Initialize state if empty
+ if (!state.mp || (!state.mp.h && !state.mp.z.length)) {
+ const local = getLocalZone();
+ state.mp = {
+ h: local,
+ z: ["UTC", "America/New_York", "Asia/Tokyo", "Europe/London"].filter(z => z !== local).slice(0, 3),
+ s: null,
+ d: new Date().toISOString().split("T")[0],
+ f24: false // Default to 12h
+ };
+ }
+
+ // Ensure f24 exists for legacy states
+ if (state.mp.f24 === undefined) state.mp.f24 = false;
+
+ // Set date picker
+ if (ui.wpDatePicker) {
+ ui.wpDatePicker.value = state.mp.d || new Date().toISOString().split("T")[0];
+ }
+
+ updatePlannerFormatBtn();
+
+ ui.worldPlannerModal.classList.remove("hidden");
+ renderWorldPlanner();
+}
+
+function closeWorldPlanner() {
+ if (ui.worldPlannerModal) {
+ ui.worldPlannerModal.classList.add("hidden");
+ }
+ scheduleSave();
+}
+
+function handleWpTzInput(e) {
+ const term = e.target.value.trim().toLowerCase();
+ const list = document.getElementById("wp-tz-results");
+ if (!list) return;
+
+ if (term.length < 2) {
+ list.innerHTML = "";
+ list.classList.add("hidden");
+ return;
+ }
+
+ const offsetQuery = parseOffsetSearchTerm(term); // Reuse existing helper
+ const existing = new Set([state.mp.h, ...state.mp.z]);
+
+ const matches = AVAILABLE_ZONES.filter((zone) => {
+ if (existing.has(zone)) return false;
+ const zoneLower = zone.toLowerCase();
+ if (zoneLower.includes(term)) return true;
+
+ // Offset match reuse
+ if (offsetQuery) {
+ const zoneOffset = getZoneInfo(zone).offset;
+ const normalized = `${offsetQuery.hours}:${String(offsetQuery.minutes).padStart(2, "0")}`;
+ if (offsetQuery.hasMinutes) {
+ if (offsetQuery.sign) return zoneOffset === `${offsetQuery.sign}${normalized}`;
+ return zoneOffset === `+${normalized}` || zoneOffset === `-${normalized}`;
+ }
+ if (offsetQuery.sign) return zoneOffset.startsWith(`${offsetQuery.sign}${offsetQuery.hours}`);
+ return zoneOffset.startsWith(`+${offsetQuery.hours}`) || zoneOffset.startsWith(`-${offsetQuery.hours}`);
+ }
+ return false;
+ }).slice(0, 12);
+
+ renderWpTzResults(matches);
+}
+
+function renderWpTzResults(results) {
+ const list = document.getElementById("wp-tz-results");
+ if (!list) return;
+ list.innerHTML = "";
+
+ if (!results.length) {
+ list.classList.add("hidden");
+ return;
+ }
+
+ results.forEach(zone => {
+ const li = document.createElement("li");
+ const button = document.createElement("button");
+ button.type = "button";
+ button.className = "tz-result-btn"; // Reuse existing style class
+
+ const info = getZoneInfo(zone);
+ const name = document.createElement("span");
+ name.className = "tz-result-name";
+ name.textContent = zone;
+
+ const offset = document.createElement("span");
+ offset.className = "tz-result-offset";
+ offset.textContent = `UTC${info.offset}`;
+
+ button.append(name, offset);
+
+ button.addEventListener("click", () => {
+ addPlannerZone(zone);
+ list.classList.add("hidden");
+ if (ui.wpAddZone) ui.wpAddZone.value = "";
+ });
+
+ li.appendChild(button);
+ list.appendChild(li);
+ });
+
+ list.classList.remove("hidden");
+}
+
+function addPlannerZone(zone) {
+ if (state.mp.h !== zone && !state.mp.z.includes(zone)) {
+ state.mp.z.push(zone);
+ scheduleSave();
+ renderWorldPlanner();
+ }
+}
+
+function handlePlannerGridClick(e) {
+ // Handle remove/promote buttons
+ const btn = e.target.closest(".wp-control-btn");
+ if (!btn) return;
+
+ const action = btn.dataset.action;
+ const zone = btn.dataset.zone;
+
+ if (action === "remove") {
+ state.mp.z = state.mp.z.filter(z => z !== zone);
+ scheduleSave();
+ renderWorldPlanner();
+ } else if (action === "promote") {
+ const oldHome = state.mp.h;
+ state.mp.h = zone;
+ state.mp.z = state.mp.z.filter(z => z !== zone);
+ if (oldHome) state.mp.z.unshift(oldHome);
+ scheduleSave();
+ renderWorldPlanner();
+ }
+}
+
+function getPlannerDate() {
+ return state.mp.d ? new Date(state.mp.d) : new Date();
+}
+
+function renderWorldPlanner() {
+ if (!ui.wpGrid) return;
+
+ ui.wpGrid.innerHTML = "";
+
+ // 1. Build City Column
+ const cityCol = document.createElement("div");
+ cityCol.className = "city-col";
+
+ // Home Row
+ if (state.mp.h) {
+ cityCol.appendChild(createPlannerCityHeader(state.mp.h, true));
+ }
+
+ // Zones
+ state.mp.z.forEach(zone => {
+ cityCol.appendChild(createPlannerCityHeader(zone, false));
+ });
+
+ ui.wpGrid.appendChild(cityCol);
+
+ // 2. Build Timeline Column
+ const timelineCol = document.createElement("div");
+ timelineCol.className = "timeline-col";
+
+ const track = document.createElement("div");
+ track.className = "timeline-track";
+
+ // Scrubber Overlay
+ const scrubber = document.createElement("div");
+ scrubber.className = "scrubber-overlay hidden"; // Hidden until hover/select
+ scrubber.id = "wp-scrubber";
+ track.appendChild(scrubber);
+
+ const ghost = document.createElement("div");
+ ghost.className = "ghost-scrubber hidden";
+ ghost.id = "wp-ghost";
+ track.appendChild(ghost);
+
+ // Render Rows
+ const baseDate = getPlannerDate();
+
+ if (state.mp.h) {
+ track.appendChild(createPlannerRow(state.mp.h, baseDate, true));
+ }
+ state.mp.z.forEach(zone => {
+ track.appendChild(createPlannerRow(zone, baseDate, false));
+ });
+
+ timelineCol.appendChild(track);
+ ui.wpGrid.appendChild(timelineCol);
+
+ // Restore selection if any
+ if (state.mp.s) {
+ updateScrubberPositionFromState();
+ }
+}
+
+function createPlannerCityHeader(zone, isHome) {
+ const div = document.createElement("div");
+ div.className = `wp-row-header${isHome ? " home-row" : ""}`;
+
+ const info = getZoneInfo(zone); // existing helper
+
+ // Controls
+ if (!isHome) {
+ const controls = document.createElement("div");
+ controls.className = "wp-row-controls";
+ controls.innerHTML = `
+ <button class="wp-control-btn" data-action="promote" data-zone="${zone}" title="Make Home"><i class="fa-solid fa-arrow-up"></i></button>
+ <button class="wp-control-btn" data-action="remove" data-zone="${zone}" title="Remove"><i class="fa-solid fa-xmark"></i></button>
+ `;
+ div.appendChild(controls);
+ } else {
+ // Home icon
+ const icon = document.createElement("div");
+ icon.style.position = "absolute";
+ icon.style.top = "6px";
+ icon.style.right = "6px";
+ icon.innerHTML = `<i class="fa-solid fa-house wp-home-icon"></i>`;
+ div.appendChild(icon);
+ }
+
+ const nameRow = document.createElement("div");
+ nameRow.className = "wp-city-name";
+ nameRow.textContent = info.name;
+
+ const timeRow = document.createElement("div");
+ timeRow.className = "wp-city-time";
+ timeRow.textContent = info.time; // Current time
+
+ const badge = document.createElement("div");
+ badge.className = "wp-offset-badge";
+ badge.textContent = `UTC${info.offset}`;
+
+ div.append(badge, nameRow, timeRow);
+ return div;
+}
+
+function createPlannerRow(zone, baseDate, isHome) {
+ const row = document.createElement("div");
+ row.className = "wp-row-cells";
+
+ const homeZone = state.mp.h;
+ if (!homeZone) return row;
+
+ const homeInfo = getZoneInfo(homeZone);
+ const targetInfo = getZoneInfo(zone);
+
+ const parseOff = (s) => {
+ const sign = s[0] === '-' ? -1 : 1;
+ const [hh, mm] = s.slice(1).split(':').map(Number);
+ return sign * (hh * 60 + mm);
+ };
+
+ const hOff = parseOff(homeInfo.offset);
+ const tOff = parseOff(targetInfo.offset);
+ const diffMins = tOff - hOff;
+
+ const is24h = !!state.mp.f24;
+
+ for (let h = 0; h < 24; h++) {
+ const cell = document.createElement("div");
+
+ let targetMins = (h * 60) + diffMins;
+ let dayShift = 0;
+ if (targetMins < 0) {
+ targetMins += 24 * 60;
+ dayShift = -1;
+ } else if (targetMins >= 24 * 60) {
+ targetMins -= 24 * 60;
+ dayShift = 1;
+ }
+
+ const tHour = Math.floor(targetMins / 60);
+ const tMin = targetMins % 60;
+
+ let cls = "wp-cell";
+ if (tHour >= 8 && tHour <= 17) cls += " business";
+ else if (tHour >= 18 && tHour <= 22) cls += " active";
+ else cls += " sleep";
+
+ if (tHour === 0 && tMin === 0) {
+ cls += " date-boundary";
+ }
+
+ cell.className = cls;
+ cell.dataset.h = h;
+
+ if (tHour === 0 && tMin === 0) {
+ const d = new Date(baseDate);
+ d.setDate(d.getDate() + dayShift);
+ cell.textContent = d.toLocaleDateString('en-US', { day: 'numeric', month: 'short' }).toUpperCase();
+ } else {
+ if (is24h) {
+ cell.textContent = tMin > 0 ? `${tHour}:${String(tMin).padStart(2,'0')}` : `${tHour}`;
+ } else {
+ const ampm = tHour >= 12 ? "pm" : "am";
+ const h12 = tHour % 12 || 12;
+ if (tMin > 0) {
+ cell.textContent = `${h12}:${String(tMin).padStart(2,'0')}`;
+ } else {
+ // Only show am/pm for home zone or first occurrence
+ cell.textContent = isHome ? `${h12} ${ampm}` : `${h12}`;
+ }
+ }
+ }
+ row.appendChild(cell);
+ }
+ return row;
+}
+
+function handleScrubberMove(e) {
+ const track = ui.wpGrid.querySelector(".timeline-track");
+ const ghost = document.getElementById("wp-ghost");
+ if (!track || !ghost) return;
+
+ const cell = e.target.closest(".wp-cell");
+ if (!cell) {
+ ghost.classList.add("hidden");
+ return;
+ }
+
+ ghost.style.left = `${cell.offsetLeft}px`;
+ ghost.classList.remove("hidden");
+}
+
+function handleScrubberClick(e) {
+ const cell = e.target.closest(".wp-cell");
+ if (!cell) return;
+
+ const hIndex = Number(cell.dataset.h);
+ const baseDate = getPlannerDate();
+ const ts = baseDate.getTime() + (hIndex * 3600 * 1000);
+
+ state.mp.s = ts;
+ scheduleSave();
+ updateScrubberPositionFromState();
+}
+
+function updateScrubberPositionFromState() {
+ const scrubber = document.getElementById("wp-scrubber");
+ if (!scrubber || !state.mp || !state.mp.s) {
+ if (scrubber) scrubber.classList.add("hidden");
+ return;
+ }
+
+ const baseDate = getPlannerDate();
+ const diff = state.mp.s - baseDate.getTime();
+ const hIndex = Math.floor(diff / (3600 * 1000));
+
+ if (hIndex >= 0 && hIndex < 24) {
+ const cell = ui.wpGrid.querySelector(`.wp-cell[data-h="${hIndex}"]`);
+ if (cell) {
+ scrubber.style.left = `${cell.offsetLeft}px`;
+ scrubber.classList.remove("hidden");
+ }
+ } else {
+ scrubber.classList.add("hidden");
+ }
+}
+
+function togglePlannerFormat() {
+ if (!state.mp) return;
+ state.mp.f24 = !state.mp.f24;
+ updatePlannerFormatBtn();
+ scheduleSave();
+ renderWorldPlanner();
+}
+
+function updatePlannerFormatBtn() {
+ const btn = document.getElementById("wp-format-toggle");
+ if (btn) {
+ btn.textContent = state.mp && state.mp.f24 ? "24h" : "12h";
+ }
+}
+
diff --git a/styles.css b/styles.css
index 0a74413..801e309 100644
--- a/styles.css
+++ b/styles.css
@@ -1680,3 +1680,461 @@ button:disabled {
display: flex;
}
}
+
+/* --- World Planner Modal & Grid --- */
+
+.planner-modal-card {
+ background: var(--panel);
+ width: 95vw;
+ max-width: 1200px; /* Wide format for the timeline */
+ border-radius: 12px;
+ border: 1px solid var(--border);
+ box-shadow: var(--shadow-md);
+ display: flex;
+ flex-direction: column;
+ height: 85vh; /* Occupy most of height */
+ overflow: hidden;
+ position: relative;
+ animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
+}
+
+.planner-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 12px 16px;
+ border-bottom: 1px solid var(--border);
+ background: var(--panel);
+ flex-shrink: 0;
+ gap: 16px;
+}
+
+.planner-controls-left, .planner-controls-right {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+
+/* Planner Search Input */
+.wp-search-wrapper {
+ position: relative;
+ display: flex;
+ align-items: center;
+ width: 260px;
+}
+
+.wp-search-icon {
+ position: absolute;
+ left: 10px;
+ color: var(--muted);
+ font-size: 0.8rem;
+ pointer-events: none;
+ z-index: 2;
+}
+
+#wp-add-zone {
+ width: 100%;
+ padding: 8px 12px 8px 32px;
+ border-radius: 6px;
+ border: 1px solid var(--border-soft);
+ background: var(--panel-2);
+ color: var(--text);
+ font-size: 0.9rem;
+}
+
+#wp-add-zone:focus {
+ outline: 2px solid var(--accent);
+ background: var(--panel);
+}
+
+/* Reusing .tz-results styles but positioned for WP */
+#wp-tz-results.tz-results {
+ position: absolute;
+ top: 100%;
+ left: 0;
+ right: 0;
+ margin-top: 4px;
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 8px;
+ box-shadow: var(--shadow-md);
+ max-height: 300px;
+ overflow-y: auto;
+ z-index: 50;
+ list-style: none;
+ padding: 0;
+}
+
+/* Planner Content Grid */
+.modal-grid-container {
+ display: grid;
+ grid-template-columns: 200px 1fr; /* Fixed City Col, Scrollable Timeline */
+ flex: 1;
+ overflow: hidden; /* Manage overflow internally */
+ position: relative;
+}
+
+/* Left Column: City Headers */
+.city-col {
+ background: var(--panel);
+ border-right: 1px solid var(--border);
+ overflow-y: hidden; /* Synced with JS if needed, but flex row usually fits */
+ display: flex;
+ flex-direction: column;
+ z-index: 10; /* Stick on top of scroll */
+ box-shadow: 2px 0 5px rgba(0,0,0,0.05);
+}
+
+.wp-row-header {
+ height: 60px; /* Fixed height for alignment */
+ padding: 8px 16px;
+ border-bottom: 1px solid var(--border-soft);
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ position: relative;
+ background: var(--panel);
+}
+
+/* Home Row distinctive style */
+.wp-row-header.home-row {
+ background: var(--panel-2);
+}
+
+.wp-city-name {
+ font-weight: 700;
+ font-size: 0.95rem;
+ color: var(--text);
+ display: flex;
+ align-items: center;
+ gap: 6px;
+}
+
+.wp-home-icon {
+ font-size: 0.8rem;
+ color: var(--text);
+}
+
+.wp-city-time {
+ font-size: 1.2rem;
+ font-weight: 600;
+ font-family: var(--font-display);
+ color: var(--text);
+}
+
+.wp-city-date {
+ font-size: 0.7rem;
+ color: var(--muted);
+}
+
+.wp-offset-badge {
+ font-size: 0.7rem;
+ color: var(--muted);
+ font-weight: 600;
+}
+
+/* Controls (hover only) */
+.wp-row-controls {
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ display: none; /* Show on hover */
+ gap: 4px;
+}
+
+.wp-row-header:hover .wp-row-controls {
+ display: flex;
+}
+
+.wp-control-btn {
+ background: transparent;
+ border: none;
+ font-size: 0.7rem;
+ color: var(--muted);
+ cursor: pointer;
+ padding: 4px;
+ border-radius: 4px;
+}
+
+.wp-control-btn:hover {
+ background: var(--border-soft);
+ color: var(--danger);
+}
+
+/* Right Column: Timeline Track */
+.timeline-col {
+ overflow-x: auto;
+ overflow-y: auto; /* Allow vertical scroll if many rows */
+ position: relative;
+ background: var(--bg);
+ cursor: crosshair;
+}
+
+.timeline-track {
+ display: flex;
+ flex-direction: column;
+ min-width: 960px; /* 24 hours * 40px */
+ position: relative;
+}
+
+.wp-row-cells {
+ display: flex;
+ height: 60px;
+ border-bottom: 1px solid var(--border-soft);
+}
+
+.wp-cell {
+ flex: 0 0 4.16666%; /* 100% / 24 */
+ min-width: 40px;
+ border-right: 1px solid rgba(0,0,0,0.05);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 0.75rem;
+ font-weight: 600;
+ color: var(--muted);
+ position: relative;
+ user-select: none;
+}
+
+/* Color Aesthetic "Exact Match" */
+/* Business Hours: 8am - 5pm */
+.wp-cell.business {
+ background: #E3F2FD; /* Light Blue */
+ color: #1565C0; /* Dark Blue Text */
+}
+[data-theme="dark"] .wp-cell.business {
+ background: #1e3a8a;
+ color: #bfdbfe;
+}
+
+/* Active Hours (Evening): 6pm - 10pm */
+.wp-cell.active {
+ background: #BBDEFB; /* Slightly darker blue */
+ color: #0D47A1;
+}
+[data-theme="dark"] .wp-cell.active {
+ background: #172554;
+ color: #93c5fd;
+}
+
+/* Sleep Hours: 11pm - 7am */
+.wp-cell.sleep {
+ background: repeating-linear-gradient(
+ 45deg,
+ var(--panel-2),
+ var(--panel-2) 5px,
+ var(--border-soft) 5px,
+ var(--border-soft) 10px
+ );
+ color: var(--muted);
+ opacity: 0.8;
+}
+
+/* Date Date Boundary */
+.wp-cell.date-boundary {
+ background: #FFF9C4 !important; /* Yellow */
+ color: #F57F17;
+}
+[data-theme="dark"] .wp-cell.date-boundary {
+ background: #422006 !important;
+ color: #fde047;
+}
+
+/* Scrubber Overlay */
+.scrubber-overlay {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 4.16666%; /* 1 cell width */
+ min-width: 40px;
+ border: 2px solid var(--text);
+ background: rgba(0,0,0,0.05); /* Transparent fill */
+ pointer-events: none; /* Click-through */
+ z-index: 20;
+ transition: transform 0.05s linear;
+ box-shadow: 0 0 0 9999px rgba(0,0,0,0.2); /* Dim everything else */
+}
+
+/* Ghost Scrubber (Hover) */
+.ghost-scrubber {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 4.16666%;
+ min-width: 40px;
+ border: 2px solid var(--muted); /* Lighter border */
+ background: transparent;
+ pointer-events: none;
+ z-index: 15;
+ transition: transform 0.05s linear;
+ opacity: 0.5;
+}
+
+/* Mobile Responsiveness for World Planner */
+@media (max-width: 768px) {
+ .planner-modal-card {
+ width: 100vw;
+ height: 100vh;
+ border-radius: 0;
+ }
+
+ .modal-grid-container {
+ grid-template-columns: 140px 1fr; /* Smaller city col */
+ }
+
+ .wp-row-header {
+ padding: 8px 8px;
+ }
+
+ .wp-city-time {
+ font-size: 1rem;
+ }
+
+ .wp-control-btn {
+ font-size: 1rem;
+ padding: 8px; /* Larger hit area */
+ }
+}
+
+.accent-btn {
+ background: var(--panel);
+ color: var(--accent);
+ border: 1px solid var(--accent);
+ border-radius: 6px;
+ padding: 7px 14px;
+ font-size: 0.85rem;
+ font-weight: 600;
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ cursor: pointer;
+ transition: all 0.15s ease;
+}
+
+.accent-btn:hover {
+ background: var(--accent-soft);
+}
+
+/* App Launcher (Waffle Menu) */
+.app-launcher-container {
+ position: relative;
+ display: flex;
+ align-items: center;
+}
+
+.app-launcher-menu {
+ position: absolute;
+ top: calc(100% + 12px);
+ right: -10px;
+ width: 320px;
+ background: var(--panel);
+ border: 1px solid var(--border);
+ border-radius: 16px;
+ box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08); /* Premium shadow */
+ padding: 16px;
+ z-index: 100;
+ transform-origin: top right;
+ animation: menu-pop 0.2s cubic-bezier(0.2, 0, 0, 1);
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+}
+
+/* Glassmorphism attempt */
+@supports (backdrop-filter: blur(12px)) {
+ .app-launcher-menu {
+ background: rgba(255, 255, 255, 0.85);
+ backdrop-filter: blur(12px);
+ -webkit-backdrop-filter: blur(12px);
+ }
+}
+
+body[data-theme="dark"] .app-launcher-menu {
+ background: #2b2c2f;
+}
+@supports (backdrop-filter: blur(12px)) {
+ body[data-theme="dark"] .app-launcher-menu {
+ background: rgba(43, 44, 47, 0.85);
+ }
+}
+
+
+.app-launcher-menu.hidden {
+ display: none;
+ animation: none;
+}
+
+@keyframes menu-pop {
+ 0% { opacity: 0; transform: scale(0.92) translateY(-8px); }
+ 100% { opacity: 1; transform: scale(1) translateY(0); }
+}
+
+.app-launcher-grid {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 12px;
+}
+
+.app-launcher-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 8px;
+ text-decoration: none;
+ color: var(--text);
+ padding: 12px 8px;
+ border-radius: 12px;
+ transition: background 0.15s ease, transform 0.1s ease;
+ text-align: center;
+}
+
+.app-launcher-item:hover {
+ background: var(--panel-2);
+ transform: translateY(-2px);
+}
+
+.app-icon-wrapper {
+ width: 48px;
+ height: 48px;
+ border-radius: 12px;
+ display: grid;
+ place-items: center;
+ font-size: 24px;
+ transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
+}
+
+.app-launcher-item:hover .app-icon-wrapper {
+ transform: scale(1.1);
+}
+
+.app-name {
+ font-size: 0.8rem;
+ font-weight: 500;
+ color: var(--text);
+ line-height: 1.2;
+}
+
+/* Mobile adjustments */
+@media (max-width: 768px) {
+ .app-launcher-menu {
+ position: fixed;
+ top: auto;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ width: 100%;
+ border-radius: 24px 24px 0 0;
+ transform-origin: bottom center;
+ animation: slide-up 0.3s cubic-bezier(0.2, 0, 0, 1);
+ border-bottom: none;
+ box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
+ }
+
+ @keyframes slide-up {
+ 0% { transform: translateY(100%); }
+ 100% { transform: translateY(0); }
+ }
+}
+
+