/* Seed Hunter — cartoon / Duolingo-like aesthetic
 * Companion to Tailwind CDN: holds component classes, animations,
 * and the few things utilities can't express compactly.
 */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  /* Base surfaces */
  --bg-base:        #F0FDF4;
  --bg-card:        #FFFFFF;
  --bg-soft-mint:   #DCFCE7;
  --bg-soft-butter: #FEF3C7;
  --bg-soft-pink:   #FCE7F3;
  --bg-soft-blue:   #DBEAFE;
  --bg-soft-violet: #EDE9FE;
  --bg-soft-orange: #FFEDD5;
  /* Text */
  --text:           #18181B;
  --text-mute:      #71717A;
  --text-dim:       #A1A1AA;
  /* Action colors and their "dark" pair used as 3D drop-shadow */
  --green:          #22C55E;
  --green-dark:     #15803D;
  --green-soft:     #BBF7D0;
  --amber:          #F59E0B;
  --amber-dark:     #B45309;
  --red:            #EF4444;
  --red-dark:       #B91C1C;
  --blue:           #3B82F6;
  --blue-dark:      #1D4ED8;
  --pink:           #EC4899;
  --pink-dark:      #BE185D;
  --violet:         #8B5CF6;
  --violet-dark:    #6D28D9;
  --orange:         #F97316;
  --orange-dark:    #C2410C;
}

html, body {
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Cute mint-tinted scrollbars. */
::-webkit-scrollbar         { width: 10px; height: 10px; }
::-webkit-scrollbar-track   { background: var(--bg-soft-mint); border-radius: 999px; }
::-webkit-scrollbar-thumb   { background: var(--green); border-radius: 999px; border: 2px solid var(--bg-soft-mint); }
::-webkit-scrollbar-thumb:hover { background: var(--green-dark); }

/* === Surfaces ============================================== */

.card {
  background: var(--bg-card);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 1px 0 rgba(24,24,27,0.04), 0 8px 24px rgba(24,24,27,0.06);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.card:hover {
  box-shadow: 0 1px 0 rgba(24,24,27,0.05), 0 12px 30px rgba(24,24,27,0.08);
}

.card-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Stat tile (colored soft variants) ====================== */

.stat-tile {
  border-radius: 18px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat-tile-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  opacity: 0.7;
  margin-bottom: 4px;
}
.stat-tile-value {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.05;
}
.stat-tile.mint   { background: var(--bg-soft-mint); }
.stat-tile.butter { background: var(--bg-soft-butter); }
.stat-tile.pink   { background: var(--bg-soft-pink); }
.stat-tile.blue   { background: var(--bg-soft-blue); }
.stat-tile.violet { background: var(--bg-soft-violet); }
.stat-tile.orange { background: var(--bg-soft-orange); }

/* Tabular numerals for stat values so the count-up doesn't jitter. */
.num-tick { font-variant-numeric: tabular-nums; }

/* === Buttons (3D drop-shadow stack) ========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 90ms ease, filter 90ms ease;
  user-select: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.4); }

/* Stacked 3D shadow: solid offset below + soft ambient.
 * On hover the button "lifts" a touch; on active it presses fully
 * down (translate = shadow height, shadow collapses to nothing). */
.btn-primary {
  background: var(--green);
  color: #FFFFFF;
  box-shadow: 0 5px 0 0 var(--green-dark);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 0 var(--green-dark);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow: 0 0 0 0 var(--green-dark);
}

.btn-warn {
  background: var(--amber);
  color: #FFFFFF;
  box-shadow: 0 5px 0 0 var(--amber-dark);
}
.btn-warn:hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 6px 0 0 var(--amber-dark); }
.btn-warn:active:not(:disabled) { transform: translateY(5px);  box-shadow: 0 0 0 0 var(--amber-dark); }

.btn-danger {
  background: var(--red);
  color: #FFFFFF;
  box-shadow: 0 5px 0 0 var(--red-dark);
}
.btn-danger:hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 6px 0 0 var(--red-dark); }
.btn-danger:active:not(:disabled) { transform: translateY(5px);  box-shadow: 0 0 0 0 var(--red-dark); }

