:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --ink: #1c1915;
  --muted: #4a453e;
  --card: #fffdf8;
  --line: #e3dcd0;
  --accent: #7b2cbf;
  --accent-soft: #f3e9fb;
  --accent-ink: #ffffff;
  --danger: #8f1d1d;
  --danger-bg: #f8ecec;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: "Nunito", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 92%, white);
  border-bottom: 1px solid var(--line);
}

.lockup { display: flex; align-items: baseline; gap: 12px; }

.brand {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

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

.top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

button, input { font: inherit; }

button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  min-height: 44px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:active { transform: scale(0.98); }

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.login {
  width: min(440px, calc(100% - 32px));
  margin: 28px auto 40px;
  display: grid;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px 22px;
}

.lede {
  margin: 0 0 6px;
  color: var(--muted);
  line-height: 1.45;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
}

.wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 24px 32px;
  align-content: start;
}

.wall[data-count="1"] { grid-template-columns: 1fr; }
.wall[data-count="2"] { grid-template-columns: 1fr 1fr; }
.wall[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wall[data-count="4"] { grid-template-columns: 1fr 1fr; }

.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  text-align: left;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 196px;
  font-weight: 500;
}

button.tile { width: 100%; }

.tile[data-picked="true"] {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.tile h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.tile-hint {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.metrics div {
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 10px 10px;
}

.tile[data-picked="true"] .metrics div { background: var(--card); }

.metrics dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.metrics dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.detail {
  overflow: auto;
  max-height: calc(100vh - 220px);
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

tbody tr:nth-child(even) td { background: #faf7f2; }

.empty {
  margin: 0;
  color: var(--muted);
}

.more {
  align-self: flex-start;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

.tile-wait {
  pointer-events: none;
}

.bar {
  display: block;
  height: 12px;
  width: 46%;
  border-radius: 999px;
  background: var(--line);
}

.bar.short { width: 28%; }
.bar.block { height: 52px; width: 100%; border-radius: 12px; }

.menu {
  position: fixed;
  z-index: 5;
  margin: 0;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgb(28 25 21 / 12%);
  display: grid;
  min-width: 220px;
  transform-origin: top left;
}

.menu button {
  background: transparent;
  color: var(--ink);
  text-align: left;
  border-radius: 8px;
  font-weight: 700;
}

.menu button:hover:not(:disabled) { background: var(--accent-soft); }

.error {
  color: var(--danger);
  min-height: 1.2em;
  margin: 0;
  font-weight: 700;
}

.banner {
  margin: 16px 24px 0;
  padding: 10px 12px;
  background: var(--danger-bg);
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; }
}

@media (max-width: 900px) {
  .top { flex-wrap: wrap; }
  .status { order: 3; flex-basis: 100%; }
  .wall,
  .wall[data-count="2"],
  .wall[data-count="3"],
  .wall[data-count="4"] {
    grid-template-columns: 1fr;
  }
}
