:root {
  --bg:           #f4f6fb;
  --card-bg:      #ffffff;
  --text:         #222222;
  --text-muted:   #888888;
  --accent:       #1a73e8;
  --accent-hov:   #1558b0;
  --border:       #c5cae9;
  --result-bg:    #e8f0fe;
  --result-txt:   #1a237e;
  --divider:      #e8f0fe;
  --shadow:       rgba(0,0,0,0.08);
  --header-bg:    #1a73e8;
  --header-txt:   #ffffff;
  --btn-toggle-bg:rgba(255,255,255,0.15);
  --tooltip-bg:   #1a237e;
  --tooltip-txt:  #ffffff;
}
[data-theme="dark"] {
  --bg:           #0f1117;
  --card-bg:      #1e2130;
  --text:         #e8eaf6;
  --text-muted:   #9e9e9e;
  --accent:       #5b9cf6;
  --accent-hov:   #82b1ff;
  --border:       #3a3f5c;
  --result-bg:    #1a2540;
  --result-txt:   #a8c7ff;
  --divider:      #2a2f4a;
  --shadow:       rgba(0,0,0,0.35);
  --header-bg:    #13182a;
  --header-txt:   #e8eaf6;
  --btn-toggle-bg:rgba(255,255,255,0.08);
  --tooltip-bg:   #a8c7ff;
  --tooltip-txt:  #0f1117;
}

/* ── MOBILE ── */
@media (max-width: 600px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 16px 18px;
    gap: 10px;
    position: relative; /* zachowane dla innych elementów */
  }
  #theme-toggle {
    position: static !important; /* !important nadpisuje regułę globalną */
    align-self: flex-end;
    order: -1;
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  header h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  input[type="number"] { width: 90px; }
  .tip-box { white-space: normal; width: 200px; }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

header {
  background: var(--header-bg);
  color: var(--header-txt);
  text-align: center;
  padding: 28px 16px 18px;
  position: relative;
  transition: background 0.3s;
}
header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
header p  { margin-top: 6px; font-size: 1rem; opacity: 0.9; }

#theme-toggle {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--btn-toggle-bg);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: var(--header-txt);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}
#theme-toggle:hover { background: rgba(255,255,255,0.25); }

main {
  max-width: 720px;
  margin: 32px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 12px var(--shadow);
  padding: 24px 28px;
  transition: background 0.3s, box-shadow 0.3s;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--divider);
  padding-bottom: 8px;
}
.card-header h2 {
  font-size: 1.15rem;
  color: var(--accent);
  transition: color 0.3s;
  flex: 1;
}

.tip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--result-bg);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: default;
  border: 1.5px solid var(--accent);
  transition: background 0.2s, color 0.2s;
  user-select: none;
}
.tip-icon:hover,
.tip-icon:focus { background: var(--accent); color: #fff; outline: none; }

.tip-box {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--tooltip-bg);
  color: var(--tooltip-txt);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  pointer-events: none;
}
.tip-box::before {
  content: '';
  position: absolute;
  bottom: 100%; right: 6px;
  border: 6px solid transparent;
  border-bottom-color: var(--tooltip-bg);
}
.tip-wrap:hover .tip-box,
.tip-icon:focus + .tip-box { display: block; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.row span { font-size: 1rem; white-space: nowrap; }

input[type="number"] {
  width: 120px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 1rem;
  outline: none;
  background: var(--card-bg);
  color: var(--text);
  transition: border 0.2s, background 0.3s, color 0.3s;
}
input[type="number"]:focus { border-color: var(--accent); }

button.calc-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 9px 22px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}
button.calc-btn:hover { background: var(--accent-hov); }

.result {
  margin-top: 12px;
  background: var(--result-bg);
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 1.05rem;
  min-height: 40px;
  color: var(--result-txt);
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

.info-text { line-height: 1.7; font-size: 0.97rem; }
.faq-list  { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.faq-item h3 { font-size: 0.97rem; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.faq-item p  { font-size: 0.93rem; line-height: 1.6; }

footer {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
