:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f3f8f6;
  --ink: #17221f;
  --muted: #66736f;
  --line: #d9e3df;
  --green: #07563f;
  --green-dark: #064432;
  --green-soft: #e1f3e9;
  --cyan: #009fd4;
  --cyan-dark: #007ca7;
  --cyan-soft: #dff4fb;
  --coral: #d94f3d;
  --coral-soft: #fde8e4;
  --amber: #d96d0b;
  --shadow: 0 14px 34px rgba(13, 55, 44, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 0;
  background: var(--page);
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  background-color: var(--page);
  background-image: url("./festival-background-v2.png");
  background-position: center top;
  background-repeat: repeat-y;
  background-size: min(100%, 1024px) auto;
  color: var(--ink);
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

:focus-visible {
  outline: 3px solid rgba(0, 159, 212, 0.28);
  outline-offset: 3px;
}

.campaign-bar,
.staff-topbar {
  background: var(--green);
  color: #ffffff;
  box-shadow: 0 3px 0 rgba(3, 58, 42, 0.1);
}

.staff-topbar {
  position: relative;
  z-index: 20;
}

.campaign-bar {
  min-height: 104px;
}

.brand-lockup {
  display: flex;
  width: min(100%, 680px);
  min-height: 104px;
  align-items: center;
  margin: 0 auto;
  padding: 10px 18px;
  color: #ffffff;
  text-decoration: none;
}

.brand-lockup img {
  width: 142px;
  height: auto;
  max-height: 84px;
  object-fit: contain;
}

.visitor-shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 40px 18px 34px;
}

.campaign-intro {
  max-width: 590px;
  margin: 0 auto;
  text-align: center;
}

.campaign-intro h1 {
  margin: 0;
  color: var(--green);
  font-size: 2rem;
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: 0;
}

.campaign-intro p {
  max-width: 540px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.55;
}

.redemption-flow {
  margin-top: 32px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  position: relative;
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 9px;
  padding: 0 4px;
  color: #89928f;
  text-align: center;
}

.steps li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 19px;
  left: calc(50% + 24px);
  width: calc(100% - 48px);
  height: 2px;
  background: var(--line);
  content: "";
}

.steps li[data-state="complete"]:not(:last-child)::after {
  background: var(--green);
}

.step-number {
  position: relative;
  z-index: 1;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid #a8b0ad;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 850;
}

.step-label {
  max-width: 130px;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.3;
}

.steps li[data-state="active"] {
  color: var(--cyan-dark);
}

.steps li[data-state="active"] .step-number {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  color: var(--cyan-dark);
}

.steps li[data-state="complete"] {
  color: var(--green);
}

.steps li[data-state="complete"] .step-number {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.visitor-actions,
.form-stack,
.camera-actions {
  display: grid;
  gap: 12px;
}

.visitor-actions {
  margin-top: 30px;
}

.button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 20px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.button svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button svg .icon-fill {
  fill: currentColor;
  stroke: none;
}

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

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

#redeemButton:disabled {
  border: 1px solid #b8c2be;
  background: rgba(255, 255, 255, 0.82);
  color: #7d8984;
  opacity: 1;
}

.button-primary {
  background: var(--green);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  background: var(--green-dark);
}

.button-instagram {
  background: var(--cyan);
  color: #ffffff;
}

.button-instagram:hover {
  background: var(--cyan-dark);
}

.button-outline {
  border: 2px solid var(--green);
  background: var(--surface);
  color: var(--green);
}

.button-quiet {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.flow-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.flow-message.is-success {
  color: var(--green);
  font-weight: 750;
}

.flow-message.is-danger {
  color: var(--coral);
  font-weight: 750;
}

.campaign-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 24px 0 0;
  color: #46534f;
  font-size: 0.91rem;
  line-height: 1.45;
}

.campaign-note svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  color: var(--cyan-dark);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.voucher-panel {
  margin-top: 34px;
  border: 1px solid #cce0d6;
  border-radius: var(--radius);
  background: #fbfdfc;
  box-shadow: var(--shadow);
  padding: 22px 18px 24px;
}

.voucher-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.success-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
}

.success-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.voucher-heading h2 {
  margin: 1px 0 0;
  color: var(--green);
  font-size: 1.35rem;
  line-height: 1.2;
}

.voucher-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.qr-code {
  display: grid;
  width: min(72vw, 270px);
  aspect-ratio: 1;
  place-items: center;
  margin: 24px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
}

.qr-code svg {
  width: 100%;
  height: 100%;
}

