:root {
  --bg: var(--tg-theme-secondary-bg-color, #eef2ff);
  --surface: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #0f172a);
  --hint: var(--tg-theme-hint-color, #64748b);
  --btn: var(--tg-theme-button-color, #0ea5e9);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top left, #c6f0ff, var(--bg));
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.app {
  max-width: 740px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.badge {
  border-radius: 999px;
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
}

.panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.hidden { display: none; }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--btn);
  color: var(--btn-text);
  font-weight: 700;
  padding: 10px 12px;
}

button:disabled { opacity: 0.45; }

.hint {
  color: var(--hint);
  margin: 8px 0;
}

.open-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.open-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  padding: 10px 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.animal {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  text-align: center;
  padding: 8px;
}

.animal img {
  width: 42px;
  height: 42px;
}

.selected-row {
  display: flex;
  gap: 6px;
  min-height: 48px;
}

.slot {
  width: 48px;
  height: 48px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.error {
  color: #dc2626;
  min-height: 20px;
}

.result {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
}
