/* KLD 3.0. Tyylilähteenä vuoden 2003 GeoCities. */

:root {
  --pm: 0; /* sivun promillet, kld.js päivittää */
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: gray url(/assets/kld.gif);
  font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", cursive;
  color: black;
  overflow-x: hidden;
}

/* Kaljapullo-kursori vain hiirelle; kosketusnäytöllä sitä ei näkyisi kuitenkaan. */
@media (pointer: fine) {
  html, button, input, textarea, a, label {
    cursor: url(/assets/osoitin.png) 16 0, auto;
  }
  button:hover, input:focus, textarea:focus {
    cursor: url(/assets/osoitin1.png) 16 0, auto;
  }
}

[hidden] {
  display: none !important;
}

/* --- ovi --- */

#ovi {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  text-align: center;
  color: yellow;
}
#ovi img {
  background: white;
  border: 4px ridge yellowgreen;
  animation: pyori 6s linear infinite;
}

/* --- pääsivu --- */

#sivu {
  padding: 10px 8px 40px;
  transform-origin: 50% 30%;
}

.laatikko {
  box-sizing: border-box;
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 0 12px 16px;
  background: lightgray;
  text-align: center;
  /* tuplanäkö */
  text-shadow: calc(var(--pm) * 3px) 0 rgba(0, 0, 0, .35);
}

h1 {
  margin: 8px 0;
  font-size: 48px;
}
h1 img {
  vertical-align: middle;
  background: white;
}
.kelt {
  color: yellow;
  text-shadow: 1px 1px 0 black;
}
.uusi {
  color: red;
  font-weight: bold;
  animation: vilkku .5s steps(1) infinite;
}

.blink {
  animation: opacity .4s ease-in-out infinite;
}
@keyframes opacity {
  50% { opacity: 0; }
}
@keyframes vilkku {
  50% { visibility: hidden; }
}
@keyframes pyori {
  to { transform: rotate(360deg); }
}
.pyori:hover {
  animation: pyori .6s linear infinite;
}

.valikko {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: darkgray;
}
.nuoli {
  max-width: 100%;
}

.nappi {
  padding: 3px 6px;
  background-color: yellowgreen;
  border: none;
  color: yellow;
  font: inherit;
  font-size: 16px;
  text-shadow: 1px 1px 0 olive;
  transition-duration: .8s;
  transition-property: transform;
}
.nappi:active {
  transform: rotate(360deg);
}
.nappi.iso {
  padding: 12px 24px;
  font-size: 28px;
  border: 4px outset yellow;
  animation: sykki 1s ease-in-out infinite;
}
@keyframes sykki {
  50% { transform: scale(1.12) rotate(-3deg); }
}

.tab {
  margin: 12px 0;
  padding: 8px;
  background: #d8d8d8;
  border: 3px inset white;
}
.lista {
  display: inline-block;
  text-align: left;
}
.pieni {
  font-size: 12px;
}

.turva {
  display: inline-block;
  width: 250px;
  margin-top: 10px;
  padding: 4px;
  background: white;
  font-size: 14px;
}

.rakenteilla {
  display: block;
  margin: 16px auto 8px;
  max-width: 100%;
  height: auto;
}

.laskuri {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: black;
}
.laskuri img {
  height: 16px;
}

/* --- salainen lähtölaskenta --- */

.salainen {
  margin: 16px auto 4px;
  padding: 10px;
  max-width: 520px;
  background: black;
  color: lime;
  border: 4px ridge yellowgreen;
  font-family: "Courier New", monospace;
}
.salainen input {
  font: inherit;
  max-width: 100%;
}
.lukko {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: bold;
  color: yellow;
}
.aika {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
}
.aika span {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.aika img {
  height: 24px;
}
.tie {
  position: relative;
  height: 40px;
  margin: 12px 0 4px;
  border-bottom: 4px dashed yellow;
  background: #333;
}
.bussi {
  position: absolute;
  bottom: 0;
  left: 0;
  font-size: 32px;
  line-height: 1;
  transform: scaleX(-1); /* emoji ajaa vasemmalle, meidän bussi oikealle */
  transition: left 1s linear;
  animation: hytky .3s steps(2) infinite;
}
@keyframes hytky {
  50% { translate: 0 -2px; }
}
.maali {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 32px;
  line-height: 1;
}

/* --- kalja-clicker --- */

.kaljaa {
  margin: 4px 0;
  font-size: 32px;
}
.kultaTila {
  color: darkgoldenrod;
  font-weight: bold;
  animation: vilkku .5s steps(1) infinite;
}
.pullo {
  margin: 8px;
  padding: 0;
  background: none;
  border: none;
  transition: transform .05s;
}
.pullo img {
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .4));
}
.pullo:hover img {
  animation: heiluu .6s ease-in-out infinite;
}
.pullo:active {
  transform: scale(.88) rotate(-10deg);
}
@keyframes heiluu {
  25% { rotate: -6deg; }
  75% { rotate: 6deg; }
}
.clickerViesti {
  min-height: 1.4em;
  margin: 4px 0;
  font-weight: bold;
}
.uusiViesti {
  animation: nouse-esiin .4s ease-out;
}
@keyframes nouse-esiin {
  from { transform: scale(1.4); color: red; }
}
.kauppa {
  display: grid;
  gap: 4px;
  max-width: 520px;
  margin: 8px auto;
}
.tuote {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
}
.tuote small {
  display: block;
  font-size: 12px;
  color: #ffffcc;
}
.tuote .hintaa {
  white-space: nowrap;
}
.tuote:disabled {
  opacity: .45;
  filter: grayscale(1);
}
.tuote:active {
  transform: none; /* ei pyöritetä koko kauppariviä */
}
.paivitys {
  background-color: darkgoldenrod;
}
.plus {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  translate: -50% -100%;
  color: yellow;
  font-weight: bold;
  font-size: 22px;
  text-shadow: 1px 1px 0 black;
  animation: nouse .8s ease-out forwards;
}
.kultainen {
  position: fixed;
  z-index: 45;
  padding: 0;
  background: none;
  border: none;
  animation: kimallus 1s ease-in-out infinite;
}
.kultainen img {
  display: block;
  filter: sepia(1) saturate(6) brightness(1.3) drop-shadow(0 0 10px gold);
}
@keyframes kimallus {
  50% { transform: scale(1.2) rotate(15deg); }
}

