:root {
  --bg: #eadfc9;
  --wood: #8b5a3c;
  --wood-dark: #69412b;
  --ink: #2f241f;
  --cream: #f5eedf;
  --thread-red: #a74b3f;
  --thread-blue: #5c7286;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 247, 228, 0.8), transparent 40%),
    linear-gradient(180deg, #c89b6e 0%, #a77048 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  touch-action: none;
  user-select: none;
}

body {
  min-height: 100dvh;
}

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

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.titleblock {
  max-width: min(26rem, 72vw);
  background: rgba(245, 238, 223, 0.82);
  border: 1px solid rgba(47, 36, 31, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(47, 36, 31, 0.08);
}

.titleblock h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw + 0.8rem, 2.3rem);
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.titleblock p {
  margin: 0.42rem 0 0;
  font-size: clamp(0.84rem, 1vw + 0.45rem, 1.02rem);
  line-height: 1.35;
}

.course-note {
  align-self: flex-end;
  max-width: min(24rem, 76vw);
  min-height: 3.2rem;
  background: rgba(245, 238, 223, 0.9);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(47, 36, 31, 0.12);
  box-shadow: 0 10px 30px rgba(47, 36, 31, 0.08);
  font-size: clamp(0.85rem, 0.7vw + 0.55rem, 1rem);
  line-height: 1.35;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.course-note.show {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .course-note {
    transition: none;
    transform: none;
  }
}
