Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

UI: the phone's top bar keeps the 12 px text floor, captions, level, attention and date at 25 px on 390x844 (Fixes #642) (#859)

Beri70d7b8a861fd
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b55f2265..a481dca27 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,15 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
## [Unreleased]
+### Fixed
+- On a phone held upright (390x844) the top bar's small text keeps the owner's 12 px floor too: the seven captions,
+ Security's level, the attention line and the plate's turn and date are 25 px in the panel, 12.3 px on screen (they
+ were 15 px, 7.4 px). The phone's bar is 32 px taller to hold them, a caption wraps between words, and Security's level
+ goes under its caption; the plate keeps its width when the month changes (#642). Smaller phones down to 375x667
+ keep the floor too (26 px at 360x800, 30 px at 375x667): there the bar grows to its rows' height and the panels
+ under it follow. On a phone held upright the decision card now starts right of the left rail and hangs under the bar instead of sitting centred, so no
+ rail button sits under it (Why? and Settings did), and the rail's buttons are 60 px, at least 24 px on screen.
+
## [0.1.1] - 2026-10-18
### Added
diff --git a/unity/Assets/Scripts/UI/HudPresenter.cs b/unity/Assets/Scripts/UI/HudPresenter.cs
index bb19d546e..ef6a59ae6 100644
--- a/unity/Assets/Scripts/UI/HudPresenter.cs
+++ b/unity/Assets/Scripts/UI/HudPresenter.cs
@@ -72,7 +72,7 @@ namespace Statecraft.Game.UI
("nav-why", "hud.nav.why"), ("nav-settings", "hud.nav.settings"), ("new-game", "hud.new_game"), ("end-turn", "hud.end_turn"),
};
- /// <summary>The owner's text floor (#624, 15 October 2026): the bar's small text (the six captions, Security's level
+ /// <summary>The owner's text floor (#624, 15 October 2026): the bar's small text (the seven captions, Security's level
/// and the attention line, SmallTextPx in the stylesheet) stays at least this many pixels on screen. The panel scales
/// with the window (about 0.67 at 1280x720, 0.62 at 1024x768), so at small windows the text is set larger in panel
/// px (SmallTextSize).</summary>
@@ -105,6 +105,14 @@ namespace Statecraft.Game.UI
public const string RailName = "left-column";
readonly HoverTip? railTips, barTips;
+ /// <summary>The panels under the bar (Statecraft.uss: top 456 px under the three-row bar), which PlaceUnderBar moves
+ /// down by what the three-row bar grows past its 440 px.</summary>
+ readonly List<VisualElement> underBar;
+ /// <summary>The bar's items, whose rows set the three-row bar's height (RowsHeight).</summary>
+ readonly List<VisualElement> barItems;
+ /// <summary>Statecraft.uss .hud-three-row .top-bar height.</summary>
+ const float ThreeRowBarPx = 440f;
+
public HudPresenter(VisualElement root, SimBridge bridge, UiText text)
{
this.root = root; this.bridge = bridge; this.text = text;
@@ -141,9 +149,13 @@ namespace Statecraft.Game.UI
}
// The text floor: checked now and twice a second, since a window resized at the same shape changes the panel's
// scale without changing its layout (no geometry event).
- smallText = bar.Query<Label>(className: "meter-name").ToList(); // the six captions and Security's level
+ smallText = bar.Query<Label>(className: "meter-name").ToList(); // the seven captions and Security's level
smallText.Add(root.Q<Label>("attention"));
turnBox = bar.Q<VisualElement>(className: "turn-box");
+ underBar = new[] { "right-column", "left-column", "event-gutter", "event-layer", "screen", "toast" }
+ .SelectMany(c => root.Query(className: c).ToList()).ToList();
+ barItems = bar.Children().ToList();
+ foreach (var k in barItems) k.RegisterCallback<GeometryChangedEvent>(OnRowGeometry); // a row grows inside the fixed bar
dateRow = bar.Q<VisualElement>(className: "date-row");
plateText = dateRow?.Query<Label>().ToList() ?? new List<Label>();
dateRow?.parent?.RegisterCallback<GeometryChangedEvent>(OnPlateGeometry); // a wider raised plate needs room in the bar
@@ -161,6 +173,9 @@ namespace Statecraft.Game.UI
floorCheck.Pause();
foreach (var l in smallText) { l.style.fontSize = StyleKeyword.Null; l.style.whiteSpace = StyleKeyword.Null; l.style.maxWidth = StyleKeyword.Null; }
turnBox.style.width = StyleKeyword.Null; turnBox.style.minWidth = StyleKeyword.Null;
+ foreach (var k in barItems) k.UnregisterCallback<GeometryChangedEvent>(OnRowGeometry);
+ foreach (var e in underBar) e.style.marginTop = StyleKeyword.Null;
+ bar.style.height = StyleKeyword.Null;
foreach (var l in plateText) { l.style.fontSize = StyleKeyword.Null; l.style.whiteSpace = StyleKeyword.Null; }
if (dateRow != null) { dateRow.style.flexDirection = StyleKeyword.Null; if (dateRow.parent != null) PadPlate(dateRow.parent, false); }
bridge.Changed -= Render; endTurn.clicked -= onEndTurn; endTurn.generateVisualContent -= PaintHourglass;
@@ -181,6 +196,9 @@ namespace Statecraft.Game.UI
void OnMeterGeometry(GeometryChangedEvent e) => UpdateRoomy();
+ // The rows' height does not depend on the bar's (RowsHeight), so this settles in one pass.
+ void OnRowGeometry(GeometryChangedEvent e) => PlaceUnderBar();
+
/// <summary>Roomy only on the one-row bar with icons; see RoomyClass.</summary>
void UpdateRoomy()
{
@@ -221,9 +239,9 @@ namespace Statecraft.Game.UI
SetCompact(bar.layout.width);
}
- /// <summary>Whether the floor raises the text at this bar width. Not on the three-row bar (a phone held upright, about
- /// 0.49 scale): its fixed rows have no room for 25 px captions, so it keeps the stylesheet's size (a follow-up, by the owner's answer).</summary>
- bool FloorRaises(float width) => smallTextSize > SmallTextPx && !(width < ThreeRowBelowPx);
+ /// <summary>Whether the floor raises the text at this bar width: at every tier, the three-row bar of a phone held upright
+ /// (about 0.49 scale, 25 px) included (#642).</summary>
+ bool FloorRaises(float width) => smallTextSize > SmallTextPx;
/// <summary>The room the raised text takes beyond what the tiers were set for (the 15 px captions, wrapped at their 120 px
/// max-width, and the 150 px turn box): each caption on one line at the larger size (text width scales with font
@@ -241,8 +259,11 @@ namespace Statecraft.Game.UI
}
return UnityEngine.Mathf.Max(0f, growth);
}
- // Statecraft.uss .turn-box width, .meter .meter-name max-width, .date-box width.
+ // Statecraft.uss .turn-box width, .meter .meter-name max-width (170 on the three-row bar, where the tier is fixed), .date-box width.
const float TurnBoxPx = 150f, CaptionMaxPx = 120f, PlateWidthPx = 230f;
+ /// <summary>The widest date line's width per px of font size, with a little to spare: the Hebrew 31 October 1956 is
+ /// about 7.8 times its size (196 px at 25 px), the English "30 September 1956" 7.2 (TopBarScoreLayoutTests.WorstDate).</summary>
+ const float DateLinePerPx = 8f;
/// <summary>The raised plate's laid-out width (PadPlate lets it size to its widest line, at least the stylesheet's 230 px;
/// at 23 px, 960x600, the date is wider), or 230 before it is laid out.</summary>
@@ -294,12 +315,48 @@ namespace Statecraft.Game.UI
{
// Raised, the plate sizes to its widest line (the turn and the date, a line each, never wrapped), at least 230 px.
plate.style.width = raised ? new StyleLength(StyleKeyword.Auto) : new StyleLength(StyleKeyword.Null);
- plate.style.minWidth = raised ? new StyleLength(PlateWidthPx) : new StyleLength(StyleKeyword.Null);
+ // At least the widest date line too, so the plate keeps its width when the month changes (PromoHudTests): at 25 px
+ // (a phone upright, #642) the Hebrew 31 October 1956 is about 196 px, wider than 230 px less the padding.
+ plate.style.minWidth = raised ? new StyleLength(UnityEngine.Mathf.Max(PlateWidthPx, DateLinePerPx * smallTextSize + 2f * PlateSidePx + 2f))
+ : new StyleLength(StyleKeyword.Null);
StyleLength Px(float v) => raised ? new StyleLength(v) : new StyleLength(StyleKeyword.Null);
plate.style.paddingTop = Px(PlateEdgePx); plate.style.paddingBottom = Px(PlateEdgePx);
plate.style.paddingLeft = Px(PlateSidePx); plate.style.paddingRight = Px(PlateSidePx);
}
+ /// <summary>The three-row bar takes its rows' height when that is more than its 440 px (Statecraft.uss), so the raised
+ /// text of a smaller phone fits it (#642, the owner: "down to 375x667"), and the panels under it move down by what it
+ /// grew: a top margin, not a top, so the stylesheet's other placements (the toast at the bottom beside a wide screen)
+ /// still apply. Set here, not as height: auto in the stylesheet: there Yoga sized the wrapping bar as if each quarter-width
+ /// meter took a line of its own (about 1300 px). Its items' geometry events re-run this (OnRowGeometry), and so does SetCompact.</summary>
+ void PlaceUnderBar()
+ {
+ // A hidden bar (the start screen) moves nothing: the start screen's toast keeps its own top (review of #859).
+ var rows = hudRoot.ClassListContains(ThreeRowClass) && bar.resolvedStyle.display != DisplayStyle.None ? RowsHeight() : 0f;
+ var grown = rows - ThreeRowBarPx;
+ bar.style.height = grown > 0.5f ? new StyleLength(rows) : new StyleLength(StyleKeyword.Null);
+ var margin = grown > 0.5f ? new StyleLength(grown) : new StyleLength(StyleKeyword.Null);
+ foreach (var e in underBar) e.style.marginTop = margin;
+ }
+
+ /// <summary>The height the bar's rows take: each row's tallest item (its children laid out in the flow, grouped by the
+ /// rows they share), with the bar's padding and border. It does not depend on the bar's own height (the rows' spacing,
+ /// align-content, is not counted), so a bar set to it keeps it. NaN before layout.</summary>
+ float RowsHeight()
+ {
+ float total = 0f, top = float.NaN, bottom = float.NaN;
+ foreach (var k in bar.Children().Where(k => k.resolvedStyle.position == Position.Relative && k.resolvedStyle.display != DisplayStyle.None).OrderBy(k => k.layout.y))
+ {
+ float t = k.layout.y - k.resolvedStyle.marginTop, b = k.layout.yMax + k.resolvedStyle.marginBottom;
+ if (t < bottom) { top = UnityEngine.Mathf.Min(top, t); bottom = UnityEngine.Mathf.Max(bottom, b); continue; } // the same row
+ if (bottom > top) total += bottom - top;
+ top = t; bottom = b;
+ }
+ if (bottom > top) total += bottom - top;
+ var s = bar.resolvedStyle;
+ return total + s.paddingTop + s.paddingBottom + s.borderTopWidth + s.borderBottomWidth;
+ }
+
#if UNITY_WEBGL && !UNITY_EDITOR
// The panel scales by the canvas's device pixels, so a screen pixel here is a CSS pixel: the device's pixels / the
// browser's devicePixelRatio (DevicePixelRatio.jslib).
@@ -319,6 +376,7 @@ namespace Statecraft.Game.UI
hudRoot.EnableInClassList(TwoRowClass, width < TwoRowBelowPx);
hudRoot.EnableInClassList(ThreeRowClass, width < ThreeRowBelowPx);
StyleSmallText(raised);
+ PlaceUnderBar();
ScreenNav.DisableCovered(hudRoot); // two rows or one: what an open screen covers changes with it (#400)
}
diff --git a/unity/Assets/Tests/EditMode/ArmisticeTests.cs b/unity/Assets/Tests/EditMode/ArmisticeTests.cs
index 9987cba3a..bcec79ddb 100644
--- a/unity/Assets/Tests/EditMode/ArmisticeTests.cs
+++ b/unity/Assets/Tests/EditMode/ArmisticeTests.cs
@@ -290,7 +290,7 @@ public class ArmisticeTests
var text = L(Regions(), new DateTime(1950, 3, 1));
StringAssert.Contains("Jordan (low accuracy)", text);
foreach (var (w, h) in new[] { (1920, 1080), (1280, 720), (1531, 784), (1366, 657), (2560, 1080), (1920, 900), (1280, 1024),
- (960, 600), (1024, 768), (390, 844), (1600, 757),
+ (960, 600), (1024, 768), (390, 844), (375, 667), (1600, 757),
// the two-row bar's shapes (#380's re-tier gives a square window two rows; review B1 of #831)
(1024, 1024), (960, 1080), (800, 1000) })
{
diff --git a/unity/Assets/Tests/EditMode/DecisionCardTests.cs b/unity/Assets/Tests/EditMode/DecisionCardTests.cs
index a5e4126e8..c00b2b639 100644
--- a/unity/Assets/Tests/EditMode/DecisionCardTests.cs
+++ b/unity/Assets/Tests/EditMode/DecisionCardTests.cs
@@ -93,7 +93,7 @@ public class DecisionCardTests
[UnityTest]
public IEnumerator TheBackdropReachesTheWindowsEdgesAtEveryTier()
{
- foreach (var (w, h) in new[] { (1920, 1080), (1280, 1024), (1024, 1024), (960, 1080), (800, 1000), (390, 844) })
+ foreach (var (w, h) in new[] { (1920, 1080), (1280, 1024), (1024, 1024), (960, 1080), (800, 1000), (390, 844), (375, 667) })
{
using var r = new Rig(w, h, "law_of_return");
yield return Frames(4);
diff --git a/unity/Assets/Tests/EditMode/LeftColumnTests.cs b/unity/Assets/Tests/EditMode/LeftColumnTests.cs
index d6b20e0db..90ffb074b 100644
--- a/unity/Assets/Tests/EditMode/LeftColumnTests.cs
+++ b/unity/Assets/Tests/EditMode/LeftColumnTests.cs
@@ -36,11 +36,13 @@ public class LeftColumnTests
("nav-settings", "hud.nav.settings", "gear"),
};
- /// <summary>InfoPanelLayoutTests' 19 window sizes.</summary>
+ /// <summary>InfoPanelLayoutTests' 19 window sizes, and the smaller phones held upright the owner's floor reaches (#642,
+ /// "down to 375x667"): 360x800 and 375x667.</summary>
static readonly (int w, int h)[] Windows =
{
(1920, 1080), (1280, 720), (1366, 768), (1760, 1000), (1920, 1200), (1440, 900), (1680, 1050), (1024, 768), (1280, 1024),
(1024, 1024), (960, 1080), (800, 1000), (1531, 784), (2560, 1080), (1920, 900), (1600, 757), (1366, 657), (960, 600), (390, 844),
+ (360, 800), (375, 667),
};
static GameSession WithAnEventOpen()
@@ -56,8 +58,9 @@ public class LeftColumnTests
/// <summary>The real Game.uxml on the real PanelSettings at w x h, in English or Hebrew, with the top bar, the screens'
/// navigation, the decision card (open when the session has an event), the info panel on Lydda's hex, the minimap and the
- /// border caption.</summary>
- static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, System.Action<VisualElement, ScreenNav> check, System.Action<VisualElement, ScreenNav>? act = null)
+ /// border caption. <paramref name="photos"/>: the card shows its event's photograph (the taller card).</summary>
+ static IEnumerator Rendered(int w, int h, bool hebrew, GameSession g, System.Action<VisualElement, ScreenNav> check, System.Action<VisualElement, ScreenNav>? act = null,
+ EventImageCatalog? photos = null)
{
var text = hebrew ? He : En;
var rt = new RenderTexture(w, h, 0);
@@ -75,7 +78,7 @@ public class LeftColumnTests
var bridge = new SimBridge(g, text);
var hud = new HudPresenter(root, bridge, text);
var nav = new ScreenNav(root);
- var card = new EventCardPresenter(root, bridge, text, null);
+ var card = new EventCardPresenter(root, bridge, text, null, photos);
var info = new InfoPanelPresenter(root, bridge, text, Names(), regions: Regions());
var mini = new MinimapPresenter(root, Hexes, text);
var layer = root.Q<Label>("map-layer");
@@ -162,6 +165,39 @@ public class LeftColumnTests
Assert.IsEmpty(problems, string.Join("\n", problems));
}
+ /// <summary>Review of #859 at fb2a8dc (WebGL) and the owner's ruling there (17 October 2026): on a phone held upright,
+ /// 390x844, 360x800 and 375x667, with a photo card open (turn 0's One Army and turn 1's The First Truce, taller than
+ /// WithAnEventOpen's card, which the test above uses), no rail button sits under the card, Why? and Settings included
+ /// (they did on main), in English and Hebrew.</summary>
+ [UnityTest]
+ public IEnumerator OnAPhoneThePhotoCardLeavesTheRailClear()
+ {
+ var catalog = AssetDatabase.LoadAssetAtPath<EventImageCatalog>("Assets/Resources/EventImageCatalog.asset");
+ Assert.IsNotNull(catalog, "precondition: the photo catalog");
+ var problems = new List<string>();
+ var turn0 = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ CollectionAssert.AreEqual(new[] { "idf_founding" }, turn0.State.PendingEvents, "precondition: One Army at turn 0");
+ var turn1 = GameSession.New(C, GoldenRun.Seed, Mode.Historical);
+ turn1.Step(new Command[0]);
+ Assert.IsNotEmpty(turn1.State.PendingEvents, "precondition: an event at turn 1");
+ foreach (var (turn, g) in new[] { (0, turn0), (1, turn1) })
+ foreach (var hebrew in new[] { false, true })
+ foreach (var (w, h) in new[] { (390, 844), (360, 800), (375, 667) })
+ yield return Rendered(w, h, hebrew, g, (root, nav) =>
+ {
+ string at = $"{(hebrew ? "he" : "en")} {w}x{h} turn {turn} {g.State.PendingEvents[0]}";
+ if (!(root.Q("event-photo").worldBound.height > 0)) { problems.Add($"{at}: precondition: the card shows its photograph"); return; }
+ var card = root.Q("event-card").worldBound;
+ foreach (var (name, _, _) in Rail)
+ {
+ var b = root.Q(name).worldBound;
+ TestContext.WriteLine($"{at}: {name} {b}, the card {card}");
+ if (b.Overlaps(card)) problems.Add($"{at}: the card {card} covers {name} {b}");
+ }
+ }, photos: catalog);
+ Assert.IsEmpty(problems, string.Join("\n", problems));
+ }
+
/// <summary>Each screen opens clear of the column at every window size (a screen under the column would hide the button
/// that closes it), and the toast too, in English and Hebrew.</summary>
[UnityTest]
diff --git a/unity/Assets/Tests/EditMode/TopBarTests.cs b/unity/Assets/Tests/EditMode/TopBarTests.cs
index 5a8a1ad01..ecaa0b6ba 100644
--- a/unity/Assets/Tests/EditMode/TopBarTests.cs
+++ b/unity/Assets/Tests/EditMode/TopBarTests.cs
@@ -27,6 +27,7 @@ public class TopBarTests
{
(1920, 1080), (1280, 720), (1366, 768), (1760, 1000), (1920, 1200), (1440, 900), (1680, 1050), (1024, 768), (1280, 1024),
(1024, 1024), (960, 1080), (800, 1000), (1531, 784), (2560, 1080), (1920, 900), (1600, 757), (1366, 657), (960, 600), (390, 844),
+ (360, 800), (375, 667), // smaller phones held upright: the owner's floor holds "down to 375x667" (#642)
};
/// <summary>Windows at the one-row tier's edge (review of #624), by their logical width. The panel scales by the plain mean of
@@ -366,17 +367,18 @@ public class TopBarTests
}, widest: false);
}
- /// <summary>The owner's text floor (#624, 15 October 2026): the bar's small text (the six captions, Security's level,
- /// the attention line, and, by the owner's second answer, the plate's turn and date line) is at least HudPresenter.TextFloorPx (12) on screen at small windows, 1280x720 and 1024x768, in
- /// both languages; a 1080p window keeps the stylesheet's 15 px. The panel scales with the window, so on screen is the
- /// font size times the window's pixels per panel pixel. (TheBarFitsEveryWindowInEnglishAndHebrew checks that nothing
- /// collides at these sizes.)</summary>
+ /// <summary>The owner's text floor (#624, 15 October 2026): the bar's small text (the seven captions, Security's level,
+ /// the attention line, and, by the owner's second answer, the plate's turn and date line) is at least
+ /// HudPresenter.TextFloorPx (12) on screen at small windows, 1280x720 and 1024x768, and on phones held upright, 390x844,
+ /// 360x800 and 375x667 (#642; the owner: "down to 375x667"), in both languages; a 1080p window keeps the stylesheet's 15 px.
+ /// The panel scales with the window, so on screen is the font size times the window's pixels per panel pixel.
+ /// (TheBarFitsEveryWindowInEnglishAndHebrew checks that nothing collides at these sizes.)</summary>
[UnityTest]
public IEnumerator TheBarsSmallTextKeepsTheFloorOnScreen()
{
var problems = new List<string>();
foreach (var hebrew in new[] { false, true })
- foreach (var (w, h) in new[] { (1280, 720), (1024, 768), (1920, 1080) })
+ foreach (var (w, h) in new[] { (1280, 720), (1024, 768), (1920, 1080), (390, 844), (360, 800), (375, 667) })
yield return Rendered(w, h, hebrew, (root, text) =>
{
string at = $"{(hebrew ? "he" : "en")} {w}x{h}";
@@ -393,6 +395,11 @@ public class TopBarTests
float onScreen = l.resolvedStyle.fontSize * perPanelPx;
TestContext.WriteLine($"{at}: {l.name}/{l.parent?.parent?.name} {l.resolvedStyle.fontSize:0.0} px, {onScreen:0.0} on screen");
if (onScreen < 12f - 0.05f) problems.Add($"{at}: {l.parent?.parent?.name} {l.name} '{l.text}' is {onScreen:0.0} px on screen, under the 12 px floor");
+ // A wrapped caption breaks between words, never inside one (#642: at 25 px "Immigration" is wider than
+ // the captions' 120 px max-width).
+ foreach (var word in l.text.Split(' '))
+ if (l.MeasureTextSize(word, 0, VisualElement.MeasureMode.Undefined, 0, VisualElement.MeasureMode.Undefined).x > l.contentRect.width + 0.5f)
+ problems.Add($"{at}: {l.parent?.parent?.name} {l.name} '{l.text}' breaks inside '{word}' ({l.contentRect.width:0.0} px wide)");
if (w == 1920 && Mathf.Abs(l.resolvedStyle.fontSize - 15f) > 0.01f) problems.Add($"{at}: {l.name} is {l.resolvedStyle.fontSize} px, not the stylesheet's 15");
}
// The plate's text keeps clear of its gilt frame (reviews of #624 in WebGL: the raised date, then the year,
@@ -422,6 +429,42 @@ public class TopBarTests
Assert.IsEmpty(problems, string.Join("\n", problems));
}
+ /// <summary>Review of #859 at fb2a8dc (WebGL): on a phone held upright (390x844, 360x800, 375x667) the three-row bar wraps Security's
+ /// caption row, and Security's caption and level still end on the reading side, where the other captions do: in Hebrew at
+ /// the meter's content right edge (they had moved to the left), in English at its left edge (the level's 6 px gap from the
+ /// caption is its left margin); with turn 1's values and with the widest.</summary>
+ [UnityTest]
+ public IEnumerator OnThePhoneBarEachCaptionMeetsItsTextColumnsReadingEdge()
+ {
+ var problems = new List<string>();
+ foreach (var hebrew in new[] { false, true })
+ foreach (var widest in new[] { false, true })
+ foreach (var (w, h) in new[] { (390, 844), (360, 800), (375, 667) })
+ yield return Rendered(w, h, hebrew, (root, text) =>
+ {
+ string at = $"{(hebrew ? "he" : "en")} {w}x{h}{(widest ? " widest" : " turn 1")}";
+ if (!root.Q("root").ClassListContains("hud-three-row")) { problems.Add($"{at}: precondition: the three-row bar"); return; }
+ int seen = 0;
+ foreach (var l in root.Q("top-bar").Query<Label>(className: "meter-name").ToList())
+ {
+ if (!Shown(l) || string.IsNullOrEmpty(l.text) || !(l.worldBound.width > 0)) continue;
+ var body = l.parent;
+ while (body != null && !body.ClassListContains("meter-body")) body = body.parent;
+ if (body == null) { problems.Add($"{at}: precondition: '{l.text}' is in a meter's text column"); continue; }
+ seen++;
+ var r = l.worldBound; var s = l.resolvedStyle; var align = s.unityTextAlign;
+ float left = body.worldBound.xMin + body.resolvedStyle.paddingLeft, right = body.worldBound.xMax - body.resolvedStyle.paddingRight;
+ bool reading = hebrew ? align == TextAnchor.UpperRight || align == TextAnchor.MiddleRight || align == TextAnchor.LowerRight
+ : align == TextAnchor.UpperLeft || align == TextAnchor.MiddleLeft || align == TextAnchor.LowerLeft;
+ float gap = hebrew ? right - (r.xMax + s.marginRight) : (r.xMin - s.marginLeft) - left;
+ TestContext.WriteLine($"{at}: '{l.text}' {r}, column {left:0.0}-{right:0.0}, {gap:0.0} px from the reading edge");
+ if (!reading || Mathf.Abs(gap) > 1f) problems.Add($"{at}: '{l.text}' {r} is {gap:0.0} px from its reading edge (column {left:0.0}-{right:0.0}, aligned {align})");
+ }
+ if (seen < 7) problems.Add($"{at}: precondition: the captions and Security's level show, found {seen}");
+ }, widest: widest);
+ Assert.IsEmpty(problems, string.Join("\n", problems));
+ }
+
/// <summary>The audit's Tab order is kept: Cabinet, Budget, Defence, Why?, Settings (the left column), New Game, End Turn, then the
/// minimap's buttons.</summary>
[UnityTest]
diff --git a/unity/Assets/Tests/EditMode/UiLayoutTests.cs b/unity/Assets/Tests/EditMode/UiLayoutTests.cs
index 34baeb024..a5508b9d4 100644
--- a/unity/Assets/Tests/EditMode/UiLayoutTests.cs
+++ b/unity/Assets/Tests/EditMode/UiLayoutTests.cs
@@ -451,7 +451,7 @@ public class UiLayoutTests
};
/// <summary>Decision cards (2026-10-13), after Task 24 review I2: every real event, the tallest included, fits the
- /// decision layer at every window shape, the narrow two- and three-row HUDs included: the card is centred, at most
+ /// decision layer at every window shape, the narrow two- and three-row HUDs included: the card is centred (between the layer's paddings), at most
/// 1040 px wide, below the top bar and inside the layer; its option buttons stay inside it with their text; and its
/// media header is 16:9 whenever the card has the height for it (on a full card it gives way first, as before).</summary>
[UnityTest]
@@ -532,7 +532,10 @@ public class UiLayoutTests
var card = root.Q("event-card"); var layer = root.Q("event-layer"); var bar = root.Q("top-bar");
var c = card.worldBound; var l = layer.worldBound;
if (!Inside(c, l)) problems.Add($"{where}: the card {c} leaves the decision layer {l}");
- if (Mathf.Abs((c.xMin - l.xMin) - (l.xMax - c.xMax)) > 1f) problems.Add($"{where}: the card {c} is not centred in the layer {l}");
+ // Centred between the layer's paddings: on a phone held upright the layer keeps the left rail's room free at its left
+ // (the owner's ruling on #859: no rail button under the card), so the card centres right of the rail.
+ float padL = layer.resolvedStyle.paddingLeft, padR = layer.resolvedStyle.paddingRight;
+ if (Mathf.Abs((c.xMin - l.xMin - padL) - (l.xMax - padR - c.xMax)) > 1f) problems.Add($"{where}: the card {c} is not centred in the layer {l} (paddings {padL}, {padR})");
if (c.width > CardMaxWidth + 1.5f) problems.Add($"{where}: the card is {c.width:0} px wide, over {CardMaxWidth}");
if (c.yMin < bar.worldBound.yMax - 0.5f) problems.Add($"{where}: the card {c} starts over the top bar {bar.worldBound}");
var hide = root.Q("event-hide").worldBound;
diff --git a/unity/Assets/UI/Statecraft.uss b/unity/Assets/UI/Statecraft.uss
index e9a0877f3..dfc7ac3ab 100644
--- a/unity/Assets/UI/Statecraft.uss
+++ b/unity/Assets/UI/Statecraft.uss
@@ -167,18 +167,35 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
/* Narrower still (a phone upright; HudPresenter adds hud-three-row with hud-two-row): the badge, the meters and the
screen buttons with End Turn take a row each, and the panels move down under the taller bar (#210). Seven meters do not
fit a phone's width with the widest values (#380): they wrap to two lines (a consequence of the owner's "tighten + re-tier", 16 October 2026), and the bar is a meter line
- (96 px) taller than the six meters' 312 px. */
-.hud-three-row .top-bar { height: 408px; }
+ (96 px) taller than the six meters' 312 px. The owner's text floor (#642) raises the small text to 25 px on a 390x844
+ phone: the plate, the meters and the attention line grow, and the bar takes 32 px more (with the widest values and
+ changes its rows end at about 431 px; each meter line already holds two caption lines, Security's level or "International
+ support", so a caption that wraps once more does not add to it). Smaller phones raise it further (26 px at 360x800, 30 px
+ at 375x667; the owner: the floor holds "down to 375x667", and the bar grows taller to fit, review of #859): the bar takes
+ its rows' height when that is more than 440 px, and the panels under it move down by what it grew (HudPresenter.PlaceUnderBar). */
+.hud-three-row .top-bar { height: 440px; }
.hud-three-row .meters { width: 100%; flex-wrap: wrap; }
/* Each meter a quarter of the row, so the seven always take two lines (four, then three) and the bar's second line is
never an empty band (a phone's turn-1 values would otherwise fit one line). A quarter (~190 px) is wider than the widest
meter there (~154 px). */
.hud-three-row .meter { flex-basis: 25%; flex-grow: 0; flex-shrink: 0; }
-.hud-three-row .right-column, .hud-three-row .left-column, .hud-three-row .event-gutter, .hud-three-row .event-layer, .hud-three-row .screen, .hud-three-row .toast { top: 424px; }
-/* The event layer keeps the same 96 px free at its bottom (padding, so its backdrop still reaches the window's bottom:
- DecisionCardTests.TheBackdropReachesTheWindowsEdgesAtEveryTier), so the centred card stays where the six meters left it,
- clear of the map's border label above the minimap (ArmisticeTests.TheLongestMapLabelFitsBesideTheEventCard). */
-.hud-three-row .event-layer { padding-bottom: 96px; }
+/* At the floor's 25 px (#642) a caption may take most of its quarter, not the 120 px that would break "Immigration" inside the
+ word (170 px: a phone's quarter, about 193 px, keeps 5% free, PromoHudTests), and "Security" and its level, too wide for a
+ quarter side by side, wrap the level under the caption. */
+.hud-three-row .meter .meter-name { max-width: 170px; }
+.hud-three-row .meter-caption-row { flex-wrap: wrap; }
+/* In Hebrew each caption, and Security's wrapped caption row, ends at the text column's right edge (review of #859: the
+ wrapped row had moved to the column's left). */
+.lang-he.hud-three-row .meter-body { align-items: flex-end; }
+.lang-he.hud-three-row .meter-caption-row { justify-content: flex-end; }
+.hud-three-row .right-column, .hud-three-row .left-column, .hud-three-row .event-gutter, .hud-three-row .event-layer, .hud-three-row .screen, .hud-three-row .toast { top: 456px; }
+/* The owner's ruling on #859 (17 October 2026): on a phone no rail button sits under the decision card, Why? and Settings
+ included. The card starts right of the column (the layer's left padding, from its 16 px: the column's 60 px and a 12 px gap; padding, so
+ the backdrop still reaches the column, LeftColumnTests.OnAPhoneThePhotoCardLeavesTheRailClear) and hangs from the layer's
+ top, under the bar, rather than sitting in the middle: centred, the card at 375x667 reached the map's border label above
+ the minimap (since #915 that label is hidden while the card is open, so no test pins this any more). The 88 px at the bottom keep the tallest card off
+ the window's foot (padding, so its backdrop still reaches it, DecisionCardTests.TheBackdropReachesTheWindowsEdgesAtEveryTier). */
+.hud-three-row .event-layer { justify-content: flex-start; padding-left: 72px; padding-bottom: 88px; }
.turn-box { width: 150px; flex-shrink: 1; min-width: 150px; align-items: flex-end; }
#attention { font-size: 15px; } /* the audit's floor (H4): 15 px in the stylesheet */
.end-turn {
@@ -204,6 +221,14 @@ Button:disabled { color: var(--ink-dim); border-color: rgba(120, 120, 120, 0.4);
.left-column .rail-button { width: 56px; height: 56px; margin: 0 0 12px 0; padding: 0; font-size: 1px; color: rgba(0, 0, 0, 0); }
.left-column .rail-button:hover, .left-column .rail-button:focus, .left-column .nav-open { color: rgba(0, 0, 0, 0); }
.left-column .rail-button .nav-disc { top: 0; left: 0; width: 56px; height: 56px; padding: 13px; border-radius: 28px; }
+/* On a phone held upright the panel's scale falls to about 0.41 (375x667), where a 56 px disc is 22.8 px on screen: the
+ column's discs are 60 px there, at least 24 on screen (LeftColumnTests), and the backdrop's strip and the backdrop
+ follow the wider column. */
+.hud-three-row .left-column { width: 60px; }
+.hud-three-row .left-column > .rail-button { width: 60px; height: 60px; }
+.hud-three-row .left-column > .rail-button .nav-disc { width: 60px; height: 60px; padding: 14px; border-radius: 30px; }
+.hud-three-row .event-gutter { width: 76px; }
+.hud-three-row .event-scrim { left: 60px; }
.right-gap { flex-grow: 1; flex-shrink: 0; min-height: 16px; }
/* The decision layer: the room under the bar, top per HUD tier as the column's. While an event is open (event-open on the
root) the map is blocked: the backdrop dims it and takes the pointer, so map clicks and drags stop at it, and