.voucher-code {
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 14px;
  border: 1px dashed #8d9a95;
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--green);
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.button-copy {
  width: min(100%, 330px);
  margin: 0 auto;
  background: var(--green);
  color: #ffffff;
}

.voucher-instruction {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 18px 0 0;
  color: var(--green);
  font-weight: 750;
  text-align: center;
}

.voucher-instruction svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.staff-topbar-inner {
  display: grid;
  width: min(100%, 800px);
  min-height: 94px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin: 0 auto;
  padding: 12px 18px;
}

.staff-brand-logo {
  width: 118px;
  height: auto;
  max-height: 72px;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  object-fit: contain;
}

.staff-heading {
  min-width: 0;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  text-align: left;
}

.staff-heading h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.15;
}

.staff-heading p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.84rem;
}

.topbar-action,
.text-icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 750;
}

.topbar-actions {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  grid-column: 3;
  grid-row: 1;
  align-items: center;
  justify-self: end;
}

.topbar-icon-button,
.dialog-close-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
}

.topbar-icon-button {
  color: #ffffff;
}

.topbar-icon-button:hover,
.topbar-icon-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
}

.topbar-icon-button svg,
.dialog-close-button svg,
.admin-menu svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.admin-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 236px;
  overflow: hidden;
  border: 1px solid #c9d8d2;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(8, 55, 42, 0.2);
  color: var(--ink);
  z-index: 30;
}

.admin-menu button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 15px;
  cursor: pointer;
  text-align: left;
  font-weight: 750;
}

.admin-menu button:hover {
  background: var(--surface-soft);
  color: var(--green);
}

.admin-menu svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.admin-menu-divider {
  height: 1px;
  background: var(--line);
}

.topbar-action {
  min-height: 44px;
  flex: 0 0 auto;
  color: #ffffff;
  padding: 0 2px;
}

.topbar-action svg,
.text-icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.staff-shell {
  width: min(100%, 800px);
  margin: 0 auto;
  padding: 0 18px 34px;
}

.network-status {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.network-status > span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #98a29f;
}

.network-status[data-state="online"] {
  color: var(--green);
}

.network-status[data-state="online"] > span {
  background: #14a35b;
  box-shadow: 0 0 0 4px rgba(20, 163, 91, 0.12);
}

.network-status[data-state="offline"] {
  color: var(--coral);
}

.network-status[data-state="offline"] > span {
  background: var(--coral);
}

.login-panel {
  max-width: 520px;
  margin: 48px auto 0;
  border: 1px solid #ccddd6;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  padding: 24px;
  box-shadow: var(--shadow);
}

.login-copy h2 {
  margin: 0;
  color: var(--green);
  font-size: 1.45rem;
}

.login-copy p {
  margin: 8px 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.form-stack label {
  color: var(--green);
  font-size: 0.92rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 56px;
  border: 1px solid #aab5b1;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 15px;
  font-size: 1.05rem;
  font-weight: 700;
}

input::placeholder {
  color: #8a9591;
  font-weight: 600;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 159, 212, 0.16);
  outline: 0;
}

input:disabled {
  background: #f1f3f2;
}

.form-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--coral);
  font-size: 0.92rem;
  font-weight: 750;
}

.stock-overview {
  padding: 24px 0 20px;
}

.stock-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.stock-label strong {
  color: var(--green);
  font-size: 1rem;
}

.stock-overview p {
  margin: 6px 0 12px;
  font-size: 1rem;
}

.stock-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #e3e7e5;
}

.stock-progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 260ms ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-item {
  min-width: 0;
  padding: 18px 8px;
  text-align: center;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--line);
}

.stat-item span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  line-height: 1.2;
}

.stat-item strong {
  display: block;
  margin-top: 7px;
  color: var(--green);
  font-size: 2rem;
  line-height: 1;
}

.stat-pending strong {
  color: var(--amber);
}

.stat-remaining strong {
  color: var(--cyan-dark);
}

.validation-workspace {
  padding: 28px 0 30px;
}

.validation-workspace h2,
.history-section h2 {
  margin: 0;
  color: var(--green);
  font-size: 1.35rem;
}

.validation-workspace .form-stack {
  margin-top: 20px;
}

#codeInput {
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-size: 1.3rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.camera-actions {
  margin-top: 12px;
}

.scanner-mode-hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.camera-panel {
  position: relative;
  margin-top: 14px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #07130f;
}

.live-qr-reader,
.live-qr-reader video,
.live-qr-reader img {
  display: block;
  width: 100%;
}

.live-qr-reader video,
.live-qr-reader img {
  min-height: 260px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #07130f;
}

