/* theme.css — design tokens, blue theme, bead-board background & components. */

:root {
  /* Brand blues */
  --brand: #2563eb;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e3a8a;
  --brand-900: #172554;
  --brand-100: #dbeafe;
  --brand-50: #eff6ff;

  /* Surfaces & text */
  --bg: #eef4ff;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --text: #0f172a;
  --muted: #5b6b85;
  --border: #d7e3f6;
  --stroke: #cfd8e3;

  /* Accents */
  --accent: #f97316;
  --ok: #16a34a;

  /* Shape */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
  --shadow-sm: 0 4px 14px rgba(37, 99, 235, 0.10);

  --maxw: 1180px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  /* Bead-board dotted background */
  background-image:
    radial-gradient(circle at 10px 10px, rgba(37, 99, 235, 0.06) 3px, transparent 4px),
    radial-gradient(circle at 30px 30px, rgba(249, 115, 22, 0.05) 3px, transparent 4px);
  background-size: 40px 40px, 40px 40px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Decorative cartoon/anime floating shapes in the corners */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}
body::before {
  top: -40px; left: -40px;
  width: 220px; height: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%232563eb' stroke-width='4' opacity='0.6'%3E%3Ccircle cx='40' cy='40' r='22'/%3E%3Ccircle cx='120' cy='60' r='14'/%3E%3Ccircle cx='70' cy='130' r='18'/%3E%3Cpath d='M150 120 q30 -10 20 25 q-25 10 -20 -25'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
}
body::after {
  bottom: -30px; right: -30px;
  width: 240px; height: 240px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='%23f97316' opacity='0.35'%3E%3Cpath d='M100 30 l18 36 40 6 -29 28 7 40 -36 -19 -36 19 7 -40 -29 -28 40 -6z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
}

/* Keep content above decorations */
.site-header, .site-footer, main, .page { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-700); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ---------- Header / Footer ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--brand-900); text-decoration: none; }
.logo-icon { flex: none; }
.site-nav { display: flex; gap: 8px; }
.site-nav a {
  padding: 8px 16px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.site-nav a:hover { background: var(--brand-50); color: var(--brand-700); }
.site-nav a.is-active { background: var(--brand); color: #fff; }

.site-footer {
  max-width: var(--maxw);
  margin: 40px auto 0;
  padding: 28px 24px 48px;
  text-align: center;
  color: var(--muted);
  border-top: 1px dashed var(--border);
}
.site-footer .sign { font-weight: 700; color: var(--brand-800); margin-top: 4px; }

/* ---------- Forms ---------- */
input[type="range"] { width: 100%; accent-color: var(--brand); }
input[type="checkbox"], input[type="file"] { accent-color: var(--brand); }
select {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px;
}
label { font-size: 14px; color: var(--muted); }

.error { color: #dc2626; }
.empty { color: var(--muted); }

/* ---------- Whiteboard editor ---------- */
.wb { display: grid; grid-template-columns: 180px 1fr 240px; gap: 16px; align-items: start; }
.wb-palette {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; max-height: 520px; overflow: auto;
}
.wb-swatch {
  width: 100%; aspect-ratio: 1 / 1; border: 1px solid rgba(0,0,0,.15);
  border-radius: 6px; cursor: pointer; padding: 0;
}
.wb-swatch.is-selected { outline: 3px solid var(--brand); outline-offset: 1px; }
.wb-main { display: flex; flex-direction: column; gap: 10px; }
.wb-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.wb-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.wb-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wb-btn {
  padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.wb-btn:hover { background: var(--brand-50); }
.wb-btn.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.wb-check { display: inline-flex; align-items: center; gap: 4px; }
.wb-canvas-wrap { display: flex; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.wb-canvas { image-rendering: pixelated; max-width: 100%; touch-action: none; cursor: crosshair; background: #fff; }
.wb-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.wb-side h3 { margin: 0 0 8px; font-size: 15px; }
.wb-materials { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow: auto; margin-bottom: 14px; }
.wb-mat { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.wb-mat-sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); flex: none; }
.wb-mat-id { font-weight: 700; width: 34px; }
.wb-mat-name { flex: 1; color: var(--muted); }
.wb-mat-n { font-weight: 700; }
.wb-empty { color: var(--muted); font-size: 13px; }
.wb-export { display: flex; gap: 6px; }
.wb-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.wb-check input { margin: 0; }

/* ---------- Lightbox (inspiration) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55);
}
.lightbox.is-open { display: flex; }
.lightbox-panel {
  position: relative; background: var(--surface); border-radius: var(--radius);
  padding: 22px; max-width: 460px; width: calc(100% - 40px); text-align: center;
  box-shadow: var(--shadow);
}
.lightbox-close { position: absolute; top: 8px; right: 12px; border: none; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.lightbox-canvas-wrap { display: flex; justify-content: center; margin: 12px 0; }
.lightbox-canvas { image-rendering: pixelated; background: #fff; border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
.lightbox-tip { color: var(--muted); font-size: 14px; }
.lightbox-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

/* ---------- Misc ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px; }
.section-title { font-size: 26px; font-weight: 800; color: var(--brand-900); margin: 0 0 4px; }
.section-sub { color: var(--muted); margin: 0 0 20px; }
.hidden { display: none !important; }