.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 3px 0 0 rgba(24,24,27,0.12), inset 0 0 0 2px rgba(24,24,27,0.06);
}
.btn-ghost:hover:not(:disabled)  { box-shadow: 0 4px 0 0 rgba(24,24,27,0.18), inset 0 0 0 2px rgba(24,24,27,0.1); }
.btn-ghost:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 0 rgba(24,24,27,0.12), inset 0 0 0 2px rgba(24,24,27,0.06); }

.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 11px; }
.btn-sm.btn-primary { box-shadow: 0 4px 0 0 var(--green-dark); }
.btn-sm.btn-primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 0 var(--green-dark); }

/* === Pills (status badges) ================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.pill-on   { background: var(--bg-soft-mint);   color: var(--green-dark); }
.pill-on   .dot { background: var(--green); }
.pill-off  { background: #FEE2E2;               color: var(--red-dark); }
.pill-off  .dot { background: var(--red); }
.pill-warn { background: var(--bg-soft-butter); color: var(--amber-dark); }
.pill-warn .dot { background: var(--amber); }
.pill-info { background: var(--bg-soft-blue);   color: var(--blue-dark); }
.pill-info .dot { background: var(--blue); }
.pill-leak { background: var(--bg-soft-violet); color: var(--violet-dark); }
.pill-weak { background: var(--bg-soft-orange); color: var(--orange-dark); }

/* === Form fields ============================================ */

.field {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid #E4E4E7;
  color: var(--text);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.field:focus  { border-color: var(--green); background: #FFFFFF; }
.field:hover:not(:focus):not(:disabled) { border-color: #D4D4D8; }
.field:disabled { opacity: 0.5; }
textarea.field { resize: vertical; line-height: 1.55; }

.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* === Tabs (rounded pills) =================================== */

.tab-bar {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: var(--bg-card);
  border-radius: 18px;
  box-shadow: inset 0 0 0 2px #E4E4E7;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-trigger {
  flex-shrink: 0;
  padding: 9px 16px;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--text-mute);
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}
.tab-trigger:hover { color: var(--text); }
.tab-trigger.active {
  background: var(--text);
  color: #FFFFFF;
  transform: translateY(-1px);
}

/* === Table ================================================= */

.term-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-weight: 500;
}
.term-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 14px;
  background: var(--bg-soft-mint);
  border-bottom: 2px solid var(--green-soft);
}
.term-table thead th:first-child { border-top-left-radius:  14px; }
.term-table thead th:last-child  { border-top-right-radius: 14px; }
.term-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #F4F4F5;
  vertical-align: middle;
}
.term-table tbody tr:last-child td { border-bottom: none; }
.term-table tbody tr:hover td { background: #FAFAFA; }
.term-table .empty {
  text-align: center;
  color: var(--text-dim);
  padding: 32px 16px;
  font-style: italic;
  font-weight: 600;
}

/* === Tags inside cells ===================================== */

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #F4F4F5;
  color: var(--text-mute);
}
.tag.leak  { background: var(--bg-soft-violet); color: var(--violet-dark); }
.tag.weak  { background: var(--bg-soft-orange); color: var(--orange-dark); }
.tag.found { background: var(--bg-soft-mint);   color: var(--green-dark); }

/* === Progress bar ========================================== */

.progress-track {
  height: 10px;
  background: #F4F4F5;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--green) 0%, #4ADE80 100%);
  width: 0%;
  border-radius: 999px;
  transition: width 280ms ease-out;
}

/* === Mascot anchor ========================================= */

.mascot {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-soft-mint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 0 0 var(--green-soft);
  overflow: hidden;
}
.mascot svg,
.mascot img { width: 92%; height: 92%; display: block; object-fit: contain; }
.mascot-sm {
  width: 38px; height: 38px;
  box-shadow: 0 3px 0 0 var(--green-soft);
}
.mascot-lg {
  width: 76px; height: 76px;
  box-shadow: 0 6px 0 0 var(--green-soft);
}

