@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=DM+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light;
  --page-bg: #edf7f2;
  --page-bg-deep: #e2efe8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --line: rgba(104, 136, 121, 0.18);
  --line-strong: rgba(75, 119, 93, 0.28);
  --ink: #162033;
  --muted: #6f7b96;
  --accent: #2f9b67;
  --accent-strong: #257a51;
  --accent-soft: rgba(47, 155, 103, 0.1);
  --danger: #c44d77;
  --focus: #25c3d8;
  --shadow: 0 28px 60px rgba(25, 35, 66, 0.12);
  --shadow-soft: 0 14px 34px rgba(25, 35, 66, 0.08);
  --font-sans: "DM Sans", "Aptos", "Segoe UI", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(47, 155, 103, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(73, 181, 138, 0.1), transparent 22%),
    linear-gradient(180deg, #f7f9ff 0%, var(--page-bg) 52%, var(--page-bg-deep) 100%);
  font-family: var(--font-sans);
}

button,
input,
select {
  font: inherit;
}

button,
.paper-card,
.primary-button,
.hero-sheet,
.mini-card,
.card,
.preview-meta span {
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.shell {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.surface {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 17px;
  background: linear-gradient(135deg, #43b37c 0%, #2f9b67 52%, #7ed3a8 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 16px 30px rgba(47, 155, 103, 0.24);
}

.brand-copy h1 {
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.05;
}

.brand-copy p {
  color: var(--muted);
  font-size: 14px;
}

.topbar-note,
.preview-meta span,
.sheet-chip {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(47, 155, 103, 0.12));
  color: var(--accent-strong);
  border: 1px solid rgba(47, 155, 103, 0.16);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.topbar-note {
  padding: 10px 14px;
  font-family: var(--font-sans);
  letter-spacing: 0;
  font-size: 13px;
  text-decoration: none;
}

.hero {
  padding: 18px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.hero-card,
.card {
  background: rgba(255, 255, 255, 0.86);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  padding: 22px;
}

.kicker,
.card-label,
.workspace-kicker {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card h2 {
  margin: 10px 0 12px;
  font-size: 38px;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 58ch;
}

.mini-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.mini-card {
  padding: 13px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
}

.mini-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.hero-sheet {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(47, 155, 103, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-chip {
  display: inline-block;
  padding: 8px 12px;
}

.hero-sheet-preview {
  flex: 1;
  min-height: 190px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(104, 136, 121, 0.12);
  padding: 24px 20px 18px 44px;
  position: relative;
  display: grid;
  align-content: start;
  gap: 18px;
  overflow: hidden;
}

.hero-sheet-preview::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 30px;
  width: 2px;
  background: rgba(198, 64, 64, 0.72);
}

.preview-rule {
  height: 2px;
  background: rgba(168, 196, 224, 0.88);
}

.preview-rule.red {
  background: rgba(198, 64, 64, 0.4);
}

.app-grid {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
  flex: 1;
}

.sidebar {
  min-width: 0;
}

.card {
  padding: 18px;
}

.section-heading strong,
.workspace-title-wrap strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.controls-panel form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.field legend,
.four-column span {
  color: var(--ink);
  font-weight: 700;
}

.compact {
  margin-top: 4px;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(47, 155, 103, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 14px;
  color: var(--ink);
}

input[type="color"] {
  min-height: 48px;
  padding: 6px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

fieldset {
  border: 1px solid rgba(47, 155, 103, 0.12);
  border-radius: 20px;
  padding: 14px 16px 16px;
  margin: 0;
  background: rgba(255, 255, 255, 0.52);
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.paper-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 13px;
  border-radius: 16px;
  border: 1px solid rgba(47, 155, 103, 0.12);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
}

.paper-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.paper-card:has(input:checked) {
  border-color: rgba(47, 155, 103, 0.58);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(47, 155, 103, 0.12));
  box-shadow: 0 14px 28px rgba(47, 155, 103, 0.14);
}

.paper-card span {
  font-weight: 700;
  line-height: 1.15;
}

.paper-card small {
  color: var(--muted);
  font-size: 12px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 8px;
}

.checkbox-grid label,
.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 500;
}

.checkbox-grid input,
.toggle-line input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.two-column,
.four-column {
  display: grid;
  gap: 12px;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.four-column {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.four-column label {
  display: grid;
  gap: 8px;
}

.four-column input {
  min-width: 0;
}

.swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(47, 155, 103, 0.16), var(--shadow-soft);
  padding: 0;
}

.range-field span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.hidden,
.conditional {
  display: none;
}

.conditional.visible {
  display: grid;
}

button {
  border: none;
  border-radius: 16px;
  padding: 13px 16px;
  font-weight: 700;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #43b37c 0%, #2f9b67 100%);
  color: #fff;
  box-shadow: 0 20px 30px rgba(47, 155, 103, 0.24);
}

.primary-button:hover:not(:disabled) {
  box-shadow: 0 24px 34px rgba(47, 155, 103, 0.28);
}

.progress-wrap {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(47, 155, 103, 0.1);
  border: 1px solid rgba(47, 155, 103, 0.12);
}

#progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #43b37c, #25c3d8);
  transition: width 120ms ease;
}

.status-message {
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.preview-meta span {
  padding: 8px 12px;
}

.worksheet-preview {
  flex: 1;
  min-height: 640px;
  padding: 16px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(233, 248, 240, 0.92)),
    repeating-linear-gradient(45deg, rgba(104, 136, 121, 0.04) 0 18px, rgba(104, 136, 121, 0.06) 18px 36px);
}

.canvas-stage {
  height: 100%;
  min-height: 608px;
  display: grid;
  place-items: center;
  overflow: auto;
}

#page-preview {
  max-width: 100%;
  max-height: 78vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(25, 35, 66, 0.18);
}

@media (max-width: 1060px) {
  .hero-grid,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .worksheet-preview {
    min-height: 520px;
  }

  .canvas-stage {
    min-height: 488px;
  }
}

@media (max-width: 720px) {
  .wrap {
    padding: 14px;
  }

  .shell {
    min-height: calc(100vh - 28px);
  }

  .topbar {
    padding: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-card h2 {
    font-size: 30px;
  }

  .mini-features,
  .paper-grid,
  .two-column,
  .four-column,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .preview-header {
    flex-direction: column;
  }

  .workspace,
  .hero,
  .card {
    padding: 16px;
  }
}
