/* Weather Kiosk styles
   Design canvas: 800 x 480 (5" Raspberry Pi touch display).
   The canvas is scaled at runtime to fit any landscape viewport via a
   CSS transform on #app. JS sets --stage-scale on #stage. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #f4f6fb;
  background: #0b1220;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0a0f1c; /* letterbox color when aspect ratios differ */
  --stage-scale: 1;
  /* Respect device safe areas (iPhone notch / home indicator, Android
     gesture bar) when running as an installed PWA in standalone mode. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  /* Fixed design canvas; scaled by JS to fit the viewport */
  width: 800px;
  height: 480px;
  flex: 0 0 auto;
  display: grid;
  grid-template-rows: 72px 1fr 84px;
  background: linear-gradient(160deg, #0e1a33 0%, #0b1220 60%, #0a0f1c 100%);
  transform: scale(var(--stage-scale));
  transform-origin: center center;
}

/* When 15-minute precipitation data isn't really 15-minutely (the source
   model only provides hourly), hide the strip and let the main content
   area reclaim its vertical space. */
#app.no-precip { grid-template-rows: 72px 1fr 0; }
#app.no-precip .precip-strip { display: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.location {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.location-local {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.75;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.loc-block {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  /* Reset button styling so the block looks like the original layout */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 10px;
  margin: -4px -10px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.loc-block:hover, .loc-block:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  outline: none;
}
.loc-block:active { background: rgba(255, 255, 255, 0.10); }

.location-sub {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
  letter-spacing: 0.2px;
}

/* ---------- Modal dialog ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
  z-index: 100;
  cursor: default;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  width: 640px;
  max-width: 95%;
  max-height: 92%;
  background: #16213a;
  color: #f4f6fb;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-header h2 { font-size: 16px; font-weight: 600; letter-spacing: 0.3px; }
.modal-header .loc-gps-btn { margin-left: auto; }
.modal-close {
  width: 36px; height: 36px;
  font-size: 22px; line-height: 1;
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,0.06); }

.modal-body {
  padding: 12px 16px 14px;
  display: grid;
  gap: 10px;
  overflow: hidden;
}

.field { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.field span { opacity: 0.75; }
.field select, .field input {
  height: 38px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.30);
  color: #f4f6fb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font: inherit;
  outline: none;
}
.field select:focus, .field input:focus { border-color: rgba(135, 206, 250, 0.7); }

.loc-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.20);
}
.loc-results li {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.loc-results li:last-child { border-bottom: none; }
.loc-results li:hover, .loc-results li:focus { background: rgba(255, 255, 255, 0.06); }
.loc-results li small { display: block; opacity: 0.6; font-size: 12px; margin-top: 2px; }
.loc-results:empty { display: none; }

.loc-hint { font-size: 12px; opacity: 0.6; min-height: 16px; }
.loc-hint.error { color: #ff8b8b; opacity: 0.9; }

.loc-gps-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: rgba(135, 206, 250, 0.10);
  color: #f4f6fb;
  border: 1px solid rgba(135, 206, 250, 0.45);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.loc-gps-btn:hover, .loc-gps-btn:focus-visible {
  background: rgba(135, 206, 250, 0.18);
  border-color: rgba(135, 206, 250, 0.75);
  outline: none;
}
.loc-gps-btn[disabled] { opacity: 0.5; cursor: progress; }
.loc-gps-btn .loc-gps-icon { font-size: 16px; }
.loc-gps-btn.locating .loc-gps-icon {
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

.loc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.45);
  margin: 4px 0 2px;
}
.loc-divider::before, .loc-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
}

/* ---------- Search history ---------- */
.loc-history[hidden] { display: none; }
.loc-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.loc-history-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.45);
}
.loc-history-items {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow: hidden;
}
.loc-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: rgba(135, 206, 250, 0.08);
  color: #f4f6fb;
  border: 1px solid rgba(135, 206, 250, 0.30);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}
.loc-history-chip:hover, .loc-history-chip:focus-visible {
  background: rgba(135, 206, 250, 0.18);
  border-color: rgba(135, 206, 250, 0.65);
  outline: none;
}

.clock {
  text-align: center;
  line-height: 1;
}
.clock .time {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.date-block { text-align: right; }
.date-block .date {
  font-size: 18px;
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.2;
}

/* ---------- Content grid ---------- */
.content {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
  padding: 12px;
  height: 100%;
  min-height: 0;
}

/* ---------- Today panel ---------- */
.today {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto 1fr;
  gap: 4px 14px;
  padding: 20px 18px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

/* ---------- Today detail (6h breakdown) ---------- */
.today.today--detail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 14px 10px 10px;
  overflow: hidden;
}

.today-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.today-detail-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.today-detail-title {
  font-size: 20px;
  font-weight: 700;
  opacity: 0.95;
}

.today-detail-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.td-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  text-align: center;
}

