:root {
  --ink: #2b3540;
  --paper: #e8e0d0;
  --muted: #8a8578;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d1117;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--paper);
  -webkit-user-select: none;
  user-select: none;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: grab;
  touch-action: none;
}

#game.holding { cursor: grabbing; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui .btn, #ui input { pointer-events: auto; }

.hidden { display: none !important; }

#hud {
  position: absolute;
  inset: 0;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.5);
}

#hud-top {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

#hud-pile {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#hud-hint {
  text-align: center;
  font-size: 14px;
  font-style: italic;
  opacity: 0.85;
}

/* Screens are weather over the painting, not windows on top of it: a soft
   vignette that keeps the art visible at the edges, and type that floats on
   its own shadow. The title screen always worked this way; everything else
   now matches it. */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  background:
    radial-gradient(ellipse 78% 70% at 50% 50%,
      rgba(9, 12, 16, 0.86) 0%,
      rgba(9, 12, 16, 0.72) 45%,
      rgba(9, 12, 16, 0.48) 100%);
  backdrop-filter: blur(2px);
  animation: screen-in 0.5s ease both;
}

@keyframes screen-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.panel {
  max-width: 620px;
  margin: 0 24px;
  padding: 10px 20px;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9), 0 0 22px rgba(0, 0, 0, 0.55);
  animation: title-rise 0.9s ease both;
}

#title-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

#title-screen {
  background: none;
  backdrop-filter: none;
}

#title-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 80% at 50% 55%,
      rgba(10, 14, 18, 0.3) 0%,
      rgba(10, 14, 18, 0.15) 60%,
      rgba(10, 14, 18, 0.05) 100%),
    linear-gradient(to bottom,
      rgba(10, 14, 18, 0.08) 0%,
      rgba(10, 14, 18, 0.15) 30%,
      rgba(10, 14, 18, 0.18) 70%,
      rgba(10, 14, 18, 0.3) 100%);
}

.title-panel {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  max-width: 620px !important;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9), 0 0 20px rgba(0, 0, 0, 0.5);
}

.title-img {
  width: min(85%, 480px);
  height: auto;
  margin-bottom: 16px;
  opacity: 0;
  animation: title-rise 2.2s ease 0.4s forwards;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.7)) brightness(1.5);
}

.title-fade {
  opacity: 0;
  animation: title-rise 1.2s ease forwards;
}

@keyframes title-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.title {
  font-size: 64px;
  font-weight: normal;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  margin-bottom: 6px;
}

.subtitle {
  font-style: italic;
  font-size: 18px;
  color: #d4cdc0;
  margin-bottom: 26px;
}

.blurb {
  line-height: 1.7;
  font-size: 16px;
  margin-bottom: 30px;
  color: #ede6da;
  white-space: pre-line;
}

.story-text {
  font-size: 19px;
  font-style: italic;
  line-height: 1.8;
  margin-bottom: 30px;
  min-height: 120px;
  white-space: pre-line;
}

/* Quiet buttons: a hairline and letterspaced type, filling gently on hover.
   A solid block button read as a web form control sitting on a painting. */
.btn {
  display: inline-block;
  padding: 12px 34px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: lowercase;
  font-variant: small-caps;
  color: var(--paper);
  background: rgba(232, 224, 208, 0.05);
  border: 1px solid rgba(232, 224, 208, 0.34);
  border-radius: 2px;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.08s ease;
}

.btn:hover {
  background: rgba(232, 224, 208, 0.14);
  border-color: rgba(232, 224, 208, 0.6);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 1px solid rgba(232, 224, 208, 0.7); outline-offset: 3px; }

.btn.small {
  display: block;
  margin: 14px auto 0;
  padding: 8px 22px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  border-color: rgba(232, 224, 208, 0.2);
  color: #cfc7b8;
}

.credit {
  margin-top: 26px;
  font-size: 12px;
  color: #b0a898;
  letter-spacing: 0.1em;
}

.end-title {
  font-size: 34px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  font-style: italic;
  font-weight: normal;
  color: #f0e9dc;
  margin-bottom: 18px;
}

