* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #d9d9d9;
  overflow-x: hidden;
}

header {
  background-color: #333;
  color: white;
  padding: 15px;
  text-align: center;
}

main {
  padding: 20px;
  display: flex;
  justify-content: center;
}

section {
  margin-bottom: 20px;
}

h2 {
  color: #333;
}

footer {
  text-align: center;
  padding: 10px;
  background-color: #ddd;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: #333;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  z-index: 1000;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.nav-left a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

.nav-left a:hover {
  text-decoration: underline;
}

.nav-right {
  display: flex;
  align-items: center;
}

.nav-right button {
  background-color: #555;
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
}

.nav-right button:hover {
  background-color: #777;
}

/* Desk */
#desk {
  position: relative;
  width: min(100%, 1000px);
  height: min(72svh, 700px);
  min-height: 420px;
  max-height: 700px;
  overflow: hidden;
  border-radius: 14px;

  background: linear-gradient(
    90deg,
    #8b5a2b 0%,
    #7a4e24 25%,
    #8b5a2b 50%,
    #7a4e24 75%,
    #8b5a2b 100%
  );

  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.3),
    0 10px 30px rgba(0, 0, 0, 0.2);

  touch-action: none;
}

#desk::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
}

#desk::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: #5a3a1a;
  box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.desk-wrapper {
  width: min(100%, 1000px);
}

.desk-label {
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  color: #3f2a18;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.35);
}


/* Ball */
.ball {
  position: absolute;
  top: 18%;
  left: 20%;
  width: clamp(52px, 8vw, 60px);
  height: clamp(52px, 8vw, 60px);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;

  background: radial-gradient(
    circle at 30% 30%,
    #ff6b6b,
    #cc0000 70%
  );

  box-shadow:
    inset -8px -12px 20px rgba(0, 0, 0, 0.4),
    inset 6px 6px 10px rgba(255, 255, 255, 0.3),
    4px 6px 10px rgba(0, 0, 0, 0.3);

  transition: transform 0.1s ease;
  z-index: 20;
}

.ball:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.ball::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  filter: blur(3px);
}

/* Notepad */
.notepad {
  position: absolute;
  top: 14%;
  left: 55%;
  width: clamp(120px, 24vw, 150px);
  height: clamp(160px, 30vw, 190px);
  background: #fdf5c9;
  border: 1px solid #d6c45c;
  box-shadow: 4px 6px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 15;
  touch-action: none;
  user-select: none;
}

.notepad-header {
  position: relative;
  z-index: 2;
  background: #e6d98c;
  padding: 6px;
  text-align: center;
  font-weight: bold;
  border-bottom: 2px solid #cbbd6b;
  font-size: clamp(0.8rem, 2.2vw, 1rem);
}

.page {
  position: absolute;
  top: 30px;
  left: 0;
  width: 100%;
  height: calc(100% - 30px);
  cursor: grab;
  touch-action: none;
  user-select: none;

  background:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent 14%,
      rgba(200, 50, 50, 0.9) 14%,
      rgba(200, 50, 50, 0.9) 15%,
      transparent 15%
    ),
    repeating-linear-gradient(
      to bottom,
      #fff9a6,
      #fff9a6 20px,
      #e6dc7a 21px
    );
}


.page:active {
  cursor: grabbing;
}

.page:nth-child(2) {
  transform: translateY(2px);
}

.page:nth-child(3) {
  transform: translateY(4px);
}

.page:nth-child(4) {
  transform: translateY(6px);
}

