
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Cinzel:wght@400;500;600;700&display=swap');

:root {
  --background: #080e19;
  --surface: #101a2a;
  --surface-light: #172438;
  --surface-hover: #203149;
  --border: #263750;
  --border-soft: #1c2b40;
  --text: #e8edf5;
  --muted: #8c9db3;
  --faint: #62758e;
  --teal: #54d5c7;
  --teal-dark: #237d7b;
  --gold: #d8b879;
  --blue: #7c9df0;
  --success: #62d6a0;
  --danger: #e47f8a;
  --shadow: 0 18px 55px rgba(0, 0, 0, .38);
  --font-ui: 'DM Sans', sans-serif;
  --font-display: 'Cinzel', serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 360px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* APPLICATION */

.app-shell {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -40%, rgba(39, 91, 117, .15), transparent 65%),
    var(--background);
}

/* TOP BAR */

.topbar {
  height: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  background: rgba(13, 23, 38, .96);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

.brand-emblem {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(84, 213, 199, .45);
  border-radius: 12px;
  color: var(--teal);
  font-size: 25px;
  background: linear-gradient(145deg, #183247, #101c30);
  box-shadow: 0 0 20px rgba(84, 213, 199, .1);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-name span {
  color: var(--teal);
}

.brand-version {
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.main-navigation {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 100%;
}

.nav-button {
  height: 100%;
  padding: 0 17px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transition: .2s;
}

.nav-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .025);
}

.nav-button.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.save-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 7px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot,
.context-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 9px rgba(98, 214, 160, .5);
}

.status-dot.offline {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(216, 184, 121, .3);
}

/* BUTTONS */

.primary-button,
.secondary-button {
  border-radius: 7px;
  padding: 9px 15px;
  font-weight: 600;
  font-size: 11px;
  transition: .2s;
}

.primary-button {
  border: 1px solid #4bd0c2;
  color: #071a20;
  background: linear-gradient(135deg, #73e2d4, #43bdb7);
  box-shadow: 0 4px 15px rgba(65, 193, 184, .12);
}

.primary-button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 5px 22px rgba(65, 193, 184, .22);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface-light);
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--teal-dark);
  background: var(--surface-hover);
}

.large {
  padding: 13px 19px;
  font-size: 12px;
}

.icon-button {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 19px;
  transition: .2s;
}

.icon-button:hover {
  color: var(--teal);
  border-color: var(--teal-dark);
  background: var(--surface-hover);
}

.icon-button.small {
  width: 27px;
  height: 27px;
  font-size: 17px;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10px;
}

/* MAIN EDITOR */

.main-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(300px, 1fr) 255px;
  overflow: hidden;
}

.sidebar {
  min-width: 0;
  background: rgba(14, 24, 39, .96);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #34465f transparent;
}

.left-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.right-sidebar {
  border-left: 1px solid var(--border);
  padding-bottom: 25px;
}

.sidebar-heading {
  padding: 21px 17px 12px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

.project-summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  margin: 0 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(120deg, #18283d, #121f32);
}

.project-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #20384a;
  color: var(--gold);
  font-size: 19px;
}

.project-name {
  font-weight: 600;
  font-size: 11px;
}

.project-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.panel-section {
  padding: 15px 13px;
  border-top: 1px solid var(--border-soft);
}

.section-heading {
  margin-bottom: 12px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.35px;
}

.tool-button {
  width: 100%;
  min-height: 37px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  margin-bottom: 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 11px;
  transition: .18s;
}

.tool-button:hover {
  color: var(--text);
  background: var(--surface-light);
}

.tool-button.active {
  color: var(--teal);
  border-color: rgba(84, 213, 199, .2);
  background: rgba(84, 213, 199, .08);
}

.tool-icon {
  width: 19px;
  color: inherit;
  text-align: center;
  font-size: 16px;
}

.tool-button kbd {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
}

.menu-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 11px;
}

.menu-button:hover {
  background: var(--surface-light);
  color: var(--teal);
}

.menu-button span {
  color: var(--gold);
  font-size: 16px;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 14px;
}

.connection-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(140deg, #18283d, #101b2b);
}

.connection-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .6px;
}

.connection-description {
  margin: 9px 0;
  color: var(--muted);
  font-size: 9px;
}

/* CENTRAL CANVAS */

.editor-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #0a1220;
}

.workspace-toolbar {
  height: 46px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: #111d2d;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
}

