/* Hide decorative shield logo in header */
.logo-link { display: none; }
* { box-sizing: border-box; }
:root { --app-head-offset: 80px; }

/* Prop Settings overlay */
.prop-settings[aria-hidden="true"] { display: none; }
.prop-settings {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.prop-settings__panel {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-1);
  width: min(520px, 92vw);
  padding: 16px;
}
.prop-settings__panel h2 {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-heading);
}
.prop-settings__panel label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  color: var(--color-muted);
}
.prop-settings__group {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-1);
}
.prop-settings__group:last-of-type {
  margin-bottom: 16px;
}
.prop-settings__group-title {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-heading);
}
.prop-settings__section {
  margin-bottom: 12px;
}
.prop-settings__section:last-of-type {
  margin-bottom: 0;
}
.prop-settings__group-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.prop-settings__panel input[type="number"],
.prop-settings__panel input[type="text"],
.prop-settings__panel textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-1);
  font-family: var(--font-sans);
}
.prop-settings__panel textarea {
  resize: vertical;
  min-height: 60px;
}
.delay-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.delay-buttons input[type="number"] {
  width: 80px;
  flex-shrink: 0;
}
.button--small {
  padding: 6px 12px;
  font-size: 0.9rem;
}
.delay-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.prop-settings__countdown {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-accent);
  text-align: center;
}
.prop-settings__countdown[aria-hidden="true"] {
  display: none;
}
.prop-settings__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.button--schedule {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.button--cancel {
  background: var(--color-bg);
  color: var(--color-accent);
  border-color: var(--color-accent);
}
html, body { height: 100%; }
html { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* Prevent sideways scroll on iOS */
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Status bar */
.statusbar { display: none !important; }
.statusbar .dot { display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--color-muted); margin-left: 6px; }

/* Header */
.app-head { 
  max-width: var(--max-content); 
  margin: 0 auto; 
  display: grid; 
  grid-template-columns: 1fr auto 1fr; 
  align-items: center; 
  gap: var(--space-2); 
  padding: var(--space-2) var(--space-4); 
  position: sticky; 
  top: 0; 
  z-index: 50; 
  background: var(--color-bg); 
}
.logo { width: auto; height: 48px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.logo-link { display: none !important; align-items: center; text-decoration: none; border-radius: var(--radius-1); }
.logo-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.brand { display: contents; }
.brand__title { margin: 0; font-size: 2rem; letter-spacing: .06em; text-transform: uppercase; font-family: var(--font-brand); font-weight: 700; grid-column: 1; justify-self: start; white-space: nowrap; }
.brand__tag { margin: 0; color: var(--color-muted); font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; display:flex; align-items:center; gap:6px; grid-column: 2; justify-self: center; }
.header-action--messages { grid-column: 3; justify-self: end; }
.brand__tag .brand__shield { width: 16px; height: 16px; display:inline-flex; color: currentColor; /* knockout */ }
@keyframes throb { 0%, 100% { filter: saturate(0.9); } 50% { filter: saturate(1.25) brightness(1.02); } }

/* Header status pill */
.brand__tag .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  height: 22px;
  border-radius: 999px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .12em;
  font-size: .7rem;
  line-height: 1;
  /* Fallback gradient */
  background: linear-gradient(180deg, var(--color-ok-strong) 0%, var(--color-ok-strong) 60%, var(--color-ok) 100%);
  /* Enhanced gradient when supported */
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-ok-strong) 85%, #fff 15%) 0%, var(--color-ok-strong) 60%, var(--color-ok) 100%);
  border: 1px solid var(--color-ok-deep);
  color: var(--color-bg); /* knockout-style dark text */
  box-shadow: 0 1px 0 rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.08);
  animation: throb 2.6s ease-in-out infinite; /* animate background saturation */
}
/* Removed empty ruleset to satisfy linter */

/* Shield when placed inside the pill */
.brand__tag .status .brand__shield { width: 14px; height: 14px; }

/* Header action (Messages) */
.header-action { display:inline-flex; align-items:center; justify-content:center; padding: 6px 10px; border-radius: var(--radius-1); color: var(--color-text); text-decoration: none; border: 1px solid transparent; }
.header-action svg { width: 22px; height: 22px; stroke: var(--color-text); }
.header-action:focus-visible { border-color: var(--color-accent); outline: none; }

/* Double-size the Messages icon only */
.header-action--messages svg { width: 44px; height: 44px; }

