/**
 * Timer Modal Styles
 * 메인 타이머 모달 전용 스타일
 */

/* KPI 완전 비노출 - 방어적 CSS */
.dm-timer .session-summary,
.dm-timer .timer-kpis,
.dm-timer .kpi-row,
.dm-timer .kpi,
.dm-timer [data-kpi],
#completed-sessions,
#total-time,
#today-pages,
[data-role="completed-sessions"],
[data-role="total-time"],
[data-role="today-pages"],
/* 대시보드 세션 기록 모달 KPI 방어 */
.session-records-modal .session-summary,
.record-modal .session-summary,
.session-summary,
.summary-item,
.summary-value,
.summary-label {
  display: none !important;
}

@layer timer.components {
  /* Main modal overlay */
  .timer-modal-overlay.enhanced {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("/images/timer_bg2.jpg") center/cover;
    backdrop-filter: none;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--dm-timer-z-modal, 1000);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Hide default background when custom background is active */
  .timer-modal-overlay.enhanced.has-custom-bg {
    background: none;
  }

  /* Modal visibility states */
  .timer-modal-overlay.enhanced.is-open {
    display: flex;
    opacity: 1;
    visibility: visible;
    animation: fadeInEnhanced 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .timer-modal-overlay.enhanced.is-hidden {
    opacity: 0;
    visibility: hidden;
  }

  .dm-timer .timer-modal-overlay.enhanced {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("/images/timer_bg2.jpg") center/cover;
    backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--timer-z-modal);
    animation: fadeInEnhanced var(--timer-anim-slow) var(--timer-anim-timing);
  }

  /* Background overlay for readability */
  .timer-modal-overlay.enhanced::before,
  .dm-timer .timer-modal-overlay.enhanced::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    backdrop-filter: none;
    z-index: -1;
  }



  /* Background particles effect */
  .background-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .dm-timer .background-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .background-particles::before,
  .background-particles::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: floatParticles 8s ease-in-out infinite;
  }

  .dm-timer .background-particles::before,
  .dm-timer .background-particles::after {
    content: "";
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: floatParticles 8s ease-in-out infinite;
  }

  .background-particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
  }

  .dm-timer .background-particles::before {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
  }

  .background-particles::after {
    top: 60%;
    right: 15%;
    animation-delay: -3s;
  }

  .dm-timer .background-particles::after {
    top: 60%;
    right: 15%;
    animation-delay: -3s;
  }

  /* Main modal */
  .timer-modal.enhanced {
    /* 모달 전체에 어두운 배경 적용하여 배경 이미지와 구분 */
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(5px) saturate(120%);
    border-radius: 24px;
    width: 440px;
    max-width: 90vw;
    min-width: 340px; /* 최소 너비 확보로 작은 화면에서도 여백 유지 */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4),
      0 0 0 1px rgba(255, 255, 255, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.15),
      /* 부드러운 외곽 glow 효과 */
      0 0 30px rgba(255, 255, 255, 0.06),
      0 0 60px rgba(255, 255, 255, 0.03);
    animation: slideUpEnhanced 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 도드라진 테두리 + 부드러운 확산 */
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    display: flex;
    flex-direction: column;
    min-height: clamp(500px, 55vh, 640px);
    overflow-y: auto;
    scrollbar-width: none;
  }

  /* Bottom spacer using pseudo-element for guaranteed rendering */
  .timer-modal.enhanced::after {
    content: '';
    display: block;
    height: 2.5rem;
    flex-shrink: 0;
  }

  .dm-timer .timer-modal.enhanced {
    /* 모달 전체에 어두운 배경 적용하여 배경 이미지와 구분 */
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(5px) saturate(120%);
    border-radius: var(--timer-radius);
    width: 440px;
    max-width: 90vw;
    min-width: 340px; /* 최소 너비 확보로 작은 화면에서도 여백 유지 */
    box-shadow: var(--timer-shadow), 0 0 0 1px rgba(255, 255, 255, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.15),
      /* 부드러운 외곽 glow 효과 */
      0 0 30px rgba(255, 255, 255, 0.06),
      0 0 60px rgba(255, 255, 255, 0.03);
    animation: slideUpEnhanced var(--timer-anim-slow) var(--timer-anim-timing);
    transition: all var(--timer-anim-duration) var(--timer-anim-timing);
    /* 도드라진 테두리 + 부드러운 확산 */
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    display: flex;
    flex-direction: column;
    min-height: clamp(500px, 55vh, 600px);
    overflow-y: auto;
    scrollbar-width: none;
  }

  .dm-timer .timer-modal.enhanced::after {
    content: '';
    display: block;
    height: 2.5rem;
    flex-shrink: 0;
  }

  /* Header - 타이틀과 컨트롤 버튼 여백 확보 */
  .timer-header.minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 헤더 좌우 패딩 충분히 확보 */
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    min-height: 60px;
    position: relative;
    z-index: 10; /* Ensure header is above particles/background */
  }

  .dm-timer .timer-header.minimal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    min-height: 60px;
    position: relative;
    z-index: 10;
  }

  /* Daily Goal Section */
  .timer-daily-goal {
    margin-top: 1.5rem !important; /* 헤더와의 간격 강제 확보 */
    padding: 0 1.5rem 1.5rem; /* 내부 여백 확보 */
    background: transparent;
    border-bottom: none;
    text-align: center;
    position: relative;
    z-index: 5;
  }

  .dm-timer .timer-daily-goal {
    margin-top: 1.5rem !important;
    padding: 0 1.5rem 1.5rem; /* 내부 여백 확보 */
    background: transparent;
    border-bottom: none;
    text-align: center;
    position: relative;
    z-index: 5;
  }


  .daily-goal-text {
    font-size: 0.95rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .dm-timer .daily-goal-text {
    font-size: 0.95rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }



  .timer-header.minimal h3 {
    margin: 0;
    margin-left: 4px; /* 왼쪽 여백 추가 - 모달 가장자리에서 떨어지게 */
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: left;
    flex: 1;
    /* 컨트롤 버튼을 위한 공간 확보 */
    max-width: calc(100% - 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dm-timer .timer-header.minimal h3 {
    margin: 0;
    margin-left: 4px; /* 왼쪽 여백 추가 */
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--timer-text-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: left;
    flex: 1;
    max-width: calc(100% - 140px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .timer-controls {
    display: inline-flex;
    align-items: center;
    gap: var(--dm-timer-control-gap, 6px);
    margin-right: 4px; /* 오른쪽 여백 추가 - 모달 가장자리에서 떨어지게 */
    flex-shrink: 0;
  }

  .dm-timer .timer-controls {
    display: inline-flex;
    align-items: center;
    gap: var(--dm-timer-control-gap, 6px);
    margin-right: 4px; /* 오른쪽 여백 추가 */
    flex-shrink: 0;
  }

  .control-btn {
    width: var(--dm-timer-control-size);
    height: var(--dm-timer-control-size);
    border-radius: var(--dm-timer-control-radius);
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
  }

  .dm-timer .control-btn {
    width: var(--dm-timer-control-size);
    height: var(--dm-timer-control-size);
    border-radius: var(--dm-timer-control-radius);
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
  }

  .control-btn .icon {
    width: var(--dm-timer-control-icon);
    height: var(--dm-timer-control-icon);
  }

  .control-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
  }

  .dm-timer .control-btn .icon {
    width: var(--dm-timer-control-icon);
    height: var(--dm-timer-control-icon);
  }

  .dm-timer .control-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
  }

  /* 최소화 버튼도 동일 룩앤필 (이전 특별 스타일 제거) */
  .control-btn.minimize {
    background: rgba(255, 255, 255, 0.1);
  }

  .dm-timer .control-btn.minimize {
    background: rgba(255, 255, 255, 0.1);
  }

  /* 다크 테마 대응 */
  .dm-timer [data-theme="dark"] .control-btn {
    background: rgba(255, 255, 255, 0.08);
  }

  .dm-timer [data-theme="dark"] .control-btn:hover {
    background: rgba(255, 255, 255, 0.14);
  }

  /* Timer body - 개선된 여백과 레이아웃 */
  .timer-body.enhanced {
    padding: 1rem 1.5rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1; /* 다시 flex: 1 적용하여 하단으로 버튼 밀어내기 */
    margin: 0;
    position: relative;
    /* 배경은 모달 전체에 적용하므로 여기서는 제거 */
  }

  .dm-timer .timer-body.enhanced {
    padding: 1rem 1.5rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    margin: 0;
    position: relative;
    /* 배경은 모달 전체에 적용하므로 여기서는 제거 */
  }

  /* Circular timer container */
  .circular-timer-container {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
    width: 260px;
    height: 260px;
  }

  .dm-timer .circular-timer-container {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
    width: 260px;
    height: 260px;
  }

  .circular-timer {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
  }

  .dm-timer .circular-timer {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
  }

  /* Progress circle styles */
  .timer-progress {
    stroke-dasharray: 534; /* 2π × 85 */
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 1s ease-out;
    animation: progressGlow 3s ease-in-out infinite alternate;
    stroke-linecap: round;
    stroke-width: 8;
    stroke: url(#progressGradient);
    mix-blend-mode: screen;
    /* Strong neon glow effect - Fluorescent Cyan */
    filter: drop-shadow(0 0 5px #00ffcc) 
            drop-shadow(0 0 15px #00ffcc) 
            drop-shadow(0 0 30px #00ffcc) !important;
  }


  .dm-timer .timer-progress {
    stroke-dasharray: 534; /* 2π × 85 */
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 1s ease-out, filter 2s ease-in-out;
    animation: progressGlow 3s ease-in-out infinite alternate;
    stroke-linecap: round;
    stroke-width: 8;
    stroke: url(#progressGradient);
    mix-blend-mode: screen;
    /* Strong neon glow effect - Fluorescent Cyan */
    filter: drop-shadow(0 0 5px #00ffcc) 
            drop-shadow(0 0 15px #00ffcc) 
            drop-shadow(0 0 30px #00ffcc) !important;
  }

  /* 시간대별 진행도 원 색상 변경 - 서서히 주황색으로 */
  /* 100% ~ 50%: 시안 (기본) */
  .timer-progress.timer-progress-start,
  .dm-timer .timer-progress.timer-progress-start {
    filter: drop-shadow(0 0 5px #00ffcc) 
            drop-shadow(0 0 15px #00ffcc) 
            drop-shadow(0 0 30px #00ffcc) !important;
  }

  /* 50% ~ 25%: 녹색으로 전환 */
  .timer-progress.timer-progress-halfway,
  .dm-timer .timer-progress.timer-progress-halfway {
    filter: drop-shadow(0 0 5px #10d975) 
            drop-shadow(0 0 15px #10d975) 
            drop-shadow(0 0 30px #10d975) !important;
  }

  /* 25% ~ 10%: 노란색으로 전환 */
  .timer-progress.timer-progress-warning,
  .dm-timer .timer-progress.timer-progress-warning {
    filter: drop-shadow(0 0 5px #ffd700) 
            drop-shadow(0 0 15px #ffd700) 
            drop-shadow(0 0 30px #ffd700) !important;
  }

  /* 10% ~ 0%: 주황색/빨간색으로 전환 */
  .timer-progress.timer-progress-critical,
  .dm-timer .timer-progress.timer-progress-critical {
    filter: drop-shadow(0 0 5px #ff6b35) 
            drop-shadow(0 0 15px #ff6b35) 
            drop-shadow(0 0 30px #ff6b35) !important;
    animation: progressGlowCritical 1.5s ease-in-out infinite alternate;
  }


  .timer-pulse {
    animation: pulseEffect 4s ease-in-out infinite;
  }

  .dm-timer .timer-pulse {
    animation: pulseEffect 4s ease-in-out infinite;
  }

  /* Center time display */
  .timer-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    width: 180px;
    text-align: center;
  }

  .dm-timer .timer-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    width: 180px;
    text-align: center;
  }

  .timer-time {
    font-size: 2.8rem;
    font-weight: 400;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  .dm-timer .timer-time {
    font-size: 2.8rem;
    font-weight: 400;
    color: var(--timer-text-white);
    line-height: 1;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  /* Focus mode indicator */
  .ambient-info {
    margin-bottom: 2rem; /* 여백 증가 */
  }

  .dm-timer .ambient-info {
    margin-bottom: 2rem;
  }

  /* 집중 시간 텍스트 - 자연스럽고 깔끔한 중앙 정렬 */
  .focus-mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    transition: color 0.3s ease;
    cursor: default;
  }

  .dm-timer .focus-mode {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    transition: color 0.3s ease;
    cursor: default;
  }

  .focus-mode:hover {
    color: rgba(255, 255, 255, 1);
    background: none;
    transform: none;
    box-shadow: none;
  }

  .dm-timer .focus-mode:hover {
    color: rgba(255, 255, 255, 1);
    background: none;
    transform: none;
    box-shadow: none;
  }

  .mode-icon {
    font-size: 1.25rem;
    animation: iconPulse 2s ease-in-out infinite;
  }

  .dm-timer .mode-icon {
    font-size: 1.25rem;
    animation: iconPulse 2s ease-in-out infinite;
  }

  .mode-text {
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .dm-timer .mode-text {
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  /* Break mode styles */
  .timer-modal.break-mode .focus-mode {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
  }

  .dm-timer .timer-modal.break-mode .focus-mode {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
  }

  .timer-modal.break-mode .focus-mode .mode-icon {
    animation: iconFloat 3s ease-in-out infinite;
  }

  .dm-timer .timer-modal.break-mode .focus-mode .mode-icon {
    animation: iconFloat 3s ease-in-out infinite;
  }

  .timer-modal.break-mode .focus-mode .mode-text {
    color: #ffffff;
  }

  .dm-timer .timer-modal.break-mode .focus-mode .mode-text {
    color: #ffffff;
  }

  /* Action buttons - 하단 여백 추가로 모달 경계와 거리 확보 */
  .timer-actions.enhanced {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* 아주 작은 화면에서만 줄바꿈 */
    /* 하단 여백 증가 - 최소 32px 확보 */
    padding: 0 1.5rem 0; /* Bottom padding moved to modal container */
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
  }

  .dm-timer .timer-actions.enhanced {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* 아주 작은 화면에서만 줄바꿈 */
    /* 하단 여백 증가 - 최소 32px 확보 */
    padding: 0 1.5rem 0; /* Bottom padding moved to modal container */
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
  }

  .timer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: var(--dm-timer-btn-padding, 12px 20px);
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 140px; /* 모바일에서도 2개 버튼이 한 줄에 들어가도록 최소 너비 조정 */
    flex: 0 1 auto;
  }

  .dm-timer .timer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: var(--dm-timer-btn-padding);
    border: none;
    border-radius: var(--timer-radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--timer-anim-timing);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 140px; /* 모바일에서도 2개 버튼이 한 줄에 들어가도록 최소 너비 조정 */
    flex: 0 1 auto;
  }

  .timer-btn.primary {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  .dm-timer .timer-btn.primary {
    background: var(--timer-primary);
    color: var(--timer-text-white);
    box-shadow: 0 4px 14px var(--timer-glow);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  .timer-btn.primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
  }

  .dm-timer .timer-btn.primary:hover {
    background: var(--timer-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--timer-glow);
  }

  /* 일시정지 버튼 - 중립 색상으로 강조 제거 */
  .timer-btn.primary.pause {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  .dm-timer .timer-btn.primary.pause {
    background: rgba(255, 255, 255, 0.1);
    color: var(--timer-text-white);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }

  /* 일시정지 버튼 hover - 중립적인 반응 */
  .timer-btn.primary.pause:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  }

  .dm-timer .timer-btn.primary.pause:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  }

  .timer-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  }

  .dm-timer .timer-btn.secondary {
    background: var(--timer-glass);
    color: var(--timer-text-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  }

  .timer-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
  }

  .dm-timer .timer-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
  }

  /* Minimize area */
  /* 최소화 영역 - 개선된 여백과 스타일 */
  .timer-minimize {
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s ease;
    text-shadow: none;
    margin-top: 0.5rem;
  }

  .dm-timer .timer-minimize {
    padding: 1.25rem 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s ease;
    text-shadow: none;
    margin-top: 0.5rem;
  }

  .timer-minimize:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-top-color: rgba(255, 255, 255, 0.15);
  }

  .dm-timer .timer-minimize:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-top-color: rgba(255, 255, 255, 0.15);
  }
}

/* 알람 선택 모달 스타일 */
.alarm-select-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alarm-select-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.alarm-select-content {
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.alarm-select-overlay.is-open .alarm-select-content {
  transform: translateY(0);
}

.alarm-select-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alarm-select-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
}

.close-alarm-modal {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s;
}

.close-alarm-modal:hover {
  color: #fff;
}

.alarm-list {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.alarm-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.alarm-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.alarm-option.selected {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
}

.sound-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sound-icon {
  font-size: 1.2rem;
}

.sound-name {
  color: #fff;
  font-weight: 500;
}

.sound-actions {
  display: flex;
  gap: 0.5rem;
}

.preview-btn, .select-btn {
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.preview-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.preview-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.select-btn {
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
}

.select-btn:hover {
  background: #2563eb;
}

.alarm-option.selected .select-btn {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  cursor: default;
}

/* Custom Background Layer */
.custom-background-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2; /* 파티클(-1)보다 뒤에 위치 */
  overflow: hidden;
  border-radius: 24px; /* 모달 둥글기 적용 */
}

.custom-background-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1.0; /* 완전 불투명으로 변경하여 대시보드가 보이지 않도록 함 */
}

/* Settings Modal Styles */
.settings-modal-content {
  width: 400px;
  max-width: 90vw;
  background: rgba(30, 30, 30, 0.95); /* Dark background */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 80vh;
  color: #fff; /* White text */
}

.settings-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 1rem;
}

.settings-tab {
  padding: 1rem;
  background: none;
  border: none;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.settings-tab:hover {
  color: rgba(255, 255, 255, 0.9);
}

.settings-tab.active {
  color: var(--dm-primary, #6366F1);
  border-bottom-color: var(--dm-primary, #6366F1);
}

.settings-tab-content {
  display: none;
  padding: 1.5rem;
  overflow-y: auto;
}

.settings-tab-content.active {
  display: block;
}

/* Background Settings Styles */
.background-settings {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bg-preview-area {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bg-placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#bg-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.bg-help-text {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
  margin: 0;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 8px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.3);
  color: #fff;
}

.hidden {
  display: none !important;
}

/* ==================== Duration Picker (READY 상태) ==================== */

/* READY 상태에서 timer-time 숨기기 */
.timer-duration-picker:not(.hidden) ~ .timer-time,
.timer-center:has(.timer-duration-picker:not(.hidden)) .timer-time {
  display: none !important;
}

/* 피커가 표시될 때 timer-time 숨기기 (JS로 제어) */
.timer-time.picker-active {
  display: none !important;
}

.timer-duration-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  pointer-events: auto;
  z-index: 10;
}

.dm-timer .timer-duration-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  pointer-events: auto;
  z-index: 10;
}


.duration-picker-wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.25rem 0.5rem;
  scroll-snap-type: y mandatory;
}

.dm-timer .duration-picker-wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  background: transparent;
  border-radius: 12px;
  padding: 0.25rem 0.5rem;
  scroll-snap-type: y mandatory;
}

.duration-picker-wheel::-webkit-scrollbar {
  width: 4px;
}

.duration-picker-wheel::-webkit-scrollbar-track {
  background: transparent;
}

.duration-picker-wheel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.duration-option {
  padding: 0.4rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  scroll-snap-align: center;
  border-radius: 6px;
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
}

.dm-timer .duration-option {
  padding: 0.4rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  scroll-snap-align: center;
  border-radius: 6px;
  min-width: 70px;
  text-align: center;
  white-space: nowrap;
}

.duration-option:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

.dm-timer .duration-option:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

.duration-option.selected {
  color: #ffffff;
  font-weight: 600;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.15);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.dm-timer .duration-option.selected {
  color: #ffffff;
  font-weight: 600;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.15);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.duration-unit {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 0.5rem;
}

.dm-timer .duration-unit {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 0.5rem;
}

/* Timer time display clickable state (for READY mode) */
.timer-time.clickable {
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.timer-time.clickable:hover {
  color: #00ffcc;
  transform: scale(1.05);
}

/* Start button specific styles */
.timer-btn.start {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-size: 1.1rem;
  min-width: 180px;
}

.dm-timer .timer-btn.start {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-size: 1.1rem;
  min-width: 180px;
}

.timer-btn.start:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.dm-timer .timer-btn.start:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

