:root {
  --bg: #050814;
  --card-bg: #111827;
  --card-bg-soft: #0b1120;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.2);
  --accent-strong: #22d3ee;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.2);
  --danger: #fb7185;
  --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.9);
  --radius-lg: 24px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1e293b 0, #020617 55%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

/* === EKRAN LOGOWANIA === */

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at top left, #0f172a 0, #020617 55%);
  z-index: 40;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: radial-gradient(circle at top left, #1f2937, #020617 60%);
  border-radius: 24px;
  padding: 20px 18px 18px;
  position: relative;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.4);
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: -120px -40px auto auto;
  background: conic-gradient(
    from 220deg,
    rgba(56, 189, 248, 0.4),
    rgba(52, 211, 153, 0.3),
    rgba(129, 140, 248, 0.4),
    rgba(56, 189, 248, 0.4)
  );
  opacity: 0.35;
  filter: blur(50px);
  pointer-events: none;
}

.auth-badge-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(16px);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.auth-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #bbf7d0, #16a34a);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.25);
}

.auth-title {
  position: relative;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.auth-subtitle {
  position: relative;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
}

.auth-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-label {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 10px 12px;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  outline: none;
}

.auth-input:focus {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.9),
    0 0 0 8px rgba(56, 189, 248, 0.25);
}

.auth-error {
  min-height: 16px;
  font-size: 12px;
  color: var(--danger);
  margin: 0;
}

.auth-button {
  margin-top: 4px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, #22c55e, #22d3ee);
  color: #0b1120;
  box-shadow: 0 14px 35px rgba(5, 150, 105, 0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.auth-button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.auth-button:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.6);
}

.auth-footnote {
  position: relative;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* === GŁÓWNA APLIKACJA === */

.app-shell {
  width: 100%;
  max-width: 960px;
}

.app-card {
  background: radial-gradient(circle at top left, #1f2937, #020617 60%);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  overflow: hidden; /* żeby rogi były idealne */
}

.app-card::before {
  content: "";
  position: absolute;
  inset: -120px -40px auto auto;
  background: conic-gradient(
    from 220deg,
    rgba(56, 189, 248, 0.4),
    rgba(52, 211, 153, 0.3),
    rgba(129, 140, 248, 0.4),
    rgba(56, 189, 248, 0.4)
  );
  opacity: 0.35;
  filter: blur(50px);
  pointer-events: none;
}

.app-header {
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
}

.badge-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  backdrop-filter: blur(16px);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #bbf7d0, #16a34a);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.25);
}

.badge-separator {
  width: 1px;
  height: 12px;
  background: linear-gradient(
    to bottom,
    rgba(148, 163, 184, 0),
    rgba(148, 163, 184, 0.8),
    rgba(148, 163, 184, 0)
  );
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.subtitle strong {
  color: #e5e7eb;
  font-weight: 600;
}

.header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pill-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at left, #0f172a, #020617);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pill-info span {
  font-weight: 500;
  color: var(--text-main);
}

.pill-icon {
  font-size: 13px;
}

.reset-btn {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(248, 250, 252, 0.22);
  background: radial-gradient(circle at top left, #0f172a, #020617);
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease, background 0.15s ease;
}

.reset-btn-icon {
  font-size: 13px;
}

.reset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.7);
  border-color: rgba(248, 250, 252, 0.4);
  background: radial-gradient(circle at top left, #111827, #020617);
}

.reset-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.lists-wrapper {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 4px;
}

@media (min-width: 720px) {
  .app-card {
    padding: 22px 20px 20px;
  }

  .lists-wrapper {
    grid-template-columns: 1fr 1fr;
  }
}

.list-card {
  border-radius: 18px;
  background: radial-gradient(circle at top, #020617, #020617 50%, #020617);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-title {
  display: flex;
  flex-direction: column;
}

.list-title-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e5e7eb;
}

.list-title-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.list-counter {
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.list-counter span {
  color: #e5e7eb;
  font-weight: 600;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
  transition: background 0.15s ease, transform 0.1s ease,
    border-color 0.15s ease, opacity 0.15s ease;
}

.item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  font-size: 13px;
  font-weight: 500;
}

.item-qty {
  font-size: 11px;
  color: var(--text-muted);
}

.item-check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  background: radial-gradient(circle at top left, #020617, #020617);
  color: transparent;
  transition: all 0.15s ease;
}

.item-image-wrapper {
  width: 42px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(30, 64, 175, 0.4);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.item-image-wrapper::after {
  content: "↕";
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 10px;
  color: rgba(241, 245, 249, 0.8);
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.7);
  opacity: 0.85;
}

.item-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item.checked {
  background: rgba(15, 23, 42, 0.65);
  border-color: rgba(55, 65, 81, 0.9);
  opacity: 0.65;
}

.item.checked .item-name {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(148, 163, 184, 0.7);
  color: #9ca3af;
}

.item.checked .item-qty {
  color: #6b7280;
}

.item.checked .item-check {
  background: radial-gradient(circle at top left, #15803d, #22c55e);
  border-color: rgba(34, 197, 94, 0.9);
  color: #ecfdf5;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.8),
    0 0 0 6px rgba(22, 163, 74, 0.25);
}

.item.checked .item-image-wrapper {
  opacity: 0.9;
  border-color: rgba(55, 65, 81, 0.9);
}

.empty-state {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed rgba(148, 163, 184, 0.5);
  font-size: 11px;
  color: var(--text-muted);
}

.empty-state strong {
  color: var(--accent-strong);
  font-weight: 600;
}

/* Modal powiększania zdjęcia */

.image-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.image-modal.open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
}

.image-modal-content {
  position: relative;
  z-index: 1;
  max-width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 16px;
  background: radial-gradient(circle at top, #020617, #020617);
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.9);
}

.image-modal-img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 12px;
  object-fit: contain;
}

.image-modal-caption {
  font-size: 12px;
  color: var(--text-muted);
}

.image-modal-close {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  border-radius: 999px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.9);
}

.image-modal-close:active {
  transform: scale(0.95);
}

@media (min-width: 1024px) {
  .image-modal-content {
    max-width: 70vw;
    max-height: 86vh;
  }
  h1 {
    font-size: 26px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 20px;
  }
  .app-card {
    padding: 18px 14px 14px;
  }
  .item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}
