.world-space-root { --world-ink: #243f39; --world-teal: #287a74; --world-line: #d8e1d8; color: var(--world-ink); width: 100%; min-width: 0; }
.world-space-root[data-world-style="ornate-2d"] { --world-ink: #27333d; --world-teal: #8a5c32; --world-line: #d7a85f; }
.world-space-root[data-world-style="ornate-2d"] .world-stage-wrap { background: #d9c49b; box-shadow: inset 0 0 0 4px rgba(215,168,95,.42), inset 0 0 0 7px rgba(39,51,61,.18); }
.world-space-root[data-world-style="ornate-2d"] .world-icon,
.world-space-root[data-world-style="ornate-2d"] .world-share-trigger,
.world-space-root[data-world-style="ornate-2d"] select { background: #fff9e9; border-color: #d7a85f; }
.world-space-root[data-world-style="ornate-2d"] .world-icon:hover:not(:disabled),
.world-space-root[data-world-style="ornate-2d"] .world-share-trigger:hover,
.world-space-root[data-world-style="ornate-2d"] .world-item:hover:not(:disabled) { background: #f9e8bd; border-color: #a97942; }
.world-space-root[data-world-style="ornate-2d"] .world-save,
.world-space-root[data-world-style="ornate-2d"] .world-companion-talk { background: #8a5c32; border-color: #8a5c32; }
.world-space-root[data-world-style="ornate-2d"] .world-save:hover:not(:disabled),
.world-space-root[data-world-style="ornate-2d"] .world-companion-talk:hover:not(:disabled) { background: #6f4727; }
.world-space-root[data-world-style="ornate-2d"] .world-companion-card { border-color: #d7a85f; background: linear-gradient(115deg, #f5e6bd, #fff9e9 72%); }
.world-space-root[data-world-style="ornate-2d"] .world-companion-avatar { background: #ead6a2; box-shadow: inset 0 0 0 2px rgba(215,168,95,.58); }
.world-space-root[data-world-style="ornate-2d"] .world-item { background: #fff9e9; border-color: #d7a85f; }
.world-space-root[data-world-style="fantasy-2d"] { --world-ink: #302856; --world-teal: #6b5bb5; --world-line: #aaa0c9; color: var(--world-ink); }
.world-space-root[data-world-style="fantasy-2d"] .world-stage-wrap { background: #211d52; box-shadow: inset 0 0 0 4px rgba(159,212,223,.38), inset 0 0 0 7px rgba(246,215,122,.24); }
.world-space-root[data-world-style="fantasy-2d"] .world-icon,
.world-space-root[data-world-style="fantasy-2d"] .world-share-trigger,
.world-space-root[data-world-style="fantasy-2d"] select { background: #302856; border-color: #6e66ad; color: #eeeaff; }
.world-space-root[data-world-style="fantasy-2d"] .world-icon:hover:not(:disabled),
.world-space-root[data-world-style="fantasy-2d"] .world-share-trigger:hover,
.world-space-root[data-world-style="fantasy-2d"] .world-item:hover:not(:disabled) { background: #40366e; border-color: #9fd4df; }
.world-space-root[data-world-style="fantasy-2d"] .world-save,
.world-space-root[data-world-style="fantasy-2d"] .world-companion-talk { background: #6b5bb5; border-color: #9fd4df; color: #fff; }
.world-space-root[data-world-style="fantasy-2d"] .world-save:hover:not(:disabled),
.world-space-root[data-world-style="fantasy-2d"] .world-companion-talk:hover:not(:disabled) { background: #8472d2; }
.world-space-root[data-world-style="fantasy-2d"] .world-companion-card { border-color: #6e66ad; background: linear-gradient(115deg, #302856, #40366e 72%); color: #eeeaff; }
.world-space-root[data-world-style="fantasy-2d"] .world-companion-avatar { background: #40366e; box-shadow: inset 0 0 0 2px rgba(159,212,223,.68); }
.world-space-root[data-world-style="fantasy-2d"] .world-item { background: #302856; border-color: #6e66ad; color: #eeeaff; }
.world-space-root[data-world-style="fantasy-2d"] .world-status,
.world-space-root[data-world-style="fantasy-2d"] .world-selection { color: #5f527d; }
.world-space-root[data-world-style="fantasy-2d"] .world-stage-loading,
.world-space-root[data-world-style="fantasy-2d"] .world-companion-eyebrow,
.world-space-root[data-world-style="fantasy-2d"] .world-companion-description,
.world-space-root[data-world-style="fantasy-2d"] .world-companion-space-hint,
.world-space-root[data-world-style="fantasy-2d"] .world-item-quantity { color: #d9d4f2; }
.world-space-root *, .world-space-root *::before, .world-space-root *::after { box-sizing: border-box; }
.world-space-root button, .world-space-root select { font: inherit; letter-spacing: 0; }
.world-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 0 12px; }
.world-heading h2 { font-size: 21px; line-height: 1.25; margin: 0 0 4px; }
.world-status { font-size: 13px; line-height: 1.4; color: var(--muted, #52635f); margin: 0; min-height: 18px; }
.world-space-root[data-dirty="true"] .world-status { color: #986427; }
.world-main-actions, .world-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.world-space-root .world-icon { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; border: 1px solid var(--world-line); border-radius: 6px; background: #fffdfa; color: var(--world-ink); padding: 0; cursor: pointer; flex-shrink: 0; }
.world-space-root .world-icon:hover:not(:disabled) { background: #e9f1e6; border-color: #8dae9c; }
.world-space-root button:focus-visible, .world-space-root select:focus-visible, .world-stage-wrap:focus-visible { outline: 3px solid #2f8e89; outline-offset: 3px; }
.world-space-root .world-delete { color: #ad5649; }
.world-space-root button:disabled { opacity: .4; cursor: default; }
.world-space-root svg { width: 19px; height: 19px; flex-shrink: 0; stroke-width: 1.7; }
.world-space-root .world-save { min-height: 40px; padding: 0 15px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; background: var(--world-teal); color: #fff; border: 1px solid var(--world-teal); border-radius: 6px; cursor: pointer; }
.world-share-trigger { min-height: 40px; padding: 0 12px; border: 1px solid var(--world-line); border-radius: 6px; background: #fffdfa; color: var(--world-ink); cursor: pointer; }
.world-share-trigger:hover { background: #eef3e8; border-color: #8dae9c; }
.world-share-panel { margin: 0 0 16px; padding: 16px; border: 1px solid #d9e5d8; border-radius: 10px; background: #f7faf1; }
.world-share-panel[hidden] { display: none; }
.world-share-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.world-share-heading h3 { margin: 0; font-size: 17px; }
.world-share-create { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.world-share-create label { display: grid; gap: 4px; color: var(--muted, #52635f); font-size: 12px; }
.world-share-create select { min-width: 108px; }
.world-share-list { display: grid; gap: 7px; margin-top: 12px; }
.world-share-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid #d9e5d8; border-radius: 7px; background: #fffdfa; }
.world-share-meta { color: var(--muted, #52635f); font-size: 12px; }
.world-share-link { display: flex; gap: 8px; align-items: center; width: 100%; }
.world-share-link input { min-width: 0; flex: 1; height: 38px; padding: 0 9px; border: 1px solid var(--world-line); border-radius: 6px; color: var(--world-ink); background: #fff; font: 12px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; }
.world-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--world-line); padding: 12px 0; }
.world-scene-label { display: flex; align-items: center; gap: 9px; min-width: 0; color: #536b60; font-size: 13px; white-space: nowrap; }
.world-space-root select { width: auto; height: 40px; background: #fffdfa; color: var(--world-ink); border: 1px solid var(--world-line); border-radius: 6px; padding: 0 28px 0 10px; max-width: 100%; }
.world-tool-divider { width: 1px; height: 23px; background: var(--world-line); margin: 0 4px; }
.world-feedback { font-size: 13px; line-height: 1.6; padding: 10px 12px; margin-bottom: 12px; border-inline-start: 3px solid #c6785b; background: #f9eee8; color: #874b3a; overflow-wrap: anywhere; }
.world-feedback[data-type="success"] { background: #edf5e7; border-color: #73a469; color: #477353; }
.world-feedback[hidden] { display: none; }
.world-workspace { display: grid; grid-template-columns: minmax(0,1fr) 280px; align-items: start; gap: 22px; }
.world-canvas-area { min-width: 0; }
.world-stage-wrap { position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: #a9c878; touch-action: none; outline: none; }
.world-stage-wrap .konvajs-content { max-width: 100%; }
.world-stage-wrap canvas { display: block; }
.world-stage-loading { display: flex; align-items: center; justify-content: center; height: 100%; position: absolute; inset: 0; font-size: 14px; color: #294936; }
.world-selection { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted, #52635f); min-height: 40px; border-bottom: 1px solid var(--world-line); }
.world-selection span:first-child { overflow-wrap: anywhere; }
.world-selection span:last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.world-companion-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 16px; border: 1px solid #d9e5d8; border-radius: 8px; background: linear-gradient(115deg,#f3f5e8,#fffdfa 72%); }
.world-companion-card[hidden] { display: none; }
.world-companion-avatar { display: grid; place-items: center; width: 58px; height: 58px; flex: 0 0 58px; overflow: hidden; border-radius: 50%; background: #e4eddd; }
.world-companion-avatar svg { width: 52px; height: 52px; }
.world-companion-copy { min-width: 0; flex: 1 1 160px; overflow-wrap: anywhere; }
.world-companion-eyebrow { color: var(--muted, #52635f); font-size: 10px; font-weight: 800; letter-spacing: .12em; margin: 0 0 4px; text-transform: uppercase; }
.world-companion-copy h3 { margin: 0 0 3px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.world-companion-description { color: var(--muted, #52635f); font-size: 12px; line-height: 1.5; margin: 0; }
.world-companion-actions { display: flex; flex: 1 1 230px; flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 100%; }
.world-companion-actions a, .world-companion-actions button { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.world-companion-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 12px; border: 1px solid #d5e0d4; border-radius: 6px; color: var(--world-ink); background: #fffdfa; font-size: 12px; text-decoration: none; }
.world-companion-actions a:hover { border-color: #84a995; background: #edf3e8; }
.world-companion-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 12px; border: 1px solid #d5e0d4; border-radius: 6px; color: var(--world-ink); background: #fffdfa; font-size: 12px; cursor: pointer; }
.world-companion-actions button:hover:not(:disabled) { border-color: #84a995; background: #edf3e8; }
.world-companion-actions button:disabled { cursor: default; }
.world-companion-space-action { border-color: #8dae9c !important; }
.world-companion-space-hint { flex: 0 1 230px; min-width: 0; max-width: 100%; color: var(--muted, #52635f); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.world-travel-panel { margin: 0 0 22px; padding: 18px; border: 1px solid rgba(47,127,124,.16); border-radius: 16px; background: rgba(255,252,245,.7); }
.world-travel-heading h2 { margin: 0; font-size: 22px; }
.world-travel-heading p { margin: 5px 0 0; }
.world-travel-current { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 11px; background: rgba(217,239,221,.55); }
.world-travel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.world-travel-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--world-line); border-radius: 13px; background: rgba(255,255,255,.72); }
.world-travel-card h3 { margin: 0; font-size: 17px; }
.world-travel-card p { margin: 0; font-size: 12px; line-height: 1.45; }
.world-travel-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.world-travel-version { color: var(--muted, #52635f); font-size: 11px; white-space: nowrap; }
.world-travel-compatible { color: #3d765e; }
.world-travel-incompatible { color: #9b6256; }
.world-travel-stable { color: var(--muted, #52635f); }
.world-travel-panel [data-travel-feedback][data-tone="error"] { color: #a55042; }
.world-travel-panel [data-travel-feedback][data-tone="success"] { color: #3b765e; }
@media (max-width: 900px) { .world-travel-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .world-travel-grid { grid-template-columns: 1fr; } }
.world-companion-actions .world-companion-talk { border-color: var(--world-teal); background: var(--world-teal); color: #fff; }
.world-companion-actions .world-companion-talk:hover { background: #216b66; }
.world-library { display: flex; flex-direction: column; width: 100%; min-width: 0; max-height: var(--world-canvas-height,600px); padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: hidden; }
.world-library-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.world-placement-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.world-placement-label span { font-size: 12px; color: var(--muted, #52635f); white-space: nowrap; }
.world-placement-label select { min-width: 170px; max-width: min(38vw, 280px); }
.world-library-heading h3 { font-size: 17px; margin: 0; white-space: nowrap; }
.world-item-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; align-content: start; padding: 3px 5px 4px 3px; }
.world-space-root .world-item { display: flex; align-items: center; flex-direction: column; min-width: 0; min-height: 142px; height: 100%; padding: 8px 8px 11px; border: 1px solid var(--world-line); border-radius: 6px; color: var(--world-ink); background: #fffdfa; cursor: pointer; text-align: center; }
.world-space-root .world-item:hover:not(:disabled) { background: #eef3e8; border-color: #8dae9c; }
.world-space-root .world-item canvas { width: 100%; max-width: 128px; height: 88px; object-fit: contain; flex-shrink: 0; }
.world-item-name { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; margin: 3px 0 4px; }
.world-item-quantity { font-size: 11px; line-height: 1.4; color: #64796c; font-variant-numeric: tabular-nums; margin-top: auto; }
.world-space-root .world-confirm { width: min(400px,calc(100vw - 32px)); padding: 22px; border: 1px solid var(--world-line); border-radius: 8px; color: var(--world-ink); background: #fffdfa; box-shadow: 0 16px 70px #243f3940; }
.world-confirm::backdrop { background: #20383155; }
.world-confirm h3 { font-size: 18px; margin: 0 0 12px; }
.world-confirm p { font-size: 14px; line-height: 1.6; color: var(--muted, #52635f); margin: 0 0 20px; }
.world-confirm > div { display: flex; justify-content: flex-end; gap: 8px; }
.world-space-root .world-keep, .world-space-root .world-discard { min-height: 40px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--world-line); background: #fffdfa; color: var(--world-ink); cursor: pointer; font-size: 13px; }
.world-space-root .world-discard { background: #a55547; color: #fff; border-color: #a55547; }
@media (max-width: 820px) {
  .world-workspace { display: block; }
  .world-library { max-height: none; overflow: visible; padding-top: 16px; }
  .world-item-grid { grid-template-columns: repeat(4,minmax(0,1fr)); overflow: visible; padding: 3px; }
}
@media (max-width: 560px) {
  .world-heading { align-items: flex-start; flex-wrap: wrap; gap: 10px; padding-bottom: 14px; }
  .world-heading > div { min-width: 0; max-width: 100%; }
  .world-heading h2 { font-size: 21px; }
  .world-status { font-size: 12px; max-width: 180px; }
  .world-main-actions { flex-wrap: wrap; flex-shrink: 1; gap: 5px; }
  .world-main-actions button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .world-share-trigger { padding: 0 8px; }
  .world-share-link { align-items: stretch; flex-direction: column; }
  .world-space-root .world-save { padding: 0 11px; }
  .world-toolbar { flex-wrap: wrap; justify-content: flex-start; gap: 10px; }
  .world-scene-label { width: 100%; }
  .world-scene-label select { flex: 1; }
  .world-tools { width: 100%; gap: 6px; }
  .world-space-root .world-icon { width: 40px; height: 40px; }
  .world-tools .world-tool-divider { margin-inline-start: auto; }
  .world-item-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
  .world-space-root .world-item { min-height: 129px; padding: 6px 4px 9px; }
  .world-space-root .world-item canvas { height: 75px; }
  .world-item-name { font-size: 12px; }
  .world-library { padding-top: 16px; }
  .world-feedback { font-size: 12px; }
  .world-companion-card { align-items: flex-start; flex-wrap: wrap; gap: 10px; padding: 12px; }
  .world-companion-avatar { width: 48px; height: 48px; flex-basis: 48px; }
  .world-companion-avatar svg { width: 44px; height: 44px; }
  .world-companion-copy { flex: 1 1 calc(100% - 60px); }
  .world-companion-actions { width: 100%; justify-content: stretch; }
  .world-companion-actions a, .world-companion-actions button { flex: 1; }
  .world-companion-space-hint { flex-basis: 100%; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .world-space-root * { animation: none !important; transition: none !important; } }