/* App */
.app { max-width: var(--max-content); margin: 0 auto; padding: 0 var(--space-4) max(var(--space-4), env(safe-area-inset-bottom)); min-height: auto; overflow-x: hidden; }
/* iOS PWA safe-area: add top padding for status bar/notch when available */
@supports (padding: max(0px)) {
  .app-head { padding-top: calc(var(--space-2) + max(0px, env(safe-area-inset-top))); }
  /* Respect notch/rounded corners horizontally */
  .app { padding-left: calc(var(--space-4) + max(0px, env(safe-area-inset-left))); padding-right: calc(var(--space-4) + max(0px, env(safe-area-inset-right))); }
  .app-head { padding-left: calc(var(--space-4) + max(0px, env(safe-area-inset-left))); padding-right: calc(var(--space-4) + max(0px, env(safe-area-inset-right))); }
  /* On iOS, also cancel app padding including safe-area so tiles go edge-to-edge without causing overflow */
  #dashboard .menu {
    margin-left: calc(-1 * (var(--space-4) + max(0px, env(safe-area-inset-left))));
    margin-right: calc(-1 * (var(--space-4) + max(0px, env(safe-area-inset-right))));
  }
}
/* Explicitly increase top padding when launched standalone/fullscreen */
@media (display-mode: standalone), (display-mode: fullscreen) {
  /* Extra headroom under iOS status bar when installed */
  .app-head { padding-top: calc(var(--space-3) + max(var(--space-3), env(safe-area-inset-top))); }
  /* Bottom spacing for home indicator (no tab bar now) */
  .app { padding-bottom: max(var(--space-4), env(safe-area-inset-bottom)); }
}
.screen { display: none; scroll-margin-top: var(--app-head-offset); }
.screen.active { display: block; }
.section-head { padding: var(--space-2) 0 var(--space-2); border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line); margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: .06em; text-transform: uppercase; font-family: var(--font-heading); font-weight: 700; }
.section-sub { margin: 2px 0 0; color: var(--color-muted); font-size: .9rem; font-family: var(--font-mono); }
.section-actions { margin-top: var(--space-4); }

/* Menu tiles */
.menu { display:flex; flex-direction: column; gap: var(--space-3); margin-top: 0; flex: 1; }
.tile { position: relative; display:flex; flex-direction: row; align-items: center; gap: var(--space-3); padding: 20px 16px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-2); text-decoration:none; color: var(--color-text); box-shadow: var(--shadow-1); min-height: 120px; overflow: hidden; isolation: isolate; width: 100%; }
#dashboard .tile { flex: 1; min-height: 0; }
.tile:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.tile::before { content: ""; position: absolute; inset: 0; background: var(--tile-image, none) center / cover no-repeat; filter: saturate(.8) contrast(.95) brightness(.8); transform: scale(1.02); transition: transform .35s ease; z-index: 0; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16,21,27,.88) 0%, rgba(16,21,27,.68) 55%, rgba(16,21,27,0) 100%); z-index: 0; }
.tile:hover::before { transform: scale(1.06); }
.tile__icon { font-size: 1.5rem; position: relative; z-index: 1; }
.tile__icon svg { width: 28px; height: 28px; stroke: var(--color-text); }
.tile__label { font-weight: 700; font-size: 1rem; letter-spacing: .02em; position: relative; z-index: 1; }
/* Home menu shows every link as available */
#dashboard .tile[aria-disabled="true"] { opacity: 1; cursor: pointer; }
/* Edge-to-edge cards on dashboard: cancel app's side padding */
#dashboard .menu { margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4)); }
/* Dashboard container should expand to fit content (no forced flex stretching) */
#dashboard.screen.active { display: flex; flex-direction: column; height: calc(100dvh - 100px); }
/* Hide icons on dashboard tiles */
#dashboard .tile__icon { display: none; }
/* Larger title text for cards */
.tile__label { font-size: 1.35rem; line-height: 1.3; }
/* On dashboard, stack content so pills can sit above titles, left-aligned */
#dashboard .tile { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
#dashboard .pill { position: static; top: auto; right: auto; transform: none; display: inline-block; align-self: flex-start; margin: 0 0 2px 0; }
.pill { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; position: relative; z-index: 1; }
.pill--new { background: var(--color-accent); color: #fff; }
/* Dashboard tile images (remote placeholders; falls back gracefully) */
#dashboard a[href="#manual"] { --tile-image: url("../assets/manual.png"); }
#dashboard a[href="#calendar"] { --tile-image: url("../assets/calendar.png"); }
#dashboard #deeds-tile  { --tile-image: url("../assets/medals.png"); }
#dashboard a[href="#map2"] { --tile-image: url("../assets/map-area.jpg"); }
#dashboard a[href="#manifesto"] { --tile-image: url("../assets/minutemen_logo.png"); }
@media (prefers-reduced-data: reduce) {
  .tile::before { background: none !important; }
}

/* Dashboard footer */
.dashboard-footer { margin-top: var(--space-3); padding: var(--space-3) 0; text-align: center; }
.footer-link { display: inline-block; color: var(--color-text); text-decoration: none; font-weight: 600; font-size: 1rem; padding: var(--space-2); }
.footer-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.footer-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* iOS Safari: after the base rule above, re-apply safe-area-aware negative margins
   so edge-to-edge tiles don't cause a 1-2px horizontal scroll. Placed AFTER the
   base rule to win the cascade on Safari. */
@supports (padding: max(0px)) {
  #dashboard .menu {
    margin-left: calc(-1 * (var(--space-4) + max(0px, env(safe-area-inset-left))));
    margin-right: calc(-1 * (var(--space-4) + max(0px, env(safe-area-inset-right))));
  }
}