/* A stacked-stone hairline under every screen title — the game's one
   ornament, echoing what the player is doing. */
.end-title::after {
  content: "";
  display: block;
  width: 92px;
  height: 1px;
  margin: 16px auto 0;
  background: linear-gradient(90deg,
    transparent, rgba(232, 224, 208, 0.45), transparent);
}

.diary-panel { max-width: 680px; }

#diary-entries {
  max-height: 56vh;
  overflow-y: auto;
  margin-bottom: 26px;
  padding-right: 14px;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 224, 208, 0.25) transparent;
}

#diary-entries::-webkit-scrollbar { width: 6px; }
#diary-entries::-webkit-scrollbar-thumb {
  background: rgba(232, 224, 208, 0.25);
  border-radius: 3px;
}

.diary-entry + .diary-entry {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid rgba(232, 224, 208, 0.12);
}

.diary-when {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-transform: lowercase;
  font-variant: small-caps;
  color: #a49c8d;
  margin-bottom: 10px;
}

.diary-text {
  font-size: 16px;
  font-style: italic;
  line-height: 1.75;
  white-space: pre-line;
  color: #e6dfd2;
}

.diary-empty {
  font-style: italic;
  color: #a49c8d;
  padding: 30px 0;
  text-align: center;
}

#calendar-season {
  font-size: 30px;
  color: #efe7d8;
}

#calendar-line {
  font-style: italic;
  color: #cdc5b6;
  margin-bottom: 34px;
}

#end-score {
  font-size: 13px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  font-variant: small-caps;
  color: #b9b1a2;
  margin-bottom: 30px;
}

#toasts {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

.toast {
  padding: 2px 10px;
  font-size: 16px;
  font-style: italic;
  font-family: Georgia, serif;
  letter-spacing: 0.05em;
  color: var(--paper);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  cursor: pointer;
  animation: toast-live 3.4s ease forwards;
}

.toast-good { color: #cfe8d4; }
.toast-warn { color: #eed89a; }
.toast-bad  { color: #eeb9ac; }

@keyframes toast-live {
  0%   { opacity: 0; transform: translateY(8px); }
  10%  { opacity: 1; transform: translateY(0); }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.wind-forecast {
  display: block;
  width: 280px;
  height: 48px;
  /* Reads over a painted background, so it needs a shadow of its own. */
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9))
          drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
  /* Only the far edges soften; the strip itself stays legible. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 96%, transparent);
}

@media (max-width: 760px) {
  .wind-forecast { width: 200px; height: 34px; }
}

#debug-overlay {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 99;
  font-family: monospace;
  font-size: 12px;
  color: #9fe8a9;
  background: rgba(10, 14, 18, 0.7);
  padding: 6px 10px;
  border-radius: 3px;
  pointer-events: none;
}

#errbanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 10px 16px;
  font-family: monospace;
  font-size: 13px;
  color: #ffd7cc;
  background: rgba(90, 20, 12, 0.92);
  border-bottom: 1px solid rgba(255, 150, 120, 0.4);
}

#rotate-controls {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}

.btn.rotate {
  width: 64px;
  height: 64px;
  padding: 0;
  font-size: 28px;
  letter-spacing: 0;
  text-indent: 0;
  border-radius: 50%;
  background: rgba(16, 21, 26, 0.6);
  color: var(--paper);
  border: 1px solid rgba(232, 224, 208, 0.26);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

#orient-prompt {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0d1117;
  color: #cdc5b6;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 17px;
  font-style: italic;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 30px;
}

#orient-prompt span {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}

@media (orientation: portrait) and (max-width: 768px) {
  #orient-prompt { display: flex; }
}

/* Hold still for anyone who has asked the system to. The canvas honours this
   too (js/game/view.js); this covers the screens and toasts. */
@media (prefers-reduced-motion: reduce) {
  .title-img,
  .title-fade,
  .panel,
  .screen,
  .toast {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .btn { transition: background 0.2s ease, border-color 0.2s ease; }
  #title-bg { display: none; }
}

