/* Minimal light-first workshop */
:root {
  --lw-bg: #f8f9fb;
  --lw-surface: #ffffff;
  --lw-ink: #1a2332;
  --lw-muted: #6b7280;
  --lw-line: #e2e8f0;
  --lw-accent: #2563eb;
  --lw-accent-hover: #1d4ed8;
  --lw-err: #b91c1c;
  --lw-ok: #047857;
  --lw-radius: 8px;
}

body.lw-dark {
  --lw-bg: #111827;
  --lw-surface: #1f2937;
  --lw-ink: #f3f4f6;
  --lw-muted: #9ca3af;
  --lw-line: #374151;
  --lw-accent: #60a5fa;
  --lw-accent-hover: #93c5fd;
  --lw-err: #fca5a5;
  --lw-ok: #6ee7b7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--lw-ink);
  background: var(--lw-bg);
  min-height: 100vh;
}

.lw-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--lw-surface);
  border-bottom: 1px solid var(--lw-line);
}

.lw-top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--lw-ink);
  font-weight: 700;
  font-size: 0.9rem;
}

.lw-top-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--lw-accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.lw-top-tag {
  font-size: 0.68rem;
  color: var(--lw-muted);
  font-weight: 500;
}

.lw-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lw-top-back {
  color: var(--lw-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
}

.lw-top-back:hover {
  color: var(--lw-ink);
  text-decoration: underline;
}

.lw-theme-btn {
  border: 1px solid var(--lw-line);
  background: var(--lw-surface);
  color: var(--lw-muted);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.lw-theme-btn:hover {
  border-color: var(--lw-accent);
  color: var(--lw-ink);
}

.lw-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.lw-intro h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lw-intro p {
  margin: 0 0 20px;
  color: var(--lw-muted);
  font-size: 0.9rem;
  max-width: 48ch;
}

.lw-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lw-line);
}

.lw-rail button {
  border: 1px solid var(--lw-line);
  background: var(--lw-surface);
  color: var(--lw-muted);
  border-radius: var(--lw-radius);
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.lw-rail button:hover {
  border-color: #cbd5e1;
  color: var(--lw-ink);
}

.lw-rail button.is-on {
  border-color: var(--lw-accent);
  color: var(--lw-accent);
  background: #eff6ff;
}

body.lw-dark .lw-rail button.is-on {
  background: rgba(37, 99, 235, 0.15);
}

.lw-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 768px) {
  .lw-grid { grid-template-columns: 1fr; }
}

.lw-source {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lw-card {
  background: var(--lw-surface);
  border: 1px solid var(--lw-line);
  border-radius: var(--lw-radius);
  padding: 14px;
}

.lw-card-title {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lw-muted);
}

.lw-drop {
  border: 1px dashed #cbd5e1;
  border-radius: var(--lw-radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  background: var(--lw-bg);
}

.lw-drop:hover {
  border-color: var(--lw-accent);
}

.lw-drop.has-file {
  border-style: solid;
  border-color: var(--lw-ok);
  background: #f0fdf4;
}

body.lw-dark .lw-drop.has-file {
  background: rgba(4, 120, 87, 0.1);
}

.lw-drop.lw-invalid {
  border-color: var(--lw-err);
  background: #fef2f2;
}

.lw-drop strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
}

.lw-drop span {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--lw-muted);
}

.lw-thumb {
  min-height: 96px;
  border: 1px solid var(--lw-line);
  border-radius: var(--lw-radius);
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

body.lw-dark .lw-thumb {
  background: #111827;
}

.lw-thumb img {
  max-width: 100%;
  max-height: 100px;
  object-fit: contain;
}

.lw-field {
  margin-bottom: 12px;
}

.lw-field:last-child {
  margin-bottom: 0;
}

.lw-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--lw-ink);
}

.lw-field input,
.lw-field select,
.lw-select-inline {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--lw-line);
  border-radius: 6px;
  background: var(--lw-surface);
  color: var(--lw-ink);
  font-size: 0.88rem;
  font-family: inherit;
}

.lw-select-inline {
  width: auto;
  min-width: 72px;
}

.lw-field input:focus,
.lw-field select:focus,
.lw-select-inline:focus {
  outline: 2px solid var(--lw-accent);
  outline-offset: 0;
  border-color: var(--lw-accent);
}

.lw-field input.lw-invalid,
.lw-field select.lw-invalid {
  border-color: var(--lw-err);
  outline-color: var(--lw-err);
}

.lw-field-msg {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--lw-err);
  min-height: 1em;
}

.lw-field-msg:empty {
  display: none;
}

.lw-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lw-tool-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

.lw-tool-head p {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--lw-muted);
}

.lw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lw-btn {
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--lw-accent);
  color: #fff;
}

.lw-btn:hover:not(:disabled) {
  background: var(--lw-accent-hover);
}

.lw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lw-btn-outline {
  background: var(--lw-surface);
  color: var(--lw-accent);
  border: 1px solid var(--lw-line);
}

.lw-packs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.lw-pack {
  border: 1px solid var(--lw-line);
  background: var(--lw-surface);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--lw-muted);
}

.lw-pack.is-on {
  border-color: var(--lw-accent);
  color: var(--lw-accent);
  background: #eff6ff;
}

.lw-packs.lw-invalid .lw-pack {
  border-color: var(--lw-err);
}

.lw-note,
.lw-warn {
  font-size: 0.82rem;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--lw-line);
  background: var(--lw-bg);
  color: var(--lw-muted);
}

.lw-warn {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--lw-err);
}

body.lw-dark .lw-warn {
  background: rgba(185, 28, 28, 0.12);
}

.lw-mail-guide {
  margin-bottom: 14px;
}

.lw-steps {
  margin: 10px 0 0;
  padding-left: 1.25rem;
  font-size: 0.82rem;
  color: var(--lw-ink);
}

.lw-steps li {
  margin-bottom: 6px;
}

.lw-steps li::marker {
  font-weight: 700;
  color: var(--lw-accent);
}

.lw-mail-reminder {
  font-size: 0.88rem;
}

.lw-mail-reminder code {
  font-size: 0.8rem;
  background: var(--lw-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.lw-status {
  font-size: 0.82rem;
  color: var(--lw-muted);
  min-height: 1.2em;
  padding: 0 2px;
}

.lw-status.is-err { color: var(--lw-err); font-weight: 600; }
.lw-status.is-ok { color: var(--lw-ok); font-weight: 600; }

.lw-results {
  min-height: 180px;
  border: 1px solid var(--lw-line);
  border-radius: var(--lw-radius);
  background: var(--lw-surface);
  padding: 14px;
}

.lw-results-empty {
  text-align: center;
  color: var(--lw-muted);
  font-size: 0.85rem;
  padding: 36px 12px;
}

.lw-results img,
.lw-results object {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  object-fit: contain;
  border: 1px solid var(--lw-line);
  border-radius: 6px;
  background: #fff;
}

.lw-assets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.lw-asset {
  border: 1px solid var(--lw-line);
  border-radius: 6px;
  padding: 8px;
  font-size: 0.68rem;
  text-align: center;
}

.lw-asset img {
  width: 100%;
  height: 56px;
  object-fit: contain;
  margin-bottom: 4px;
}

.lw-asset a {
  color: var(--lw-accent);
  font-weight: 600;
  text-decoration: none;
}

.lw-asset a:hover {
  text-decoration: underline;
}

.lw-mod {
  font-size: 0.78rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--lw-line);
  color: var(--lw-muted);
}

.lw-mod a {
  color: var(--lw-accent);
  font-weight: 600;
}