.breadcrumb-divider {
  color: var(--faint);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.canvas-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
}

.toolbar-button {
  width: 25px;
  height: 25px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
}

.toolbar-button:hover {
  color: var(--teal);
  border-color: var(--teal-dark);
}

#fitCanvas {
  width: auto;
  padding: 0 8px;
}

.canvas-area {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #0a1524;
  background-image:
    radial-gradient(ellipse at 50% 48%, rgba(39, 79, 102, .14), transparent 70%),
    radial-gradient(rgba(125, 159, 180, .12) .8px, transparent .8px);
  background-size: auto, 23px 23px;
}

.canvas-background {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(9, 18, 31, .08), rgba(9, 18, 31, .15)),
    radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, .2));
}

.empty-map {
  z-index: 1;
  max-width: 490px;
  padding: 25px;
  text-align: center;
  animation: fade-in .6s ease;
}

.empty-map-symbol {
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 55px;
  text-shadow: 0 0 35px rgba(216, 184, 121, .35);
}

.empty-map h1 {
  margin: 0 0 11px;
  font-family: var(--font-display);
  font-size: clamp(19px, 2.5vw, 27px);
  font-weight: 500;
  letter-spacing: .4px;
}

.empty-map p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 11px;
}

.empty-map-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 25px;
}

.empty-map-note {
  margin-top: 24px;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 1.6px;
}

.map-canvas {
  position: absolute;
  inset: 30px;
  overflow: hidden;
  border: 1px solid #435e63;
  border-radius: 3px;
  background: #d7e0d2;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.map-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 27px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: #101b2b;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: .8px;
}

/* INSPECTOR */

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 15px 14px;
}

.inspector-header .section-heading {
  margin-bottom: 6px;
}

.inspector-title {
  font-size: 13px;
  font-weight: 600;
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .8px;
}

.text-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #0c1727;
  color: var(--text);
  font-size: 11px;
}

.text-input:focus {
  border-color: var(--teal-dark);
}

.description-input {
  min-height: 75px;
  resize: vertical;
}

.property-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
}

.property-row span:last-child {
  color: var(--text);
}

.layer-placeholder {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #111d2e;
}

.layer-placeholder > span:first-child {
  color: var(--gold);
  font-size: 16px;
}

.layer-placeholder strong,
.layer-placeholder small {
  display: block;
}

.layer-placeholder strong {
  font-size: 10px;
  font-weight: 600;
}

.layer-placeholder small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.layer-status {
  margin-left: auto;
  color: var(--success);
  font-size: 8px;
}

/* AETHER LAUNCHER */

.aether-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  min-width: 119px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid rgba(84, 213, 199, .6);
  border-radius: 24px;
  background: linear-gradient(135deg, #193c4b, #14263b);
  color: var(--teal);
  box-shadow: 0 5px 25px rgba(0, 0, 0, .4), 0 0 20px rgba(84, 213, 199, .12);
  transition: .25s;
}

.aether-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(84, 213, 199, .2);
}

.launcher-symbol {
  font-size: 20px;
}

.launcher-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.2px;
}

.launcher-status {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--gold);
}

/* AETHER WINDOW */

.aether-window {
  position: fixed;
  right: 22px;
  bottom: 79px;
  z-index: 100;
  width: 390px;
  height: min(590px, calc(100vh - 115px));
  min-height: 350px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #35576a;
  border-radius: 13px;
  background: #101c2c;
  box-shadow: var(--shadow), 0 0 35px rgba(66, 181, 178, .08);
  animation: window-enter .2s ease;
}

.aether-header {
  height: 65px;
  min-height: 65px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(120deg, #172d40, #142338);
  cursor: default;
}

.aether-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aether-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(84, 213, 199, .5);
  border-radius: 10px;
  background: #1b3948;
  color: var(--teal);
  font-size: 23px;
}

.aether-identity strong,
.aether-identity small {
  display: block;
}

.aether-identity strong {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1.4px;
}

.aether-identity small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 1.1px;
}

.aether-window-actions {
  display: flex;
  gap: 5px;
}

.aether-mode-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: #0e1928;
}

.aether-mode {
  padding: 9px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  transition: .2s;
}

.aether-mode:hover {
  color: var(--text);
  background: var(--surface-light);
}

.aether-mode.active {
  background: rgba(84, 213, 199, .1);
  color: var(--teal);
}

.aether-context {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 9px;
}

.aether-context strong {
  color: var(--text);
  font-weight: 600;
}

