:root {
  --bg: #0f1419;
  --surface: #1a212b;
  --surface-2: #232c38;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4dabf7;
  --accent-2: #2f9e44;
  --legs: #f59f00;
  --border: #2c3744;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 24px);
  max-width: 720px;
  margin: 0 auto;
}

.screen { padding-top: 16px; }
[hidden] { display: none !important; }

h1 { font-size: 1.4rem; margin: 0; }

/* --- Ekran hasła --- */
#lock { min-height: 80dvh; display: flex; align-items: center; justify-content: center; }
.lock-box {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.lock-box h1 { font-size: 2rem; margin-bottom: 8px; }

input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
input[type="password"]:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 600;
  background: var(--accent);
  color: #06121f;
}
button:active { transform: translateY(1px); }

.link {
  background: none;
  color: var(--muted);
  padding: 6px 8px;
  font-weight: 500;
  font-size: 0.95rem;
}

.error { color: #ff8787; margin: 0; }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.topbar h1 { flex: 1; }
.topbar #back { margin-left: -8px; }

/* --- Menu kafelki --- */
.tiles { display: grid; gap: 14px; }
.tile {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: block;
  width: 100%;
  color: var(--text);
  font-weight: 600;
}
.tile .tile-title { font-size: 1.25rem; }
.tile .tile-sub { display: block; color: var(--muted); font-weight: 400; font-size: 0.9rem; margin-top: 4px; }

/* --- Legenda --- */
.legend {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 18px 2px 0;
}

/* --- Bloki sesji --- */
.block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.block-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.block-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
}
.block-head .tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}
.tag.superset { background: rgba(77,171,247,0.18); color: var(--accent); }
.tag.legs { background: rgba(245,159,0,0.18); color: var(--legs); }

.slot { padding: 10px 0; border-top: 1px solid var(--border); }
.slot:first-of-type { border-top: none; }
.slot-head { display: flex; align-items: baseline; gap: 10px; }
.slot-name { font-weight: 600; flex: 1; }
.video {
  flex: none;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent);
  background: rgba(77, 171, 247, 0.14);
  border: 1px solid rgba(77, 171, 247, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
}
.video:active { transform: translateY(1px); }

.history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.history li { font-size: 0.92rem; color: var(--text); }
.history .date { color: var(--muted); margin-right: 6px; }
.history .rir { color: var(--muted); }
.history.empty li { color: var(--muted); font-style: italic; }
