:root {
  color-scheme: light;
  --czerwony: #c62828;
  --czerwony-ciemny: #8e0000;
  --tlo: #f4f4f4;
  --tekst: #222;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(160deg, #f4f4f4 0%, #ece1e1 100%);
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--tekst);
  padding: 24px 16px;
}

.karta {
  background: #fff;
  padding: 32px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: 480px;
}

.naglowek {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}

.ikona {
  font-size: 2.2rem;
  line-height: 1;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 6px;
  color: var(--czerwony-ciemny);
}

.opis {
  color: #555;
  font-size: 0.9rem;
  margin: 0;
}

.pole {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.grupa-liczb {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.grupa-liczb .pole {
  margin-bottom: 0;
}

.grupa-liczb label {
  display: flex;
  align-items: flex-end;
  min-height: 2.4em;
  line-height: 1.2;
}

.system-pracy {
  margin-top: 4px;
}

.pole input,
.pole select {
  width: 100%;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--czerwony);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

.suma {
  font-size: 0.85rem;
  color: #444;
  margin: 4px 0 16px;
}

button {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--czerwony);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease-in-out, transform 0.1s ease-in-out;
}

button:hover:not(:disabled) {
  background: var(--czerwony-ciemny);
}

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

button:disabled {
  background: #aaa;
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: girar 0.7s linear infinite;
}

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

.komunikat {
  margin-top: 16px;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.komunikat.blad {
  color: var(--czerwony);
}

.komunikat.sukces {
  color: #2e7d32;
}

.stopka {
  width: 100%;
  max-width: 480px;
  text-align: center;
  font-size: 0.8rem;
  color: #777;
}

.stopka-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #777;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

.stopka-link:hover {
  color: var(--czerwony-ciemny);
}

.stopka-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

@media (max-width: 560px) {
  body {
    justify-content: flex-start;
    padding: 16px 10px;
  }

  .karta {
    padding: 24px 20px;
  }

  .grupa-liczb {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .grupa-liczb .pole {
    margin-bottom: 16px;
  }
}
