/* Fling Forts — page shell. Everything here is about stray touches not moving the page. */
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; position: fixed; inset: 0;
  background: #3b3229; color: #2b2620;
  touch-action: none;                 /* no browser pan / pinch / double-tap zoom */
  overscroll-behavior: none;          /* no pull-to-refresh, no bounce */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;        /* no long-press callout */
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }

.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(30, 25, 20, 0.55); padding: max(16px, env(safe-area-inset-top)) 16px;
  touch-action: none;
}
.screen[hidden] { display: none; }
.screen.clear { background: transparent; pointer-events: none; }
.screen.clear .card { pointer-events: auto; }

.card {
  background: #f6ecd6; border: 3px solid #2b2620; border-radius: 22px;
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.35);
  padding: 22px 26px; width: min(420px, 100%); text-align: center;
  display: flex; flex-direction: column; gap: 12px; max-height: 100%; overflow: auto;
}
.card.slim { width: auto; flex-direction: row; padding: 12px; }
.card.help { width: min(560px, 100%); text-align: left; }
.card.help ul { margin: 0; padding-left: 20px; line-height: 1.4; font-size: 15px; }
.card.help p { margin: 0; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 46px); letter-spacing: 0.5px; line-height: 1.05; }
h2 { margin: 0; font-size: 26px; text-align: center; }
.ember { color: #e8664a; } .tide { color: #2f9c9a; }
.tag { margin: 0 0 4px; color: #6b5d48; font-weight: 700; }

button {
  font: inherit; font-weight: 800; color: #2b2620; cursor: pointer;
  border: 3px solid #2b2620; border-radius: 14px; background: #fbf5e8;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.3); touch-action: manipulation;
}
button:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3); }
button.big { font-size: 20px; padding: 13px 18px; background: #e8664a; color: #fff; }
button.big.alt { background: #2f9c9a; }
button.small { font-size: 15px; padding: 9px 14px; }
.solo { display: flex; flex-direction: column; gap: 8px; }
.levels { display: flex; gap: 6px; justify-content: center; }
.levels button { flex: 1; padding: 8px 4px; font-size: 15px; }
.levels button.on { background: #2b2620; color: #f6ecd6; }

/* online screen */
button.big.online { background: #5b4a8a; }
.join { display: flex; gap: 8px; }
.join input {
  flex: 1; min-width: 0; font: inherit; font-size: 24px; font-weight: 800; text-align: center; letter-spacing: 6px;
  text-transform: uppercase; padding: 8px; border: 3px solid #2b2620; border-radius: 14px; background: #fff;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.code { font-size: 40px; font-weight: 900; letter-spacing: 10px; color: #2b2620; min-height: 0; }
.code:empty { display: none; }
.status { margin: 0; font-size: 14px; color: #6b5d48; word-break: break-all; min-height: 1em; }

/* Phones held upright: the field would shrink to a strip, so ask for a turn instead of showing it tiny.
   Tablets in portrait (wider than 600 px) still get the game. */
@media (orientation: portrait) and (max-width: 600px) {
  body::before {
    content: ''; position: fixed; inset: 0; z-index: 50;
    background: #2a6fb8 url('assets/bg.jpg') center / cover no-repeat;
  }
  body::after {
    content: 'Turn your phone sideways to play';
    position: fixed; left: 50%; top: 50%; z-index: 51; width: min(78vw, 320px); box-sizing: border-box;
    transform: translate(-50%, -50%); padding: 150px 22px 24px; border-radius: 22px;
    background: #fff6df url('assets/sling_0.webp') center 18px / auto 118px no-repeat;
    border: 4px solid #3a2412; box-shadow: 0 8px 0 rgba(58, 36, 18, 0.35);
    color: #3a2412; font: 800 22px/1.25 "Trebuchet MS", "Segoe UI", system-ui, sans-serif; text-align: center;
  }
}
