* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

html,
body {
  height: 100%;
}

.top-banner,
.bottom-banner {
  min-height: 90px;
  max-height: 250px;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-space {
  background: #ddd;
  color: #333;
  border: 1px dashed #888;
  width: 95%;
  height: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0066cc;
  color: #fff;
  padding: 10px 20px;
  position: relative;
}

.nav-links {
  display: flex;
  gap: 14px;
}

.nav-links a {
  text-decoration: none;
  color: #fff;
  font-size: 14px;
  transition: color .3s;
}

.nav-links a:hover {
  color: #010056;
}

.hamburger {
  display: none;
  font-size: 22px;
  cursor: pointer;
}

.main-container {
  display: flex;
  min-height: 66vh;
}

.left-banner {
  min-width: 160px;
  max-width: 300px;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sleep-tool-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 40px 28px 28px 28px;
  background: linear-gradient(115deg, #edf4ff 0%, #eef6ff 40%, #ffffff 100%);
}

.sleep-card {
  max-width: 960px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sleep-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  position: relative;
  flex-wrap: wrap;
}

.sleep-title {
  font-size: 2.15rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: #0066cc;
}

.sleep-info-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #0066cc;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e3f2fd 70%);
  color: #0066cc;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  transition: transform .35s cubic-bezier(.42, 0, .58, 1), box-shadow .35s, background .4s;
}

.sleep-info-trigger:hover,
.sleep-info-trigger:focus-visible {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  outline: none;
}

.sleep-info-trigger:active {
  transform: scale(.95);
}

.sleep-info-flyout {
  position: absolute;
  top: 55px;
  left: 0;
  z-index: 50;
  background: #ffffffee;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid #c5d8e6;
  border-radius: 18px;
  padding: 18px 20px 16px 20px;
  width: min(560px, 85vw);
  box-shadow: 0 10px 36px rgba(0, 0, 0, .15);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.98);
  transition: opacity .55s cubic-bezier(.42, 0, .58, 1), transform .55s cubic-bezier(.42, 0, .58, 1);
}

.sleep-info-flyout h2 {
  font-size: 1.15rem;
  color: #0066cc;
  margin-bottom: 6px;
}

.sleep-info-flyout p {
  font-size: .9rem;
  color: #222;
  line-height: 1.35;
  margin-bottom: 10px;
}

.sleep-info-flyout .sleep-sub {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #444;
  margin-top: -4px;
}

.sleep-info-flyout .sleep-disclaimer {
  font-size: .6rem;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #555;
}

.sleep-title-row:hover .sleep-info-flyout,
.sleep-info-trigger:focus+.sleep-info-flyout,
.sleep-info-trigger:focus-visible+.sleep-info-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sleep-interaction-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
}

.sleep-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #e3f2fd;
  border-radius: 14px;
  padding: 18px 16px 16px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

.sleep-form .input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sleep-form .input-group.with-info {
  position: relative;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
}

.field-info-trigger {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #0066cc;
  background: radial-gradient(circle at 30% 30%, #ffffff 0%, #e3f2fd 75%);
  color: #0066cc;
  font-weight: 600;
  font-size: .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .35s cubic-bezier(.42, 0, .58, 1), box-shadow .35s, background .4s;
}

.field-info-trigger:hover,
.field-info-trigger:focus-visible {
  transform: translateY(-2px) scale(1.07);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  outline: none;
}

.field-info-trigger:active {
  transform: scale(.9);
}

.field-info-flyout {
  position: absolute;
  top: 38px;
  left: 0;
  z-index: 40;
  background: #ffffffee;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid #c5d8e6;
  border-radius: 14px;
  padding: 12px 14px 11px 14px;
  width: min(380px, 85vw);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .15);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.97);
  transition: opacity .45s cubic-bezier(.42, 0, .58, 1), transform .45s cubic-bezier(.42, 0, .58, 1);
  font-size: .75rem;
  line-height: 1.25;
  color: #222;
}

.field-info-flyout strong {
  color: #0066cc;
}

.field-label-row .field-info-trigger:hover+.field-info-flyout,
.field-label-row .field-info-trigger:focus+.field-info-flyout,
.field-label-row .field-info-trigger:focus-visible+.field-info-flyout {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.sleep-form label {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
  margin-bottom: 2px;
}

.sleep-form .input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sleep-form input[type=time] {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid #b0bec5;
  font-size: 1rem;
  background: #f7fafd;
  color: #222;
  transition: border .3s;
}

.sleep-form input[type=time]:focus {
  border: 1.5px solid #0066cc;
  outline: none;
}

.sleep-form select,
.sleep-form input[type=number] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid #b0bec5;
  background: #e3f2fd;
  color: #222;
  font-size: 1rem;
  transition: border .3s;
}