/* === Inline SVG icon ====================================== */

.ico {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  fill: currentColor;
  flex-shrink: 0;
}
.ico.sm { width: 12px; height: 12px; vertical-align: -1.5px; }
.ico.md { width: 16px; height: 16px; vertical-align: -3px; }
.ico.lg { width: 20px; height: 20px; vertical-align: -4px; }
.ico.xl { width: 28px; height: 28px; vertical-align: -6px; }

/* Speech-bubble that points at the mascot. */
.bubble {
  position: relative;
  background: var(--bg-card);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 1px 0 rgba(24,24,27,0.04), 0 4px 12px rgba(24,24,27,0.06);
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.bubble::before {
  content: '';
  position: absolute;
  left: -8px; top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 14px; height: 14px;
  background: var(--bg-card);
  box-shadow: -3px 3px 6px -3px rgba(24,24,27,0.08);
}

/* === Tab pane show/hide ==================================== */

.tab-pane            { display: none; }
.tab-pane.active     { display: block; }

/* === Logs viewer line ====================================== */

.log-line {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  padding: 2px 0 2px 12px;
  color: var(--text-mute);
  border-left: 3px solid transparent;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line:hover { border-left-color: var(--green); color: var(--text); }

code, pre {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color: var(--violet-dark);
  background: var(--bg-soft-violet);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
}

/* === Animations ============================================ */

/* Bounce-in for cards on initial paint. Cascaded via delay. */
@keyframes bounce-in {
  0%   { opacity: 0; transform: translateY(8px) scale(0.98); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.bounce-in { animation: bounce-in 480ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* Wiggle the mascot every now and then. */
@keyframes wiggle {
  0%, 90%, 100% { transform: rotate(0deg); }
  92% { transform: rotate(-8deg); }
  94% { transform: rotate(6deg); }
  96% { transform: rotate(-4deg); }
  98% { transform: rotate(2deg); }
}
.mascot.wiggle { animation: wiggle 4.5s ease-in-out infinite; }

/* Pulse dot — for live state indicators. */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
.dot-pulse { animation: pulse 1.4s ease-in-out infinite; }

/* Soft glow on the primary CTA when idle. */
@keyframes glow-soft {
  0%, 100% { box-shadow: 0 5px 0 0 var(--green-dark), 0 0 0 0 rgba(34, 197, 94, 0); }
  50%      { box-shadow: 0 5px 0 0 var(--green-dark), 0 0 0 8px rgba(34, 197, 94, 0.18); }
}
.btn-primary.idle { animation: glow-soft 2.2s ease-in-out infinite; }

/* Tab pane fade-up. */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tab-pane.active { animation: fade-up 260ms ease-out both; }

/* Log line slide-in. */
@keyframes log-enter {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.log-line.enter { animation: log-enter 220ms ease-out both; }

/* Confetti pop for the "found" stat — fires once when value goes up. */
@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.pop { animation: pop 340ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* === Mobile ================================================ */

@media (max-width: 768px) {
  body { font-size: 15px; }
  .field { font-size: 16px !important; }
  .card { padding: 18px; border-radius: 18px; }
  .stat-tile { padding: 14px; border-radius: 14px; }
  .stat-tile-value { font-size: 24px; }
  .btn { padding: 11px 15px; font-size: 13px; }
  .tab-trigger { padding: 8px 12px; font-size: 12px; }
  .term-table { font-size: 12px; }
  .mascot { width: 48px; height: 48px; font-size: 26px; }
}

@media (max-width: 420px) {
  .stat-tile-value { font-size: 22px; }
}

/* === Tooltips ============================================== */
/* Any element with [data-tooltip="..."] gets a floating bubble on
 * hover or focus. Position defaults to "top"; override with
 * data-tooltip-pos="right|bottom|left".
 * On touch devices the JS bridge toggles a `.tip-open` class on the
 * element (tap-to-show / tap-elsewhere-to-dismiss). */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 60;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: #18181B;
  color: #FFFFFF;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.01em;
  line-height: 1.45;
  text-transform: none;
  padding: 8px 11px;
  border-radius: 8px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  z-index: 60;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #18181B;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus::after,
[data-tooltip]:focus::before,
[data-tooltip]:focus-within::after,
[data-tooltip]:focus-within::before,
[data-tooltip].tip-open::after,
[data-tooltip].tip-open::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip][data-tooltip-pos="right"]::after {
  bottom: auto; top: 50%; left: calc(100% + 8px);
  transform: translateY(-50%) translateX(2px);
}
[data-tooltip][data-tooltip-pos="right"]::before {
  bottom: auto; top: 50%; left: calc(100% + 2px);
  transform: translateY(-50%) rotate(90deg);
}
[data-tooltip][data-tooltip-pos="right"]:hover::after,
[data-tooltip][data-tooltip-pos="right"]:focus::after,
[data-tooltip][data-tooltip-pos="right"].tip-open::after {
  transform: translateY(-50%) translateX(0);
}
[data-tooltip][data-tooltip-pos="bottom"]::after {
  bottom: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(-2px);
}
[data-tooltip][data-tooltip-pos="bottom"]::before {
  bottom: auto; top: calc(100% + 2px);
  border-top: none; border-bottom: 6px solid #18181B;
}
[data-tooltip][data-tooltip-pos="bottom"]:hover::after,
[data-tooltip][data-tooltip-pos="bottom"]:focus::after,
[data-tooltip][data-tooltip-pos="bottom"].tip-open::after {
  transform: translateX(-50%) translateY(0);
}

/* Tiny "info" hint badge — show a question mark anchor inline; the
 * actual tooltip is attached to the badge. Keeps labels visually
 * uncluttered. */
.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-soft-violet);
  color: var(--violet-dark);
  font-family: 'Nunito', sans-serif;
  font-weight: 900;
  font-size: 10px;
  margin-left: 6px;
  cursor: help;
  vertical-align: 1px;
  transition: background 140ms ease;
}
.hint:hover { background: var(--violet); color: #FFFFFF; }
.hint::before { content: '?'; }

/* === Docs layout =========================================== */
.docs-shell { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
@media (max-width: 900px) { .docs-shell { grid-template-columns: 1fr; } }
.docs-toc {
  position: sticky; top: 92px; align-self: start;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(24,24,27,0.04), 0 8px 24px rgba(24,24,27,0.06);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.docs-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mute);
  text-decoration: none;
  transition: color 120ms ease, background 120ms ease;
}
.docs-toc a:hover { color: var(--text); background: var(--bg-soft-mint); }
.docs-toc a.active { color: var(--text); background: var(--bg-soft-mint); }
.docs-section { scroll-margin-top: 92px; }
.docs-section h2 {
  font-family: 'Nunito', sans-serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.docs-section h2 .ico { width: 22px !important; height: 22px !important; vertical-align: -4px; }
.docs-section h3 {
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 800;
  margin: 18px 0 8px;
}
.docs-section p, .docs-section li {
  font-size: 14px; line-height: 1.65; color: #27272A;
}
.docs-section ul, .docs-section ol {
  padding-left: 22px; margin-top: 6px;
}
.docs-section ul li { list-style: disc; margin-bottom: 4px; }
.docs-section ol li { list-style: decimal; margin-bottom: 4px; }
.docs-section code {
  background: var(--bg-soft-violet);
  color: var(--violet-dark);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
}
.docs-section .callout {
  background: var(--bg-soft-butter);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 12px 0;
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
}
.docs-section .callout svg { color: var(--amber-dark); flex-shrink: 0; }
.docs-section .endpoint-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #F4F4F5;
  font-size: 12.5px;
}
.docs-section .endpoint-row:last-child { border-bottom: none; }
.docs-section .endpoint-row .method {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 5px;
  text-align: center;
  background: var(--bg-soft-blue);
  color: var(--blue-dark);
  align-self: start;
}
.docs-section .endpoint-row .method.post { background: var(--bg-soft-mint); color: var(--green-dark); }
.docs-section .endpoint-row .method.del  { background: #FEE2E2; color: var(--red-dark); }

/* === Reduced motion ======================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
