html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #140b0e;
  color: #f3e6d0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* No scroll bounce, text selection or long-press menus over the game. */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
}

#game {
  position: absolute;
  inset: 0;
  background: #140b0e;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #140b0e;
  outline: none;
  touch-action: none;
}

/* Mouse cursors (CursorStyle.cs picks one; Tools/make_cursors.py draws them): a paw, closed while the button is down,
   and arrows circling while a right-drag turns the camera. Important because Unity writes the canvas's own cursor
   style when it shows the cursor. */
#unity-canvas.cursor-paw {
  cursor: url("cursor-paw.png") 6 5, default !important;
  cursor: -webkit-image-set(url("cursor-paw.png") 1x, url("cursor-paw@2x.png") 2x) 6 5, default !important;
  cursor: image-set(url("cursor-paw.png") 1x, url("cursor-paw@2x.png") 2x) 6 5, default !important;
}

#unity-canvas.cursor-paw-closed {
  cursor: url("cursor-paw-closed.png") 6 5, default !important;
  cursor: -webkit-image-set(url("cursor-paw-closed.png") 1x, url("cursor-paw-closed@2x.png") 2x) 6 5, default !important;
  cursor: image-set(url("cursor-paw-closed.png") 1x, url("cursor-paw-closed@2x.png") 2x) 6 5, default !important;
}

#unity-canvas.cursor-rotate {
  cursor: url("cursor-rotate.png") 16 16, move !important;
  cursor: -webkit-image-set(url("cursor-rotate.png") 1x, url("cursor-rotate@2x.png") 2x) 16 16, move !important;
  cursor: image-set(url("cursor-rotate.png") 1x, url("cursor-rotate@2x.png") 2x) 16 16, move !important;
}

.hidden {
  display: none !important;
}

/* ---------------------------------------------------------------- Loading */

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #3a1a22 0%, #140b0e 70%);
  text-align: center;
  padding: 0 24px;
  z-index: 11;
  transition: opacity 0.6s;
}

#loading.fading {
  opacity: 0;
  pointer-events: none;
}

.loading-title {
  font-size: 44px;
  font-weight: 700;
  color: #e8ba62;
  letter-spacing: 1px;
}

.loading-subtitle {
  margin-top: 4px;
  font-size: 16px;
  opacity: 0.75;
}

.loading-bar {
  margin-top: 28px;
  width: min(360px, 70vw);
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#loading-fill {
  width: 0;
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, #b9883b, #e8ba62);
  transition: width 0.2s;
}

#loading-status {
  margin-top: 12px;
  font-size: 14px;
  opacity: 0.7;
}

.home-screen-hint {
  margin-top: 28px;
  max-width: 360px;
  padding: 12px 16px;
  border: 1px solid rgba(232, 186, 98, 0.45);
  border-radius: 10px;
  background: rgba(20, 11, 14, 0.55);
  font-size: 15px;
  line-height: 1.45;
}

.hint-title {
  margin-bottom: 4px;
  font-weight: 700;
  color: #e8ba62;
}

.share-icon {
  width: 15px;
  height: 18px;
  vertical-align: -3px;
  fill: none;
  stroke: #6fb1ff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- Rotate (phones held upright) */

#rotate {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: #140b0e;
  font-size: 20px;
  text-align: center;
  padding: 0 32px;
}

/* After the title screen, which reads fine either way up. */
@media (orientation: portrait) {
  body.touch.ready #rotate {
    display: flex;
  }
}

/* The same tip as on the title screen, a little closer to the line above it. */
#rotate .home-screen-hint {
  margin-top: 4px;
}

.rotate-phone {
  width: 44px;
  height: 76px;
  border: 4px solid #e8ba62;
  border-radius: 10px;
  animation: turn 2.4s ease-in-out infinite;
}

@keyframes turn {
  0%, 25% { transform: rotate(0deg); }
  55%, 100% { transform: rotate(-90deg); }
}

/* ---------------------------------------------------------------- Errors */

#error {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  padding: 12px 16px;
  border-radius: 8px;
  background: #8e1f2c;
  color: #fff;
  font-size: 15px;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------- Text boxes */

/* Laid over the game's text fields (WebTextInput.cs): the game draws the field, the page draws the text and the caret,
   so typing works like on any web page (a phone's keyboard opens, paste and accents work). */
.cm-text-form {
  position: absolute;
  display: none;
  margin: 0;
  padding: 0;
  z-index: 5;
}

.cm-text-input {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: #f5ecde;
  caret-color: #e8ba62;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  /* The page turns text selection off; Safari won't type into a box without it. */
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