/* Buttons */
.button { display:inline-block; padding: 10px 14px; background: var(--color-surface); color: var(--color-text); border:1px solid var(--color-line); border-radius: var(--radius-1); text-decoration:none; }
.button:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Manifesto */
.scroll-copy { max-height: calc(100vh - 260px); overflow:auto; padding-right: 4px; }
.manifesto-list { font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.6; list-style: none; padding-left: 0; margin: 0; }
.manifesto-list li { padding: 10px 0; border-bottom: 1px dashed var(--color-line); }

/* Map */
.map-wrap { position: relative; height: 56vh; min-height: 320px; border: 1px solid var(--color-line); border-radius: var(--radius-2); overflow: hidden; background: #06090d; }
.map-image { position:absolute; inset:0; width:100%; height:100%; object-fit: cover; filter: contrast(1.05) brightness(0.9) saturate(0.8); }
.targets { position:absolute; inset:0; pointer-events:none; }
.target { position:absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); display:inline-flex; align-items:center; background: transparent; border: none; padding: 0; color: var(--color-text); font-size: .85rem; pointer-events:auto; box-shadow: none; }
/* Crosshair-style pin */
.target .dot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 2px rgba(194,59,59,.35), 0 0 10px rgba(194,59,59,.35); }
.target .dot::before, .target .dot::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(194,59,59,.5); }
.target .dot::before { width: 2px; height: 26px; border-radius: 2px; }
.target .dot::after { width: 26px; height: 2px; border-radius: 2px; opacity: .55; }
.target .dot { outline: 2px solid rgba(194,59,59,.35); outline-offset: 8px; }
.target .label { display:none; }
.target:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
/* HUD reticle */
.hud.reticle { position:absolute; inset:0; pointer-events:none; }

/* Popover */
.popover[aria-hidden="true"] { display: none; }
.popover { position: absolute; min-width: 220px; max-width: 80%; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-line); border-radius: var(--radius-2); box-shadow: var(--shadow-1); padding: 10px 12px; z-index: 30; }

/* Map popover positioned relative to map container */
#map-popover { position: absolute; z-index: 1000; }
.popover__header { font-weight: 700; margin-bottom: 6px; letter-spacing: .02em; font-size: 1.1rem; }
.popover__body { color: var(--color-text); font-size: .7rem; display:flex; flex-direction: column; gap: 6px; }
.popover__row { display:flex; align-items:center; gap: 8px; }
.popover__row svg { width: 16px; height: 16px; stroke: var(--color-text); }
.popover__row span { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .05em; }
.popover__arrow { position: absolute; width: 12px; height: 12px; background: var(--color-surface); border-left: 1px solid var(--color-line); border-top: 1px solid var(--color-line); transform: rotate(45deg); }
.popover[data-placement="top"] .popover__arrow { bottom: -6px; left: 50%; transform: translateX(-50%) rotate(225deg); }
.popover[data-placement="bottom"] .popover__arrow { top: -6px; left: 50%; transform: translateX(-50%) rotate(225deg); }
.popover[data-placement="left"] .popover__arrow { right: -6px; top: 50%; transform: translateY(-50%) rotate(225deg); }
.popover[data-placement="right"] .popover__arrow { left: -6px; top: 50%; transform: translateY(-50%) rotate(225deg); }

