/* Hardware display only. Reserve room for the hint, then fit both clock axes. */
.connection-guide-entry { display:block; padding:12px 4px; min-height:44px; text-align:center; color:var(--accent); font-size:14px; line-height:1.5; text-underline-offset:4px; }
.home-timer-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-timer-modes button { border:0; background:none; color:var(--muted); font:inherit; font-size:16px; font-weight:700; border-radius:12px; min-height:44px; padding:9px 8px; cursor:pointer; }
.home-timer-modes a { padding:9px 8px; }
.home-timer-modes button:hover, .home-timer-modes button:focus-visible { background:var(--card); color:var(--accent); }
#ledHeader[hidden], #ledFooter[hidden] { display:none; }
.timer-connection-help { margin: 10px 0; padding: 14px; border: 1px solid var(--amber); border-radius: 16px; background: var(--card); }
.timer-connection-help p { margin: 0 0 10px; line-height: 1.5; overflow-wrap: anywhere; }
.timer-connection-help .btn-row { flex-wrap: wrap; }
.timer-connection-help .btn-row button { flex: 1 1 180px; }
#view-display > :not(#stage) { flex-shrink: 0; }
#view-display #stage {
  flex: 1 0 180px;
  min-height: 180px;
  padding: 16px;
  overflow: hidden;
}

/* Optional LED mode keeps the last hardware value on screen after stopping. */
body.led-mode #view-display.active {
  position:fixed; inset:0; width:100%; max-width:none; height:100vh; height:100dvh;
  margin:0; padding:var(--app-safe-top) var(--app-safe-right) var(--app-safe-bottom) var(--app-safe-left);
  overflow:hidden; z-index:70; background:#000;
}
body.led-mode #view-display > :not(#stage):not(#ledHeader):not(#ledFooter),
body.led-mode .bottom-nav, body.led-mode #storageBanner, body.led-mode #shareModal,
body.led-mode #stageHint { display:none !important; }
body.led-mode #view-display #stage {
  order:1; flex:1 1 0%; min-height:0; width:100%; margin:0; padding:clamp(12px,3vw,40px);
  border:0; border-radius:0; background:#000; box-shadow:none;
}
body.led-mode { --led-color:#a3ff12; }
body.led-mode[data-led-color="red"] { --led-color:#ff4949; }
body.led-mode #view-display #bigTime { color:var(--led-color); }
#ledHeader { order:0; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 20px; color:#9ba7ba; }
#ledHeader span { text-align:center; font-size:13px; }
#ledHeader small { display:block; margin-top:4px; font-size:11px; font-weight:400; }
#ledFooter { order:2; text-align:center; padding:8px 20px 18px; color:#9ba7ba; font-size:13px; }
#ledFooter p { margin:0 0 10px; line-height:1.5; }
#ledFooter p:empty { display:none; }
#ledStatus.live { color:#6cda9d; }
#ledStatus.waiting { color:#f7c66d; }
#ledHelp { max-width:680px; margin-left:auto !important; margin-right:auto !important; }
#ledHeader button, #ledFooter button { min-height:44px; padding:10px 16px; border:1px solid #303846; border-radius:12px; color:#bdc7d5; background:#10151d; font:inherit; font-size:13px; cursor:pointer; box-shadow:none; }
#ledHeader button:focus-visible, #ledFooter button:focus-visible { outline:2px solid var(--led-color); outline-offset:3px; }
.led-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:10px; }
.led-colors { display:flex; gap:6px; }
#ledFooter button[data-led-color="green"] { color:#a3ff12; }
#ledFooter button[data-led-color="red"] { color:#ff4949; }
#ledFooter button[aria-pressed="true"] { border-color:currentColor; background:#1b2417; }
@media(max-width:420px) {
  .home-timer-modes a, .home-timer-modes button { font-size:13px; }
  #ledHeader { padding:10px; gap:8px; }
  #ledHeader button { padding:10px; }
}
#view-display .time-display {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
#view-display #bigTime {
  flex: none;
  white-space: nowrap;
  line-height: 1;
  /* A conservative fallback for older Safari versions without container units. */
  font-size: min(calc(140vw / var(--len, 6)), 96px);
  animation: none;
}
#view-display #stageHint {
  flex-shrink: 0;
  margin-top: 8px;
  padding: 0 8px;
  line-height: 1.4;
}
#view-display #stageHint:empty { display: none; }

/* Automatic in-app focus: no Fullscreen API call or permission is required.
   Hardware stop, reset or disconnect restores the existing view immediately. */
body.hardware-timing #view-display.active {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: var(--app-safe-top) var(--app-safe-right) var(--app-safe-bottom) var(--app-safe-left);
  overflow: hidden;
  z-index: 70;
  background: var(--bg);
}
body.hardware-timing #view-display > :not(#stage),
body.hardware-timing #stageHint,
body.hardware-timing .bottom-nav,
body.hardware-timing #storageBanner,
body.hardware-timing #shareModal { display: none !important; }
body.hardware-timing #view-display #stage {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  box-shadow: none;
}
body.hardware-timing #view-display #bigTime,
body.led-mode #view-display #bigTime {
  font-size: min(calc(145vw / var(--len, 6)), 80vh);
}
@supports (font-size: 1cqb) {
  #view-display #bigTime,
  body.hardware-timing #view-display #bigTime,
  body.led-mode #view-display #bigTime {
    font-size: min(calc(145cqi / var(--len, 6)), 88cqb);
  }
}
body.led-mode.hardware-timing #view-display.active,
body.led-mode.hardware-timing #view-display #stage { background:#000; }

/* Tighter LED digits use more of the available screen. Keep the original
   typeface and fit against both axes, including longer minute values. */
body.led-mode #view-display #stage { padding:clamp(8px,1.5vmin,18px); }
body.led-mode #view-display #bigTime {
  letter-spacing:-0.035em;
  font-size:min(calc(160vw / var(--len, 6)), 82vh);
}
@supports (font-size: 1cqb) {
  body.led-mode #view-display #bigTime {
    font-size:min(calc(172cqi / var(--len, 6)), 94cqb);
  }
}
