:root {
  --bg-top: #fff7dd;
  --bg-bottom: #f3d17a;
  --text-main: #2b1a00;
  --accent: #f5a400;
  --panel: rgba(255, 255, 255, 0.78);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top, var(--bg-top), var(--bg-bottom)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
  transition:
    background 0.8s ease,
    color 0.4s ease;
  overflow-x: hidden;
}

body[data-visual-state="before-4"] {
  --bg-top: #fff7dd;
  --bg-bottom: #f3d17a;
}

body[data-visual-state="after-4"] {
  --bg-top: #ffe9b8;
  --bg-bottom: #efb85e;
}

body[data-visual-state="after-5"] {
  --bg-top: #ffe0a6;
  --bg-bottom: #de8b34;
}

body[data-visual-state="weekend"] {
  --bg-top: #fff0c6;
  --bg-bottom: #e58d2a;
}

body[data-friday-mode="true"] .beer-svg svg {
  filter: drop-shadow(0 24px 36px rgba(170, 84, 0, 0.24));
}

body[data-dev-mode="false"] .dev-only {
  display: none;
}

.app {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 760px;
  width: 100%;
  box-sizing: border-box;
  padding: 18px 24px 72px;
}

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

h1 {
  font-size: clamp(42px, 8vw, 90px);
  margin: 0 0 10px;
  letter-spacing: -3px;
  line-height: 0.94;
  text-wrap: balance;
}

h1 span {
  color: #f5a400;
}

.beer-svg {
  width: min(250px, 100%);
  max-width: 90vw;
  margin: 10px auto;
}

.beer-svg svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 20px 30px rgba(80, 40, 0, 0.2));
}

#svgBeerFill,
#svgFoam {
  transition:
    y 0.8s ease,
    height 0.8s ease,
    d 0.8s ease,
    opacity 0.4s ease;
}

#svgBeerFill {
  transition:
    y 0.8s ease,
    height 0.8s ease;
  transform-origin: center;
}

#svgFoam {
  transition:
    d 0.8s ease,
    opacity 0.4s ease;
  animation: foamFloat 2.6s ease-in-out infinite;
}

.wave {
  animation: beerWave 0.7s ease;
}

@keyframes beerWave {
  0% {
    transform: skewX(0deg) scaleY(1);
  }
  35% {
    transform: skewX(-1.8deg) scaleY(1.015);
  }
  70% {
    transform: skewX(1.2deg) scaleY(0.992);
  }
  100% {
    transform: skewX(0deg) scaleY(1);
  }
}

@keyframes foamFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

@keyframes drip {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 0.75;
  }
  100% {
    transform: translateY(90px);
    opacity: 0;
  }
}

.buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 26px auto 0;
  max-width: 720px;
}

button {
  border: 0;
  border-radius: 20px;
  padding: 14px 10px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  background: white;
  box-shadow: 0 10px 25px rgba(80, 40, 0, 0.15);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

button:hover {
  transform: translateY(-3px);
}

button.active {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}

.message {
  font-size: clamp(20px, 3.8vw, 42px);
  font-weight: 900;
  margin-top: 12px;
  white-space: normal;
  text-wrap: balance;
}

.sub {
  font-size: 18px;
  opacity: 0.75;
  margin-bottom: 4px;
  line-height: 1.35;
}

.context-text {
  min-height: 1.4em;
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  opacity: 0.82;
  line-height: 1.45;
}

.countdown {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.68;
}

.sub,
.context-text,
.countdown {
  display: none;
}

.timeline-card {
  margin: 12px auto 0;
  padding: 14px 16px 12px;
  max-width: 620px;
  border-radius: 24px;
  background: rgba(255, 248, 230, 0.7);
  box-shadow: 0 18px 45px rgba(96, 56, 0, 0.12);
  backdrop-filter: blur(10px);
}

.timeline-head {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.timeline-kicker,
.timeline-now,
.timeline-status {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timeline-kicker {
  opacity: 0.68;
}

.timeline-now {
  opacity: 0.72;
}

.timeline-status {
  color: #9a5600;
}

.timeline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timeline-icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(80, 40, 0, 0.12);
  font-size: 18px;
  line-height: 1;
}

.timeline-icon-button i {
  font-size: 17px;
}

.timeline-icon-button.active {
  background: #2b1a00;
  color: #fff8ea;
}

.timeline-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(142, 97, 24, 0.12);
  overflow: hidden;
}

.timeline-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f3c043, #f5a400 55%, #de8b34);
  transition: width 0.8s ease;
}

.timeline-glow {
  position: absolute;
  top: 50%;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 223, 140, 0.9);
  box-shadow: 0 0 0 8px rgba(255, 214, 97, 0.18);
  transform: translate(-50%, -50%);
  transition: left 0.8s ease;
}

