@import url("https://use.typekit.net/dnt4gdo.css");

/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Set shorter line heights on headings and interactive elements */
h1, h2, h3, h4,
button, input, label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1, h2,
h3, h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

:root {
  --primary: #ffc907;
  --secondary: #003366;
  --accent: #77a8bb;
  --background: #fff7e1;
  --heading: "proxima-nova", "proxima nova", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --body: "proxima-nova", "proxima nova", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #fffbe8 10%, var(--background) 60%);
  color: var(--secondary);
  font-family: var(--body);
  overflow-x: auto;
}

.difficulty-screen {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  background: rgba(0, 51, 102, 0.4);
  padding: 1rem;
}

.difficulty-screen[hidden] {
  display: none;
}

.difficulty-card {
  width: min(36rem, 95vw);
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--secondary) 28%, #ffffff);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(0, 51, 102, 0.28);
  padding: 1rem;
}

.difficulty-subtitle {
  margin-top: 0.25rem;
}

.difficulty-options {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.difficulty-option {
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, #ffffff);
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--accent) 13%, #ffffff);
  color: var(--secondary);
  padding: 0.7rem;
  cursor: pointer;
}

.difficulty-option.is-selected {
  border-color: color-mix(in srgb, var(--primary) 68%, var(--secondary));
  background: color-mix(in srgb, var(--primary) 36%, #ffffff);
  box-shadow: 0 0 0 3px rgba(255, 201, 7, 0.32);
}

.difficulty-summary {
  margin-top: 0.7rem;
  font-size: 0.94rem;
}

.continue-game {
  margin-top: 0.7rem;
  border: 0;
  border-radius: 0.72rem;
  padding: 0.58rem 0.9rem;
  background: color-mix(in srgb, var(--secondary) 88%, #ffffff);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.continue-game:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

h1 {
  text-align: center;
}

h1,
h2,
h3,
h4 {
  font-family: var(--heading);
  color: var(--secondary);
  letter-spacing: 0.01em;
  font-weight: 300;
}

p,
span,
li {
  font-family: var(--body);
  font-weight: 300;
}

.brand-lockup {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.brand-logo {
  display: block;
  width: min(16.5rem, 68vw);
  height: auto;
  max-height: 6.5rem;
  object-fit: contain;
}

.brand-logo-fallback {
  font-family: var(--heading);
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--secondary);
}

.brand-tagline {
  font-size: 0.92rem;
  color: color-mix(in srgb, var(--secondary) 75%, var(--accent));
}

.desktop-header {
  display: none;
}

.mobile-nav ul {
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.72rem 0.2rem;
  font-family: var(--heading);
  font-size: 0.9rem;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 120ms ease;
}

.nav-item:hover {
  background: color-mix(in srgb, var(--accent) 28%, #ffffff);
}

.nav-item.is-active {
  background: color-mix(in srgb, var(--primary) 82%, #ffffff);
  color: #111111;
  font-weight: 700;
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--secondary) 35%, transparent);
}

main {
  padding: 0.85rem;
  padding-bottom: 8.8rem;
  display: block;
}

.game-section {
  display: none;
  background: linear-gradient(165deg, #ffffff 0%, color-mix(in srgb, var(--accent) 11%, #ffffff) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, #ffffff);
  border-radius: 0.95rem;
  padding: 0.78rem;
  box-shadow: 0 8px 22px rgba(0, 51, 102, 0.08);
}

.game-section.is-active {
  display: block;
}

.game-section.section-enter {
  animation: section-enter 260ms cubic-bezier(0.2, 0.7, 0.25, 1);
}

@keyframes section-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#home {
  position: relative;
  min-height: 0;
  padding-top: 3.2rem;
}

#home h2 {
  text-align: center;
}

.home-corner-actions {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  right: 0.7rem;
  display: flex;
  justify-content: space-between;
}

.corner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--secondary) 24%, transparent);
  background: color-mix(in srgb, var(--accent) 30%, #ffffff);
  color: var(--secondary);
  text-decoration: none;
  border-radius: 0.8rem;
  width: 2.6rem;
  height: 2.6rem;
  box-shadow: 0 4px 10px rgba(0, 51, 102, 0.15);
}

.corner-btn:hover {
  background: color-mix(in srgb, var(--accent) 45%, #ffffff);
}

#clicker {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.1rem auto 0;
  width: 7.8rem;
  height: 7.8rem;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #111111;
  font-weight: 700;
  font-size: 3.55rem;
  box-shadow: 0 10px 24px rgba(0, 51, 102, 0.25);
  transition: transform 120ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

#clicker:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 51, 102, 0.3);
}

#clicker:active,
#clicker.is-pressed {
  transform: translateY(1px) scale(0.98);
  background: #8cd3ff;
  box-shadow: 0 0 0 6px rgba(119, 168, 187, 0.45), 0 8px 16px rgba(0, 51, 102, 0.2);
}

