:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e8e8e8;
  background: #0b0c0e;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -20%, #24262b 0, #0b0c0e 48%); }
button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.hidden { display: none !important; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid #292b30; border-radius: 20px; background: rgba(20, 21, 24, .92); box-shadow: 0 30px 80px #0008; }
.mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: #d7ff47; color: #0b0c0e; font-size: 24px; font-weight: 800; }
h1 { margin: 24px 0 6px; font-size: 30px; }
.login-card p { color: #989ba3; margin: 0 0 30px; }
label { display: block; margin-bottom: 9px; color: #bfc1c7; font-size: 13px; }
.password-row { display: flex; gap: 10px; }
input, textarea { width: 100%; color: #f4f4f4; background: #101114; border: 1px solid #383a41; border-radius: 10px; outline: none; }
input { padding: 12px 14px; }
input:focus, textarea:focus { border-color: #d7ff47; box-shadow: 0 0 0 3px #d7ff4718; }
button { padding: 11px 16px; border-radius: 10px; background: #d7ff47; color: #101114; font-weight: 700; }
button:disabled { opacity: .4; cursor: not-allowed; }
.error { min-height: 20px; color: #ff7676; font-size: 13px; margin-top: 12px; }
.chat { width: min(1440px, 100%); height: calc(100vh - 40px); display: grid; grid-template-rows: auto 1fr; border: 1px solid #292b30; border-radius: 18px; overflow: hidden; background: #111215; box-shadow: 0 30px 80px #0008; }
header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid #292b30; }
header > div { display: flex; align-items: center; gap: 9px; }
header small { color: #8e9199; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d7ff47; box-shadow: 0 0 10px #d7ff4799; }
.secondary { background: #24262b; color: #d7d8dc; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: #0c0d0f; }
.tab { padding: 7px 15px; color: #9598a0; background: transparent; font-weight: 650; }
.tab.active { color: #111215; background: #d7ff47; }
.panel { min-height: 0; display: none; }
.panel.active { display: grid; }
.chat-panel { overflow: hidden; }
.chat-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 410px; }
.conversation { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr auto; border-right: 1px solid #292b30; }
.project-bar { display: grid; grid-template-columns: auto minmax(180px, 360px) auto auto; align-items: center; gap: 10px; padding: 11px max(18px, calc((100% - 820px) / 2)); border-bottom: 1px solid #292b30; background: #151619; }
.project-bar label { margin: 0; white-space: nowrap; }
.project-bar select { min-width: 0; padding: 8px 11px; }
.project-link { color: #d7ff47; font-size: 12px; text-decoration: none; white-space: nowrap; }
.new-project-button { padding: 8px 11px; white-space: nowrap; }
.game-preview { min-width: 0; display: grid; grid-template-rows: auto 1fr; padding: 16px 20px 20px; overflow: hidden; background: #0d0e10; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 12px; }
.preview-heading > div { min-width: 0; display: grid; gap: 3px; }
.preview-heading small { overflow: hidden; color: #777b84; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; color: #d8d9dc; background: #23252a; font-size: 20px; }
.phone-frame { position: relative; width: min(360px, 100%); height: 100%; min-height: 520px; max-height: 760px; justify-self: center; overflow: hidden; border: 8px solid #282a2f; border-radius: 34px; background: #090a0b; box-shadow: 0 18px 45px #000b, inset 0 0 0 1px #494c54; }
.phone-speaker { position: absolute; z-index: 3; top: 8px; left: 50%; width: 72px; height: 5px; border-radius: 999px; background: #16171a; transform: translateX(-50%); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #70737b; font-size: 13px; pointer-events: none; }
.game-preview:not(.empty) .preview-empty { display: none; }
.messages { overflow-y: auto; padding: 28px max(22px, calc((100% - 780px) / 2)); }
.message { margin: 0 0 22px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { margin-left: auto; width: fit-content; max-width: 82%; padding: 12px 15px; border-radius: 14px 14px 3px 14px; background: #292c31; }
.message.assistant { color: #e8e8e8; }
.message.system { color: #91949b; font-size: 13px; }
.message.error { color: #ff8585; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 16px max(18px, calc((100% - 820px) / 2)); border-top: 1px solid #292b30; background: #151619; }
textarea { min-height: 48px; max-height: 180px; padding: 13px 15px; resize: none; line-height: 1.45; }
.danger { color: #ffd7d7; background: #5a2228; }
.assets-panel { grid-template-rows: auto auto auto 1fr; overflow: hidden; }
.asset-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 24px 26px 18px; }
.asset-toolbar h2 { margin: 0 0 5px; font-size: 23px; }
.asset-toolbar p { margin: 0; color: #8f9299; }
.asset-imports { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.upload-button { display: inline-flex; align-items: center; margin: 0; padding: 11px 16px; border-radius: 10px; color: #111215; background: #d7ff47; font-weight: 700; cursor: pointer; }
.upload-button input { display: none; }
.url-form { display: flex; gap: 8px; }
.url-form input { width: min(310px, 40vw); }
.asset-jobs { margin: 0 26px 14px; padding: 12px 14px; border: 1px solid #3b3e45; border-radius: 10px; color: #c7c9ce; background: #191b1f; font-size: 13px; }
.asset-job + .asset-job { margin-top: 7px; }
.asset-job.failed { color: #ff8585; }
.asset-filters { display: grid; grid-template-columns: 1fr 230px; gap: 10px; padding: 0 26px 18px; }
.asset-breadcrumbs { display: flex; align-items: center; gap: 5px; padding: 0 26px 14px; overflow-x: auto; color: #747780; white-space: nowrap; }
.asset-breadcrumbs button { padding: 5px 8px; color: #c7c9ce; background: #23252a; font-size: 12px; }
select { padding: 11px 13px; border: 1px solid #383a41; border-radius: 10px; color: #e8e8e8; background: #101114; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); align-content: start; gap: 14px; padding: 0 26px 28px; overflow-y: auto; }
.asset-card { min-width: 0; overflow: hidden; border: 1px solid #2d2f35; border-radius: 13px; background: #18191d; }
.asset-preview { height: 150px; display: grid; place-items: center; overflow: hidden; background-color: #0d0e10; background-image: linear-gradient(45deg,#17191d 25%,transparent 25%),linear-gradient(-45deg,#17191d 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#17191d 75%),linear-gradient(-45deg,transparent 75%,#17191d 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.asset-preview img, .asset-preview video { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.asset-preview audio { width: calc(100% - 16px); }
.folder-preview { width: 100%; height: 150px; display: grid; place-items: center; border-radius: 0; background: #101114; font-size: 58px; }
.file-preview { padding: 12px; border-radius: 9px; color: #d7ff47; background: #202329; font-weight: 800; text-transform: uppercase; }
.asset-meta { padding: 13px; }
.asset-meta h3 { margin: 0 0 5px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-path { margin: 0 0 10px; color: #858891; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-tags { min-height: 25px; display: flex; gap: 5px; flex-wrap: wrap; }
.tag { padding: 3px 7px; border-radius: 999px; color: #bfc2c9; background: #292c32; font-size: 10px; }
.asset-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; color: #777a82; font-size: 11px; }
.delete-asset { padding: 5px 8px; color: #ff9c9c; background: transparent; font-size: 12px; }
.empty-assets { grid-column: 1 / -1; padding: 70px 20px; color: #878a92; text-align: center; }
.project-dialog { width: min(620px, calc(100% - 28px)); padding: 0; border: 1px solid #393c43; border-radius: 18px; color: #e8e8e8; background: #151619; box-shadow: 0 30px 100px #000d; }
.project-dialog::backdrop { background: #050506c7; backdrop-filter: blur(5px); }
.project-dialog form { display: grid; gap: 10px; padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 8px; }
.dialog-heading h2 { margin: 0 0 5px; }
.dialog-heading p { margin: 0; color: #8d9098; font-size: 13px; }
.route-input { display: flex; align-items: center; border: 1px solid #383a41; border-radius: 10px; overflow: hidden; background: #101114; }
.route-input:focus-within { border-color: #d7ff47; box-shadow: 0 0 0 3px #d7ff4718; }
.route-input span { padding-left: 13px; color: #858891; font-size: 13px; white-space: nowrap; }
.route-input input { border: 0; box-shadow: none !important; }
.project-dialog small { margin: -3px 0 7px; color: #777b83; }
.project-dialog textarea { min-height: 180px; padding: 13px 15px; resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.optional { color: #767982; font-size: 11px; }
.objects-panel { grid-template-rows: auto auto 1fr; overflow: hidden; }
.objects-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px 17px; border-bottom: 1px solid #292b30; }
.objects-toolbar h2 { margin: 0 0 5px; font-size: 23px; }
.objects-toolbar p { margin: 0; color: #8f9299; }
.objects-actions { display: flex; gap: 9px; }
.objects-actions select { min-width: 210px; }
.objects-workspace { min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.object-list { overflow-y: auto; border-right: 1px solid #292b30; background: #101114; }
.object-list-item { width: 100%; padding: 14px 16px; border-radius: 0; border-bottom: 1px solid #24262b; color: #d7d8dc; background: transparent; text-align: left; }
.object-list-item:hover { background: #1a1c20; }
.object-list-item.active { color: #101114; background: #d7ff47; }
.object-list-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.object-list-item small { display: block; margin-top: 4px; opacity: .65; font-weight: 500; }
.object-detail { min-width: 0; overflow-y: auto; padding: 24px 28px 34px; }
.object-detail-heading h2 { margin: 0 0 6px; }
.object-detail-heading p { max-width: 760px; margin: 0 0 8px; color: #999ca4; line-height: 1.5; }
.source-files { color: #686c75; font-size: 11px; }
.state-picker { display: grid; grid-template-columns: minmax(180px, 320px) 1fr; gap: 16px; align-items: end; margin: 24px 0 18px; padding: 16px; border: 1px solid #303238; border-radius: 12px; background: #16181b; }
.state-picker label { margin-bottom: 7px; }
.state-description { color: #999ca4; font-size: 13px; line-height: 1.45; }
.current-assignment { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px; border-radius: 10px; background: #101114; }
.current-assignment img { width: 62px; height: 62px; object-fit: contain; border-radius: 8px; background: #202228; }
.current-assignment.empty { color: #777a82; }
.object-assets-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.object-assets-heading h3 { margin: 0; }
.object-assets-heading input { width: min(340px, 48%); }
.selected-object-asset { max-width: 55%; overflow: hidden; color: #9da0a8; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.object-file-browser { overflow: hidden; border: 1px solid #303238; border-radius: 12px; background: #111215; }
.object-file-breadcrumbs { padding: 10px; border-bottom: 1px solid #2c2e33; }
.object-asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
.object-file-browser .object-asset-grid { max-height: 390px; padding: 10px; overflow-y: auto; }
.object-asset-option { min-width: 0; padding: 0; overflow: hidden; border: 2px solid transparent; color: #e2e3e6; background: #1b1d21; text-align: left; }
.object-asset-option.selected { border-color: #d7ff47; }
.object-asset-option img, .object-asset-placeholder { width: 100%; height: 105px; display: grid; place-items: center; object-fit: contain; background: #0d0e10; }
.object-asset-option span { display: block; padding: 9px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.assignment-actions { position: sticky; bottom: -34px; display: flex; justify-content: flex-end; margin: 20px -28px -34px; padding: 14px 28px; border-top: 1px solid #292b30; background: #151619ee; backdrop-filter: blur(8px); }
.assignment-prompt-label { margin: 18px 0 7px; }
.assignment-prompt { min-height: 105px; padding: 12px 14px; resize: vertical; }
.objects-empty { display: grid; min-height: 180px; place-items: center; padding: 24px; color: #777a82; text-align: center; }
@media (max-width: 600px) {
  .shell { padding: 0; }
  .login-card { border-radius: 0; min-height: 100vh; padding: 30px 22px; }
  .chat { height: 100vh; border: 0; border-radius: 0; }
  .password-row { flex-direction: column; }
  header small, header > div strong { display: none; }
  header { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; }
  header > div { display: none; }
  .tabs { min-width: 0; order: 2; overflow-x: auto; }
  .tab { flex: 1; padding: 7px 10px; }
  .messages { padding: 20px 16px; }
  .composer { padding: 12px; }
  .asset-toolbar { flex-direction: column; padding: 18px 14px 14px; }
  .asset-imports, .url-form { width: 100%; }
  .upload-button { width: 100%; justify-content: center; }
  .url-form input { width: 100%; }
  .asset-filters { grid-template-columns: 1fr; padding: 0 14px 14px; }
  .asset-breadcrumbs { padding: 0 14px 12px; }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 14px 20px; gap: 9px; }
  .asset-preview { height: 120px; }
  .asset-jobs { margin: 0 14px 14px; }
  .project-dialog form { padding: 18px; }
  .route-input span { display: none; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .objects-toolbar { align-items: stretch; flex-direction: column; padding: 16px 14px; }
  .objects-actions { display: grid; grid-template-columns: 1fr; }
  .objects-actions select { min-width: 0; }
  .objects-workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .object-list { display: flex; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid #292b30; }
  .object-list-item { min-width: 170px; border-right: 1px solid #24262b; border-bottom: 0; }
  .object-detail { padding: 18px 14px 28px; }
  .state-picker { grid-template-columns: 1fr; }
  .object-assets-heading { align-items: stretch; flex-direction: column; }
  .object-assets-heading input { width: 100%; }
  .selected-object-asset { max-width: 100%; }
  .object-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assignment-actions { bottom: -28px; margin: 18px -14px -28px; padding: 12px 14px; }
  .assignment-actions button { width: 100%; }
}
@media (max-width: 900px) {
  .chat-workspace { grid-template-columns: minmax(0, 1fr); }
  .conversation { border-right: 0; }
  .game-preview { display: none; }
  .project-bar { grid-template-columns: 1fr auto; padding: 10px 12px; }
  .project-bar label { grid-column: 1 / -1; }
  .new-project-button { grid-column: 1 / -1; }
}
@media (max-width: 430px) {
  .asset-grid { grid-template-columns: 1fr; }
  .asset-preview { height: 190px; }
  .project-link { display: none !important; }
  .project-bar { grid-template-columns: 1fr; }
}
