:root {
  --ink: #2b2118; --paper: #fff8ec; --paper2: #f6ead6; --line: #e3d2b5; --brand: #d98a1e; --brand2: #2f6f4a; --gold: #e0a526;
  --shadow: 0 10px 30px rgba(40, 25, 10, .28);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Avenir Next", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc6e4; color: var(--ink); user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#game:active { cursor: grabbing; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.7em; padding: .12em .45em; margin: 0 .12em; border-radius: 7px; background: #fff; border: 1px solid #cdbb9c; border-bottom-width: 3px; font: 700 .82em ui-monospace, Menlo, monospace; text-align: center; color: var(--ink); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 14px; padding: .65em 1.1em; font-weight: 800; background: var(--paper2); color: var(--ink); border: 2px solid var(--line); transition: transform .08s, background .15s; }
button:hover:not(:disabled) { transform: translateY(-1px); background: #fff; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: #a23f2b; color: #fff; }
button.primary:hover:not(:disabled) { background: #d9644b; }
button.green { background: var(--brand2); border-color: #23564a; color: #fff; }
button.green:hover:not(:disabled) { background: #3a8571; }
button.big { font-size: 1.25rem; padding: .8em 2em; border-radius: 18px; }
button.ghost { background: transparent; border-color: transparent; font-weight: 700; color: #7a6650; padding: .3em .6em; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#topleft { position: absolute; left: 18px; top: 16px; display: flex; flex-direction: column; gap: 10px; width: 330px; }
.chip { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; background: rgba(255, 248, 236, .93); border: 2px solid var(--line); border-radius: 999px; padding: 7px 16px; box-shadow: 0 4px 14px rgba(40, 25, 10, .18); font-weight: 700; font-size: 15px; }
#clockTime { color: #7a6650; font-variant-numeric: tabular-nums; }
#objective { background: rgba(43, 33, 24, .78); color: #fff; border-radius: 16px; padding: 10px 14px; backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.lbl { font-size: 11px; letter-spacing: .14em; font-weight: 800; opacity: .7; }
#objText { font-weight: 700; font-size: 15px; line-height: 1.3; margin-top: 2px; }
#alerts { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
/* red alerts: small frosted-glass chips, one line per stable; tap one to unfold its list */
.alert { max-width: 100%; color: #fff; font-size: 12.5px; line-height: 1.35; border-radius: 15px; padding: 5px 11px 5px 10px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .05) 55%), rgba(46, 30, 20, .40);
  -webkit-backdrop-filter: blur(14px) saturate(1.7); backdrop-filter: blur(14px) saturate(1.7);
  border: 1px solid rgba(255, 255, 255, .36); box-shadow: 0 6px 18px rgba(20, 10, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -1px 0 rgba(0, 0, 0, .14); transition: background .2s; }
.arow { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.alert .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #ff5a3c; box-shadow: 0 0 0 3px rgba(255, 90, 60, .3), 0 0 10px #ff5a3c; animation: adot 1.8s ease-in-out infinite; }
@keyframes adot { 50% { box-shadow: 0 0 0 5px rgba(255, 90, 60, .12), 0 0 14px #ff5a3c; } }
.alert b { font-size: 13.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.alert em { flex: none; font-style: normal; font-weight: 800; font-size: 11.5px; min-width: 19px; text-align: center; padding: 0 5px; border-radius: 999px; background: #e8452e; text-shadow: none; }
.alert .ics { flex: none; font-size: 13px; letter-spacing: 1px; text-shadow: none; }
.amore { margin-top: 5px; padding: 5px 0 2px; border-top: 1px solid rgba(255, 255, 255, .25); }
.amore b { font-size: 12.5px; } .amore span { color: rgba(255, 255, 255, .86); }
#topright { position: absolute; right: 18px; top: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#miniWrap { position: relative; width: 230px; height: 230px; border-radius: 50%; overflow: hidden; border: 5px solid var(--paper); box-shadow: var(--shadow); background: #b9d8a0; }
#minimap { width: 100%; height: 100%; display: block; }
#district { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 12px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
#keys { display: flex; gap: 10px; font-size: 12.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); }
#bottom { position: absolute; left: 0; right: 0; bottom: 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#prompt { position: relative; display: flex; align-items: center; gap: 10px; background: rgba(255, 248, 236, .96); border: 2px solid var(--line); border-radius: 16px; padding: 10px 18px; font-weight: 800; font-size: 17px; box-shadow: var(--shadow); overflow: hidden; }
#promptHold { position: absolute; left: 0; bottom: 0; height: 5px; width: 100%; }
#promptHold i { display: block; height: 100%; width: 0; background: var(--brand); }
#modeHint { font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
#stamina { width: 260px; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.bar { height: 12px; border-radius: 99px; background: rgba(43, 33, 24, .35); overflow: hidden; border: 2px solid rgba(255, 255, 255, .7); }
.bar i { display: block; height: 100%; border-radius: 99px; background: #6cc070; transition: width .2s; }
#toasts { position: absolute; right: 18px; top: 300px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; max-width: min(420px, 60vw); }
.toast { background: rgba(43, 33, 24, .88); color: #fff; padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 15px; animation: tin .25s ease-out, tout .4s ease-in 3.4s forwards; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); border-radius: 18px; text-align: right; }
.toast.warn { background: #c8372a; }
.toast.good { background: #2f7d5e; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
@keyframes tout { to { opacity: 0; transform: translateY(-8px); } }
#banner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; color: #fff; text-shadow: 0 3px 16px rgba(0, 0, 0, .55); animation: bin .5s cubic-bezier(.2, 1.4, .4, 1); }
#bannerSmall { font-size: 15px; letter-spacing: .3em; font-weight: 800; }
#bannerBig { font: 800 58px/1.05 Georgia, "Times New Roman", serif; margin: 6px 0; }
#bannerSub { font-size: 19px; font-weight: 700; }
@keyframes bin { from { opacity: 0; transform: scale(.85); } }

/* ---------- panels ---------- */
.panel { position: fixed; right: 22px; bottom: 22px; width: 380px; background: var(--paper); border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 16px; animation: pin .2s ease-out; }
@keyframes pin { from { opacity: 0; transform: translateY(14px); } }
.hp-head { display: flex; gap: 12px; align-items: center; }
.portrait { width: 92px; height: 92px; border-radius: 18px; background: linear-gradient(#cfe6f3, #e9f2d9); border: 2px solid var(--line); object-fit: cover; flex: none; }
.portrait.unknown { filter: brightness(0) opacity(.35); }
.hp-head h2 { margin: 0; font: 800 26px/1.1 Georgia, serif; }
.sub { color: #7a6650; font-size: 13.5px; font-weight: 600; }
.rar { display: inline-block; padding: 2px 9px; border-radius: 99px; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hearts { color: var(--brand); letter-spacing: 2px; font-size: 16px; }
.hearts i { color: #dccbb0; font-style: normal; }
.about { font-size: 14px; line-height: 1.4; margin: 12px 0; color: #54463a; }
.need { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin: 6px 0; }
.need .bar { height: 11px; border-color: var(--line); background: #efe2cb; }
.need.low { color: #c8372a; }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.acts button { padding: .6em .4em; font-size: 14.5px; }
.acts .wide { grid-column: 1 / -1; }
.note { font-size: 12.5px; color: #7a6650; margin-top: 8px; line-height: 1.35; }
.close { position: absolute; right: 10px; top: 8px; }

.overlay { position: fixed; inset: 0; background: rgba(30, 22, 14, .55); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 5; }
.sheet { overflow-y: auto; background: var(--paper); border: 3px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 22px 24px; max-width: min(1100px, 94vw); max-height: 92vh; display: flex; flex-direction: column; position: relative; }
.sheet h2 { margin: 0 0 2px; font: 800 30px Georgia, serif; }
.sheet-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; padding-right: 70px; }
.jr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 320px); gap: 18px; min-height: 0; flex: 1; width: min(1010px, 88vw); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px; align-content: start; max-height: 68vh; }
.card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 7px; text-align: center; cursor: pointer; position: relative; font-weight: 800; font-size: 13.5px; transition: transform .08s; }
.card:hover { transform: translateY(-2px); }
.card.sel { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(200, 85, 61, .25); }
.card img { width: 100%; aspect-ratio: 1; border-radius: 11px; background: linear-gradient(#cfe6f3, #e9f2d9); display: block; margin-bottom: 4px; }
.card.unk img { filter: grayscale(.75) brightness(.72) contrast(.9); }
.card.unk { color: #8a7a66; background: #f4ecdd; }
.card .tag { position: absolute; left: 10px; top: 10px; font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--brand2); color: #fff; }
.card .bang { position: absolute; right: 9px; top: 9px; width: 20px; height: 20px; border-radius: 50%; background: #e8452e; color: #fff; font-size: 13px; line-height: 20px; }
.card .dot { height: 5px; border-radius: 9px; margin-top: 4px; }
.detail { background: var(--paper2); border-radius: 18px; padding: 14px; overflow-y: auto; }
.mapwrap { display: grid; grid-template-columns: auto minmax(200px, 290px); gap: 18px; min-height: 0; }
#bigmap { width: min(84vh, 60vw); height: auto; border-radius: 18px; border: 3px solid var(--line); display: block; }
.stlist { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.st { background: #fff; border: 2px solid var(--line); border-left: 10px solid #999; border-radius: 12px; padding: 8px 10px; font-size: 13px; line-height: 1.35; }
.st b { font-size: 14.5px; display: block; }
.st.unk { opacity: .6; border-left-color: #bbb; }
.st .warn { color: #c8372a; font-weight: 800; }
.legend { font-size: 12.5px; color: #7a6650; line-height: 1.7; margin-top: 4px; }
.help { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 26px; font-size: 15px; margin: 8px 0 16px; }
.help div { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px dashed var(--line); padding: 5px 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- title ---------- */
#title { position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding-left: 7vw; z-index: 10; background: linear-gradient(90deg, rgba(14, 40, 24, .72), rgba(30, 48, 20, .16) 60%, transparent); }
#titleCard { color: #fff; max-width: 560px; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.kicker { letter-spacing: .32em; font-size: 13px; font-weight: 800; opacity: .9; }
#title h1 { font: 800 84px/.95 Georgia, "Times New Roman", serif; margin: 10px 0 14px; }
#title h1 { color: #ffe9a8; letter-spacing: -.01em; }
#title h1 em { font-style: normal; color: #ffb52e; background-image: radial-gradient(circle, #3a2410 0 2.6px, transparent 3.2px); background-size: 19px 17px; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: none; filter: drop-shadow(0 2px 10px rgba(0,0,0,.45)); background-color: #ffb52e; }
#title .kicker { color: #c8f0b0; }
#loadText { font-size: 18px; font-weight: 700; min-height: 1.4em; }
#titleBtns { display: flex; gap: 12px; margin: 18px 0 26px; }
#title .controls { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; font-weight: 700; opacity: .95; }

.binds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin: 6px 0 10px; }
.bindrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14.5px; font-weight: 700; }
.bindrow button { min-width: 132px; padding: .45em .7em; font-size: 14px; }

.sw { display: inline-block; width: 13px; height: 13px; border-radius: 3px; vertical-align: -2px; }
.legend b { color: var(--ink); }

.pic { position: relative; flex: none; }
.lock { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 30px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.hp-head .lock { font-size: 34px; }
.portrait.locked { filter: grayscale(.75) brightness(.72); }
.card .lockedtag { font-size: 9px; letter-spacing: .05em; }
.unlock { background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 10px 12px; font-size: 14px; line-height: 1.4; margin-top: 12px; color: #54463a; }
.unlock > b:first-child { display: block; margin-bottom: 4px; color: var(--ink); }

#objective, #alerts .alert, #inv, #payday { pointer-events: auto; cursor: pointer; }
#objective:hover { background: rgba(43, 33, 24, .92); }
#alerts .alert:hover { border-color: rgba(255, 255, 255, .7); }
.spk { font-size: 11px; opacity: .75; margin-left: 4px; }
#payday { font-size: 13.5px; padding: 6px 14px; }
#payday.short { border-color: #e8452e; color: #c8372a; }
#coinChip.pop { animation: coinpop .5s ease-out; display: inline-block; }
@keyframes coinpop { 30% { transform: scale(1.5); color: #c88a10; } }
.handpic { display: flex; align-items: center; justify-content: center; font-size: 54px; }
#titleBtns { flex-direction: column; gap: 10px; max-width: 520px; }
.slot { display: flex; align-items: center; gap: 12px; background: rgba(255, 248, 236, .95); border: 2px solid var(--line); border-radius: 18px; padding: 10px 12px 10px 18px; color: var(--ink); text-shadow: none; box-shadow: var(--shadow); }
.slot > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.slot b { font-size: 18px; }
.slot span { font-size: 13px; color: #7a6650; font-weight: 600; }
.slot.empty { background: rgba(255, 248, 236, .78); }
.slot button.big { font-size: 1rem; padding: .6em 1.2em; }

.codebox { background: rgba(43, 33, 24, .72); border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.5; text-shadow: none; }
.codebox b { font-family: ui-monospace, Menlo, monospace; background: rgba(255, 255, 255, .16); padding: 2px 7px; border-radius: 7px; user-select: text; -webkit-user-select: text; }
.codebox span { opacity: .8; font-size: 12.5px; }
.codebox .ghost { color: #ffe9b0; text-decoration: underline; }

.chipbtn { pointer-events: auto; align-self: flex-start; border-radius: 999px; padding: 6px 14px; font-size: 13.5px; background: #f2c230; border-color: #c89a10; color: #3a2a08; box-shadow: 0 4px 14px rgba(40, 25, 10, .18); }
.chipbtn:hover:not(:disabled) { background: #ffd95a; }
.earnlist { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.earn { display: flex; gap: 14px; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.45; color: #54463a; }
.earn .ico { font-size: 34px; line-height: 1; }
.earn b:first-child { display: block; font-size: 16px; color: var(--ink); margin-bottom: 2px; }
.earn .row { margin-top: 8px; }
.earn .row button { font-size: 13px; padding: .45em .8em; }

/* ---------- fit any screen: the interface scales with the window (--ui is set from the window size) ---------- */
:root { --ui: 1; }
#topleft, #topright, #bottom, #toasts, #banner, .panel, .sheet, #titleCard { zoom: var(--ui); }
#title { overflow-y: auto; align-items: center; }
#titleCard { margin: auto 0; padding: 20px 0; }
.sheet { max-width: calc(94vw / var(--ui)); max-height: calc(92vh / var(--ui)); }
.jr { width: min(1010px, calc(88vw / var(--ui))); }
.grid { max-height: calc(66vh / var(--ui)); }
#bigmap { width: min(calc(80vh / var(--ui)), calc(58vw / var(--ui))); }
#prompt { pointer-events: auto; cursor: pointer; }
#prompt:hover { background: #fff; }
.btnrow { display: flex; gap: 8px; }
.chipbtn.green2 { background: #8fd0a4; border-color: #4f9a68; color: #123a22; }
.chipbtn.green2:hover:not(:disabled) { background: #a9e3bb; }
.auth { display: flex; flex-direction: column; gap: 10px; background: rgba(255, 248, 236, .96); color: var(--ink); text-shadow: none; border: 2px solid var(--line); border-radius: 20px; padding: 16px 18px; box-shadow: var(--shadow); max-width: 480px; }
.auth label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 14px; }
.auth input { font: inherit; font-size: 18px; padding: .5em .7em; border-radius: 12px; border: 2px solid var(--line); background: #fff; user-select: text; -webkit-user-select: text; }
.auth input:focus { outline: 3px solid rgba(200, 85, 61, .35); border-color: var(--brand); }
.auth span { font-size: 12.5px; color: #7a6650; line-height: 1.4; }
.auth .big { font-size: 1.05rem; padding: .6em 1.2em; }
#auErr { color: #c8372a; font-weight: 800; font-size: 14px; min-height: 1.2em; }
.buildgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bitem { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.bitem.has { background: #eef6e6; border-color: #b9d8a0; }
.bitem .ico { font-size: 26px; width: 34px; text-align: center; }
.bitem > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.bitem b { font-size: 15px; } .bitem span { font-size: 12.5px; color: #7a6650; }
.bitem em { font-style: normal; font-weight: 800; color: #2f7d5e; font-size: 13.5px; }
.bitem button { font-size: 13px; padding: .45em .8em; white-space: nowrap; }
.paints { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; font-size: 13.5px; }
.swrow { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; padding: 0; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.stbtns { float: right; display: flex; gap: 4px; }
.stbtns button { font-size: 12px; padding: .3em .55em; border-radius: 9px; }

h3.mk { margin: 16px 0 8px; font: 800 19px Georgia, serif; }
h3.mk .sub { font: 600 13px ui-rounded, system-ui; margin-left: 8px; }
.market { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.mhorse { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #7a6650; }
.mhorse img { width: 100%; aspect-ratio: 1; border-radius: 10px; background: linear-gradient(#cfe6f3, #e9f2d9); }
.mhorse b { font-size: 14.5px; color: var(--ink); }
.mhorse button { font-size: 12.5px; padding: .4em .3em; margin-top: 3px; }
.mhorse.sold { background: #eef6e6; border-color: #b9d8a0; }
.mhorse em { font-style: normal; font-weight: 800; color: #2f7d5e; }

#inv { gap: 10px; font-size: 14px; padding: 7px 13px; }
#inv span { white-space: nowrap; }
#topleft { width: 370px; }

.auth select { font: inherit; font-size: 16px; padding: .4em .6em; border-radius: 12px; border: 2px solid var(--line); background: #fff; }

.layers { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.layer { font-size: 12.5px; padding: .35em .7em; border-radius: 99px; }
.layer.on { background: var(--brand2); border-color: #23564a; color: #fff; }

#bigmap { width: min(calc(108vh / var(--ui)), calc(60vw / var(--ui))); }

#players { pointer-events: auto; cursor: pointer; font-size: 13.5px; padding: 6px 14px; background: rgba(47, 127, 232, .92); border-color: #1f5fbf; color: #fff; }
.joinbox { display: flex; align-items: center; gap: 10px; background: rgba(47, 111, 94, .92); border-radius: 18px; padding: 10px 12px 10px 18px; text-shadow: none; box-shadow: var(--shadow); }
.joinbox > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; } .joinbox b { font-size: 17px; } .joinbox span { font-size: 12.5px; opacity: .85; }
.joinbox input { width: 130px; font: 800 20px ui-monospace, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; text-align: center; padding: .4em .3em; border-radius: 12px; border: 2px solid #fff; user-select: text; -webkit-user-select: text; }
.joinbox button.big { font-size: 1rem; padding: .6em 1.1em; background: #fff; color: #23564a; border-color: #fff; }
#joinErr { color: #ffd9d2; font-weight: 800; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); min-height: 0; }
.invite { font: 800 44px ui-monospace, Menlo, monospace; letter-spacing: .18em; text-align: center; background: #fff; border: 3px dashed var(--brand2); border-radius: 18px; padding: 14px; margin: 12px 0; color: var(--brand2); user-select: text; -webkit-user-select: text; display: flex; align-items: center; justify-content: center; gap: 18px; }
.invite button { font-size: 14px; letter-spacing: 0; }
.chgrid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.chpic { width: 220px; height: 260px; object-fit: cover; object-position: center 20%; border-radius: 20px; border: 2px solid var(--line); background: linear-gradient(#cfe6f3, #e9f2d9); }
.chrow { margin-bottom: 10px; font-size: 14px; } .chrow > b { display: block; margin-bottom: 3px; }
.chname { display: flex; flex-direction: column; gap: 4px; font-size: 14px; margin-bottom: 12px; }
.chname input { font: inherit; font-size: 20px; font-weight: 800; padding: .4em .6em; border-radius: 12px; border: 2px solid var(--line); user-select: text; -webkit-user-select: text; }
.chrow .row button { font-size: 14px; padding: .5em .9em; }

#char { z-index: 30; }
#char .sheet { background: var(--paper); }

/* ---------- phones and tablets ---------- */
html, body { touch-action: none; overscroll-behavior: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#keys span[data-open] { pointer-events: auto; cursor: pointer; }
#touch { position: absolute; inset: 0; pointer-events: none; }
#stick { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 3px solid rgba(255, 255, 255, .7); pointer-events: auto; touch-action: none; display: flex; align-items: center; justify-content: center; }
#stick i { width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, .88); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
#tbtns { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, auto); gap: 10px; align-items: end; justify-items: end; pointer-events: none; }
#tbtns button { pointer-events: auto; touch-action: none; width: 70px; height: 70px; border-radius: 50%; padding: 0; font-size: 26px; line-height: 1; background: rgba(255, 248, 236, .86); border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); display: flex; flex-direction: column; align-items: center; justify-content: center; }
#tbtns button small { font-size: 10.5px; font-weight: 800; margin-top: 2px; }
#tbtns button.on { background: #f2c230; transform: scale(.94); }
#tbtns .tsm { width: 54px; height: 54px; font-size: 22px; }
#tbtns .tbig { width: 88px; height: 88px; font-size: 32px; background: rgba(200, 85, 61, .92); color: #fff; grid-row: span 2; }
#tbtns .tsm:nth-child(1) { grid-column: 2; } #tbtns .tsm:nth-child(2) { grid-column: 3; }
body.touch #modeHint, body.touch .kb, body.touch #keys kbd, body.touch #promptKey, body.touch #title .controls { display: none; }
body.touch #keys span[data-open] { background: rgba(255, 248, 236, .92); color: var(--ink); text-shadow: none; padding: 7px 13px; border-radius: 99px; font-size: 14px; border: 2px solid var(--line); }
body.touch #bottom { bottom: 32px; left: 190px; right: 270px; }
body.touch #prompt { font-size: 18px; padding: 13px 20px; }
body.touch button, body.touch .card, body.touch .swatch { touch-action: manipulation; }
body.touch .overlay, body.touch .sheet, body.touch #title, body.touch .grid, body.touch .detail, body.touch .stlist { touch-action: pan-y; }
body.touch .swatch { width: 36px; height: 36px; }
#rotate { position: fixed; inset: 0; z-index: 99; background: #2b2118; color: #fff; display: flex; align-items: center; justify-content: center; text-align: center; font: 800 24px/1.5 ui-rounded, system-ui; padding: 30px; }

#street { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .85); text-align: right; max-width: 240px; margin-top: -2px; }
.mapbox { position: relative; }
#bigmap { width: min(calc(104vh / var(--ui)), calc(62vw / var(--ui))); height: auto; cursor: grab; touch-action: none; }
.mapbtns { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; }
.mapbtns button { font-size: 14px; padding: .4em .75em; border-radius: 12px; background: rgba(255, 248, 236, .96); }
.earn.hired { background: #eef6e6; border-color: #b9d8a0; }
#payday { cursor: pointer; }

/* phones and tablets: menu chips and friends sit top-centre, messages under them, so the right-hand side is free for the buttons */
#topmid { position: absolute; top: 12px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; zoom: var(--ui); }
body.touch #toasts { top: 112px; right: 0; left: 0; margin: 0 auto; align-items: center; max-width: 460px; }
body.touch #stick { width: min(150px, 34vh); height: min(150px, 34vh); }
body.touch #stick i { width: 41%; height: 41%; }
@media (max-height: 430px) {
  body.touch #tbtns { gap: 7px; } body.touch #tbtns button { width: 60px; height: 60px; font-size: 22px; } body.touch #tbtns .tsm { width: 46px; height: 46px; font-size: 19px; } body.touch #tbtns .tbig { width: 76px; height: 76px; font-size: 28px; }
  body.touch #topleft { width: 330px; } body.touch #miniWrap { width: 200px; height: 200px; }
}
#topmid > * { align-self: center; }
.mapbtns { flex-wrap: wrap; right: 70px; }
.mapbtns button { box-shadow: 0 2px 6px rgba(0, 0, 0, .18); font-weight: 800; }

/* several stables, decorations, the vet */
.ytabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.ytabs button { font-size: 14px; padding: .45em .9em; border-radius: 99px; }
.ytabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.decor { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
.decor button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border-radius: 14px; background: #fff; font-size: 13px; line-height: 1.2; }
.decor button .ico { font-size: 26px; } .decor button em { font-style: normal; font-weight: 700; font-size: 12px; color: #7a6650; }
.decor button:disabled { opacity: .45; }
.placed { margin-top: 10px; font-size: 13px; color: #7a6650; } .placed b { color: var(--ink); } .placed > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.placed .pl { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 2px solid var(--line); border-radius: 99px; padding: 3px 5px 3px 10px; color: var(--ink); font-weight: 700; }
.placed .pl button { font-size: 11.5px; padding: .25em .6em; border-radius: 99px; }
.sickbox { margin-top: 10px; background: #fdeceb; border: 2px solid #e8a39a; border-radius: 14px; padding: 9px 11px; font-size: 13px; line-height: 1.35; }
.sickbox b { display: block; font-size: 15px; color: #b23a2e; } .sickbox .row { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; } .sickbox button { font-size: 13px; padding: .4em .7em; }
@media (max-width: 760px) { .buildgrid { grid-template-columns: 1fr; } .paints { grid-template-columns: 1fr; } .market { grid-template-columns: repeat(3, 1fr); } }

/* decorating view: drag and drop from above */
#arrange { position: fixed; inset: 0; z-index: 4; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#arrange:active { cursor: grabbing; }
#arrange .arr-ui { position: absolute; left: 50%; transform: translateX(-50%); background: rgba(255, 250, 240, .96); color: #2b2118; border-radius: calc(18px * var(--ui, 1)); box-shadow: 0 6px 24px rgba(0, 0, 0, .28); cursor: default; font-size: calc(15px * var(--ui, 1)); }
#arrange .arr-top { top: calc(12px * var(--ui, 1)); padding: calc(9px * var(--ui, 1)) calc(18px * var(--ui, 1)); display: flex; gap: calc(14px * var(--ui, 1)); align-items: baseline; flex-wrap: wrap; justify-content: center; max-width: 94vw; }
#arrange .arr-top b { font-size: 1.15em; } #arrange .arr-top em { font-style: normal; opacity: .7; font-size: .9em; }
#arrange .arr-bar { bottom: calc(14px * var(--ui, 1)); padding: calc(9px * var(--ui, 1)); display: flex; gap: calc(8px * var(--ui, 1)); align-items: center; flex-wrap: wrap; justify-content: center; max-width: 96vw; width: max-content; }
#arrange .arr-bar button { font-size: 1em; padding: calc(10px * var(--ui, 1)) calc(14px * var(--ui, 1)); white-space: nowrap; }
#arrange .arr-sel { font-weight: 800; padding: 0 calc(6px * var(--ui, 1)); white-space: nowrap; } #arrange .arr-sel.dim { font-weight: 600; opacity: .65; }
#arrange .arr-zoom { display: flex; gap: 4px; } #arrange .arr-zoom button { padding-left: calc(12px * var(--ui, 1)); padding-right: calc(12px * var(--ui, 1)); font-weight: 900; }
#arrange .arr-add { bottom: calc(84px * var(--ui, 1)); padding: calc(10px * var(--ui, 1)); width: min(94vw, calc(860px * var(--ui, 1))); max-height: 62vh; overflow-y: auto; touch-action: pan-y; }
#arrange .arr-add .decor { margin: 0; }
body.arranging #topleft, body.arranging #topright, body.arranging #topmid, body.arranging #bottom, body.arranging #touch, body.arranging #banner, body.arranging #horsePanel { display: none !important; }
.arrcta { display: flex; gap: 14px; align-items: center; margin: 4px 0 12px; } .arrcta span { opacity: .8; font-size: .95em; } .arrcta button { white-space: nowrap; flex: none; }
#chName.need { outline: 3px solid #e8452e; }
@media (max-height: 430px) { #arrange .arr-top em { display: none; } #arrange .arr-add { bottom: calc(96px * var(--ui, 1)); max-height: 56vh; } }

.sellbox { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-top: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(217, 138, 30, .14); font-size: .92em; line-height: 1.3; }
.sellbox b { display: block; font-size: 1.08em; } .sellbox button { flex: none; white-space: nowrap; }

/* saving: where and when */
.slot em.when { font-style: normal; font-size: 12.5px; font-weight: 700; color: #2f7d5e; margin-top: 1px; }
.codebox.warnbox { background: rgba(200, 55, 42, .88); }
.savestat { margin: 2px 0 12px; padding: 8px 14px; border-radius: 12px; background: #eef6ee; border: 2px solid #b9dcc4; color: #24624a; font-weight: 700; font-size: 14.5px; }
#busy { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 60; max-width: min(520px, 86vw); padding: 16px 26px; border-radius: 20px; background: rgba(43, 33, 24, .93); color: #fff; font-weight: 800; font-size: 19px; text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .4); }
#busy.good { background: #2f7d5e; } #busy.warn { background: #c8372a; }
#stale { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(30, 22, 14, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#stale .sheet { width: 520px; max-width: 100%; text-align: center; } #stale p { margin: 10px 0; line-height: 1.45; } #stale button { margin-top: 10px; }
.savestat.warn { background: #fdecea; border-color: #e7b0a8; color: #a02a1f; }