/* Map2 (Leaflet) overrides */
#map2 #leaflet-map { overflow: hidden; position: relative; border: 1px solid var(--color-line); border-radius: var(--radius-2); }
#map2 .leaflet-container { overflow: hidden; }
#map2 .leaflet-shadow-pane { display: none; }
#map2 .leaflet-popup-pane { z-index: 700; }
/* Darken the base imagery to boost target contrast */
#map2 .leaflet-overlay-pane img { filter: brightness(0.62) contrast(1.15) saturate(0.78); }
/* Subtle vignette for focus without obscuring center */
#map2 #leaflet-map::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 70% at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,.35) 100%); }

/* Dark-mode popup skin to match app popover */
.leaflet-popover .leaflet-popup-content-wrapper {
  background: var(--color-surface);
  color: var(--color-text);
}
.leaflet-popover .leaflet-popup-content { margin: 0; }
.leaflet-popover .leaflet-popup-tip { background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line); }
.leaflet-popover .leaflet-popup-close-button { display:none; color: var(--color-muted); }

/* Remove fixed margin - now handled by dynamic zoom-aware offset */

.leaflet-popup.leaflet-popover .leaflet-popup-tip-container {
  /* Center the arrow horizontally */
  left: 50% !important;
  margin-left: -6px !important;
}

/* Use existing popover content tokens inside Leaflet popup */
.leaflet-popover .popover__header { font-weight: 700; margin-bottom: 6px; letter-spacing: .02em; }
.leaflet-popover .popover__body { color: var(--color-muted); font-size: .9em; display:flex; flex-direction: column; gap: 6px; }
.leaflet-popover .popover__row { display:flex; align-items:center; gap: 8px; }
.leaflet-popover .popover__row svg { width: 16px; height: 16px; stroke: var(--color-muted); }
.leaflet-popover .popover__row span { font-family: var(--font-mono); }

/* Map2 markers: ring-only target (no fill), heavier stroke for noisy backgrounds */
#map2 .leaflet-div-icon.marker-dot,
#map2 .leaflet-marker-icon.marker-dot {
  width: 32px; height: 32px;
  --icon-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cline x1='24' y1='0' x2='24' y2='16' stroke='%23C23B3B' stroke-width='2'/%3E%3Cline x1='-0.00500497' y1='23.995' x2='15.995' y2='23.995' stroke='%23C23B3B' stroke-width='2'/%3E%3Cline x1='24' y1='47.995' x2='24' y2='31.995' stroke='%23C23B3B' stroke-width='2'/%3E%3Cline x1='48.005' y1='24' x2='32.005' y2='24' stroke='%23C23B3B' stroke-width='2'/%3E%3C/svg%3E");
  background: var(--icon-crosshair) center / 150% 150% no-repeat;
  border-radius: 50%;
  position: relative;
  border: 2px solid var(--color-accent);
  box-shadow: none; /* remove shadow artifact over imagery */
}
/* Remove crosshair arms from previous style */
#map2 .leaflet-div-icon.marker-dot::before,
#map2 .leaflet-div-icon.marker-dot::after,
#map2 .leaflet-marker-icon.marker-dot::before,
#map2 .leaflet-marker-icon.marker-dot::after { content: none; }

/* Keyboard focus ring for markers */
#map2 .leaflet-marker-icon.marker-dot:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Chat */
.chat { list-style: none; padding-left: 0; margin: 0; display:flex; flex-direction: column; gap: var(--space-2); }
.msg { display:flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-1); }
.msg .from { color: var(--color-muted); font-family: var(--font-mono); font-size: .8rem; letter-spacing: .06em; }
.msg .text { font-weight: 600; display:flex; align-items:center; gap: 8px; }
.msg.urgent { border-color: var(--color-accent); }
.msg__icon svg { width: 16px; height: 16px; stroke: var(--color-accent); }
/* Solid variant is itself the SVG; keep it inline and size it explicitly */
.msg__icon--solid { color: var(--color-accent); width: 1.375rem; height:  1.375rem; display: inline-block; vertical-align: -2px; }
.msg__icon--solid * { stroke: none; }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display:flex; align-items: center; justify-content: center; gap: var(--space-5); height: var(--nav-height); padding: 0 max(0px, env(safe-area-inset-left)) max(0px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-right)); background: linear-gradient(180deg, rgba(11,15,20,0) 0%, rgba(11,15,20,.95) 38%); z-index: 20; }
.navbtn { text-decoration:none; font-size: 1.25rem; padding: 6px 10px; border-radius: var(--radius-1); border: 1px solid transparent; color: var(--color-text); display:inline-flex; }
.navbtn svg { width: 22px; height: 22px; stroke: var(--color-text); }
.navbtn:focus { border-color: var(--color-accent); outline: none; }

