* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --slider-track: #334155;
  --success: #34d399;
  --notify-active: #f87171;
}

html {
  scroll-snap-type: y mandatory;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0.875rem 1.25rem;
  padding-top: max(0.875rem, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.btn-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}

.btn-hamburger span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.btn-hamburger:hover {
  color: var(--accent);
}

.btn-hamburger:active {
  transform: scale(0.95);
}

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.btn-add {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add:hover {
  background: rgba(56, 189, 248, 0.1);
}

.btn-add:active {
  transform: scale(0.97);
}

/* Toolbar – dwa rzędy, czytelny układ */
.toolbar {
  position: fixed;
  top: 3.5rem;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.search-row {
  margin-bottom: 0.6rem;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.5;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.2s;
}

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

.search-input:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

.filters-row {
  display: flex;
  gap: 1rem;
}

.filter-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-select {
  width: 100%;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.5rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.filter-select:focus {
  border-color: rgba(56, 189, 248, 0.5);
}

/* Reels container */
.reels-container {
  flex: 1;
  padding-top: 10rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom) + 5rem);
}

.reel-card {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem 1.25rem;
  padding-top: 10rem;
  padding-bottom: max(4rem, env(safe-area-inset-bottom) + 5rem);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.reel-card:last-child {
  padding-bottom: max(4rem, env(safe-area-inset-bottom) + 5rem);
}

/* Wykres prognoz */
.chart-container {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: 0.5rem;
  border: 1px solid rgba(56, 189, 248, 0.12);
}

.forecast-chart {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.chart-axis {
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 1;
}

.chart-axis-label {
  font-size: 0.65rem;
  fill: var(--text-muted);
  text-anchor: end;
}

.chart-label {
  font-size: 0.6rem;
  fill: var(--text-muted);
}

.user-forecast-line {
  stroke: var(--notify-active);
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

.chart-meta {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Category badge */
.category-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* Question */
.question-text {
  font-size: 1.35rem;
  line-height: 1.45;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.deadline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.deadline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-notify {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.btn-notify .notify-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.btn-notify:hover {
  opacity: 1;
  background: rgba(148, 163, 184, 0.15);
}

.btn-notify.subscribed {
  opacity: 1;
  color: var(--notify-active);
}

/* Slider section */
.slider-section {
  margin-top: auto;
  padding-top: 1.5rem;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.slider-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.slider-wrapper {
  position: relative;
  margin-bottom: 0.5rem;
}

.slider-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 0 2px var(--bg);
}

.slider-marker-median {
  background: #34d399;
}

.slider-marker-avg {
  background: #38bdf8;
}

.slider-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.slider-legend span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.slider-legend .dot-median {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
}

.slider-legend .dot-avg {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  background: var(--slider-track);
  border-radius: 6px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
  transition: transform 0.15s;
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

/* Submit button */
.btn-submit {
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-submit:active {
  transform: scale(0.98);
}

.scroll-hint-card {
  margin-top: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.scroll-hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  animation: scroll-hint-blink 1.5s ease-in-out infinite;
}

@keyframes scroll-hint-blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Result (after prediction) */
.result-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--card-bg);
  border-radius: 0.75rem;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.result-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.result-avg {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.result-compare {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.9rem;
}

.result-compare.higher {
  color: var(--success);
}

.result-compare.lower {
  color: #f87171;
}

/* Load more button */
.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--card-bg);
  border: 2px dashed rgba(56, 189, 248, 0.4);
  cursor: pointer;
  transition: background 0.2s;
}

.load-more:hover,
.load-more:active {
  background: rgba(56, 189, 248, 0.1);
}

/* Zamknięte – brak prognozowania */
.closed-notice {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.closed-notice p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Empty state */
.empty-state {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-hint {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* Modal dodawania prognozy */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-bg);
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.modal-overlay.visible .modal-panel {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.15);
}

.modal-form {
  padding: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group textarea,
.form-group input,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--slider-track);
  border-radius: 0.5rem;
  transition: border-color 0.2s;
}

.form-group textarea {
  resize: vertical;
  min-height: 4rem;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.btn-modal-cancel {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--slider-track);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-cancel:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-modal-submit {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.btn-modal-submit:hover {
  background: var(--accent-dim);
}

.btn-modal-submit:active {
  transform: scale(0.98);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--slider-track);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 200;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}


