:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #fffdf8;
  --text: #1f2933;
  --muted: #52606d;
  --border: rgba(31, 41, 51, 0.08);
  --accent: #d96c06;
  --accent-strong: #8d3c06;
  --shadow: 0 18px 60px rgba(73, 54, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(217, 108, 6, 0.18), transparent 34%),
    linear-gradient(160deg, #f8f0df 0%, #f7f3ea 45%, #ece8df 100%);
}

main {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 24px;
}

h1,
p {
  margin: 0;
}

.submit-page,
.admin-page,
.visualisation-page {
  display: flex;
  align-items: center;
}

.admin-page {
  align-items: stretch;
}

.visualisation-page {
  min-height: 100vh;
  align-items: stretch;
  background: #f7f3ea;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel-narrow {
  width: min(100%, 520px);
  padding: 28px;
}

.panel-wide {
  padding: 24px;
}

.layout {
  width: min(100%, 1280px);
  min-height: calc(100vh - 48px);
  display: flex;
  min-width: 0;
  min-height: 0;
}

.visualisation-layout {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 24px;
}

#display-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede,
.fine-print,
.stats,
.status {
  color: var(--muted);
}

.lede {
  margin-top: 12px;
  font-size: 1.05rem;
}

.fine-print {
  margin-top: 16px;
  font-size: 0.92rem;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

input,
button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  font: inherit;
}

input {
  padding: 16px 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(31, 41, 51, 0.1);
}

button {
  padding: 16px 18px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  width: auto;
  min-width: 120px;
  background: #fff3e7;
  color: var(--accent-strong);
  border: 1px solid rgba(141, 60, 6, 0.12);
}

button:hover {
  filter: brightness(0.98);
}

.status {
  min-height: 1.5em;
  margin-top: 14px;
}

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.generator-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.file-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.generator-controls input {
  width: 110px;
  padding: 14px 16px;
}

.file-controls input {
  width: 240px;
  padding: 12px 14px;
  background: var(--panel-strong);
  border: 1px solid rgba(31, 41, 51, 0.1);
}

.stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 0.96rem;
}

.cloud {
  position: relative;
  flex: 1;
  margin-top: 26px;
  padding: 20px;
  overflow: hidden;
  min-height: 0;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.7);
  border: 1px solid rgba(31, 41, 51, 0.06);
}

.visualisation-cloud {
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
  overflow: hidden;
  padding: 0;
  background: #f7f3ea;
}

.visualisation-qr-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
  height: calc(100vh - 48px);
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(31, 41, 51, 0.08);
  box-shadow: var(--shadow);
}

.visualisation-qr-image {
  display: block;
  width: 100%;
  max-width: 184px;
  height: auto;
}

.visualisation-qr-copy {
  width: 100%;
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.visualisation-qr-copy-small {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 400;
}

.cloud-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.cloud-stage span {
  transition: color 160ms ease;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.1rem;
}

.empty-state[hidden] {
  display: none !important;
}

#display-panel:fullscreen {
  width: 100%;
  height: 100vh;
  max-width: none;
  padding: 28px;
  border-radius: 0;
}

#display-panel:fullscreen .cloud {
  min-height: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .submit-page,
  .admin-page,
  .visualisation-page {
    align-items: stretch;
  }

  main {
    padding: 16px;
  }

  .layout {
    min-height: calc(100vh - 32px);
  }

  .panel-narrow,
  .panel-wide {
    padding: 20px;
    border-radius: 20px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    flex-direction: column;
  }

  .generator-controls {
    width: 100%;
    flex-direction: column;
  }

  .file-controls {
    width: 100%;
    flex-direction: column;
  }

  .generator-controls input {
    width: 100%;
  }

  .file-controls input {
    width: 100%;
  }

  button.secondary {
    width: 100%;
  }

  .cloud {
    padding: 16px;
  }

  .visualisation-cloud {
    height: auto;
    min-height: calc(100vh - 224px);
  }

  .visualisation-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 16px;
  }

  .visualisation-qr-panel {
    height: auto;
    padding: 14px;
    justify-content: center;
    align-items: center;
  }

  .visualisation-qr-image {
    max-width: 132px;
  }
}
