:root {
  /* Keep the toolbar clear of notches (below). */
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #e4d6c8; /* render.js C.sky */
  color: #2a2826;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  touch-action: none;
}

@media (hover: hover) and (pointer: fine) {
  #game { cursor: none; }
}

/* Hidden while you walk (index.html: game.onWalk / onTap); it fades by toolbar.css. */
#unified-toolbar.away {
  opacity: 0;
  pointer-events: none;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(237, 224, 212, 0.84);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.8s ease;
  cursor: default;
  touch-action: manipulation;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.card {
  max-width: 34rem;
  max-height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 2rem;
  text-align: center;
  line-height: 1.65;
}

/* The end of the first year (index.html #year-end). */
.year-line {
  margin: 0;
  font-size: 1.6rem;
  font-style: italic;
  opacity: 0.75;
}

.year-score {
  margin: 0.6rem 0 0;
  font-size: 3.6rem;
  line-height: 1.2;
}

.card-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.card-buttons button {
  min-width: 8.5rem;
  padding: 0.55rem 1.2rem;
  font: inherit;
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.04em;
  color: inherit;
  background: rgba(255, 250, 242, 0.35);
  border: 1px solid rgba(42, 40, 38, 0.45);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.card-buttons button:hover,
.card-buttons button:focus-visible {
  background: rgba(255, 250, 242, 0.7);
  border-color: rgba(42, 40, 38, 0.8);
  outline: none;
}

/* The leaderboard about your place (index.html showBoard). */
.board {
  list-style: none;
  margin: 1.4rem auto 0;
  padding: 0;
  /* Fixed, as the card shrinks to its content: the same with the name box or without. */
  width: 20rem;
  max-width: 100%;
  font-size: 1.05rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  text-align: left;
}

.board:empty { display: none; }

.board li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.12rem 0.4rem;
  border-bottom: 1px solid rgba(42, 40, 38, 0.12);
}

.board li:last-child { border-bottom: none; }

.board .place {
  min-width: 2.2rem;
  text-align: right;
  opacity: 0.6;
}

.board .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.board .points { text-align: right; }

/* Yours, in the stone's cinnabar (render.js C.player). */
.board li.you {
  color: #b0432e;
  background: rgba(255, 250, 242, 0.45);
}

.board li.you .place { opacity: 1; }

.name-entry {
  display: flex;
  gap: 0.4rem;
}

.name-entry input,
.name-entry button {
  font: inherit;
  color: #2a2826;
  background: rgba(255, 250, 242, 0.55);
  border: 1px solid rgba(42, 40, 38, 0.45);
  border-radius: 3px;
}

.name-entry input {
  flex: 1;
  min-width: 0;
  padding: 0.1rem 0.4rem;
  font-style: italic;
  -webkit-user-select: text;
  user-select: text;
}

.name-entry input:focus {
  outline: none;
  border-color: #b0432e;
}

.name-entry button {
  padding: 0.1rem 0.6rem;
  font-style: italic;
  cursor: pointer;
}

.name-entry button:hover,
.name-entry button:focus-visible {
  background: rgba(255, 250, 242, 0.85);
  outline: none;
}

.board-note {
  margin: 0.8rem 0 0;
  font-style: italic;
  opacity: 0.7;
}

.board-note:empty { display: none; }

/* ---- the Shore toolbar -------------------------------------------------- */
/* By default it sits top-left on a desktop and bottom-centre on touch. Once
   dragged, toolbar.js places it with an inline top/left and these give way. */
.shore-toolbar {
  touch-action: none;
  /* A blur behind it would be redone every frame over the moving canvas. */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  top: 10px;
  left: 10px;
  transform: none;
}
.dropdown-menu {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@media (pointer: coarse) {
  .shore-toolbar {
    top: auto;
    bottom: calc(10px + var(--sab));
    left: 50%;
    transform: translateX(-50%);
  }
}
/* A phone on its side: bottom-left, out of the middle of the short screen. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 519px) {
  .shore-toolbar {
    left: calc(10px + var(--sal));
    transform: none;
  }
}
.shore-toolbar[style*="top"] { bottom: auto; }
