/* Fullscreen Desk-Frame Focus Stage ("자리")
 * - Pure box-free typographic clock + slim paw trail ("진짜 책상 위 액자")
 * - 3-second auto-hide chrome layer (opacity:0, pointer-events:none)
 * - Smooth panorama expansion transition + 100dvh & safe-area-inset support
 */

.focus-overlay-root {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 100;
  background: #3a2c22;
}

.focus-overlay-root.is-open {
  display: block;
}

.focus-stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes panorama-expand {
  0% {
    transform: scale(1.045);
    filter: brightness(1.06);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.focus-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: center center;
  transition: filter 0.45s ease;
}

/* OLED Low-Power Dark Desk-Stand Mode (dimmed brightness ~0.52 + subtle OLED vignette + ±4px burn-in shift) */

.focus-oled-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.52) 72%, rgba(0, 0, 0, 0.78) 100%);
  transition: opacity 0.45s ease;
}

.focus-stage.is-low-power .focus-canvas {
  filter: brightness(0.52) contrast(1.04);
}

.focus-stage.is-low-power .focus-oled-vignette {
  opacity: 1;
}

.focus-stage.is-low-power .focus-digits {
  color: rgba(255, 244, 224, 0.74);
}

.focus-stage.is-low-power .window-lights-chip {
  opacity: 0.62;
}

/* Strict Mode Invalidation Alert */

.focus-invalid-banner {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(92vw, 520px);
  background: rgba(164, 48, 38, 0.94);
  color: #fff9f7;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 200, 194, 0.36);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}

.focus-invalid-banner[hidden] {
  display: none;
}

/* =====================================================================
 * Slim "창밖의 불빛 · 142명 함께 집중 중" Co-Focusing Chip
 * Stays subtly luminous even in Frame Mode; hides completely when toggled OFF
 * ===================================================================== */

.window-lights-chip {
  position: absolute;
  z-index: 9;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(24, 21, 18, 0.56);
  color: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 236, 198, 0.22);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 650;
  pointer-events: none;
  transition: opacity 0.4s ease, top 0.35s ease;
}

.window-lights-chip[hidden] {
  display: none;
}

/* When top chrome buttons are visible, tuck Window Lights chip cleanly just beneath the top-left seat pill;
   when Frame Mode hides top chrome after 3s, glide Window Lights smoothly up to top-left corner like concept art! */

.focus-stage:not(.is-frame-mode) .window-lights-chip {
  top: calc(50px + env(safe-area-inset-top, 0px));
}

.focus-stage.is-frame-mode .window-lights-chip {
  opacity: 0.86;
}

@keyframes wl-pulse {
  0%, 100% { opacity: 0.7; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* =====================================================================
 * Always-Visible Box-Free Ambient Clock + Slim Paw Trail ("액자 모드")
 * ZERO dark box or opaque backdrop — lets the room & pet breathe fully!
 * ===================================================================== */

.focus-clock-ambient {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translate(calc(-50% + var(--oled-shift-x, 0px)), var(--oled-shift-y, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), bottom 0.4s ease, right 0.4s ease;
}

/* When controls auto-hide in portrait, clock glides slightly lower and calmer */

.focus-stage.is-frame-mode .focus-clock-ambient {
  bottom: calc(36px + env(safe-area-inset-bottom, 0px));
}

.focus-digits {
  font-size: clamp(46px, 11vw, 68px);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: rgba(255, 252, 245, 0.96);
}

.focus-digits.is-hidden {
  display: none;
}

.paw-step {
  font-size: 12px;
  opacity: 0.28;
  filter: grayscale(1) drop-shadow(0 1px 4px rgba(16, 11, 7, 0.65));
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

/* =====================================================================
 * Auto-Hiding Chrome Controls Layer (top bar + bottom action buttons)
 * ===================================================================== */

.focus-chrome {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    calc(14px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.42s ease;
}

.focus-chrome.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.focus-chrome.is-hidden button {
  pointer-events: none !important;
}

/* Sound Drawer */

.sound-drawer {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  max-height: calc(100dvh - 110px);
  overflow-y: auto;
  background: rgba(26, 20, 16, 0.9);
  color: #fffaf3;
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 244, 224, 0.24);
  border-radius: 20px;
  padding: 16px;
  pointer-events: auto;
  box-shadow: var(--shadow-lg);
}

.sound-drawer[hidden] {
  display: none;
}

.sound-chip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.sound-chip {
  border: 1px solid rgba(255, 245, 232, 0.2);
  background: rgba(255, 245, 232, 0.08);
  color: #fff9f0;
  border-radius: 14px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}

.sound-chip.is-active {
  background: var(--accent);
  border-color: #f3a476;
}

.sound-vol-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.sound-vol-row input {
  flex: 1;
  accent-color: #f0a46b;
}

/* =====================================================================
 * Landscape Desk-Stand Frame Mode (e.g., 844x390)
 * Box-free floating typography at bottom-right; controls at bottom-left
 * ===================================================================== */

@media (orientation: landscape) and (max-height: 540px) {
  .focus-clock-ambient,
.focus-stage.is-frame-mode .focus-clock-ambient {
    left: auto;
    transform: translate(var(--oled-shift-x, 0px), var(--oled-shift-y, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    align-items: flex-end;
    gap: 5px;
  }

  .focus-digits {
    font-size: clamp(38px, 6vw, 52px);
  }

  .paw-step {
    font-size: 12px;
  }

  .focus-chrome {
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      calc(18px + env(safe-area-inset-right, 0px))
      calc(14px + env(safe-area-inset-bottom, 0px))
      calc(18px + env(safe-area-inset-left, 0px));
  }
}

/* Quit Confirmation Modal (prevents accidental 1-tap session abort) */

.focus-quit-confirm {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 12, 9, 0.56);
  backdrop-filter: blur(8px);
}

.focus-quit-confirm[hidden] {
  display: none;
}

.focus-quit-card {
  width: min(92vw, 360px);
  background: rgba(255, 251, 244, 0.96);
  color: #362920;
  border: 1px solid rgba(186, 152, 118, 0.42);
  border-radius: 20px;
  padding: 24px 22px 20px;
  text-align: center;
  box-shadow: 0 20px 54px rgba(14, 9, 5, 0.42);
}

.focus-quit-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #2d2118;
}

.focus-quit-card p {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #675446;
}

.focus-quit-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
