@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard-gov.min.css");

/* Reset & Core Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: #0b0f1a;
  color: #ffffff;
  font-family: "Pretendard GOV", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Utility */
.hidden {
  display: none !important;
}

/* 1. Setup View Styling */
.setup-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #0b0f1a;
  padding: 40px 20px;
  box-sizing: border-box;
}

.setup-card {
  background-color: #121621;
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.brand {
  margin-bottom: 16px;
}

.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}

.setup-card h2 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: #f8fafc;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

label {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-bottom: 8px;
}

input[type="text"],
input[type="date"],
input[type="time"] {
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus {
  border-color: #38bdf8;
}

.btn-start {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: linear-gradient(135deg, #8b5cf6, #38bdf8);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: transform 0.1s, opacity 0.2s;
  font-family: inherit;
}

.btn-start:hover {
  opacity: 0.95;
}

.btn-start:active {
  transform: scale(0.98);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.form-actions .btn-start {
  flex: 1.5;
}

.btn-share {
  flex: 1;
  height: 48px;
  padding: 0 12px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  box-sizing: border-box;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-share:hover {
  background: #334155;
  color: #7dd3fc;
}

/* 2. Fullscreen Countdown View Styling */
.countdown-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Mobile viewport height fix */
  background-color: #000000;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

.countdown-content {
  text-align: center;
  padding: 12px 16px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 요구사항 2: <작은글씨>[행사명](0000.0.0.)까지 - 잘림 없이 전체 표시 */
.event-info {
  font-family: 'Pretendard GOV', sans-serif;
  font-size: clamp(1rem, 3.5vw, 2.3rem);
  font-weight: 400;
  color: #ffffff;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  max-width: 96vw;
  line-height: 1.35;
  text-align: center;
}

/* 요구사항 1 & 2: 고정폭 글꼴 + <큰 글씨>[D-00 : 00: 00: 00] */
.timer-text {
  font-family: 'Pretendard GOV', -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.6rem, 8.5vw, 7.5rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -1px;
  white-space: nowrap;
  line-height: 1;
  max-width: 100vw;
}

/* 우하단 컨트롤 버튼 그룹 */
.exit-btn-group {
  position: absolute;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100000;
}

.btn-exit-icon {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  padding: 0;
}

.btn-exit-icon:hover {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* 요구사항 3: 우하단 '나가기' 버튼 */
.btn-exit {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 18px;
  height: 40px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.btn-exit:hover {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
}

/* Fullscreen User-Interaction Hint (공유 링크 접속 시) */
.fullscreen-hint {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  pointer-events: none;
  animation: fadeInDown 0.5s ease-out;
}

.fullscreen-hint-box {
  background: rgba(18, 22, 33, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  padding: 10px 18px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* -------------------------------------------------- */
/* 모바일 가로 강제 회전 모드 CSS (Fall-back Landscape) */
/* -------------------------------------------------- */
.countdown-container.force-landscape-mode {
  transform: rotate(90deg);
  transform-origin: center center;
  width: 100vh !important;
  height: 100vw !important;
  position: fixed;
  top: 50%;
  left: 50%;
  margin-top: -50vw;
  margin-left: -50vh;
}

/* Mobile Specific Optimizations */
@media (max-width: 640px) {
  .setup-container {
    padding: 24px 14px;
    align-items: flex-start;
  }

  .setup-card {
    padding: 24px 16px;
    border-radius: 12px;
    margin: auto 0;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .countdown-content {
    padding: 8px 12px;
  }

  .event-info {
    font-size: clamp(1rem, 4.8vw, 1.6rem);
    margin-bottom: 16px;
    max-width: 98vw;
    line-height: 1.4;
  }

  .timer-text {
    font-size: clamp(1.4rem, 8vw, 3.2rem);
    letter-spacing: -1.5px;
  }

  .exit-btn-group {
    bottom: 16px;
    right: 16px;
  }

  .btn-exit {
    padding: 8px 14px;
    height: 36px;
    font-size: 0.85rem;
  }

  .btn-exit-icon {
    width: 36px;
    height: 36px;
  }
}

/* Presets Section in Setup View */
.presets-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
}

.presets-label {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 12px;
  font-weight: 500;
}

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-preset {
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.btn-preset:hover {
  background-color: #1e293b;
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-preset-date {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 600;
}

/* Admin Page Styling */
.admin-body {
  background-color: #0b0f1a;
  color: #ffffff;
  font-family: "Pretendard GOV", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-y: auto;
  min-height: 100vh;
  padding: 40px 20px;
}

.admin-container {
  max-width: 680px;
  margin: 0 auto;
}

.admin-header {
  margin-bottom: 30px;
}

.admin-header h2 {
  font-size: 1.8rem;
  margin: 12px 0 6px 0;
  color: #f8fafc;
}

.admin-header p {
  color: #94a3b8;
  font-size: 0.95rem;
}

.admin-card {
  background-color: #121621;
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.admin-card h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: #38bdf8;
}

.btn-add {
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  border: none;
  color: #000;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.preset-admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 12px 16px;
  border-radius: 10px;
}

.preset-item-title {
  display: block;
  color: #f8fafc;
  font-size: 0.95rem;
}

.preset-item-date {
  font-size: 0.8rem;
  color: #38bdf8;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

.admin-btn-group {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-action {
  background-color: #8b5cf6;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary {
  background-color: #334155;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
}

.empty-msg {
  color: #64748b;
  text-align: center;
  padding: 20px;
}
