:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  background: #f6f8fc;
  color: #172033;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  background: #f6f8fc;
}

.panel {
  grid-row: 1 / 2;
  height: calc(100vh - 36px);
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 12px 0 36px rgba(15, 23, 42, 0.08);
  z-index: 2;
}

.panel::-webkit-scrollbar { width: 10px; }
.panel::-webkit-scrollbar-track { background: #f1f5f9; }
.panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.panel::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

h1 { margin: 0 0 8px; font-size: 32px; color: #0f172a; }

.muted, .hint { color: #64748b; line-height: 1.6; }

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0 16px;
}

.panel-tab {
  padding: 10px 8px;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  box-shadow: none;
}

.panel-tab.active {
  color: white;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-color: transparent;
}

.panel-section { display: none; }
.panel-section.active { display: block; }

.file-picker {
  display: block;
  margin: 16px 0 12px;
  padding: 16px;
  border: 1px dashed #94a3b8;
  border-radius: 14px;
  cursor: pointer;
  background: #f8fafc;
}

.file-picker:hover { border-color: #2563eb; background: #eff6ff; }
.file-picker input { display: block; margin-top: 12px; width: 100%; color: #334155; }

button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  color: white;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

button:hover { filter: brightness(1.04); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary {
  margin-top: 10px;
  color: #1d4ed8;
  background: #dbeafe;
  box-shadow: none;
  border: 1px solid #93c5fd;
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  color: #475569;
  font-weight: 700;
}

.field-control {
  width: 100%;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0f172a;
  background: #f8fafc;
}

.share-action { margin-top: 12px; }
.share-hint { margin: 0 0 12px; }
.share-status { word-break: break-word; }
.share-link-box { margin-top: 12px; }
.hidden { display: none !important; }

.status {
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1d4ed8;
  min-height: 44px;
  border: 1px solid #bfdbfe;
}

.progress {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  transition: width 160ms ease;
}

.progress-detail {
  margin-top: 8px;
  min-height: 20px;
  color: #64748b;
  font-size: 13px;
}

.meta {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

dt { color: #64748b; }
dd { margin: 0; color: #0f172a; text-align: right; font-weight: 600; }

#viewer {
  grid-row: 1 / 2;
  position: relative;
  min-width: 0;
  background:
    radial-gradient(circle at center, rgba(219, 234, 254, 0.9) 0, rgba(248, 250, 252, 0.96) 55%, #e2e8f0 100%);
  touch-action: none;
}

.site-footer {
  grid-column: 1 / -1;
  grid-row: 2 / 3;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 13px;
}

canvas { display: block; outline: none; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 42vh) 1fr auto; }
  .panel {
    height: auto;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  }
  #viewer { grid-row: 2 / 3; }
  .site-footer { grid-row: 3 / 4; }
}