.dragged-page {
  position: absolute;
  z-index: 1000;
  transform: rotate(-5deg);
  box-shadow: 8px 10px 18px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.mug {
  position: absolute;
  right: 90px;
  bottom: 26px;
  width: 110px;
  height: 95px;
  background: linear-gradient(to bottom, #ffffff 0%, #f3f3f3 100%);
  border: 3px solid #d8d8d8;
  border-top: 6px solid #ececec;
  border-radius: 10px 10px 18px 18px;
  box-shadow:
    inset -10px -10px 16px rgba(0, 0, 0, 0.08),
    inset 8px 8px 12px rgba(255, 255, 255, 0.92),
    6px 8px 14px rgba(0, 0, 0, 0.22);
  z-index: 14;
  overflow: visible;
}

.mug::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 8px;
  width: calc(100% - 16px);
  height: 14px;
  background: linear-gradient(to bottom, #fefefe 0%, #e5e5e5 100%);
  border: 2px solid #d8d8d8;
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.7);
}

.mug::after {
  content: "";
  position: absolute;
  right: -22px;
  top: 20px;
  width: 28px;
  height: 42px;
  border: 7px solid #d7d7d7;
  border-left: none;
  border-radius: 0 24px 24px 0;
  background: transparent;
}

.mug-water {
  position: absolute;
  top: 4px;
  left: 14px;
  width: calc(100% - 28px);
  height: 18px;
  background: linear-gradient(to bottom, rgba(150, 210, 255, 0.95), rgba(88, 155, 230, 0.95));
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.mug.spilled .mug-water {
  opacity: 1;
}

.mug-label {
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  text-align: center;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.05;
  color: #111;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}


.splash {
  position: absolute;
  right: 62px;
  bottom: 82px;
  width: 180px;
  height: 120px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
}

.splash.active {
  opacity: 1;
}

.droplet {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 18px;
  height: 26px;
  background: radial-gradient(circle at 30% 30%, rgba(220, 245, 255, 0.95), rgba(80, 160, 235, 0.92));
  border-radius: 50% 50% 55% 55%;
  transform-origin: bottom center;
  opacity: 0;
}

.splash.active .droplet {
  animation: splash-pop 0.75s ease-out forwards;
}

.droplet-1 {
  --dx: -70px;
  --dy: -75px;
  animation-delay: 0s;
}

.droplet-2 {
  --dx: -42px;
  --dy: -100px;
  animation-delay: 0.03s;
}

.droplet-3 {
  --dx: -8px;
  --dy: -88px;
  animation-delay: 0.05s;
}

.droplet-4 {
  --dx: 16px;
  --dy: -105px;
  animation-delay: 0.02s;
}

.droplet-5 {
  --dx: 52px;
  --dy: -82px;
  animation-delay: 0.04s;
}

.droplet-6 {
  --dx: 78px;
  --dy: -58px;
  animation-delay: 0.01s;
}

@keyframes splash-pop {
  0% {
    transform: translate(-50%, 0) scale(0.3);
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  100% {
    transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(1);
    opacity: 0;
  }
}


/* Lamp */
#lamp {
  position: absolute;
  bottom: 20px;
  left: clamp(24px, 6vw, 60px);
  width: 20px;
  height: 80px;
  background: #444;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 3px 5px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 12;
}

#lamp:hover {
  transform: scale(1.05);
}

#lamp::before {
  content: "";
  position: absolute;
  top: -50px;
  left: 8px;
  width: 4px;
  height: 50px;
  background: #555;
  transform: rotate(-25deg);
  transform-origin: bottom;
}

#lamp::after {
  content: "";
  position: absolute;
  top: -70px;
  left: -20px;
  width: 60px;
  height: 30px;
  background: #666;
  border-radius: 10px 10px 5px 5px;
}

#lamp.on::before {
  content: "";
  position: absolute;
  top: -40px;
  left: -80px;
  width: 200px;
  height: 120px;
  background: radial-gradient(
    ellipse at top,
    rgba(255, 255, 200, 0.4),
    rgba(255, 255, 200, 0.1) 60%,
    transparent 80%
  );
  pointer-events: none;
}

#lamp.on {
  background: #666;
  box-shadow:
    0 0 40px 10px rgba(255, 255, 180, 0.3),
    0 0 80px 30px rgba(255, 255, 180, 0.2),
    3px 5px 10px rgba(0, 0, 0, 0.4);
}

#lamp.on::after {
  background: #888;
}

/* Mobile */
@media (max-width: 768px) {
  main {
    padding: 12px;
  }

  .mug {
  right: 26px;
  bottom: 22px;
  width: 92px;
  height: 80px;
}

.mug::after {
  right: -18px;
  top: 18px;
  width: 24px;
  height: 36px;
}

.mug-label {
  top: 30px;
  font-size: 0.72rem;
}

.splash {
  right: 6px;
  bottom: 72px;
  width: 150px;
  height: 105px;
}


  .navbar {
    padding: 10px 14px;
    flex-wrap: wrap;
  }

  .nav-left,
  .nav-right {
    width: 100%;
    justify-content: center;
  }

  #desk {
    width: 100%;
    height: 70svh;
    min-height: 380px;
  }


  .ball {
    width: 56px;
    height: 56px;
  }

  .notepad {
    width: 132px;
    height: 168px;
  }

  #lamp {
    left: 28px;
    bottom: 18px;
    transform: scale(0.92);
    transform-origin: bottom left;
  }
}

@media (max-width: 480px) {
  .nav-left a,
  .nav-right button {
    font-size: 0.95rem;
  }

  .mug {
  right: 14px;
  width: 84px;
  height: 74px;
}

.mug-label {
  font-size: 0.64rem;
}


  #desk {
    height: 68svh;
    min-height: 340px;
    border-radius: 10px;
  }

  .notepad {
    left: 50%;
  }
}