.timeline-stops {
  position: relative;
  height: 72px;
  margin-top: 10px;
}

.timeline-stop {
  position: absolute;
  top: 0;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 3px;
  text-align: center;
  opacity: 0.46;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateX(-50%);
}

.timeline-stop.is-active {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

#timelineStopStart {
  left: 0%;
  transform: translateX(0);
}

#timelineStopStart.is-active {
  transform: translateX(0) translateY(-2px);
}

#timelineStopMidday {
  left: 44.44%;
}

#timelineStopTrigger {
  left: 85.5%;
}

#timelineStopFinal {
  left: 100%;
  top: 0;
  transform: translateX(-100%);
}

#timelineStopFinal.is-active {
  transform: translateX(-100%) translateY(-2px);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(123, 78, 10, 0.22);
}

.timeline-stop.is-active .timeline-dot {
  background: #f5a400;
  box-shadow: 0 0 0 6px rgba(245, 164, 0, 0.16);
}

.timeline-label,
.timeline-time {
  display: block;
  font-size: 11px;
}

.timeline-label {
  font-weight: 800;
}

.timeline-time {
  opacity: 0.7;
}

.timeline-trigger {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 700;
  color: rgba(43, 26, 0, 0.82);
}

body[data-timeline-phase="trigger"] .timeline-card {
  background:
    linear-gradient(135deg, rgba(255, 244, 207, 0.92), rgba(255, 224, 166, 0.92));
  box-shadow: 0 24px 54px rgba(174, 96, 0, 0.2);
}

body[data-timeline-phase="trigger"] .timeline-glow,
body[data-timeline-phase="celebration"] .timeline-glow {
  animation: triggerPulse 1.4s ease-in-out infinite;
}

body[data-timeline-phase="trigger"] .timeline-status,
body[data-timeline-phase="celebration"] .timeline-status {
  color: #bd5f00;
}

@keyframes triggerPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 0 8px rgba(255, 214, 97, 0.18);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 0 16px rgba(255, 214, 97, 0.08);
  }
}

.confetti-piece {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 18px;
  border-radius: 999px;
  opacity: 0.92;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.92;
  }
  100% {
    transform: translate3d(var(--drift-x), 112vh, 0) rotate(var(--spin));
    opacity: 0;
  }
}

footer {
  position: fixed;
  left: 22px;
  right: 22px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  opacity: 0.65;
}

.footer-badge {
  font-weight: 800;
}

footer a {
  font-weight: bold;
  color: #2b1a00;
}

@media (max-width: 900px) {
  .app {
    padding: 28px 20px 92px;
  }

  .buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 650px) {
  body {
    align-items: flex-start;
  }

  .app {
    padding: 22px 16px 120px;
  }

  h1 {
    margin-bottom: 14px;
    letter-spacing: -2px;
  }

  .beer-svg {
    max-width: min(280px, 82vw);
    margin: 18px auto;
  }

  .message {
    margin-top: 18px;
  }

  .sub {
    font-size: 16px;
  }

  .context-text {
    font-size: 14px;
    min-height: 2.8em;
  }

  .countdown {
    font-size: 13px;
    line-height: 1.5;
  }

  .timeline-card {
    padding: 16px 14px 14px;
  }

  .timeline-head {
    grid-template-columns: 1fr;
    justify-items: start;
    margin-bottom: 12px;
  }

  .timeline-actions {
    margin-top: 2px;
  }

  .buttons {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  button {
    padding: 13px 10px;
    font-size: 14px;
  }

  footer {
    left: 16px;
    right: 16px;
    bottom: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .app {
    padding: 18px 14px 120px;
  }

  h1 {
    font-size: clamp(34px, 12vw, 48px);
  }

  .beer-svg {
    max-width: min(248px, 78vw);
  }

  .buttons {
    grid-template-columns: 1fr;
  }

  .message {
    font-size: clamp(17px, 5.8vw, 24px);
    line-height: 1.15;
  }

  .timeline-stops {
    height: 66px;
  }

  .timeline-label,
  .timeline-time {
    font-size: 10px;
    line-height: 1.15;
  }

  .timeline-stop {
    width: 52px;
    gap: 2px;
  }

  #timelineStopMidday {
    left: 42%;
  }

  #timelineStopTrigger {
    opacity: 0;
  }

  #timelineStopFinal {
    left: 100%;
    width: 46px;
    top: 0;
  }

   #timelineStopFinal .timeline-label {
    white-space: wrap;
   }

  .timeline-label {
    white-space: nowrap;
  }

  .timeline-icon-button {
    width: 40px;
    height: 40px;
  }
}