.sleep-form select:focus,
.sleep-form input[type=number]:focus {
  border: 1.5px solid #0066cc;
  outline: none;
}

.sleep-form .radio-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.sleep-form .radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  background: #f0f7ff;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid #c5d8e6;
  transition: background .3s, border .3s;
}

.sleep-form .radio-row input {
  accent-color: #0066cc;
}

.sleep-form .radio-row label:hover {
  background: #e1f1ff;
}

.sleep-btn {
  margin-top: 6px;
  padding: 10px 0;
  background: linear-gradient(90deg, #0066cc 60%, #333 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  transition: background .3s, transform .2s;
}

.sleep-btn:hover {
  background: linear-gradient(90deg, #004080 60%, #111 100%);
  transform: translateY(-2px) scale(1.03);
}

.sleep-result-container {
  margin-top: 0;
  width: 100%;
  background: linear-gradient(140deg, #f0f7ff 0%, #ffffff 100%);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
  padding: 18px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: scale(.95) translateY(40px);
  pointer-events: none;
  transition: opacity .7s cubic-bezier(.42, 0, .58, 1), transform .7s cubic-bezier(.42, 0, .58, 1);
}

.sleep-result-container.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  animation: popResult 1.05s cubic-bezier(.42, 0, .58, 1);
}

.sleep-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
  width: 100%;
}

.sleep-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #222;
  margin-bottom: 4px;
  letter-spacing: 1px;
  animation: fadeInNum 1.1s cubic-bezier(.42, 0, .58, 1);
  text-align: center;
}

.sleep-label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #0066cc;
  text-align: center;
}

.sleep-cycles-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.sleep-cycles-list .cycle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #e6f3ff;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 500;
  color: #222;
  border: 1px solid #c5d8e6;
  animation: fadeInTips .9s;
}

.sleep-cycles-list .cycle-item span.cycle-count {
  background: #0066cc;
  color: #fff;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .65rem;
  letter-spacing: .5px;
}

.sleep-progress-wrapper {
  width: 100%;
  margin-top: 4px;
}

.sleep-progress-bar {
  width: 100%;
  height: 14px;
  background: #cfd8dc;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.sleep-progress {
  height: 100%;
  width: 0;
  border-radius: 10px;
  background: #2196f3;
  transition: width 1.2s cubic-bezier(.42, 0, .58, 1), background .3s;
}

.sleep-scale {
  display: flex;
  justify-content: space-between;
  font-size: .6rem;
  color: #555;
  letter-spacing: .5px;
  margin-top: -2px;
}

.sleep-tips {
  font-size: .72rem;
  color: #333;
  margin-top: 10px;
  text-align: center;
  font-style: italic;
  animation: fadeInTips 1.05s cubic-bezier(.42, 0, .58, 1);
}

.sleep-disclaimer-bottom {
  font-size: .55rem;
  opacity: .75;
  text-align: center;
  margin-top: 10px;
  letter-spacing: .5px;
}

@media (max-width:900px) {
  .left-banner {
    display: none;
  }

  .sleep-tool-section {
    padding: 28px 14px;
  }
}

@media (max-width:700px) {
  .sleep-form {
    max-width: 100%;
  }

  .sleep-result-container {
    max-width: 100%;
  }

  .sleep-title {
    font-size: 1.65rem;
  }
}

@keyframes popResult {
  0% {
    opacity: 0;
    transform: scale(.8) translateY(60px);
  }

  60% {
    opacity: 1;
    transform: scale(1.05) translateY(-8px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fadeInNum {
  from {
    opacity: 0;
    transform: scale(.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInTips {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cards-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 20px;
  padding: 20px;
}

.card {
  position: relative;
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.card-overlay {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
}

.card h2 {
  font-size: 2rem;
}

.tool-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.tool-name {
  font-size: 14px;
  text-align: start;
  flex: 1;
  transform: translateX(-20px);
  margin-left: 10%;
}

.tool-link {
  padding: 6px 12px;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  transition: background .3s;
  margin-left: auto;
  border: 3px solid #004080;
}

.tool-link:hover {
  background: #004080;
}

@media (max-width:1000px) {
  .cards-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width:600px) {
  .cards-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width:850px) {
  .left-banner {
    display: none;
  }
}

@media (min-width:850px) {
  .bottom-banner {
    display: none;
  }
}

@media (max-width:850px) {
  .hamburger {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    gap: 10px;
    background: #0066cc;
    position: absolute;
    top: 157px;
    width: 30%;
    max-width: 220px;
    padding: 10px 0 10px 10px;
    z-index: 100;
  }

  .nav-links.active {
    display: flex;
  }
}

.layout-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content-row {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.scroll-panel {
  background: linear-gradient(120deg, #e3f2fd 0%, #f5f5f5 100%);
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0 30% 0;
}