:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #1b1d22;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button,
.file-button {
  border: 1px solid #c9ced8;
  border-radius: 6px;
  background: #ffffff;
  color: #1b1d22;
  cursor: pointer;
  padding: 0.55rem 0.8rem;
}

button:disabled {
  color: #8b929e;
  cursor: not-allowed;
  background: #eef0f4;
}

.file-button:has(input:disabled) {
  color: #8b929e;
  cursor: not-allowed;
  background: #eef0f4;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dde1e8;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
}

.file-button input {
  display: none;
}

.mode-switch {
  border: 1px solid #c9ced8;
  border-radius: 7px;
  display: inline-flex;
  overflow: hidden;
}

.mode-switch label {
  align-items: center;
  cursor: pointer;
  display: inline-flex;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0 0.7rem;
}

.mode-switch label + label {
  border-left: 1px solid #c9ced8;
}

.canvas-frame {
  align-items: center;
  background:
    linear-gradient(45deg, #e7e9ee 25%, transparent 25%),
    linear-gradient(-45deg, #e7e9ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7e9ee 75%),
    linear-gradient(-45deg, transparent 75%, #e7e9ee 75%);
  background-color: #fdfdfd;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
  display: grid;
  min-height: 420px;
  padding: 1rem;
  position: relative;
}

.public-demo-notice {
  background: #fff4de;
  border-bottom: 1px solid #ead4a8;
  color: #674300;
  display: grid;
  gap: 0.2rem;
  line-height: 1.45;
  padding: 0.75rem 1rem;
}

.public-demo-notice[hidden] {
  display: none;
}

.public-demo-notice strong {
  font-size: 0.95rem;
}

.public-demo-notice span {
  font-size: 0.88rem;
}

#previewCanvas {
  background: #ffffff;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(30, 35, 45, 0.08);
  display: block;
  height: min(78vh, 720px);
  max-width: 100%;
  width: 100%;
}

.empty-state {
  color: #69717d;
  left: 50%;
  margin: 0;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.control-panel {
  background: #ffffff;
  border-left: 1px solid #dde1e8;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: auto;
}

.panel-section {
  border-bottom: 1px solid #e4e7ed;
  padding: 1rem;
}

.panel-section h1,
.panel-section h2 {
  letter-spacing: 0;
  margin: 0 0 0.75rem;
}

.panel-section h1 {
  font-size: 1.25rem;
}

.panel-section h2 {
  font-size: 0.95rem;
}

.status,
.message,
.button-help,
.backend-setup p,
.muted-section p {
  color: #69717d;
  font-size: 0.9rem;
  line-height: 1.45;
}

.status {
  border-radius: 6px;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
}

.status-waiting {
  background: #fff8e5;
  color: #805800;
}

.status-error {
  background: #ffeceb;
  color: #9b1c16;
}

.status-ready {
  background: #eaf8ef;
  color: #176633;
}

.message {
  margin: 0.7rem 0 0;
}

.button-help {
  margin: 0.45rem 0 0;
}

.backend-setup {
  background: #fffaf0;
}

.backend-setup[hidden] {
  display: none;
}

.backend-setup code {
  background: #fff0c2;
  border-radius: 4px;
  color: #674300;
  font-size: 0.85em;
  padding: 0.1rem 0.25rem;
}

.point-list {
  display: grid;
  gap: 0.45rem;
  list-style-position: inside;
  margin: 0;
  max-height: 190px;
  overflow: auto;
  padding: 0;
}

.point-list li {
  border: 1px solid #dde1e8;
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
}

.person-point {
  color: #005c9f;
}

.background-point {
  color: #8b3f00;
}

.field,
.check-field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.check-field {
  align-items: center;
  grid-template-columns: auto 1fr;
}

.field span,
.check-field {
  color: #3f4651;
  font-size: 0.9rem;
}

.field output {
  color: #69717d;
  font-size: 0.85rem;
}

.field input[type="color"] {
  border: 1px solid #c9ced8;
  border-radius: 6px;
  height: 38px;
  padding: 2px;
  width: 64px;
}

.muted-section input {
  border: 1px solid #c9ced8;
  border-radius: 6px;
  color: #69717d;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-left: 0;
    border-top: 1px solid #dde1e8;
  }

  #previewCanvas {
    height: 58vh;
  }
}
