#accessGate { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: safe center; padding: 24px; overflow-y: auto; background: #f6f7f9; user-select: text; }
#accessGate[hidden] { display: none; }
.access-panel { width: min(100%, 390px); padding: 32px; border: 1px solid #e5e7eb; border-radius: 14px; background: #fff; box-shadow: 0 10px 32px rgba(15,23,42,.05); }
.access-panel h1 { font-size: 23px; letter-spacing: -.6px; margin: 8px 0; color: #1e293b; }
.access-panel p { font-size: 14px; color: #64748b; line-height: 1.6; margin-bottom: 24px; }
.access-panel label { display: block; font-size: 14px; font-weight: 600; margin: 15px 0 7px; }
.access-panel input { width: 100%; padding: 11px 12px; font-size: 16px; border: 1px solid #d1d5db; border-radius: 7px; }
.access-panel button { width: 100%; margin-top: 22px; padding: 11px; font-size: 15px; font-weight: 600; border: 0; border-radius: 7px; background: #4f46e5; color: #fff; cursor: pointer; }
.access-panel button:disabled { opacity: .6; cursor: wait; }
.access-panel input:focus-visible, .access-panel button:focus-visible { outline: 2px solid #6366f1; outline-offset: 3px; }
#accessMessage { font-size: 13px; color: #b91c1c; line-height: 1.5; min-height: 20px; margin-top: 12px; }
.app-header {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) max-content minmax(336px, 380px) minmax(max-content, 1fr);
  grid-template-areas: "identity identity . tools" "period clock weather views";
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px 16px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  flex-shrink: 0;
  z-index: 20;
}
.app-header > * { min-width: 0; }
.header-identity { grid-area: identity; display: flex; align-items: center; gap: 9px; }
.header-brand-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: grid; place-items: center; background: #4f46e5; color: #fff; font-size: 15px; }
.header-brand-copy { min-width: 0; }
.app-brand-title { display: block; font-size: 17px; font-weight: 700; color: #0f172a; line-height: 1.35; letter-spacing: -.4px; overflow-wrap: anywhere; }
.header-sync { display: flex; align-items: center; gap: 5px; font-size: 10.5px; line-height: 1.4; color: #059669; margin-top: 2px; }
#syncDot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #10b981; }
.header-period { grid-area: period; justify-self: start; align-self: end; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; max-width: 100%; padding-bottom: 8px; }
.header-period-nav { display: flex; flex-shrink: 0; align-items: center; gap: 3px; background: #f1f5f9; padding: 3px 4px; border-radius: 7px; }
.header-period-nav .btn { border: 0; background: transparent; padding: 4px 7px; font-size: 11.5px; }
.header-period-nav #btnToday { padding-inline: 9px; }
#currentPeriodLabel { min-width: 0; max-width: 100%; font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: -.4px; white-space: normal; margin: 0; }
.header-tools { grid-area: tools; justify-self: end; display: flex; align-items: center; gap: 8px; width: max-content; }
.header-tools > * { flex-shrink: 0; }
.header-views { grid-area: views; justify-self: end; align-self: end; padding-bottom: 8px; }
.header-monitor-row { display: contents; }
/* Reserve the remaining space after the 14px grid gap: clock to weather is 0.5cm. */
.header-clock { grid-area: clock; display: flex; align-items: center; justify-content: center; min-width: 0; padding-inline-end: calc(0.5cm - 14px); pointer-events: none; }
.header-clock-time { display: flex; align-items: baseline; justify-content: center; gap: 12px; line-height: 1.1; color: #000; font-variant-numeric: tabular-nums; white-space: nowrap; }
#clockDate { font-size: clamp(26px, 2vw, 30px); font-weight: 400; letter-spacing: -.6px; }
.header-clock-digits { display: inline-flex; align-items: baseline; font-size: clamp(54px, 4.2vw, 64px); font-weight: 750; letter-spacing: -1.4px; white-space: nowrap; }
.header-clock-seconds { color: inherit; }
.header-monitor-row #pyeongtaekWeather { grid-area: weather; justify-self: start; width: min(100%,440px); min-width: 0; }
@media (min-width: 1361px) {
  .header-clock, .header-monitor-row #pyeongtaekWeather { grid-row: 1 / span 2; }
  #pyeongtaekWeather .ptw-days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; }
}
@media (max-width: 1360px) {
  .header-clock-time { flex-direction: column; align-items: center; gap: 4px; }
  #clockDate { font-size: 22px; }
  .header-clock-digits { font-size: 52px; }
}
@media (max-width: 1100px) {
  .app-header { grid-template-columns: minmax(0,1fr) minmax(406px,440px); grid-template-areas: "identity tools" "period views" "clock weather"; gap: 12px 0.5cm; }
  .header-period, .header-views { padding-bottom: 0; align-self: center; }
  .header-clock { justify-self: end; padding-inline-end: 0; }
  .header-monitor-row #pyeongtaekWeather { justify-self: end; }
}
@media (max-width: 720px) {
  .app-header { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "identity identity" "tools tools" "clock clock" "weather weather" "period views"; padding: 12px 14px; gap: 12px; }
  .header-tools { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .header-clock { justify-self: center; }
  .header-clock-time { flex-direction: row; flex-wrap: wrap; gap: 6px 12px; }
  .header-monitor-row #pyeongtaekWeather { justify-self: center; }
  #clockDate { font-size: 20px; }
  .header-clock-digits { font-size: 44px; }
  .app-brand-title { font-size: 16px; }
}
@media (max-width: 460px) {
  .app-header { grid-template-columns: minmax(0,1fr); grid-template-areas: "identity" "tools" "clock" "weather" "period" "views"; }
  .header-clock-time { flex-direction: column; }
  .header-tools, .header-period, .header-views { justify-self: center; }
  #currentPeriodLabel { font-size: 15px; }
  .header-period { gap: 8px; }
}
@media (max-width: 760px), (max-height: 520px) {
  body { overflow-y: auto; }
  .app-body { min-height: 320px; flex-shrink: 0; }
}
