:root {
  --paper: #FBF8EF;
  --cream: #FFF7D6;
  --stone: #E9E4D6;
  --yellow: #FFD43B;
  --ink: #2B2620;
  --brown: #5C5133;
  --focus: #004E89;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 5px 10px;
  text-decoration: none;
}

.page-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 5px 10px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 6px 11px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
}

.btn:hover,
.btn.active {
  background: var(--yellow);
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  border-right: 2px solid var(--ink);
  background: var(--cream);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.filter-btn {
  appearance: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--ink);
  padding: 4px 8px;
  cursor: pointer;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--yellow);
}

.asset-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.asset-item {
  appearance: none;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.asset-item:hover {
  background: #fff3bf;
}

.asset-item.active {
  background: var(--yellow);
  border-width: 2px;
}

.asset-item-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.asset-item-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--brown);
  flex-shrink: 0;
}

.stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
}

#asset-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#asset-canvas:active {
  cursor: grabbing;
}

.stage-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.stage-info {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  flex-wrap: wrap;
}

.info-card {
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 10px 14px;
  max-width: 480px;
  pointer-events: auto;
}

.info-card h1 {
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: 16px;
}

.info-card p {
  margin: 0;
  font-size: 13px;
  color: var(--brown);
  line-height: 1.45;
}

.metrics {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 6px 10px;
}

@media (max-width: 820px) {
  .shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .stage-wrap {
    order: -1;
    height: 54vh;
    min-height: 320px;
    border-bottom: 2px solid var(--ink);
  }
  .sidebar {
    border-right: none;
  }
  .asset-list {
    max-height: none;
  }
}
