@import url("../assets/brand/windwalker-brand.css?v=7");

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent-hover: #5ba3ff;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.app-header {
  margin-bottom: 1.25rem;
}

.app-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel--form {
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  position: sticky;
  top: 1rem;
}

@media (max-width: 900px) {
  .panel--form {
    position: static;
    max-height: none;
  }
}

.form {
  padding: 1rem 1.1rem 1.25rem;
}

.form-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.form-section summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-section summary::-webkit-details-marker {
  display: none;
}

.form-section summary::after {
  content: "▾";
  font-size: 0.65rem;
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.form-section:not([open]) summary::after {
  transform: rotate(-90deg);
}

.form-section__body {
  padding: 0 1rem 0.85rem;
  border-top: 1px solid rgba(45, 58, 77, 0.6);
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem 1rem;
}

legend {
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

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

.field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

.field--checkbox .label {
  margin: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field-row .field {
  margin-bottom: 0;
}

.label {
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
}

input[type="file"] {
  font-size: 0.8rem;
  color: var(--muted);
}

.hint {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hint--solution-note {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 0.76rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
}

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

.btn--primary {
  background: var(--accent);
  color: #fff;
}

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

.btn--secondary {
  background: var(--border);
  color: var(--text);
}

.btn--secondary:hover:not(:disabled) {
  filter: brightness(1.15);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.45rem 0.75rem;
  font-weight: 500;
  font-size: 0.85rem;
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.25em;
}

.panel--preview {
  min-height: 320px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.preview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: repeating-conic-gradient(#1e2838 0% 25%, #161d28 0% 50%) 50% / 24px 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.75rem;
}

.preview-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#maze-canvas {
  display: block;
  max-width: 100%;
  max-height: min(75vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: transparent;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.server-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: #e94560;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ── WindWalker footer + sample watermark ─────────────────────────── */
.site-footer {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem 1.35rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  max-width: 100%;
}

.site-footer__link:hover {
  color: var(--accent-hover);
}

.site-footer__logo {
  height: 36px;
  width: auto;
  max-width: min(200px, 55vw);
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

/**
 * Mark sample pages with class `page-sample` on <body>.
 * Large faint fixed watermark (UI); canvas also gets a light brand stamp when #sample-brand-watermark is preloaded.
 */
body.page-sample {
  position: relative;
}

body.page-sample::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../assets/brand/windwalker-composition.png?v=3") center 42% / min(62vmin, 520px) no-repeat;
  opacity: 0.055;
}

body.page-sample .app {
  position: relative;
  z-index: 1;
}
