:root {
  --pxa-accent: #2563eb;
  --pxa-accent-soft: #eaf2ff;
  --pxa-border: #d8e3f2;
  --pxa-surface: #ffffff;
  --pxa-surface-soft: #f6f9fd;
  --pxa-text: #102132;
  --pxa-muted: #5d7186;
  --pxa-shadow: 0 18px 36px -28px rgba(15, 23, 42, 0.35);
}

.workspace,
.panel-work,
.panel-related,
.panel-comments {
  display: grid;
  gap: 20px;
}

.panel-intro,
.panel-work,
.panel-related,
.panel-comments {
  position: relative;
  overflow: hidden;
}

.panel-intro::before,
.panel-work::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 140px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 52%),
    linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0));
  pointer-events: none;
}

.intro-head,
.pxa-layout {
  position: relative;
  z-index: 1;
}

.intro-head {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 22px;
  align-items: start;
}

.intro-meta {
  display: grid;
  gap: 16px;
}

.intro-meta h1 {
  margin: 0;
  color: var(--pxa-text);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.intro-meta .muted {
  margin: 0;
  max-width: 920px;
  color: #4d6279;
  font-size: 15px;
  line-height: 1.9;
}

.intro-meta .ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
}

.panel-intro .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-intro .tags span,
.tool-billing span,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.panel-intro .tags span {
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: rgba(255, 255, 255, 0.92);
  color: #2e4c74;
}

.tool-billing {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tool-billing .bill-mode {
  background: linear-gradient(135deg, var(--pxa-accent), #1d4ed8);
  color: #fff;
  box-shadow: 0 16px 28px -20px rgba(37, 99, 235, 0.78);
}

.tool-billing .bill-credit {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.lang-switch {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #d9e4f3;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.98));
  box-shadow: var(--pxa-shadow);
}

.lang-switch label {
  color: var(--pxa-text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.lang-switch select,
.control input[type="text"],
.control input[type="color"],
.control input[type="file"],
.control select,
.summary-box textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--pxa-border);
  border-radius: 18px;
  background: #fff;
  color: var(--pxa-text);
  font-size: 14px;
}

.lang-switch select,
.control select,
.control input[type="text"],
.control input[type="color"],
.control input[type="file"] {
  min-height: 48px;
  padding: 0 16px;
}

.pxa-layout {
  display: grid;
  gap: 20px;
}

.pxa-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 20px;
  align-items: start;
}

.pxa-canvas-card,
.pxa-side-card,
.pxa-notes-card,
.pxa-stats-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid #dbe5f2;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.98));
  box-shadow: var(--pxa-shadow);
}

.section-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #edf4ff, #dbe9ff);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #c8dafc;
}

.pxa-toolbar,
.pxa-action-row,
.tool-buttons,
.palette-grid,
.bg-grid,
.history-grid,
.tab-nav,
.preset-grid,
.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pxa-toolbar button,
.pxa-action-row button,
.tool-buttons button,
.tab-nav button,
.preset-grid button {
  border: 1px solid #cad7e8;
  background: #f7f9fc;
  color: #395067;
  border-radius: 16px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pxa-toolbar button:hover,
.pxa-action-row button:hover,
.tool-buttons button:hover,
.tab-nav button:hover,
.preset-grid button:hover {
  transform: translateY(-1px);
  border-color: #b7c8e0;
  box-shadow: 0 14px 24px -20px rgba(37, 99, 235, 0.5);
}

.pxa-toolbar .primary,
.pxa-action-row .primary,
.preset-grid .primary {
  color: #fff;
  border-color: var(--pxa-accent);
  background: linear-gradient(135deg, var(--pxa-accent), #1d4ed8);
}

.tool-buttons button.is-active,
.tab-nav button.is-active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.pxa-status {
  min-height: 22px;
  color: var(--pxa-accent);
  font-size: 13px;
  line-height: 1.6;
}

.pxa-status.error {
  color: #c2410c;
}

.pxa-canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 20px;
  border: 1px solid #dbe5f2;
  border-radius: 26px;
  background:
    linear-gradient(45deg, #f8fbff 25%, transparent 25%, transparent 75%, #f8fbff 75%),
    linear-gradient(45deg, #f8fbff 25%, transparent 25%, transparent 75%, #f8fbff 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  overflow: auto;
}

#pxa-outer {
  position: relative;
}

#pxa-wrap {
  position: relative;
  width: fit-content;
  margin: 0 auto;
}

#pxa-c {
  display: block;
  border-radius: 18px;
  box-shadow: 0 22px 36px -28px rgba(15, 23, 42, 0.55);
  image-rendering: pixelated;
  cursor: crosshair;
}

