:root {
  color-scheme: light;
  --bg: #f2f4ef;
  --ink: #1e2320;
  --muted: #687067;
  --brick: #a74228;
  --brick-dark: #6e2c1e;
  --paper: rgba(255, 255, 255, 0.72);
  --line: rgba(30, 35, 32, 0.12);
  --shadow: 0 28px 70px rgba(84, 48, 31, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 18%, rgba(167, 66, 40, 0.12), transparent 28%),
    linear-gradient(135deg, #f7f2e8 0%, var(--bg) 52%, #e6ece4 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.home,
.brick-stage,
.brick-button,
.brick-button img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button,
input,
a {
  font: inherit;
}

.home {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.brick-stage {
  width: min(920px, 100%);
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(46px, 10vw, 112px);
  line-height: 0.92;
  letter-spacing: 0;
}

.brick-button {
  display: block;
  width: min(430px, 82vw);
  margin: 28px auto 20px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(var(--shadow));
  transform: translate3d(var(--brick-x, 0px), var(--brick-y, 0px), 0) rotate(var(--brick-tilt, 0deg));
  transition: filter 180ms ease;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.brick-button:hover,
.brick-button:focus-visible {
  --brick-tilt: -1deg;
  filter: drop-shadow(0 34px 80px rgba(84, 48, 31, 0.28));
  outline: 0;
}

.brick-button[data-mood="evade"] {
  --brick-tilt: -3deg;
  cursor: grab;
}

.brick-button[data-mood="curious"] {
  --brick-tilt: 2deg;
}

.brick-button.is-catchable {
  --brick-tilt: 0deg;
}

.brick-button.is-catchable img {
  animation: catchable-pulse 900ms ease-in-out infinite alternate;
}

.brick-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

@keyframes catchable-pulse {
  from {
    filter: saturate(1);
  }

  to {
    filter: saturate(1.18) brightness(1.04);
  }
}

.join-form {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(30, 35, 32, 0.08);
  text-align: left;
}

.join-form[hidden] {
  display: none;
}

.join-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.join-form__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

.join-form button,
.back-link,
.admin-toolbar button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  padding: 0 18px;
  background: var(--brick);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.join-form button:hover,
.back-link:hover,
.admin-toolbar button:hover,
.table-action:hover {
  background: var(--brick-dark);
}

.admin-login {
  width: min(520px, 100%);
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.admin-login[hidden],
.admin-tools[hidden] {
  display: none;
}

.admin-login label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-toolbar button.secondary {
  background: rgba(30, 35, 32, 0.08);
  color: var(--ink);
}

.table-action {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--brick-dark);
  font-size: 13px;
}

.queue-page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 34px 22px 60px;
}

.queue-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.queue-header h1 {
  font-size: clamp(42px, 9vw, 92px);
}

.queue-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(30, 35, 32, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

td:first-child,
th:first-child {
  width: 90px;
  text-align: center;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-queue {
  margin: 0;
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 640px) {
  .home {
    padding: 22px 14px;
  }

  .join-form__row,
  .queue-header {
    grid-template-columns: 1fr;
  }

  .join-form__row {
    display: grid;
  }

  .queue-header {
    display: grid;
    align-items: start;
  }

  .back-link {
    width: 100%;
  }

  th,
  td {
    padding: 13px 10px;
    font-size: 14px;
  }

  td:first-child,
  th:first-child {
    width: 62px;
  }
}
