/* Pebble Mini App: the mobile app's dark, calm palette (documents/mobile_app_frontend.md §8). */
:root {
  --bg: #0e1417;
  --bg-glow: #14201f;
  --surface: #18242a;
  --surface-raised: #1f2e35;
  --line: #28383f;
  --text: #e7eef0;
  --text-muted: #8fa6ad;
  --text-faint: #5e747b;
  --accent: #8faac4;
  --accent-soft: #222e3a;
  --accent-ink: #0d1722;
  --danger: #d98c8c;
  --radius-card: 22px;
  --gutter: 16px;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tabs-height: 64px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(120% 60% at 50% 0%, var(--bg-glow), var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  font-size: 17px;
}

p {
  margin: 0;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 14px;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding-top: var(--safe-top);
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px var(--gutter) calc(var(--tabs-height) + var(--safe-bottom) + 24px);
}

.screen.center {
  min-height: 70vh;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Buttons: 52px, fully rounded; tap targets never under 44px. */
.btn {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary.on {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn:focus-visible,
.card:focus-visible,
.row:focus-visible,
.dot:focus-visible,
.tabs a:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cards (blinded picks) */
.cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: opacity 0.2s;
}

.cards.dimmed {
  opacity: 0.4;
  pointer-events: none;
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  cursor: pointer;
}

.card:active {
  background: var(--surface-raised);
}

.card .cover {
  aspect-ratio: 16 / 9;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover {
  display: block;
  width: 100%;
  object-fit: cover;
  background: var(--surface-raised);
}

.cover-empty {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface-raised), var(--accent-soft));
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--accent-soft);
}

/* Panels: set rating, match prompt */
.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.thanks {
  color: var(--text-muted);
  text-align: center;
}

.rating {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dots {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.dot {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dot-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.dot-captions {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-faint);
}

/* Details */
.details {
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}

.details > .pad {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px var(--gutter) 0;
}

.gallery {
  position: relative;
}

.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-track .cover,
.gallery > .cover {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
}

.gallery-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.gallery-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(231, 238, 240, 0.45);
}

.gallery-dots span.on {
  background: var(--text);
}

.info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 15px;
}

.info dt {
  color: var(--text-faint);
}

.info dd {
  margin: 0;
  color: var(--text-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.description {
  color: var(--text);
}

.reason {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--accent-soft);
  animation: fade-in 0.4s ease-out;
}

.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match {
  margin-top: 6px;
}

/* Feedback */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

textarea::placeholder {
  color: var(--text-faint);
}

.counter {
  align-self: flex-end;
  font-size: 13px;
  color: var(--text-faint);
}

/* Saved list */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 10px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
}

.row .cover {
  width: 72px;
  height: 72px;
  aspect-ratio: auto;
  border-radius: 12px;
}

.row h3 {
  overflow-wrap: anywhere;
}

.empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 48px 8px;
  text-align: center;
}

/* Bottom navigation */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px var(--gutter) calc(8px + var(--safe-bottom));
  background: rgba(14, 20, 23, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tabs[hidden] {
  display: none;
}

.tabs a {
  flex: 1;
  max-width: 260px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.tabs a.active {
  color: var(--accent-ink);
  background: var(--accent);
}

/* Loaders and dialogs */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40vh;
  color: var(--text-muted);
}

.inline-loader .loader {
  min-height: 0;
  padding: 4px;
}

.inline-loader[hidden] {
  display: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.spinner.big {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.stage {
  min-height: 1.5em;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--gutter) var(--gutter) calc(var(--gutter) + var(--safe-bottom));
  background: rgba(5, 9, 11, 0.6);
  animation: fade-in 0.15s ease-out;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  padding: 22px 18px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
