:root {
  --bg-blue: #89d6ff;
  --bg-blue-deep: #4cb3f8;
  --grass: #8fd27f;
  --wood: #8a5b36;
  --ink: #1e2a3a;
  --card: #ffffffd9;
  --line: #0e1d2f33;
  --accent: #ff9b3f;
  --accent-2: #4ecdc4;
  --danger: #ff5c5c;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
}

.screen {
  width: 100%;
  height: 100%;
  position: relative;
}

.hidden {
  display: none !important;
}

.login-screen {
  background: radial-gradient(circle at 25% 20%, #c6ebff, var(--bg-blue) 45%, var(--bg-blue-deep));
  display: flex;
  align-items: center;
  justify-content: center;
}

.sky-bg {
  position: absolute;
  inset: 0;
}

.sun {
  position: absolute;
  right: 8%;
  top: 8%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffde7, #ffd166 65%, #ffbc42);
  box-shadow: 0 0 60px #ffd166aa;
}

.cloud {
  position: absolute;
  background: #fff;
  border-radius: 999px;
  filter: drop-shadow(0 10px 10px #00000014);
  animation: cloud-float 12s ease-in-out infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.cloud-a {
  width: 220px;
  height: 70px;
  top: 18%;
  left: 9%;
}

.cloud-a::before {
  width: 90px;
  height: 90px;
  left: 25px;
  top: -42px;
}

.cloud-a::after {
  width: 72px;
  height: 72px;
  right: 30px;
  top: -36px;
}

.cloud-b {
  width: 180px;
  height: 58px;
  top: 30%;
  right: 12%;
  animation-delay: -2s;
}

.cloud-b::before {
  width: 70px;
  height: 70px;
  left: 22px;
  top: -30px;
}

.cloud-b::after {
  width: 55px;
  height: 55px;
  right: 30px;
  top: -20px;
}

.cloud-c {
  width: 250px;
  height: 80px;
  bottom: 18%;
  left: 20%;
  animation-delay: -6s;
}

.cloud-c::before {
  width: 100px;
  height: 100px;
  left: 26px;
  top: -45px;
}

.cloud-c::after {
  width: 78px;
  height: 78px;
  right: 34px;
  top: -32px;
}

.cloud-panel {
  z-index: 2;
  width: min(460px, 92vw);
  padding: 36px 30px;
  background: var(--card);
  border: 3px solid #ffffffcc;
  border-radius: 48% 52% 57% 43% / 42% 40% 60% 58%;
  box-shadow: 0 25px 60px #09224340;
  backdrop-filter: blur(3px);
}

.cloud-panel h1 {
  font-size: 2rem;
}

.cloud-panel p {
  margin: 6px 0 16px;
}

.cloud-panel form {
  display: grid;
  gap: 8px;
}

.cloud-panel label {
  font-weight: 700;
  font-size: 0.9rem;
}

.cloud-panel input {
  border: 2px solid #9dd6ff;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 1rem;
}

.cloud-panel button {
  margin-top: 10px;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #ffbc42, #ff8f3f);
  color: #0f2038;
  font-weight: 800;
  cursor: pointer;
}

.cloud-panel button.alt-btn {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, #7bd389, #5ccfca);
}

.status {
  min-height: 24px;
  margin-top: 10px;
  font-size: 0.92rem;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(#c4dcff, #d7efff 35%, #9aa6b1 80%);
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 20px);
}

.hud-card {
  background: #fffffff2;
  border: 2px solid #ffffff;
  border-radius: 16px;
  padding: 8px 12px;
  min-width: 120px;
  box-shadow: 0 8px 15px #172d421f;
}

.hud-card span {
  font-size: 0.72rem;
  opacity: 0.8;
  display: block;
}

.hud-card strong {
  font-size: 0.95rem;
}

.hint-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  background: #ffffffde;
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  border: 2px solid #fff;
}

.interaction-tip {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  background: #12233ae6;
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.panel {
  position: absolute;
  right: 12px;
  top: 74px;
  width: min(380px, calc(100vw - 24px));
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: #fffffff4;
  border: 2px solid #fff;
  border-radius: 18px;
  box-shadow: 0 20px 30px #0000002a;
  padding: 12px;
}

.panel h3 {
  margin-bottom: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.panel-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: #1f2d3a;
  color: #fff;
  cursor: pointer;
}

.panel .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 6px;
  font-size: 0.92rem;
}

.panel button {
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  background: var(--accent-2);
  color: #11333f;
  font-weight: 700;
}

.panel button.warn {
  background: var(--danger);
  color: #fff;
}

.panel button.gold {
  background: var(--accent);
}

.panel input {
  border: 1px solid #9bb9ca;
  border-radius: 8px;
  padding: 6px 8px;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.item-card {
  border-radius: 14px;
  border: 2px solid #d6ecf8;
  background: #f5fbff;
  padding: 8px;
}

.icon-box {
  width: 38px;
  height: 38px;
}

.toast {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  background: #0f1f33ea;
  color: #fff;
  padding: 10px 15px;
  border-radius: 10px;
  z-index: 10;
}

.effect-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fx-text {
  position: absolute;
  color: #ffd54a;
  text-shadow: 0 1px 4px #142435;
  font-weight: 800;
  animation: float-out 2s linear forwards;
}

.weather-particle {
  position: absolute;
  pointer-events: none;
}

.weather-particle.rain {
  width: 1px;
  height: 14px;
  background: linear-gradient(180deg, #cfeeff00, #b8e3ff, #b8e3ff00);
  animation: weather-rain 1.3s linear infinite;
}

.weather-particle.snow {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f0f8ff;
  animation: weather-snow 4.2s ease-in-out infinite;
}

@keyframes cloud-float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-8px) translateX(6px);
  }
}

@keyframes float-out {
  0% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -38px);
  }
}

@keyframes weather-rain {
  0% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(120px);
  }
}

@keyframes weather-snow {
  0% {
    transform: translate(0, -6px);
  }
  50% {
    transform: translate(10px, 52px);
  }
  100% {
    transform: translate(-8px, 108px);
  }
}

@media (max-width: 768px) {
  .hint-bar {
    gap: 6px;
    font-size: 0.75rem;
    padding: 6px 10px;
    bottom: 8px;
  }

  .panel {
    top: 64px;
    right: 6px;
    width: calc(100vw - 12px);
  }
}