#pxa-sel-overlay {
  position: absolute;
  border: 2px dashed rgba(37, 99, 235, 0.95);
  background: rgba(37, 99, 235, 0.12);
  pointer-events: none;
  display: none;
  border-radius: 6px;
}

.pxa-control-grid,
.pxa-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.control,
.stat-box,
.summary-box,
.notes-box {
  display: grid;
  gap: 8px;
}

.control span,
.stat-box span,
.summary-box span,
.notes-box span {
  color: var(--pxa-muted);
  font-size: 13px;
}

.control strong,
.stat-box strong,
.summary-box strong {
  color: var(--pxa-text);
}

.control input[type="range"] {
  width: 100%;
}

.control input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--pxa-accent);
}

.stat-box {
  min-width: 140px;
  padding: 16px 18px;
  border: 1px solid #dae5f2;
  border-radius: 20px;
  background: var(--pxa-surface-soft);
}

.stat-box strong {
  font-size: 24px;
  line-height: 1.2;
}

.swatch,
.history-dot,
.bg-swatch {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 2px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.swatch:hover,
.history-dot:hover,
.bg-swatch:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.38);
}

.swatch.is-active,
.bg-swatch.is-active {
  border-color: rgba(37, 99, 235, 0.88);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.current-swatch {
  display: flex;
  align-items: center;
  gap: 12px;
}

#pxa-cur-swatch {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 2px solid rgba(15, 23, 42, 0.08);
  background: #000000;
}

.tab-nav {
  padding: 6px;
  border: 1px solid #dbe5f2;
  border-radius: 18px;
  background: #f8fbff;
}

.tab-nav button {
  flex: 1 1 0;
  min-width: 92px;
  border: 0;
  box-shadow: none;
}

.tab-panel[hidden] {
  display: none;
}

.preview-grid {
  gap: 14px;
}

.preview-card {
  flex: 1 1 120px;
  min-width: 120px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dae5f2;
  border-radius: 20px;
  background: #f8fbff;
}

.preview-card strong {
  color: var(--pxa-text);
  font-size: 13px;
}

.preview-card canvas {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  image-rendering: pixelated;
  border-radius: 16px;
  border: 1px solid #dbe5f2;
  background: #fff;
}

.summary-box textarea {
  min-height: 148px;
  padding: 14px 16px;
  line-height: 1.7;
  resize: vertical;
}

.notes-box ol {
  margin: 0;
  padding-left: 18px;
  color: #476178;
  line-height: 1.9;
}

.empty-state {
  margin: 0;
  color: #64748b;
}

@media (max-width: 1080px) {
  .intro-head,
  .pxa-main-grid,
  .pxa-control-grid,
  .pxa-stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .panel {
    padding: 16px;
  }

  .pxa-canvas-card,
  .pxa-side-card,
  .pxa-notes-card,
  .pxa-stats-card {
    padding: 18px;
    border-radius: 22px;
  }

  .intro-meta h1 {
    font-size: 30px;
  }

  .preview-card {
    min-width: 100%;
  }

  .preview-card canvas {
    width: 80px;
    height: 80px;
  }
}