.home-stats {
  margin-top: 2.35rem;
}

.milestone-panel {
  margin-top: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, #ffffff);
  background: color-mix(in srgb, var(--accent) 12%, #ffffff);
  border-radius: 0.9rem;
  padding: 0.65rem;
}

.milestone-panel h3 {
  margin-bottom: 0.35rem;
}

.next-milestone {
  text-align: left;
  font-size: 0.94rem;
  font-weight: 600;
}

.milestone-log-prompt {
  margin-top: 0.3rem;
  text-align: left;
  font-size: 0.88rem;
  color: color-mix(in srgb, var(--secondary) 78%, var(--accent));
}

.milestone-log-toggle {
  margin-top: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--secondary) 25%, #ffffff);
  border-radius: 0.65rem;
  padding: 0.4rem 0.65rem;
  background: #ffffff;
  color: var(--secondary);
  font-weight: 600;
  cursor: pointer;
}

.milestone-log {
  margin-top: 0.55rem;
}

.milestone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.milestone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.55rem;
  font-size: 0.92rem;
}

.milestone-item.is-unlocked {
  background: color-mix(in srgb, #8fd5b2 25%, #ffffff);
}

.milestone-item.is-locked {
  background: color-mix(in srgb, var(--secondary) 8%, #ffffff);
}

#home p {
  text-align: center;
}

#dropdisplay {
  font-size: clamp(2.7rem, 10vw, 4rem);
  font-weight: 700;
  line-height: 1;
  color: var(--secondary);
}

.rate-text {
  font-style: italic;
  font-size: 1.2rem;
  color: color-mix(in srgb, var(--secondary) 75%, var(--accent));
}

.difficulty-current {
  margin-top: 0.3rem;
  font-size: 0.95rem;
}

.upgrade-summary {
  margin-top: 0.55rem;
  margin-bottom: 0.65rem;
}

#upgrades h2,
#upgrades .upgrade-summary,
#upgrades .upgrade-empty-state {
  text-align: center;
}

.upgrade-empty-state {
  margin: -0.2rem 0 0.75rem;
  font-size: 0.95rem;
  color: color-mix(in srgb, var(--secondary) 72%, var(--accent));
}

.upgrades-grid {
  display: grid;
  gap: 0.6rem;
}