.td-hour {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

.td-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.td-icon img {
  width: 38px;
  height: 38px;
  display: block;
}

.td-temp {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}

.td-precip {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.td-precip-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.td-precip-mm {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #87cefa;
}
.td-precip-mm-icon {
  width: 13px;
  height: 13px;
  display: block;
}

.td-wind {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.td-wind-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.today-icon {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}
.today-icon img {
  width: 110px;
  height: 110px;
  display: block;
}

.today-temp {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}
.today-feels {
  width: 100%;
  text-align: center;
  font-size: 16px;
  opacity: 0.75;
  font-weight: 400;
  margin-top: 2px;
}
.temp-value { font-size: 84px; font-variant-numeric: tabular-nums; }
.temp-unit { font-size: 36px; opacity: 0.85; align-self: flex-start; margin-top: 12px; }

.today-condline {
  grid-column: 1 / 3;
  grid-row: 3 / 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
  align-items: baseline;
  margin: 4px 0 22px;
}

.today-cond {
  font-size: 22px;
  opacity: 0.9;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}

.today-hilo {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 20px;
  opacity: 0.9;
}
.today-hilo b { font-weight: 700; }

.today-meta {
  grid-column: 1 / 3;
  grid-row: 4 / 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  align-content: start;
  font-size: 16px;
}
.meta-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.07);
  min-width: 0;
}
.meta-label { opacity: 0.85; display: inline-flex; align-items: center; justify-content: flex-end; }
.meta-icon { width: 20px; height: 20px; display: block; }
.meta-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: left; white-space: nowrap; min-width: 0; overflow: hidden; }
.wind-arrow { font-size: 1.3em; line-height: 1; vertical-align: middle; -webkit-text-stroke: 1px currentColor; margin-left: 8px; width: 1.3em; height: 1.3em; text-align: center; overflow: visible; }

/* ---------- 3-day forecast ---------- */
.forecast {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  min-height: 0;
  cursor: pointer;
}

/* Week view: six cards in a 3 x 2 grid filling the same space. Slightly
   more compact than the 3-day cards so two rows fit the 800x480 canvas. */
