/* =========================================================================
 * 스마트 동계 올림픽 — 게임 공통 스타일 (common.css)
 * 겨울 테마: 화이트-블루 색조, 눈/얼음 배경
 * ========================================================================= */
:root {
  --ice-deep: #0b1f3a;
  --ice-blue: #1f7ae0;
  --ice-light: #9fe0ff;
  --snow: #f3f9ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: 'Jua', 'Apple SD Gothic Neo', sans-serif;
  background: var(--ice-deep);
  color: var(--snow);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

body.winter {
  background:
    radial-gradient(circle at 20% 10%, #16365e 0%, transparent 45%),
    radial-gradient(circle at 80% 90%, #0e2a4d 0%, transparent 45%),
    linear-gradient(160deg, #0b1f3a 0%, #143a63 100%);
}

/* 헤더 */
#ui-header {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: rgba(11, 31, 58, 0.65);
  backdrop-filter: blur(6px);
  z-index: 30;
  transition: transform .3s ease, opacity .3s ease;
}
#ui-header.hidden { transform: translateY(-110%); opacity: 0; pointer-events: none; }
#ui-header h1 { margin: 0; font-size: 1.5rem; color: var(--ice-light); }
#ui-home {
  color: var(--snow); text-decoration: none;
  background: var(--ice-blue); padding: 8px 16px; border-radius: 20px;
  font-size: 1rem;
}

/* 캔버스 */
.canvas-container {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
#input_video { display: none; }
#output_canvas {
  width: 100%; height: 100%;
  object-fit: cover;
  background: #07172c;
}

/* 안내 오버레이 */
#overlay {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(7, 23, 44, 0.78);
  backdrop-filter: blur(3px);
  z-index: 20; text-align: center; padding: 24px;
}
#overlay.show { display: flex; }
.overlay-box { max-width: 560px; }
.overlay-msg { font-size: 1.6rem; line-height: 1.5; margin-bottom: 28px; }
.overlay-sport { font-size: 2.4rem; color: var(--ice-light); margin-bottom: 8px; }
.overlay-desc { font-size: 1.15rem; color: #cfe7ff; margin-bottom: 28px; line-height: 1.6; }

.big-btn {
  font-family: inherit;
  font-size: 1.6rem;
  color: #fff;
  background: linear-gradient(135deg, #1f7ae0, #38b6ff);
  border: none; border-radius: 50px;
  padding: 18px 48px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(31, 122, 224, 0.5);
  transition: transform .12s ease;
}
.big-btn:active { transform: scale(0.95); }

/* 중단 버튼 */
#stop-btn {
  position: absolute; top: 16px; right: 16px;
  display: none;
  font-family: inherit; font-size: 1rem; color: #fff;
  background: rgba(220, 60, 80, 0.9);
  border: none; border-radius: 24px; padding: 10px 20px;
  cursor: pointer; z-index: 25;
}
#stop-btn.show { display: block; }

/* 결과 모달 */
#result-modal {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: rgba(7, 23, 44, 0.82);
  z-index: 40; padding: 24px;
}
#result-modal.show { display: flex; }
.modal-card {
  background: linear-gradient(160deg, #ffffff, #e8f4ff);
  color: var(--ice-deep);
  border-radius: 28px; padding: 32px 28px;
  width: 100%; max-width: 460px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-card h2 { margin: 0 0 6px; font-size: 2rem; color: var(--ice-blue); }
#result-text { font-size: 1.4rem; margin: 6px 0 20px; min-height: 1.5em; }
#name-input {
  font-family: inherit; font-size: 1.2rem;
  width: 100%; padding: 12px 16px; margin-bottom: 18px;
  border: 2px solid var(--ice-blue); border-radius: 14px;
  text-align: center;
}
.modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-btns .full { grid-column: 1 / -1; }
.modal-btn {
  font-family: inherit; font-size: 1.1rem; color: #fff;
  border: none; border-radius: 16px; padding: 14px;
  cursor: pointer;
}
.modal-btn.video { background: #e0427a; }
.modal-btn.photo { background: #1f7ae0; }
.modal-btn.retry { background: #2bb673; }
.modal-btn.home  { background: #5a6b82; text-decoration: none; display: block; }
.modal-btn:active { filter: brightness(0.92); }

/* 반응형(작은 화면) */
@media (max-width: 600px) {
  #ui-header h1 { font-size: 1.1rem; }
  .overlay-msg { font-size: 1.2rem; }
  .overlay-sport { font-size: 1.8rem; }
  .big-btn { font-size: 1.3rem; padding: 14px 32px; }
  .modal-card h2 { font-size: 1.6rem; }
}

/* 눈 파티클(가벼운 CSS 애니메이션) */
.snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 10; overflow: hidden;
}
.snow span {
  position: absolute; top: -10px;
  color: rgba(255, 255, 255, 0.8);
  animation: snowfall linear infinite;
}
@keyframes snowfall {
  to { transform: translateY(110vh) rotate(360deg); }
}