/* Screenshot mode (hide chrome) */
body.shot .statusbar, body.shot .bottom-nav { display: none; }

/* Focus visible */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Bottom frame bezel (always visible to frame the app) */
.bottom-frame { display: none; }

/* iOS PWA: prevent body scroll on landing page */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
  }
  
  /* Dashboard fills viewport without overflow */
  #dashboard.screen {
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Inner screens can scroll independently */
  .screen:not(#dashboard) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Message icon with notification badge */
.header-action--messages {
  position: relative;
}

.message-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.message-icon {
  width: 28px;
  height: 28px;
}

.message-icon--filled {
  color: var(--color-text);
  fill: currentColor;
}
.header-action--messages .icon-filled * { stroke: none; }

.message-badge {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1rem;
  font-weight: 900;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "ss01" 0;
  color: #FFFFFF;
  line-height: 1;
  pointer-events: none;
  letter-spacing: -0.06em;
  text-rendering: geometricPrecision;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Outline vs filled toggle (default: outline only) */
.header-action--messages .icon-filled { display: none; }
.header-action--messages .message-badge { display: none; }

/* When there are new messages */
.header-action--messages.has-new .icon-outline { display: none !important; }
.header-action--messages.has-new .icon-filled { display: inline-block !important; }
.header-action--messages.has-new .icon-filled { color: #FF3B3B; }
.header-action--messages.has-new .message-badge { display: inline-flex !important; }

/* Focus states */
.header-action--messages:focus-visible {
  border-color: #B22234;
  outline: 2px solid #B22234;
}

/* Notification pulse animation */
@keyframes notification-pulse {
  0% { transform: scale(1); }
  25% { transform: scale(1.15); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes badge-pop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.header-action--messages.notification-arriving .message-icon-wrap {
  animation: notification-pulse 0.6s ease-out;
}

.header-action--messages.notification-arriving .message-badge {
  animation: badge-pop 0.4s ease-out;
}

/* Div tile styling - make it behave like other tiles */
.tile[role="button"] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.tile[role="button"]:hover {
  background: var(--color-surface-hover, var(--color-surface));
}

.tile[role="button"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* iPhone SE Optimizations (375px x 667px) */
@media screen and (max-width: 414px) and (max-height: 736px) {
  /* Reduce header padding for more content space */
  .app-head {
    padding: var(--space-1) var(--space-3);
  }
  
  /* Smaller brand title for iPhone SE */
  .brand__title {
    font-size: 1.6rem;
  }
  
  /* Optimize prop settings panel for small screen */
  .prop-settings__panel {
    width: min(360px, 95vw);
    padding: 12px;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Smaller group padding */
  .prop-settings__group {
    padding: 12px;
    margin-bottom: 16px;
  }
  
  /* Compact form elements */
  .prop-settings__panel input[type="number"],
  .prop-settings__panel input[type="text"],
  .prop-settings__panel textarea {
    padding: 6px 8px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Smaller delay buttons for mobile */
  .button--small {
    padding: 4px 8px;
    font-size: 0.85rem;
  }
  
  /* Stack delay buttons on very small screens */
  .delay-buttons {
    flex-direction: column;
    align-items: stretch;
  }
  
  .delay-buttons input[type="number"] {
    width: 100%;
    margin-top: 8px;
  }
  
  /* Compact group actions */
  .prop-settings__group-actions {
    gap: 6px;
  }
  
  .prop-settings__group-actions .button {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
  }
}

/* Extra small screens (iPhone SE 1st gen) */
@media screen and (max-width: 320px) {
  .brand__title {
    font-size: 1.4rem;
  }
  
  .prop-settings__panel {
    width: min(300px, 98vw);
    padding: 8px;
  }
  
  .prop-settings__group {
    padding: 8px;
  }
}