.forecast.week {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.forecast.week .fc-card { padding: 12px 8px 8px; border-radius: 12px; }
.forecast.week .fc-day { font-size: 18px; }
.forecast.week .fc-icon { margin: 2px 0; }
.forecast.week .fc-icon img { width: 48px; height: 48px; }
.forecast.week .fc-cond { display: none; }
.forecast.week .fc-humidity { display: none; }
.forecast.week .fc-precip { margin-top: auto; min-height: 0; padding-bottom: 4px; }
.forecast.week .fc-high { font-size: 22px; }
.forecast.week .fc-low { font-size: 15px; }
.forecast.week .fc-precip { font-size: 14px; }
.forecast.week .fc-precip-icon { width: 14px; height: 14px; }
.forecast.week .fc-precip-sum {
  width: auto;
}

.fc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.fc-day { font-size: 22px; font-weight: 700; opacity: 0.95; }
.fc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.4));
}
.fc-icon img {
  width: 64px;
  height: 64px;
  display: block;
}
.fc-cond { font-size: 16px; opacity: 0.85; min-height: 36px; padding: 0 4px; }
.fc-temps {
  display: flex; gap: 10px; align-items: baseline; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.fc-high { font-size: 26px; font-weight: 700; }
.fc-low { font-size: 18px; opacity: 0.7; font-weight: 700; }
.fc-precip {
  font-size: 16px;
  opacity: 0.85;
  margin-top: 6px;
  min-height: 44px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 5px;
  white-space: nowrap;
}
.fc-precip-icon {
  width: 16px;
  height: 16px;
  display: block;
}
.fc-precip-sum {
  opacity: 0.85;
  width: 100%;
  text-align: center;
}

.fc-humidity {
  font-size: 16px;
  opacity: 0.85;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.fc-humidity-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* ---------- Precipitation strip ---------- */
.precip-strip {
  display: grid;
  grid-template-rows: 18px 32px 20px;
  padding: 4px 12px 14px;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.precip-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.75);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.precip-title-icon { width: 14px; height: 14px; display: block; }

.precip-track {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
  align-items: stretch;
}

.precip-block {
  position: relative;
  height: 100%;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background 400ms ease;
}

.precip-block .pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.precip-block.hour-start { }

.precip-axis {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}
.precip-axis span { text-align: left; padding-left: 2px; }
.precip-axis span.empty { visibility: hidden; }

/* ---------- Alert chip (Météo-France Vigilance) ---------- */
.alert-chip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #0b1220;
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  text-decoration: none;
  pointer-events: none;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert-chip[hidden] { display: none; }
/* Today's chip is a link to the official Vigilance page for the
   department; restore pointer events and add a subtle hover state. */
.alert-chip.alert-link { pointer-events: auto; cursor: pointer; }
.alert-chip.alert-link:hover { filter: brightness(1.05); transform: translateY(-1px); }
.alert-chip.alert-link:active { transform: translateY(0); }
.alert-chip::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

/* Official Météo-France Vigilance palette
 * yellow #fff600  orange #ffb82b  red #cc0000
 * Source: https://webservice.meteofrance.com/v3/warning/dictionary */
.alert-chip.alert-yellow { background: #fff600; color: #1a1a00; border-color: rgba(0, 0, 0, 0.35); }
.alert-chip.alert-orange { background: #ffb82b; color: #2a1300; border-color: rgba(0, 0, 0, 0.35); }
.alert-chip.alert-red    { background: #cc0000; color: #ffffff; border-color: rgba(0, 0, 0, 0.35); }

/* Today card border when vigilance alert is active */
.today.vigilance-yellow { border: 3px solid #fff600; }
.today.vigilance-orange { border: 3px solid #ffb82b; }
.today.vigilance-red    { border: 3px solid #cc0000; }

/* Forecast card border when vigilance alert is active */
.fc-card.vigilance-yellow { border: 3px solid #fff600; }
.fc-card.vigilance-orange { border: 3px solid #ffb82b; }
.fc-card.vigilance-red    { border: 3px solid #cc0000; }

/* Card variants are tiny chips on the forecast cards */
.fc-card { position: relative; }
.fc-card .alert-chip {
  font-size: 10px;
  padding: 2px 6px;
  top: 6px;
  right: 6px;
  max-width: calc(100% - 12px);
  letter-spacing: 0.2px;
}

.today { position: relative; }

/* ---------- Status bar ---------- */
/* Hidden by default; only the #status node is shown as a small floating
   banner when an error occurs. The OK / Updated text is suppressed so
   we keep all the vertical space for content. */
.statusbar { display: none; }

.statusbar.error-visible {
  display: block;
  position: absolute;
  left: 12px;
  bottom: 8px;
  z-index: 20;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(216, 36, 26, 0.92);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.statusbar.error-visible #updated { display: none; }
.statusbar.error-visible #status::before { content: "⚠ "; }

/* ---------- Cursor auto-hide ---------- */
/* Hide cursor after 3 s of mouse inactivity (kiosk use). */
html.cursor-hidden, html.cursor-hidden * {
  cursor: none !important;
}

/* ---------- States ---------- */
.error { color: #ff8b8b; }
.fade-in { animation: fadeIn 350ms ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- RTL adjustments (Arabic, Urdu) ---------- */
[dir="rtl"] .loc-block { text-align: right; }
[dir="rtl"] .date-block { text-align: left; }
[dir="rtl"] .meta-label { text-align: left; }
[dir="rtl"] .meta-value { text-align: right; }
[dir="rtl"] .precip-axis span { text-align: right; padding: 0 2px 0 0; }
/* The precipitation strip is inherently directional (now -> later);
   keep its visual order LTR even in RTL languages. */
[dir="rtl"] .precip-track,
[dir="rtl"] .precip-axis { direction: ltr; }

/* ---------- Credits ---------- */
.credits {
  position: absolute;
  right: 10px;
  bottom: 2px;
  z-index: 5;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}
.credits a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}
.credits a:hover { color: rgba(255, 255, 255, 0.95); }
/* Hide credits when an error banner shows up; the banner sits opposite
   corner but on small viewports they could collide. */
.statusbar.error-visible ~ .credits { display: none; }

/* ---------- Fullscreen toggle ----------
   Floating button shown only when the Fullscreen API is available
   (Android browsers, desktop). It sits in the top-right corner outside
   the scaled #app canvas so it doesn't interfere with the kiosk layout
   and remains tap-friendly on touch devices. */
.fullscreen-btn {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  z-index: 50;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #f4f6fb;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, border-color 150ms ease, opacity 200ms ease;
  /* Slightly dimmed when idle so it doesn't compete with the dashboard,
     but still clearly visible at a glance. */
  opacity: 0.85;
}
.fullscreen-btn[hidden] { display: none; }
.fullscreen-btn:hover, .fullscreen-btn:focus-visible {
  opacity: 1;
  background: rgba(0, 0, 0, 0.65);
  border-color: rgba(255, 255, 255, 0.30);
  outline: none;
}
.fullscreen-btn:active { transform: scale(0.96); }

.fullscreen-btn img {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}
/* Show only the icon that matches the current state. */
.fullscreen-btn .fs-icon-exit { display: none; }
.fullscreen-btn.is-fullscreen .fs-icon-enter { display: none; }
.fullscreen-btn.is-fullscreen .fs-icon-exit { display: block; }

[dir="rtl"] .fullscreen-btn {
  right: auto;
  left: calc(8px + env(safe-area-inset-left));
}