/* --- ilmo --- */

.ilmonneet {
  width: 100%;
  border-collapse: collapse;
  background: white;
  table-layout: fixed;
}
.ilmonneet th, .ilmonneet td {
  border: 1px solid black;
  padding: 2px 4px;
  overflow-wrap: anywhere;
}
.ilmonneet th {
  background: yellowgreen;
  color: yellow;
  text-shadow: 1px 1px 0 olive;
}

.lomake {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}
.lomake input, .lomake textarea {
  max-width: 100%;
  font: inherit;
}
.lomake textarea {
  width: min(100%, 320px);
}
.laukaisualue {
  position: relative;
  width: 100%;
  min-height: 60px;
}
.ilmonappi {
  position: relative;
  margin-top: 12px;
  transition: left .25s, top .25s, transform .8s;
}
.ilmonappi:hover {
  animation: shakeanimation 1s;
}
@keyframes shakeanimation {
  15%, 85% { translate: -2px 0; }
  25%, 75% { translate: 4px 0; }
  30%, 50%, 70% { translate: -8px 0; }
  40%, 60% { translate: 8px 0; }
}
#ilmoViesti p {
  margin: 4px 0;
  padding: 2px 6px;
  background: white;
}
.virhe {
  color: red;
}
.ok {
  color: green;
}

/* --- musiikki --- */

.soitin {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* --- kiinteät jutut sivun päällä --- */

#promillet {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 20;
  padding: 2px 6px;
  background: black;
  color: lime;
  font-family: "Courier New", monospace;
  font-size: 14px;
  border: 2px ridge yellowgreen;
}

#avustaja {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  pointer-events: none;
}
#avustaja img {
  display: block;
}
@media (pointer: coarse) {
  #avustaja {
    left: auto !important;
    top: auto !important;
    right: 4px;
    bottom: 4px;
  }
  #avustaja img {
    width: 90px;
    height: auto;
  }
}
.puhe {
  position: absolute;
  bottom: 100%;
  left: 40%;
  width: max-content;
  max-width: 240px;
  padding: 6px 10px;
  background: white;
  border: 2px solid black;
  border-radius: 12px;
  font-size: 14px;
}
@media (pointer: coarse) {
  .puhe {
    left: auto;
    right: 20%;
  }
}

#sammunut {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: black;
  color: white;
  font-size: 24px;
  animation: pimenee 2s;
}
.zzz {
  font-size: 80px;
  margin: 0;
  animation: sykki 2s ease-in-out infinite;
}
@keyframes pimenee {
  from { opacity: 0; }
}

/* --- efektit (kld.js luo nämä) --- */

.jalki, .sade, .kupla, .pshh {
  position: fixed;
  z-index: 40;
  pointer-events: none;
}

.jalki {
  width: 12px;
  animation: putoa .9s ease-in forwards;
}
@keyframes putoa {
  to { transform: translateY(70px) rotate(var(--kierto)); opacity: 0; }
}

.sade {
  top: -90px;
  width: 32px;
  animation: sada var(--kesto) linear forwards;
}
@keyframes sada {
  to { transform: translateY(calc(100vh + 120px)) rotate(var(--kierto)); }
}

.kupla {
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: rgba(255, 250, 220, .9);
  border: 1px solid goldenrod;
  animation: kupli .7s ease-out forwards;
}
@keyframes kupli {
  to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}

.pshh {
  translate: -50% -100%;
  color: gold;
  font-weight: bold;
  font-size: 20px;
  text-shadow: 1px 1px 0 saddlebrown;
  animation: nouse .8s ease-out forwards;
}
@keyframes nouse {
  to { transform: translateY(-40px) scale(1.4); opacity: 0; }
}

/* Liikeherkille: ei heilumista eikä pullosadetta, musiikki ja kursori jäävät. */
@media (prefers-reduced-motion: reduce) {
  .blink, .uusi, .nappi.iso, #ovi img, .zzz, .bussi, .kultainen, .kultaTila, .pullo:hover img {
    animation: none;
  }
  .laatikko {
    text-shadow: none;
  }
}
