Styles Textual widgets in terminal.tcss for the robot-pokemon TUI. Use when a panel looks wrong, needs colour/border/layout adjustments, or when adding new TCSS rules for new widgets.
Applies and fixes TCSS (Textual CSS) styles in terminal.tcss. Ensures visual consistency across all panels, overlays, and widgets.
tui-specialist.agent.md
#nickname-panel, .overlay)terminal.tcss and check if a rule for the target ID/class already existsterminal.py compose() to confirm the widget ID/class is actually applied$primary, $accent, $surface, , , , CSS variables — prefer these over hardcoded colours$panel$warning$error$successCommon patterns:
/* Full-screen overlay */
#my-panel {
layer: overlay;
width: 100%;
height: 100%;
background: $surface 80%;
align: center middle;
}
/* Centred dialog box */
#my-dialog {
layer: overlay;
width: 60;
height: auto;
border: double $accent;
padding: 1 2;
align: center middle;
}
/* Scrollable log area */
#output {
height: 1fr;
border: solid $primary;
scrollbar-gutter: stable;
}
/* HP bar colours */
.hp-high { color: $success; }
.hp-mid { color: $warning; }
.hp-low { color: $error; }
Show/hide pattern — use display property, not visibility:
.hidden { display: none; }
# In PanelMixin — toggle display directly, not the class
self.query_one("#my-panel").display = True
display = True)Input: "The battle panel overlaps the main log and is too wide."
Fix:
#battle-panel {
layer: overlay;
width: 70%;
max-width: 80;
height: auto;
border: heavy $warning;
padding: 1 2;
align: center middle;
offset: 15% 10%;
}
pytemon/terminal.tcss — all styles live herepytemon/terminal.py — widget IDs and classes defined in compose()compose() matches exactly (case-sensitive)layer: overlay and the app defines LAYERS = ["default", "overlay"]height: 1fr or a fixed value