Phase 2: client military/social screens, WebSocket push, trade + endgame, review findings pending

Built: units/movements/reports/send/expansion screens, alliance/messages/rankings screens, ws client + server /ws push
(docs/PROTOCOL.md), Internet exchange trade, backbone endgame + world end, shared reports, buildDone relative levels.
Tested: npm test 175/175. Two adversarial reviews found issues (trade-leg recall exploit, __proto__ via validate.js,
rankings DoS, static headers, ...): fixes follow in the next commit.
NOT done: bots/balance, e2e suite, real-device checks.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-11 19:05:03 +02:00
parent 249818a7aa
commit b18645dca1
87 changed files with 10201 additions and 71 deletions

View file

@ -84,7 +84,10 @@ button:focus:not(:focus-visible), [tabindex="-1"]:focus { outline: none; }
.nav-btn[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cyan); }
.nav-ic { position: relative; display: inline-flex; }
.nav-ic svg.ic { width: 24px; height: 24px; }
.nav-badge { position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #1a0710; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-badge { position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--cyan); color: #04222b; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-badge.is-alert { background: var(--red); color: #1a0710; animation: mil-pulse 1.4s ease-in-out infinite; }
@keyframes mil-pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 107, 135, .0), 0 0 0 0 rgba(255, 107, 135, .5); transform: scale(1.12); } }
.more-list { display: grid; gap: 8px; padding-bottom: 6px; }
.nav-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (orientation: landscape) and (max-height: 520px), (min-width: 900px) {
@ -321,4 +324,190 @@ input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outl
.device .row-sub { white-space: normal; }
.card .btn.wide { margin-top: 10px; }
/* ---------------------------------------------------------------- social (alliance, messages, rankings): .soc- */
.soc-page { gap: 10px; }
.soc-body, .soc-content, .soc-listbox { display: grid; gap: 10px; align-content: start; min-width: 0; }
.soc-card .card-head { margin-bottom: 8px; }
.soc-card > .detail-desc { margin-bottom: 10px; }
.soc-card .field { margin-top: 10px; }
.soc-head-actions { display: flex; align-items: center; gap: 4px; }
.soc-stack { grid-auto-flow: row; grid-auto-columns: auto; }
.soc-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; min-width: 0; }
.soc-name { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.soc-head .bar { --c: var(--cyan); height: 6px; margin-top: 4px; }
.soc-tag { font-family: var(--mono); color: var(--cyan); flex: none; }
.soc-role-leader { color: #2b2204; background: var(--amber); border-color: var(--amber); font-weight: 650; }
.soc-role-diplomat { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 60%, var(--line2)); }
.soc-role-officer { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 55%, var(--line2)); }
.soc-state-war { color: var(--red); border-color: #7a2a3f; background: #2d1019; }
.soc-state-nap { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 55%, var(--line2)); }
.soc-state-confed { color: var(--green); border-color: #1a6a4f; background: #0e2b23; }
.soc-state-same { color: var(--amber); }
.soc-tabs { margin-bottom: 0; }
.soc-tabs .seg-btn { min-width: 0; padding: 0 4px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-tabs4 .seg-btn { font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.soc-tabn { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #1a0710; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.soc-subtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.soc-subtabs .chip-btn { flex: 1; }
.soc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.soc-list { display: grid; gap: 8px; min-width: 0; }
.soc-item { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 56px; flex-wrap: wrap; min-width: 0; }
.soc-item > .row-main { min-width: 0; flex: 1 1 140px; }
.soc-item .row-sub { white-space: normal; overflow-wrap: anywhere; }
.soc-item .form-error { flex-basis: 100%; margin: 4px 0 0; }
.soc-actions { display: flex; gap: 8px; flex: none; }
.soc-invite .soc-actions { margin-left: auto; }
.soc-member .row-title b { overflow-wrap: anywhere; }
.soc-member .row-sub { white-space: normal; }
.soc-wrap { white-space: normal !important; }
.soc-req { margin: 2px 0 8px; }
.soc-hint { padding: 0 2px; }
.soc-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.soc-err { display: grid; gap: 8px; justify-items: start; }
.soc-text { width: 100%; min-height: 76px; max-height: 40vh; padding: 10px 12px; border-radius: 12px; background: #080e1c; border: 1px solid var(--line2); color: var(--text); font-size: 16px; line-height: 1.35; resize: vertical; font-family: var(--font); }
.soc-text:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; border-color: var(--cyan); }
.soc-composer { display: grid; gap: 8px; }
.soc-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.soc-addnote { display: grid; gap: 8px; margin-top: 10px; }
.soc-count { font-size: 12px; color: var(--dimmer); }
.soc-count.over { color: var(--red); font-weight: 700; }
.soc-rate { color: var(--amber); background: #2b2204; border: 1px solid #6b5a1f; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.soc-text-out, .soc-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 15px; line-height: 1.4; }
.soc-note .soc-text-out { margin-bottom: 2px; }
.soc-msgrow { display: flex; align-items: center; gap: 2px; }
.soc-msgrow .soc-msg { flex: 1; min-width: 0; align-items: flex-start; }
.soc-msg.unread { border-color: var(--cyan); background: #0c1f33; }
.soc-msg .when { margin-top: 2px; }
.soc-preview { color: var(--dim); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: normal; }
.soc-feed { align-items: flex-start; }
.soc-feed.unread { border-color: var(--cyan); background: #0c1f33; }
.soc-feed .row-title { align-items: center; }
.soc-feed .when { margin-left: auto; }
.soc-thread-head { display: flex; align-items: center; gap: 6px; }
.soc-thread-name { flex: 1; min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.soc-thread { display: grid; gap: 8px; }
.soc-bubble { max-width: 86%; padding: 8px 12px 6px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); justify-self: start; min-width: 0; }
.soc-bubble.out { justify-self: end; background: #11304a; border-color: #1f5b86; }
.soc-bubble.unread { border-color: var(--cyan); }
.soc-bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; color: var(--dimmer); }
.soc-del { width: 32px; height: 32px; display: inline-grid; place-items: center; background: none; border: 0; color: var(--dimmer); border-radius: 8px; }
.soc-del svg.ic { width: 14px; height: 14px; }
.soc-reply { position: sticky; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 0 calc(8px + 0px); margin-top: 4px; }
.soc-dip { display: grid; gap: 10px; }
.soc-rel .row-sub { white-space: normal; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.soc-eta { color: var(--amber); }
.soc-moves { display: grid; gap: 8px; }
.soc-move { min-height: 64px; }
.soc-yourank { display: flex; align-items: center; gap: 12px; border-color: var(--cyan); background: #0c1f33; padding: 10px 12px; }
.soc-yr-n { font-size: 24px; font-weight: 700; color: var(--cyan); min-width: 2.4ch; }
.soc-ranklist { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.soc-rank { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 54px; text-align: left; }
.soc-rank.you { border-color: var(--cyan); background: #0c1f33; box-shadow: 0 0 0 1px rgba(77, 227, 255, .3); }
.soc-rk { color: var(--dimmer); min-width: 3.2ch; font-size: 14px; }
.soc-rank .row-sub { white-space: normal; overflow-wrap: anywhere; }
.soc-val { font-size: 16px; color: var(--text); flex: none; }
@media (max-width: 380px) { .soc-tabs .seg-btn { font-size: 13px; } .soc-bubble { max-width: 94%; } }
@media (prefers-reduced-motion: reduce) { .sheet, .backdrop, .toast, .bar i { transition: none; } }
/* ---------------------------------------------------------------- military + expansion (prefix mil-, send-, rep-) */
.row-sub.wrap { white-space: normal; overflow: visible; }
.head-actions { display: flex; align-items: center; gap: 6px; }
.mil-sections { display: grid; gap: 12px; }
.mil-list { display: grid; gap: 8px; }
.mil-row { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 58px; }
.mil-row.current { border-color: var(--cyan); }
.mil-row.out.type-return { opacity: .8; }
.mil-row .row-main { min-width: 0; }
.mil-row .lv { color: var(--dim); font-size: 13px; }
.mil-when { display: grid; justify-items: end; gap: 1px; flex: none; text-align: right; }
.mil-when small { color: var(--dimmer); font-size: 11px; }
.mil-cd { font-size: 15px; }
.mil-cd.big { font-size: 19px; color: var(--red); }
.mil-bar { margin-top: 5px; --c: var(--cyan); }
.mil-group { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; display: grid; gap: 4px; }
.row-ic.bad { background: #3a1620; color: var(--red); }
.warn-card { border-color: #7a2a3f; background: rgba(48, 14, 24, .9); }
.warn-card .card-head h2 { color: #ffc4d0; }
.mil-banner { display: flex; align-items: center; gap: 10px; }
.mil-banner .row-main { flex: 1; min-width: 0; }
.mil-banner b { color: #ffd0da; }
.mil-banner .mil-cd { color: var(--red); }
.mil-banner:not([hidden]) .row-ic { animation: mil-pulse-ic 1.4s ease-in-out infinite; }
@keyframes mil-pulse-ic { 50% { box-shadow: 0 0 0 6px rgba(255, 107, 135, .18); } }
.mil-recall { margin-top: 8px; width: max-content; }
.mil-recall .mil-cd { font-size: 13px; }
.mil-row .arrow { display: inline-flex; vertical-align: middle; margin: 0 4px; color: var(--dimmer); }
.mil-row .arrow svg.ic { width: 14px; height: 14px; }
.mil-end { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.mil-coord { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--cyan); padding: 2px 4px; min-height: 28px; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.mil-coord svg.ic { width: 13px; height: 13px; }
.pop-top { max-width: 1100px; margin: 0 auto; padding: 4px 12px 0; display: grid; gap: 8px; }
.row-btn.locked { opacity: .6; }
.card.inner { background: var(--panel2); }
.stepper { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.stepper .btn { min-width: 46px; padding: 0 8px; }
input.mil-num { width: 100%; min-height: 46px; padding: 0 10px; border-radius: 12px; background: #080e1c; border: 1px solid var(--line2); color: var(--text); font-size: 16px; text-align: center; font-family: var(--mono); -moz-appearance: textfield; }
input.mil-num::-webkit-outer-spin-button, input.mil-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.send { gap: 14px; }
.send-sec { display: grid; gap: 8px; }
.send-sec:empty { display: none; }
.send-coords { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.send-target { background: var(--panel2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; }
.wrap-seg { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.wrap-seg .seg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; font-size: 14px; }
.seg-btn:disabled { opacity: .4; cursor: not-allowed; }
.send-why { display: grid; gap: 2px; }
.mil-pick { background: var(--panel2); border-radius: 12px; padding: 8px 10px; display: grid; gap: 6px; }
.pick-ctl { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto 64px auto; gap: 6px; align-items: center; }
.pick-ctl .btn.small { min-width: 40px; padding: 0 8px; }
.pick-ctl input.mil-num { min-height: 40px; padding: 0 4px; }
.pick-ctl input[type="range"] { width: 100%; min-height: 40px; accent-color: var(--cyan); }
.send-preview { background: var(--panel2); border-radius: 12px; padding: 4px 12px; }
.send-warn { display: grid; gap: 8px; }
.warn-check { display: flex; gap: 10px; align-items: flex-start; background: #2a210a; border: 1px solid #6b5a1f; border-radius: 12px; padding: 10px 12px; color: var(--amber); font-size: 14px; }
.warn-check input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--amber); }
select { width: 100%; }
.alert.rep.tone-good .row-ic { color: var(--green); }
.alert.rep.tone-bad .row-ic { color: var(--red); }
.alert.rep.tone-warn .row-ic { color: var(--amber); }
.rep-detail { gap: 12px; }
.rep-verdict { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; font-size: 18px; }
.rep-verdict.victory { background: #0e2b23; color: var(--green); border: 1px solid #1a6a4f; }
.rep-verdict.defeat { background: #2d1019; color: #ffc4d0; border: 1px solid #7a2a3f; }
.rep-sec { display: grid; gap: 6px; }
.rep-party { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.mil-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mil-table th { text-align: right; font-weight: 500; color: var(--dimmer); font-size: 12px; padding: 2px 6px; }
.mil-table td { padding: 5px 6px; border-top: 1px solid var(--line); }
.mil-table td:not(:first-child) { text-align: right; }
.rep-group { display: grid; gap: 4px; margin-bottom: 8px; }
.rep-buildings { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; font-size: 14px; }
.rep-buildings li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 3px 0; }
.rep-raw { white-space: pre-wrap; font-size: 12px; color: var(--dim); }
.hud-town { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--cyan); }
.hud-town select { min-height: 36px; font-size: 14px; padding: 0 10px; width: auto; max-width: 100%; flex: 0 1 280px; }
.hud-town svg.ic { width: 18px; height: 18px; }
.lg.mv-out { height: 0; width: 14px; border-top: 2px dashed var(--cyan); }
.lg.mv-in { height: 0; width: 14px; border-top: 2px dashed var(--red); }
@media (orientation: landscape) and (max-height: 520px) { .hud-town select { min-height: 30px; } }
@media (prefers-reduced-motion: reduce) { .nav-badge.is-alert, .mil-banner .row-ic { animation: none; } }
.units-head { max-width: 1100px; margin: 0 auto; padding: 4px 12px 0; }
.send-foot { position: sticky; bottom: -1px; z-index: 2; display: grid; gap: 8px; padding: 10px 0 2px; margin-top: 4px; background: linear-gradient(180deg, rgba(12, 19, 34, 0), var(--panel) 22%); }
.send-foot .form-error { margin-bottom: 0; }
.row-btn.mil-train { flex-wrap: wrap; row-gap: 6px; }
.mil-train .costs { flex-basis: 100%; gap: 6px; padding-left: 48px; }
.mil-train .cost { padding: 3px 8px; }
.mil-train .cost svg.ic { width: 15px; height: 15px; }
.mil-train .pill { max-width: none; }