/* Chapter selection laid out on the woven wool floor of a tent. */
body {
  background-color: #14231c;
  background-image: radial-gradient(ellipse at 18% 0%, #3b3b2866, transparent 56%),
    repeating-linear-gradient(90deg, #e1c58a05 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, #0002 0 1px, transparent 1px 4px);
}
.wrap {
  max-width: 1280px;
  padding: calc(env(safe-area-inset-top) + 18px) max(16px, 3vw, env(safe-area-inset-right))
           calc(env(safe-area-inset-bottom) + 24px) max(16px, 3vw, env(safe-area-inset-left));
}
.wrap > header {align-items: center; gap: 12px;}
.brand h1 {font-size: clamp(21px, 2.4vw, 32px); letter-spacing: .015em;}
.tools button {min-height: 44px; background: #16271ff0; border-color: #bba47a66;}
.chapter-rug {
  margin-top: 18px;
  padding: 36px 7% 34px;
  background: #273723 url('chapter-rug-wide.webp') center/100% 100% no-repeat;
  border-radius: 5px;
  overflow: hidden;
  overflow: clip;
  box-shadow: 0 2px 3px #050b09, 0 16px 36px -16px #030c09;
}
.chapter-rug .chapter-header {margin: 0 0 6px; padding: 0;}
.chapter-rug .chapter-header h2 {
  color: #f7e8bd; font: 600 13px/1.25 Georgia, serif;
  letter-spacing: .19em; text-shadow: 0 1px 4px #142014;
}
.chapter-rug .chapter-header span:empty {display: none;}
.chapter-rug .levels.wheel-on {width: 100%; max-width: 1020px; margin: 0 auto;}
.wheel-on .cw-hint {margin-top: 9px; color: #fff0c9; text-shadow: 0 1px 3px #0d190e; font-size: 12px; line-height: 1.25;}
.wheel-on .cw-arrow {min-width: 44px; min-height: 44px;}
.wheel-on .cw-num::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  min-width: 44px; min-height: 44px; width: 100%; height: 100%; transform: translate(-50%, -50%);
}
.wheel-on .cw-plaque {
  padding: 0; width: 100%; background: none; box-shadow: none; border-radius: 0;
  text-shadow: 0 2px 6px #111c11, 0 1px 2px #0d1b10;
}
.wheel-on .cw-plaque small {color: #f4d79a; font: 700 11px/1.5 system-ui, sans-serif; letter-spacing: .18em;}
.wheel-on .cw-plaque h3 {
  margin: 8px 0 12px; color: #fff3d5; font: 500 clamp(30px, 3.9vw, 54px)/1.04 Georgia, serif;
  letter-spacing: -.018em; text-transform: none; text-wrap: balance; overflow-wrap: break-word;
  text-shadow: 0 2px 5px #101a0f;
}
.wheel-on .cw-plaque p {
  max-width: 38ch; margin-inline: auto; color: #f8efda; opacity: 1;
  font: 500 clamp(14px, 1.18vw, 17px)/1.5 system-ui, sans-serif; text-wrap: pretty;
}
.wheel-on .cw-play {
  width: fit-content; max-width: 100%; min-height: 46px; margin: 20px auto 4px; padding: 11px 26px;
  border: 1px solid #f0d294; border-radius: 6px; color: #32260f;
  background: linear-gradient(#eacf92, #d5ae65); box-shadow: inset 0 0 0 2px #debd82, inset 0 0 0 3px #9d793f, 0 3px 8px #0c180db3;
  font: 700 clamp(16px, 1.4vw, 21px)/1.15 Georgia, serif; letter-spacing: .01em; text-transform: none; text-shadow: none;
}
.wheel-on .cw-play.locked {font-size: 15px;}
.wheel-on :is(.cw-play,.cw-arrow,.cw-side,.cw-num):focus-visible {outline: 3px solid #fff5cc; outline-offset: 5px;}
@media (hover: hover) {
  .wheel-on .cw-play:not(:disabled):hover {background: linear-gradient(#ffe2a4, #dfbd79);}
}

/* All controls that turn the wheel stay in its column as the viewport rotates. */
@media (orientation: landscape) {
  .chapter-rug {padding-block: clamp(34px, 4.2vw, 68px); padding-inline: clamp(30px, 7.5vw, 96px);}
  .chapter-rug .chapter-header {max-width: 1020px; margin-inline: auto; align-items: flex-start;}
  .chapter-rug .chapter-header h2 {width: 48%; text-align: center;}
  .levels.wheel-on .cw {
    --s: min(42vw, 66svh, 620px); display: grid; width: 100%; align-items: center;
    /* The wheel's column is as wide as the wheel with its side windows; the words take the rest. */
    grid-template-columns: calc(var(--s) * 1.14) minmax(0, 1fr);
    grid-template-rows: 1fr auto auto 1fr auto; column-gap: clamp(24px, 5.2vw, 78px);
  }
  .wheel-on .cw-stage {grid-area: 1 / 1 / 5 / 2; justify-self: center;}
  .wheel-on .cw-hint {grid-area: 5 / 1; justify-self: center;}
  .wheel-on .cw-plaque {grid-area: 2 / 2; align-self: end; margin: 0; text-align: left;}
  .wheel-on .cw-plaque p {margin-inline: 0;}
  .wheel-on .cw-play {grid-area: 3 / 2; justify-self: start; align-self: start; margin-inline: 0;}
}
@media (orientation: landscape) and (max-height: 540px) {
  .wrap {padding-top: calc(env(safe-area-inset-top) + 3px);}
  .wrap > header {flex-wrap: nowrap;}
  .brand h1 {font-size: 20px;}
  .brand span {margin-top: 1px; font-size: 8px;}
  .wrap .tools {width: auto; gap: 5px;}
  .tools button {font-size: 11px; padding: 6px 10px;}
  .chapter-rug {margin-top: 3px; padding: 12px max(20px, 5vw) 16px;}
  .chapter-rug .chapter-header {position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);}
  .levels.wheel-on .cw {--s: min(42vw, calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 92px), 420px); column-gap: clamp(14px, 4vw, 45px);}
  .wheel-on .cw-hint {margin-top: 5px; font-size: 11px;}
  .wheel-on .cw-plaque h3 {font-size: clamp(24px, 4.2vw, 36px); margin: 4px 0 7px;}
  .wheel-on .cw-plaque p {font-size: 14px; line-height: 1.38;}
  .wheel-on .cw-play {margin-top: 13px; padding: 8px 20px;}
}
@media (orientation: portrait) {
  .wrap {padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));}
  .wrap > header {max-width: 720px; margin-inline: auto; padding-inline: 5px;}
  .chapter-rug {
    max-width: 720px; width: 100%; align-self: center; margin-top: 12px; padding: 26px 8% 40px;
    background-image: url('chapter-rug-upright.webp');
  }
  .levels.wheel-on .cw {--s: min(84vw, 47svh, 600px); width: 100%;}
  .wheel-on .cw-stage {margin-inline: auto;}
  .wheel-on .cw-plaque {margin: 18px auto 0;}
  .wheel-on .cw-plaque h3 {margin: 5px 0 8px;}
}
@media (orientation: portrait) and (max-width: 520px) {
  .wrap {padding-top: calc(env(safe-area-inset-top) + 10px);}
  .wrap > header {gap: 8px;}
  .wrap .tools {width: auto; gap: 4px;}
  .tools button {font-size: 11px; padding: 6px 8px;}
  .chapter-rug {padding: 26px 0 40px; margin-top: 8px;}
  .wheel-on .cw-plaque, .chapter-rug .chapter-header {padding-inline: 14px; box-sizing: border-box;}
  .chapter-rug .chapter-header {margin: 0;}
  .wheel-on .cw-hint {margin-top: 4px;}
  .wheel-on .cw-plaque {margin-top: 11px;}
  .wheel-on .cw-play {margin-top: 13px;}
}
@media (orientation: portrait) and (max-height: 640px) {
  .chapter-rug {padding-top: 14px;}
  .levels.wheel-on .cw {--s: min(84vw, 40svh, 425px);}
  .wheel-on .cw-plaque h3 {font-size: 27px;}
  .wheel-on .cw-plaque p {line-height: 1.38;}
  .wheel-on .cw-play {margin-top: 10px;}
}
@media (prefers-reduced-motion: reduce) {
  .wheel-on .cw-window :is(img,video), .wheel-on .cw-rim, .wheel-on .cw-num {transition: none !important;}
}

/* The rug holds still: the same size whichever chapter is chosen. A chapter's words keep to a set number of lines
   and never stretch the rug or move the button. */
.wheel-on .cw-plaque h3 {white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.wheel-on .cw-plaque p {display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; min-height: 4.2em;}
@media (orientation: portrait) {
  .wheel-on .cw-plaque p {-webkit-line-clamp: 4; min-height: 5.6em;}
}
/* A phone held sideways: the wheel as large as the screen allows on the left, the words larger and well clear of it
   on the right, as on a computer. The title bar floats over the rug's corner instead of taking a row of its own. */
@media (orientation: landscape) and (max-height: 540px) {
  .wrap > header {position: absolute; z-index: 6; top: calc(env(safe-area-inset-top) + 4px); right: max(12px, env(safe-area-inset-right)); left: auto; width: auto;}
  .wrap > header .brand {display: none;}
  .chapter-rug {margin-top: 0; padding-block: 8px;}
  .levels.wheel-on .cw {
    --s: min(46vw, calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 58px), 480px);
    min-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 22px);
    column-gap: clamp(34px, 8vw, 96px);
  }
  .wheel-on .cw-hint {display: none;}
  .wheel-on .cw-plaque h3 {font-size: clamp(30px, 5.4vw, 46px); margin: 4px 0 9px;}
  .wheel-on .cw-plaque p {font-size: 16.5px; line-height: 1.4;}
  .wheel-on .cw-play {margin-top: 15px; padding: 11px 26px; font-size: 17px;}
}

/* Below the wheel only what a player needs: keep the game on the device, support, credits. The lists of who joins
   David after which chapter are gone from the menu — nobody reads them there. */
#roadStrip, #campStrip, #appTip, #offlineLine, #supportLine {display: none !important;}
#offlineStrip, #supportStrip {display: inline-block; margin: 10px 6px 0; padding: 0; border: 0; background: none; vertical-align: middle;}
