/* The town is a flex box: the 3D stage, and (only while you pick a look) the maker next to it or under it.
   The maker never floats over the canvas and never scrolls inside: a scrollable layer on top of a WebGL canvas
   makes mobile Chromium drop the part of the canvas it does not even cover. */
.town{position:relative;display:flex;height:min(78vh,760px);min-height:420px;border:3px solid var(--ink,#3b1d3a);border-radius:16px;overflow:hidden;background:#a9ddff;color:var(--ink,#3b1d3a);font:600 14px/1.4 var(--font-body,"Nunito",-apple-system,sans-serif)}
.town [hidden]{display:none!important}
.town-stage{position:relative;flex:1 1 auto;min-width:0;min-height:0;touch-action:none;-webkit-user-select:none;user-select:none}
.town-view{position:absolute;inset:0}
.town-view canvas{display:block;width:100%;height:100%}
.town-note{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:#fff;color:var(--ink,#3b1d3a);font:700 16px/1.4 var(--font-head,"Baloo 2","Trebuchet MS",sans-serif);padding:12px 18px;border:2px solid var(--ink,#3b1d3a);border-radius:12px;pointer-events:none;max-width:80%;text-align:center}
.town[data-state="ok"] .town-note{display:none}
.town-tag{position:absolute;left:12px;top:12px;background:#ffe14d;color:var(--ink,#3b1d3a);font:800 15px/1 var(--font-head,"Baloo 2","Trebuchet MS",sans-serif);letter-spacing:.06em;padding:9px 12px;border-radius:10px;border:2px solid var(--ink,#3b1d3a);text-decoration:none;cursor:pointer;z-index:2}
.town-tag:hover{background:#ffeb80}
.town-hud{position:absolute;left:12px;bottom:12px;transition:opacity .6s;background:rgba(255,255,255,.92);color:var(--ink,#3b1d3a);font:600 14px/1.4 var(--font-body,"Nunito",-apple-system,sans-serif);padding:6px 12px;border-radius:999px;border:2px solid var(--ink,#3b1d3a);pointer-events:none;max-width:calc(100% - 128px)}
.town-hud-touch{display:none}
.town-hud.gone{opacity:0}
.town:not([data-mode="play"]) .town-hud{display:none}
/* the town takes the keyboard focus when you click the stage: no ring for a click, a ring when you came by keyboard */
.town:focus{outline:none}
.town:focus-visible{outline:3px solid var(--accent,#ffc542);outline-offset:-3px}
@media (pointer:coarse){.town-hud-desktop{display:none}.town-hud-touch{display:block}}
/* the whole screen through the browser's Fullscreen button: no border, no rounded corners, nothing else on the screen */
.town:fullscreen{width:100vw;height:100vh;border:0;border-radius:0}
.town:-webkit-full-screen{width:100vw;height:100vh;border:0;border-radius:0}

/* the time of day, your coins and your level */
.town-stats{position:absolute;left:12px;top:58px;display:none;flex-direction:column;align-items:flex-start;gap:6px}
.town[data-mode="play"] .town-stats{display:flex}
.town-chip{gap:6px}
.town-ico{display:block}
.town-ico-moon{display:none}
.town-phase[data-phase="night"] .town-ico:not(.town-ico-moon){display:none}
.town-phase[data-phase="night"] .town-ico-moon{display:block}
.town-huss b{font:800 15px/1 var(--font-head,"Baloo 2","Trebuchet MS",sans-serif);margin-left:2px}
.town-huss-bar{position:relative;display:block;width:56px;height:6px;border-radius:3px;background:var(--line,#f3dbe6);overflow:hidden}
.town-huss-fill{position:absolute;left:0;top:0;bottom:0;width:0;background:var(--btn,#d6215a);border-radius:3px}
.town-huss-points{font-size:12px;font-weight:800;color:var(--dim,#7d5f79)}
.town-bubble{position:absolute;left:0;top:0;width:140px;padding:8px 10px;border-radius:12px;background:#fff;border:2px solid var(--ink,#3b1d3a);font:700 13px/1.3 var(--font-body,"Nunito",-apple-system,sans-serif);pointer-events:none}
.town-power{position:absolute;left:50%;bottom:110px;transform:translateX(-50%);width:220px;max-width:70%;padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.94);border:2px solid var(--ink,#3b1d3a)}
.town-power-track{position:relative;display:block;height:12px;border-radius:6px;background:#e9e2ea}
.town-power-band{position:absolute;left:62%;width:16%;top:0;bottom:0;background:#7fd08a;border-radius:4px}
.town-power-mark{position:absolute;left:0;top:-3px;width:6px;height:18px;margin-left:-3px;border-radius:3px;background:var(--ink,#3b1d3a)}
.town-shoot{position:absolute;z-index:3;right:16px;bottom:16px;width:76px;height:76px;border-radius:50%;border:3px solid var(--ink,#3b1d3a);background:var(--accent,#ffc542);color:var(--ink,#3b1d3a);font:800 15px/1 var(--font-body,"Nunito",-apple-system,sans-serif);cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none}
.town-shoot:hover{background:#ffd467}
.town-shoot:active{transform:scale(.95)}
.town-float{position:absolute;left:50%;bottom:150px;transform:translateX(-50%);font:800 18px/1 var(--font-head,"Baloo 2","Trebuchet MS",sans-serif);color:#fff;text-shadow:0 2px 0 var(--ink,#3b1d3a);opacity:0;pointer-events:none;white-space:nowrap}
.town-float.on{animation:townFloat 1.1s ease-out forwards}
@keyframes townFloat{0%{opacity:0;transform:translate(-50%,10px)}15%{opacity:1}100%{opacity:0;transform:translate(-50%,-40px)}}

/* who you are, and the way to a free house */
.town-top{position:absolute;right:12px;top:12px;display:none;gap:6px;align-items:center;flex-wrap:wrap;justify-content:flex-end;max-width:66%}
.town[data-mode="play"] .town-top{display:flex}
.town-you,.town-chip{height:36px;display:inline-flex;align-items:center;padding:0 12px;border-radius:999px;border:2px solid var(--ink,#3b1d3a);background:rgba(255,255,255,.94);font:800 14px/1 var(--font-body,"Nunito",-apple-system,sans-serif);color:var(--ink,#3b1d3a)}
.town-you{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.town-chip{cursor:pointer}
.town-chip:hover{background:var(--accent,#ffc542)}
.town-narrow{display:none}
.town-compass{position:absolute;left:50%;top:12px;transform:translateX(-50%);display:flex;align-items:center;gap:6px;height:36px;padding:0 12px 0 8px;border-radius:999px;border:2px solid var(--ink,#3b1d3a);background:rgba(255,255,255,.94);font:800 14px/1 var(--font-body,"Nunito",-apple-system,sans-serif);white-space:nowrap}
.town-compass-arrow{display:block;color:var(--btn,#d6215a)}
.town-toast{position:absolute;left:50%;top:58px;transform:translateX(-50%);max-width:min(92%,480px);padding:10px 16px;border-radius:12px;background:var(--ink,#3b1d3a);color:#fff;font:700 15px/1.4 var(--font-body,"Nunito",-apple-system,sans-serif);text-align:center;opacity:0;transition:opacity .25s;pointer-events:none}
.town-toast.on{opacity:1}
.town-prompt{position:absolute;left:50%;bottom:60px;transform:translateX(-50%);display:flex;flex-direction:column;align-items:center;gap:6px}
.town-prompt-key{padding:4px 10px;border-radius:999px;background:rgba(255,255,255,.94);border:2px solid var(--ink,#3b1d3a);font:800 12px/1.3 var(--font-body,"Nunito",-apple-system,sans-serif)}
.town-prompt-key kbd{font:inherit;padding:0 5px;border:1px solid var(--ink,#3b1d3a);border-bottom-width:2px;border-radius:4px}
@media (pointer:coarse){.town-prompt-key{display:none}}

/* the maker */
.town-panel{position:relative;flex:0 0 344px;width:344px;margin:0;padding:14px 16px 0;background:var(--card,#fff);border-left:3px solid var(--ink,#3b1d3a);overflow-x:hidden;overflow-y:auto}
/* beside the stage the maker may scroll if a short screen cannot hold every row; it no longer lies over the canvas,
   which is what broke the picture on phones. Under the stage (narrow screens) the page itself scrolls, see below. */
.town-card-title{margin:0;font:700 22px/1.2 var(--font-head,"Baloo 2","Trebuchet MS",sans-serif)}
.town-card-sub{margin:2px 0 6px;color:var(--dim,#7d5f79)}
.town-tabs{display:none;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.town-tabs-always{display:flex}
/* sized so that, on a 900px window of the home page (a 630px panel), every row down to the shoes is on screen:
   the seven hair pills take two lines and the eight top colors one */
.town-row{display:grid;grid-template-columns:76px 1fr;gap:8px;align-items:start;margin:0 0 5px}
.town-label{padding-top:5px;font-weight:800}
.town-opts{display:flex;flex-wrap:wrap;gap:5px}
.town-swatch{width:24px;height:24px;border-radius:50%;border:2px solid var(--ink,#3b1d3a);background:var(--c);box-shadow:inset 0 -3px 0 rgba(0,0,0,.12);cursor:pointer;padding:0}
.town-pill{height:26px;padding:0 7px;border-radius:999px;border:2px solid var(--ink,#3b1d3a);background:var(--card,#fff);color:var(--ink,#3b1d3a);font:800 12px/1 var(--font-body,"Nunito",-apple-system,sans-serif);cursor:pointer}
.town-swatch[aria-pressed="true"]{outline:3px solid var(--accent,#ffc542);outline-offset:2px}
.town-pill[aria-pressed="true"]{background:var(--ink,#3b1d3a);color:#fff}
.town-name{height:38px;width:100%;border:2px solid var(--ink,#3b1d3a);border-radius:10px;padding:0 10px;background:var(--card,#fff);color:var(--ink,#3b1d3a);font:700 15px var(--font-body,"Nunito",-apple-system,sans-serif)}
.town-actions{position:sticky;bottom:0;display:flex;gap:8px;margin:8px -16px 0;padding:10px 16px;background:var(--card,#fff);border-top:2px solid var(--line,#f3dbe6)}
.town-btn{height:44px;padding:0 16px;border-radius:12px;border:2px solid var(--ink,#3b1d3a);font:800 15px/1 var(--font-body,"Nunito",-apple-system,sans-serif);cursor:pointer}
.town-btn-primary{flex:1;background:var(--btn,#d6215a);border-color:var(--btn,#d6215a);color:#fff}
.town-btn-primary:hover{background:var(--primary-deep,#c8154a)}
.town-btn-ghost{background:var(--card,#fff);color:var(--ink,#3b1d3a)}
.town-btn-ghost:hover{background:var(--yard,#ffe1ec)}
.town-save-note{margin:0;padding:8px 0 10px;font-size:13px;font-weight:800}
.town-swatch:focus-visible,.town-pill:focus-visible,.town-btn:focus-visible,.town-name:focus-visible,.town-chip:focus-visible{outline:3px solid var(--accent,#ffc542);outline-offset:2px}

@media (pointer:coarse){.town-swatch{width:34px;height:34px}.town-pill{height:36px}}
/* the sheets: the phone's menu, missions, garden shop, leaders */
.town-menu-list{display:grid;gap:8px}
.town-menu-list .town-btn{width:100%;background:var(--card,#fff);color:var(--ink,#3b1d3a)}
.town-menu-list .town-btn:hover{background:var(--yard,#ffe1ec)}
.town-sheet{padding-bottom:0}
.town-missions,.town-ranks{list-style:none;margin:0;padding:0}
.town-mission{display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:10px 0;border-top:2px solid var(--line,#f3dbe6)}
.town-mission:first-child{border-top:0}
.town-mission-text{font-weight:800}
.town-mission-bar{grid-column:1;display:block;height:8px;border-radius:4px;background:var(--line,#f3dbe6);overflow:hidden}
.town-mission-fill{display:block;height:100%;width:0;background:var(--accent,#ffc542);border-radius:4px}
.town-mission-count{grid-row:1;grid-column:2;font:800 14px/1.4 var(--font-body,"Nunito",-apple-system,sans-serif);white-space:nowrap}
.town-mission-reward{grid-column:2;font-size:13px;color:var(--dim,#7d5f79);white-space:nowrap}
.town-mission.done .town-mission-text{text-decoration:line-through}
.town-mission.done .town-mission-fill{background:#7fd08a}
.town-shop{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.town-item{display:grid;grid-template-columns:18px 1fr;gap:2px 8px;align-items:center;padding:8px 10px;border:2px solid var(--line,#f3dbe6);border-radius:12px}
.town-item-dot{grid-row:1 / span 2;width:18px;height:18px;border-radius:50%;border:2px solid var(--ink,#3b1d3a)}
.town-dot-flowers{background:#ff5c8a}.town-dot-bush{background:#2f9147}.town-dot-tree{background:#3ea85a}.town-dot-pine{background:#27793a}
.town-dot-bench{background:#9a6a3c}.town-dot-lamp{background:#ffe9a8}.town-dot-bath{background:#cfd2d6}.town-dot-sign{background:#ffe14d}
.town-item-name{font-weight:800;line-height:1.2}
.town-item-price{font-size:13px;color:var(--dim,#7d5f79)}
.town-item .town-btn{grid-column:1 / -1;height:36px;margin-top:6px}
.town-item .town-btn:disabled{opacity:.45;cursor:not-allowed}
.town-shop-note{grid-column:1 / -1;margin:0;color:var(--dim,#7d5f79)}
.town-rank{display:grid;grid-template-columns:44px 1fr auto;gap:8px;padding:7px 0;border-top:2px solid var(--line,#f3dbe6);font-weight:700}
.town-rank:first-child{border-top:0}
.town-rank-pos{color:var(--dim,#7d5f79)}
.town-rank-score{font-weight:800}
.town-rank.mine{background:#ffd6e4;border-radius:8px;padding-left:6px;padding-right:6px;box-shadow:inset 4px 0 0 var(--btn,#d6215a)}
.town-rank.mine .town-rank-name{font-weight:800}
.town-rank-note{padding:10px 0;color:var(--dim,#7d5f79)}
.town-ranks-me{margin:8px 0 0;font-weight:800}
/* a stage of medium width (a tablet upright, a small laptop window): the centered compass would sit on the chips at the
   top right, which may take two rows there, so it drops below them, over on the right, and the toast goes lower still */
@media (min-width:641px) and (max-width:1225px) and (min-height:521px){
  .town-compass{top:104px;left:auto;right:12px;transform:none}
  .town-toast{top:150px}
}
/* narrow or flat screens: the stage on top, the maker under it, the page itself scrolls */
@media (max-width:640px), (max-height:520px){
  .town{flex-direction:column;height:auto;min-height:0;border-width:2px;overflow:hidden;overflow:clip}   /* clip, not a scroll box: "Back to town" then sticks to the window while a long sheet scrolls */
  .town-stage{flex:none;height:72vh;min-height:380px}
  .town[data-mode="edit"] .town-stage,.town[data-mode="loading"] .town-stage,.town[data-mode="menu"] .town-stage{height:46vh;min-height:300px}
  .town-shop{grid-template-columns:1fr}
  .town-hud{font-size:12px}
  .town-top{max-width:calc(100% - 150px);gap:5px}
  .town-wide{display:none}
  .town-narrow{display:inline-flex}
  .town-compass{top:184px;left:auto;right:8px;transform:none}   /* under the three chips at the left, which reach past the middle on a 360px screen */
  .town-toast{top:238px}
  .town-prompt{bottom:100px}
  .town-panel{flex:none;width:auto;border-left:0;border-top:3px solid var(--ink,#3b1d3a);padding:10px 12px 0;overflow:visible}
  .town-card-title{font-size:19px}
  .town-card-sub{margin-bottom:8px;font-size:13px}
  .town-tabs{display:flex}
  .town-panel:not([data-tab="face"]) .town-row[data-group="face"],.town-panel:not([data-tab="hair"]) .town-row[data-group="hair"],
  .town-panel:not([data-tab="top"]) .town-row[data-group="top"],.town-panel:not([data-tab="legs"]) .town-row[data-group="legs"]{display:none}
  .town-row{grid-template-columns:70px 1fr;gap:6px;margin-bottom:7px}
  .town-actions{margin:8px -12px 0;padding:10px 12px}
}
