/* Planet Surface Studio: the page's arrangement only. Every control's look (buttons, fields, switches, menus, dialogs,
   toasts) and every colour comes from Myth Engine's editor kit (vendor/myth-ui/myth-ui.css) and its theme tokens, as
   Myth's UI standards ask (Myth/docs/UI-STANDARDS.md, "Local CSS may"). */

.planet-host { flex: 1 1 auto; min-height: 0; display: flex; }
/* Whatever the page hides (a setting that does not apply to the world on show) stays hidden, whatever its arrangement. */
.planet-host [hidden] { display: none !important; }
.planet-host > .myth-editor-layout { flex: 1 1 auto; min-width: 0; }

/* The Preview Area: its toolbar, the brush row, the planet, the status line. */
.planet-preview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.planet-preview > .myth-preview-viewport { flex: 1 1 auto; min-height: 0; position: relative; display: flex; flex-direction: column; }
/* The bar's right end: Settings, and Export at its full width. (The kit spaces the bar's groups and buttons.) */
.planet-toolbar-end { flex: none; overflow: visible; }
.planet-toolbar-end > #export { flex: none; white-space: nowrap; }
/* The viewport: the planet, with Myth's tool rail docked on it (for a world with seas made the new way). */
.planet-viewport { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }
/* Tool Options: the brush's size, its slider and its number box, beside its label. */
.planet-preview .myth-ui-editor-field:has(#brush) { flex-direction: row; align-items: center; gap: 10px; width: 300px; }
.planet-preview .myth-ui-editor-field:has(#brush) > .myth-ui-range-number { flex: 1 1 auto; min-width: 0; }
.planet-hint { color: var(--myth-ui-text-muted, var(--text-muted)); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The status strip is the kit's (myth-editor-statusbar); its parts line up on their text. In a narrow window the world's
   name stays whole and the note and the brush's hint shorten. */
.planet-status { align-items: baseline; }
.planet-title { white-space: nowrap; flex: none; }
.planet-note { color: var(--myth-ui-text-muted, var(--text-muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.planet-note.error { color: var(--myth-ui-danger, #e5534b); white-space: normal; }

/* The planet. The view fills the whole stage, so a planet seen up close fills it; the camera looks at the planet's
   middle, so its middle is the middle of the stage at any size, and its size follows the stage's shorter side
   (view3d.js fit). The view is laid over the stage, so its own drawing size never sets the stage's size. */
.planet-stage { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden; background: #000; }
.planet-stage > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.planet-stage > canvas:active { cursor: grabbing; }
/* Making the world: in the middle of the view. */
.planet-busy { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 14px; background: var(--myth-ui-surface-raised, var(--panel)); border: 1px solid var(--myth-ui-border, var(--border)); }
.planet-busy > .myth-ui-progress { width: 90px; }
/* The navigation, floating in the view's corner, holds navigation only: zoom and home. */
.planet-navigation { position: absolute; right: 12px; bottom: 12px; z-index: 1; }
.planet-weatherbar { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
/* Settings, behind the bar's menu button: the theme, the side panels, the keys. */
.planet-settings { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }

/* The worlds to start from, and the maps. */
.planet-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.planet-kind { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px; min-width: 0; height: auto; }
.planet-kind-picture { display: block; width: 100%; max-width: 116px; aspect-ratio: 1; border-radius: 50%; }
.planet-kind > .myth-ui-choice-card-title { text-align: center; }
.planet-map { cursor: crosshair; background: #0b0e16; border: 1px solid var(--myth-ui-border-soft, var(--border)); border-radius: 3px; overflow: hidden; }
.planet-map canvas { display: block; width: 100%; height: auto; }
.planet-readout { display: block; color: var(--myth-ui-text-muted, var(--text-muted)); font-size: 12px; line-height: 1.5; }

/* The properties. Reset to Defaults sits beside the filter box at the top; the filter takes the rest of the row. */
.planet-host .myth-ui-property-inspector-toolbar { display: flex; align-items: center; gap: 6px; }
.planet-host .myth-ui-property-inspector-toolbar > .myth-ui-property-inspector-search { flex: 1 1 auto; min-width: 0; }
.planet-host .myth-ui-property-inspector-toolbar > #resetDefaults { flex: none; white-space: nowrap; }
/* In a section with a group inside it, each shown row sits the kit's own gap below the row shown before it, whatever rows
   are hidden between them (ui.js sync marks the rows; the kit's sibling rule counts a hidden field and skips a switch's
   row). These must win over that rule, which outweighs a plain class. */
.planet-host .myth-ui-property-section-body > .planet-row-first { margin-block-start: 0 !important; }
.planet-host .myth-ui-property-section-body > .planet-row-next { margin-block-start: var(--myth-ui-property-stack-gap) !important; }
.planet-seed { display: flex; align-items: center; gap: 6px; }
.planet-seed > input { flex: 1 1 auto; min-width: 0; }
.planet-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.planet-switch-row { display: flex; }
.planet-ramp { display: flex; gap: 4px; }
.planet-ramp > * { flex: 1 1 0; min-width: 0; }

/* Export's dialog. */
.planet-export { width: min(480px, 94vw); }
.planet-export .myth-ui-dialog-body { display: flex; flex-direction: column; gap: 12px; }
.planet-export-about { margin: 0; }

/* In a narrow window Myth's editor layout stacks its columns (the kit's own query: the editor 980 px wide or less). The
   planet then comes first and fills the screen under the menus but for the top of the drawers' row, which shows below it
   so it is plain there is more (the worlds and the properties, on the drawers' rail) as the editor scrolls. */
@container (max-width: 980px) {
  .planet-host .myth-editor-layout-main { order: -1 !important; height: calc(100svh - 56px) !important; }
  .planet-host .myth-editor-layout-main > .planet-preview { height: 100%; }
}
/* A phone: smaller controls over the planet. */
@media (max-width: 700px) {
  .planet-navigation { right: 6px; bottom: 6px; }
}
