/* Arta Ozola-Jaunaraja manner: light paper, hair-fine ink, soft watercolour, lace edges */
:root {
  --paber: #f8f2e4;
  --tint: #35344a;
  --tellis: #b8604f;
  --meri: #4f7f95;
  --ooker: #e8c983;
  --roosa: #f0c8bc;
  --taevas: #bcd3dd;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 20%, rgba(234, 166, 160, .35), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(143, 184, 201, .35), transparent 45%),
    var(--paber);
  color: var(--tint);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 8px 24px;
  touch-action: manipulation;
}

h1, h2, .kes {
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive;
  font-weight: 700;
}

.tagasi {
  align-self: flex-start;
  color: var(--tint);
  font-size: 15px;
  text-decoration: none;
  border-bottom: 2px dashed var(--tellis);
}

.pais {
  width: min(100%, 720px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

h1 {
  margin: 6px 0;
  font-size: clamp(22px, 6vw, 34px);
  color: var(--tellis);
  transform: rotate(-1.5deg);
}

.skoor {
  background: var(--ooker);
  padding: 6px 14px;
  font-size: 20px;
  border-radius: 40% 55% 45% 60% / 60% 45% 55% 40%;
  border: 1px solid var(--tint);
  transform: rotate(2deg);
}
.skoor span { color: var(--tellis); }

.lava {
  position: relative;
  width: min(100%, 720px, calc(100vh - 110px));
  min-width: 280px;
  aspect-ratio: 1 / 1;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 14px rgba(53, 52, 74, .18);
  outline: 1px solid var(--tint);
  outline-offset: 4px;
  cursor: pointer;
  touch-action: none;
}

/* Paper card with a stitched border */
.kaart {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-.8deg);
  width: min(94%, 460px);
  max-height: 96%;
  overflow-y: auto;
  background: #fffaf0;
  padding: 16px 18px;
  border-radius: 4px;
  box-shadow: 0 3px 16px rgba(53, 52, 74, .2);
  outline: 1px dotted var(--tint);
  outline-offset: -8px;
}

.kaart h2 { margin: 4px 0 8px; color: var(--meri); font-size: 22px; }
.kaart p { margin: 7px 0; line-height: 1.35; font-size: 16px; }
.juhis { font-size: 14px !important; opacity: .8; }
.hyyu { color: var(--tellis); font-size: 20px; }

.kes { color: var(--tellis); font-size: 18px; margin-bottom: 2px !important; }
.jutt { font-size: 17px !important; }

button {
  font: inherit;
  font-size: 16px;
  color: var(--tint);
  background: var(--roosa);
  border: 1px solid var(--tint);
  border-radius: 14px 18px 12px 20px;
  padding: 9px 14px;
  margin-top: 6px;
  box-shadow: 0 1px 4px rgba(53, 52, 74, .2);
  cursor: pointer;
}
button:active { transform: translate(2px, 2px); box-shadow: none; }

.valikud { display: flex; flex-direction: column; gap: 7px; }
.valikud button { text-align: left; margin-top: 0; }
.valikud button:nth-child(1) { background: #fde7c8; }
.valikud button:nth-child(2) { background: #d9ece9; }
.valikud button:nth-child(3) { background: #f6dcd9; }
.valikud button:disabled { opacity: .4; cursor: default; }
.valikud button.oige { opacity: 1; background: #bfe3c0; }
.valikud button.abi {
  align-self: flex-start;
  background: none;
  border: none;
  box-shadow: none;
  padding: 2px 0;
  font-size: 14px;
  text-decoration: underline dotted;
}

.tagasiside { font-weight: 700; }
.tagasiside.hea { color: var(--meri); }
.tagasiside.halb { color: var(--tellis); }

.reegel {
  background: var(--ooker);
  padding: 5px 10px;
  display: inline-block;
  transform: rotate(-1deg);
  font-size: 14px !important;
}

#alusta, #edasi, #uuesti { background: var(--ooker); font-weight: 700; }

.kleepsud {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kleepsud li {
  background: var(--taevas);
  padding: 4px 10px;
  border-radius: 50% 40% 55% 45% / 45% 55% 40% 50%;
  font-size: 14px;
  border: 1px solid var(--tint);
}
.kleepsud li:nth-child(3n) { background: var(--roosa); transform: rotate(3deg); }
.kleepsud li:nth-child(3n+1) { background: var(--ooker); transform: rotate(-2deg); }

.teade {
  min-height: 1.4em;
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--meri);
  font-weight: 700;
  text-align: center;
}

/* Character builder */
.koostaja { display: flex; gap: 10px; align-items: flex-start; }
#eelvaade {
  flex: none;
  width: 96px;
  height: 164px;
  position: sticky;
  top: 0;
  background: radial-gradient(circle at 50% 60%, #f6e7bd 55%, transparent 56%);
  box-shadow: none;
  outline: none;
  cursor: default;
}
.osad { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.osa { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.osa b { width: 100%; font-size: 14px; }
.osa button { margin: 0; padding: 5px 9px; font-size: 14px; background: #fffdf7; }
.osa button[aria-pressed="true"] { background: var(--ooker); outline: 2px solid var(--tint); }
.osa button.toon { width: 30px; height: 30px; padding: 0; border-radius: 50%; }
.osa button.toon[aria-pressed="true"] { outline: 3px solid var(--tint); outline-offset: 2px; }
#valmis { background: var(--ooker); font-weight: 700; }
@media (max-width: 420px) {
  .koostaja { flex-direction: column; align-items: center; }
  #eelvaade { position: static; }
}

.peidus { display: none !important; }
