/* nodes web companion — tokens straight from the Flutter AppTheme. */

:root {
  --ink: #111111;
  --paper: #ffffff;
  --grey: #757575;
  --mist: #eeeeee;
  --accent: #1a73e8;
  --accent-soft: #3f93f7;
  --green: #1e8e3e;
  --terracotta: #c65a3a;
  --amber: #b07d10;
  --hairline: rgba(17, 17, 17, 0.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#constellation {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── hero ─────────────────────────────────────────────────────────────── */

#hero {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

.hero-inner {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#hero-logo svg { display: block; }

.wordmark {
  margin: 14px 0 0;
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tagline {
  margin: 10px 0 30px;
  color: var(--grey);
  font-size: 15.5px;
  max-width: 320px;
}

/* Pebble elements: the injected SVG paints the surface behind the content. */
[data-pebble] { position: relative; background: transparent; border: none; }
[data-pebble] > :not(.pebble-svg) { position: relative; z-index: 1; }

.login-card {
  --pebble-fill: var(--paper);
  --pebble-stroke: rgba(17, 17, 17, 0.10);
  width: 100%;
  padding: 26px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  filter: drop-shadow(0 10px 28px rgba(20, 80, 224, 0.08));
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--grey);
}

/* Inputs mirror the app's InputDecorationTheme (12px radius, hairline). */
input[type='email'],
input[type='password'],
input[type='search'] {
  font: inherit;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  color: var(--ink);
  background: rgba(17, 17, 17, 0.03);
  border: 1px solid rgba(17, 17, 17, 0.10);
  border-radius: 12px;
  padding: 10px 14px;
  width: 100%;
  outline: none;
}

input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.btn-primary {
  --pebble-fill: var(--accent);
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  padding: 14px 20px;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* "Otwórz aplikację" — the primary CTA linking to the Flutter review app at
   /app. Anchor styled as the primary button, so it needs the box model the
   <button> gets for free. */
.btn-open-app {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
  border-radius: 14px;
}
.open-app-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted, #8a8a99);
  text-align: center;
}
.hero-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 18px;
  color: var(--muted, #8a8a99);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hero-divider::before,
.hero-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.25;
}

.btn-label { display: inline-block; }

.login-error {
  margin: -4px 0 0;
  color: var(--terracotta);
  font-size: 13.5px;
  font-weight: 500;
}

.login-hint {
  margin: 2px 0 0;
  text-align: center;
  color: var(--grey);
  font-size: 12.5px;
}

/* ── app shell ────────────────────────────────────────────────────────── */

#app { position: relative; z-index: 1; min-height: 100dvh; }

#app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}

.header-logo svg { display: block; }

.header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mist);
  flex-shrink: 0;
  transition: background 0.3s;
}

.live-dot[data-state='live'] { background: var(--green); }
.live-dot[data-state='pulse'] { background: var(--accent-soft); }

.icon-btn {
  font: inherit;
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
  background: none;
  border: none;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 10px;
}

.text-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--grey);
  background: none;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
}

.icon-btn:focus-visible,
.text-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
}

.section-label {
  margin: 18px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey);
}

/* ── deck & card rows ─────────────────────────────────────────────────── */

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.row:active { background: rgba(17, 17, 17, 0.03); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.row-main { flex: 1; min-width: 0; }

.row-title {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row-sub {
  color: var(--grey);
  font-size: 12.5px;
  margin-top: 1px;
}

.row-sub .due { color: var(--accent); font-weight: 600; }

.row-chevron { color: var(--grey); font-size: 20px; flex-shrink: 0; }

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.state-0 { background: var(--accent-soft); }   /* new */
.state-1, .state-3 { background: var(--amber); } /* (re)learning */
.state-2 { background: var(--green); }          /* review */
.state-suspended { background: var(--mist); }

.chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--grey);
  background: var(--mist);
  border-radius: 999px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.search-wrap { margin: 4px 0 12px; }

.empty, .loading {
  text-align: center;
  color: var(--grey);
  padding: 44px 20px;
  font-size: 14.5px;
}

.load-more {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  padding: 14px;
  width: 100%;
  cursor: pointer;
}

/* ── card sheet ───────────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(17, 17, 17, 0.28);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-panel {
  position: relative;
  background: var(--paper);
  width: 100%;
  max-width: 640px;
  height: 92dvh;
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  animation: sheet-up 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  font-size: 24px;
  color: var(--grey);
}

.sheet-scroll {
  overflow-y: auto;
  padding: 46px 22px calc(30px + env(safe-area-inset-bottom));
  flex: 1;
}

.card-html {
  font-size: 16.5px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

#sheet-reveal-zone { margin: 26px 0 8px; }

.card-divider {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 22px 0;
}

/* ── toast ────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 16px;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.toast.show { opacity: 0.92; }

/* ── motion & desktop ─────────────────────────────────────────────────── */

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

@media (min-width: 700px) {
  .hero-inner { max-width: 420px; }
  .wordmark { font-size: 52px; }
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel { height: min(760px, 90dvh); border-radius: 22px; }
}
