/* ================================
   BASE
   ================================ */
/* @font-face {
  font-family: "GenSenRounded";
  src: url("../assets/font/GenSenRounded2TW-B.otf") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
} */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  line-height: inherit;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
}

:root {
  --primary-500: #b5f1f8;
  --secondary-200: #7c87ac;
  --secondary-400: #5773d1;
  --grey-600: #1e2849;
  --grey-800: #343454;
  --grey-900: #091123;
}

body {
  font-family: "Manrope";
  -webkit-font-smoothing: antialiased;
  line-height: 1.2;
  font-size: 16px;
  background-color: var(--grey-800);
  color: var(--secondary-200);
  width: 100%;
  height: 100dvh;
  display: flex;
  justify-content: center;
  text-align: center;
}

h2 {
  font-size: 64px;
  color: var(--primary-500);
  font-variant-numeric: tabular-nums;
}
h3 {
  font-size: 36px;
  color: var(--primary-500);
}
h4 {
  font-size: 24px;
  color: var(--primary-500);
}
h5 {
  font-size: 20px;
  color: var(--primary-500);
}
h6 {
  font-size: 18px;
  color: var(--primary-500);
}
p {
  color: var(--secondary-200);
}

/* ================================
   LAYOUT
   ================================ */
.l-main {
  display: flex;
  flex-flow: column nowrap;
  flex: 1;
  max-width: 420px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: 32px;
  padding-right: 32px;
  gap: 16px;
}

/* ================================
   MODULES
   ================================ */

/* --- counter --- */
.counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  border: 1px solid var(--primary-500);
  border-radius: 8px;
  color: var(--primary-500);
}

.counter__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* --- c-btn --- */
.c-btn {
  padding: 8px 16px;
  border-radius: 8px;
  background-color: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.c-btn--large {
  padding: 20px 40px;
  font-size: 24px;
}

.c-btn--primary {
  width: 100%;
  background-color: var(--primary-500);
  color: var(--grey-800);
}

.c-btn--primary:active {
  transform: scale(0.95);
}

.c-btn--secondary {
  border: 1px solid var(--secondary-200);
  color: var(--secondary-200);
}

.c-btn--secondary:hover {
  border-color: var(--secondary-400);
  color: var(--secondary-400);
}

.c-btn--secondary:active {
  transform: scale(0.95);
}

/* --- sleep-display --- */
.sleep-display {
  padding: 8px 16px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  background-color: var(--grey-600);
  color: var(--secondary-200);
}

.sleep-display__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* --- c-overlay --- */
.c-overlay {
  width: 100%;
  height: 100dvh;
  background-color: rgba(0, 0, 0, 60%);
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.c-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* --- c-modal --- */
.c-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--grey-800);
  min-width: 240px;
  border-radius: 16px;
  gap: 16px;
  padding: 40px;
}

.c-modal__title {
  color: var(--primary-500);
}

.c-modal__body {
  display: flex;
  align-items: center;
}

/* --- time-picker --- */
.time-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-picker__column {
  width: 56px;
  height: 180px;
  display: flex;
  flex-direction: column;
  mask-image: linear-gradient(
    to bottom,
    transparent 10%,
    rgba(0, 0, 0, 1) 50%,
    transparent 90%
  );
  overflow-y: scroll;
  scroll-snap-type: y proximity;
}

.time-picker__column::-webkit-scrollbar {
  display: none;
}

.time-picker__item {
  scroll-snap-align: center;
  scroll-snap-stop: always;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--primary-500);
  flex-shrink: 0;
}

.time-picker__separator {
  font-size: 36px;
  color: var(--primary-500);
}

/* ================================
   PAGE SECTIONS (非重用區塊)
   ================================ */
.reward {
  flex: 1;
  min-height: 200px;
  max-height: 320px;
  width: 100%;
  background-color: var(--grey-900);
  border: 1px solid var(--primary-500);
  border-radius: 16px;
  position: relative;
  overflow: hidden; /* 確保金幣不會噴出邊框 */
}

.reward canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.timer {
  /* 目前無額外樣式需求 */
}

.tools {
  padding-top: 32px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ================================
   STATE
   ================================ */
.is-active {
  opacity: 1;
  pointer-events: auto;
}