.live-qr-reader canvas {
  max-width: 100%;
}

.validation-result {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  border: 1px solid #58ba7f;
  border-radius: var(--radius);
  background: var(--green-soft);
  padding: 16px;
  color: var(--green);
}

.validation-result.is-danger {
  border-color: #ec9b90;
  background: var(--coral-soft);
  color: #a63326;
}

.result-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #16a35b;
  color: #ffffff;
}

.result-icon::after {
  content: "✓";
  font-size: 1.65rem;
  font-weight: 900;
}

.is-danger .result-icon {
  background: var(--coral);
}

.is-danger .result-icon::after {
  content: "!";
}

.validation-result strong,
.validation-result span {
  display: block;
}

.validation-result strong {
  font-size: 1.2rem;
  line-height: 1.2;
}

.validation-result div > span {
  margin-top: 4px;
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-size: 1rem;
}

.history-section {
  border-top: 1px solid var(--line);
  padding-top: 26px;
}

.place-footer {
  width: 100%;
  overflow: hidden;
  margin-top: auto;
  background: transparent;
}

.place-footer img {
  display: block;
  width: 100%;
  height: clamp(118px, 18vw, 210px);
  object-fit: cover;
  object-position: center bottom;
}

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

.text-icon-button {
  min-height: 44px;
  flex: 0 0 auto;
  color: var(--green);
  padding: 0;
}

.history-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}

.history-status {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: #159856;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
}

.history-list strong {
  min-width: 0;
  color: var(--ink);
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.history-list time,
.history-list .empty-history {
  color: var(--muted);
  font-size: 0.86rem;
}

.history-list .empty-history {
  grid-column: 1 / -1;
  padding: 20px 0;
}

.last-updated {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.admin-dialog {
  width: min(calc(100% - 32px), 470px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid #c9d8d2;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 0;
  box-shadow: 0 24px 70px rgba(6, 45, 34, 0.28);
}

.admin-dialog::backdrop {
  background: rgba(3, 28, 21, 0.58);
  backdrop-filter: blur(2px);
}

.admin-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.admin-dialog-header span {
  display: block;
  color: var(--cyan-dark);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-dialog-header h2 {
  margin: 3px 0 0;
  color: var(--green);
  font-size: 1.3rem;
  line-height: 1.2;
}

.dialog-close-button {
  flex: 0 0 auto;
  color: var(--muted);
}

.dialog-close-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.admin-dialog-content {
  padding: 22px 20px 24px;
}

.admin-dialog-content > p:first-child {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-stock-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.admin-stock-summary div {
  min-width: 0;
  padding: 14px 6px;
  text-align: center;
}

.admin-stock-summary div + div {
  border-left: 1px solid var(--line);
}

.admin-stock-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.2;
}

.admin-stock-summary strong {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 1.45rem;
}

.admin-settings-form {
  margin-top: 22px;
}

.staff-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  width: min(calc(100% - 36px), 440px);
  min-height: 50px;
  margin: 0 auto;
  border: 1px solid #58ba7f;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--green);
  padding: 14px 16px;
  box-shadow: 0 14px 34px rgba(13, 55, 44, 0.18);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  z-index: 50;
}

.staff-toast.is-danger {
  border-color: #ec9b90;
  color: #a63326;
}

@media (min-width: 640px) {
  .campaign-intro h1 {
    font-size: 2.75rem;
  }

  .visitor-shell {
    padding-top: 48px;
  }

  .brand-lockup img {
    width: 168px;
  }

  .visitor-actions {
    grid-template-columns: 1fr 1fr;
  }

  .voucher-panel {
    padding: 28px 32px 30px;
  }

  .staff-heading h1 {
    font-size: 1.15rem;
  }

  .staff-brand-logo {
    width: 132px;
    max-height: 76px;
  }

  .stat-item span {
    font-size: 0.84rem;
  }

  .stat-item strong {
    font-size: 2.3rem;
  }
}

@media (max-width: 420px) {
  .staff-topbar-inner {
    min-height: 90px;
    gap: 8px;
    padding-inline: 12px;
  }

  .staff-brand-logo {
    width: 98px;
    max-height: 64px;
  }

  .staff-heading h1 {
    max-width: 104px;
    font-size: 0.88rem;
  }

  .staff-heading p {
    max-width: 104px;
    font-size: 0.72rem;
  }

  .admin-menu {
    position: fixed;
    top: 82px;
    right: 12px;
  }

  .place-footer img {
    width: 125%;
    height: 130px;
    max-width: none;
    margin-left: -12.5%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