.context-dot {
  width: 5px;
  height: 5px;
  background: var(--gold);
  box-shadow: none;
}

.aether-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: #354c63 transparent;
}

.welcome-message {
  padding: 25px 7px;
  text-align: center;
}

.welcome-emblem {
  color: var(--gold);
  font-size: 36px;
  text-shadow: 0 0 20px rgba(216, 184, 121, .3);
}

.welcome-message h2 {
  margin: 12px 0 9px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}

.welcome-message p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.welcome-secondary {
  max-width: 270px;
  margin: 13px auto;
  color: var(--faint) !important;
}

.aether-message {
  max-width: 92%;
  padding: 11px 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #17263a;
  color: var(--text);
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.aether-message.user {
  margin-left: auto;
  border-color: rgba(84, 213, 199, .22);
  background: rgba(84, 213, 199, .09);
}

.aether-message .message-role {
  display: block;
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

.aether-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
}

.suggestion-chip {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #152438;
  color: var(--muted);
  font-size: 8px;
  transition: .2s;
}

.suggestion-chip:hover {
  color: var(--teal);
  border-color: var(--teal-dark);
}

.aether-composer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #0d1827;
}

.aether-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: #101e30;
  color: var(--text);
  font-size: 10px;
}

.aether-composer textarea:focus {
  border-color: var(--teal-dark);
}

.aether-composer textarea::placeholder {
  color: var(--faint);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.composer-footer span {
  color: var(--faint);
  font-size: 8px;
}

.send-button {
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: var(--teal);
  color: #081b20;
  font-size: 14px;
}

.send-button:hover {
  filter: brightness(1.12);
}

.aether-disclaimer {
  padding: 7px;
  border-top: 1px solid var(--border-soft);
  color: var(--faint);
  text-align: center;
  font-size: 7px;
  letter-spacing: 1.1px;
}

/* SECONDARY PAGES */

.secondary-page {
  flex: 1;
  overflow: auto;
  padding: 40px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(39, 91, 117, .12), transparent 65%),
    var(--background);
}

.page-heading {
  max-width: 900px;
  margin: 0 auto 30px;
}

.page-heading h1 {
  margin: 10px 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
}

.page-heading p {
  color: var(--muted);
  font-size: 11px;
}

.feature-card {
  max-width: 900px;
  padding: 30px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: linear-gradient(140deg, #15263a, #101a2a);
  box-shadow: 0 10px 35px rgba(0, 0, 0, .14);
}

.feature-card h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
}

.feature-card p {
  max-width: 650px;
  margin-bottom: 23px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.feature-icon {
  color: var(--gold);
  font-size: 30px;
}

.project-list {
  max-width: 900px;
  margin: 0 auto;
}

/* NOTIFICATIONS */

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 11px 15px;
  border: 1px solid var(--teal-dark);
  border-radius: 7px;
  background: #152b37;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 10px;
  animation: fade-in .2s ease;
}

/* ANIMATIONS */

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes window-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* RESPONSIVE */

@media (max-width: 1050px) {
  .main-content {
    grid-template-columns: 190px minmax(250px, 1fr) 220px;
  }

  .brand {
    min-width: 190px;
  }

  .nav-button {
    padding: 0 10px;
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .brand {
    min-width: 0;
  }

  .brand-version,
  .save-indicator {
    display: none;
  }

  .brand-name {
    font-size: 12px;
  }

  .main-navigation {
    gap: 0;
  }

  .nav-button {
    padding: 0 7px;
    font-size: 9px;
  }

  .main-content {
    grid-template-columns: 165px minmax(0, 1fr);
  }

  .right-sidebar {
    display: none;
  }

  .aether-window {
    right: 10px;
    bottom: 68px;
    width: min(390px, calc(100vw - 20px));
  }
}

@media (max-width: 520px) {
  .topbar {
    height: 60px;
    min-height: 60px;
  }

  .brand-emblem {
    width: 31px;
    height: 31px;
  }

  .brand-name {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .main-navigation {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .header-actions .icon-button {
    display: none;
  }

  .main-content {
    grid-template-columns: 1fr;
  }

  .left-sidebar {
    display: none;
  }

  .empty-map-actions {
    flex-direction: column;
  }

  .secondary-page {
    padding: 22px 15px;
  }

  .aether-window {
    height: min(620px, calc(100vh - 85px));
    bottom: 68px;
  }

  .aether-launcher {
    right: 12px;
    bottom: 12px;
  }
}