.upgrade-card {
  width: 100%;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, #ffffff);
  border-radius: 0.9rem;
  padding: 0.72rem;
  background: color-mix(in srgb, var(--accent) 18%, #ffffff);
  color: var(--secondary);
  box-shadow: 0 6px 14px rgba(0, 51, 102, 0.12);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.upgrade-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 18px rgba(0, 51, 102, 0.18);
  background: color-mix(in srgb, var(--accent) 24%, #ffffff);
}

.upgrade-card:active {
  transform: translateY(0) scale(0.995);
}

.upgrade-card.is-revealed {
  animation: upgrade-reveal 380ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.upgrade-card.is-error {
  border-color: #d94141;
  background: #ffe7e7;
  box-shadow: 0 0 0 3px rgba(217, 65, 65, 0.22), 0 8px 16px rgba(217, 65, 65, 0.2);
  animation: upgrade-shake 240ms ease;
}

@keyframes upgrade-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@keyframes upgrade-reveal {
  0% {
    opacity: 0;
    transform: translateX(18px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.unlock-toast-stack {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: grid;
  gap: 0.45rem;
  pointer-events: none;
}

.unlock-toast {
  min-width: 12rem;
  text-align: center;
  padding: 0.52rem 0.8rem;
  border-radius: 0.7rem;
  border: 1px solid #1f7f48;
  background: #2ca55f;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(44, 165, 95, 0.32);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.unlock-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.offline-popup {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 51, 102, 0.34);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.offline-popup[hidden] {
  display: none;
}

.resource-popup {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 51, 102, 0.34);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.resource-popup[hidden] {
  display: none;
}

.resource-popup-card {
  width: min(25rem, 94vw);
  border-radius: 0.95rem;
  border: 1px solid color-mix(in srgb, var(--secondary) 25%, #ffffff);
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(0, 51, 102, 0.24);
  padding: 1rem;
  text-align: center;
  animation: popup-enter 220ms ease;
}

.resource-popup-card p {
  margin-top: 0.45rem;
}

.resource-popup-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.resource-popup-actions a,
.resource-popup-actions button {
  border: 0;
  border-radius: 0.65rem;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.resource-popup-actions a {
  background: color-mix(in srgb, var(--secondary) 88%, #ffffff);
  color: #ffffff;
}

.resource-popup-actions button {
  background: color-mix(in srgb, var(--accent) 28%, #ffffff);
  color: var(--secondary);
}

.offline-popup-card {
  width: min(24rem, 94vw);
  border-radius: 0.95rem;
  border: 1px solid color-mix(in srgb, var(--secondary) 25%, #ffffff);
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(0, 51, 102, 0.24);
  padding: 1rem;
  text-align: center;
  animation: popup-enter 220ms ease;
}

.offline-popup-card h3 {
  margin-bottom: 0.45rem;
}

.offline-popup-card p + p {
  margin-top: 0.35rem;
}

.offline-popup-card button {
  margin-top: 0.75rem;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.55rem 0.95rem;
  background: color-mix(in srgb, var(--secondary) 88%, #ffffff);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

@keyframes popup-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upgrade-card h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.upgrade-icon {
  font-size: 1.15rem;
}

.upgrade-desc {
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  color: color-mix(in srgb, var(--secondary) 76%, var(--accent));
}

.upgrade-card p + p {
  margin-top: 0.18rem;
}

footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 19;
  display: grid;
  grid-template-rows: auto auto;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem 0.55rem;
  background: rgba(255, 255, 255, 0.96);
  border-top: 2px solid color-mix(in srgb, var(--secondary) 14%, transparent);
  box-shadow: 0 -8px 18px rgba(0, 51, 102, 0.08);
  backdrop-filter: blur(10px);
}

.mobile-footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
}

.mobile-footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.mobile-footer-brand h1 {
  text-align: left;
  font-size: 1.2rem;
  line-height: 1;
}

.mobile-footer-logo {
  display: flex;
  justify-content: center;
  align-items: center;
}

.mobile-footer-brand-logo {
  width: min(5.8rem, 18vw);
  max-height: 3rem;
}

.mobile-footer-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.mobile-footer-links {
  justify-content: flex-end;
}

.reset-btn {
  border: 0;
  border-radius: 0.75rem;
  padding: 0.65rem 0.95rem;
  background: color-mix(in srgb, var(--secondary) 90%, #ffffff);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 51, 102, 0.25);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.reset-btn:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--secondary) 80%, var(--accent));
  box-shadow: 0 8px 18px rgba(0, 51, 102, 0.28);
}

.reset-btn:active {
  transform: translateY(0);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  border-radius: 0.65rem;
  padding: 0.3rem 0.5rem;
  background: color-mix(in srgb, var(--secondary) 88%, #ffffff);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.8rem;
}

.win-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}

.confetti-emoji {
  position: absolute;
  top: -12vh;
  will-change: transform, opacity;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -8vh, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translate3d(0, 115vh, 0) rotate(540deg);
    opacity: 0;
  }
}

@media (min-width: 768px) {
  .desktop-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem 0.25rem;
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 247, 225, 0.94);
    border-bottom: 1px solid color-mix(in srgb, var(--secondary) 14%, transparent);
    box-shadow: 0 8px 18px rgba(0, 51, 102, 0.08);
    backdrop-filter: blur(10px);
  }

  .desktop-brand {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    align-items: flex-start;
  }

  .desktop-brand h1 {
    text-align: left;
    font-size: clamp(2rem, 2.3vw, 2.7rem);
    line-height: 1;
  }

  .desktop-logo-slot {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .desktop-brand-logo {
    width: min(17rem, 20vw);
    max-height: 7rem;
  }

  .desktop-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .desktop-footer-links {
    justify-content: flex-end;
  }

  .mobile-header {
    display: none;
  }

  footer {
    display: none;
  }

  .mobile-nav ul {
    max-width: 1200px;
    margin: 0 auto;
    gap: 0.5rem;
  }

  .nav-item {
    padding: 0.9rem;
  }

  main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    padding-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  .game-section,
  .game-section.is-active {
    display: block;
  }

  #home {
    min-height: 0;
    padding-top: 2.6rem;
  }

  .brand-logo {
    width: min(18rem, 24vw);
  }

  #clicker {
    margin-top: 0.9rem;
    width: 8.8rem;
    height: 8.8rem;
    font-size: 4rem;
  }

  .home-stats {
    margin-top: 1.8rem;
  }

}

@media (max-width: 767px) {
  body,
  main {
    min-width: 400px;
  }

  #home > h1,
  #home > .brand-lockup {
    display: none;
  }

  .mobile-nav ul {
    gap: 0.3rem;
    padding: 0.45rem;
  }

  .nav-item {
    font-size: 0.82rem;
    padding: 0.7rem 0.15rem;
  }

  main {
    padding: 0.65rem;
    padding-bottom: 7.95rem;
  }

  footer {
    grid-template-rows: auto auto;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem 0.45rem;
  }

  .mobile-footer-top {
    gap: 0.45rem;
  }

  .mobile-footer-brand h1 {
    font-size: 1.05rem;
  }

  .mobile-footer-brand-logo {
    width: min(5.2rem, 20vw);
    max-height: 2.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-section.section-enter,
  #clicker,
  .nav-item,
  .upgrade-card,
  .upgrade-card.is-error,
  .reset-btn {
    animation: none;
    transition: none;
  }

  .win-confetti-layer {
    display: none;
  }
}
