/* ============================================================================
   Generator lozinki — responsive (mobile-first → tablet → desktop).
   Brand duo only: yellow #fabc41 + navy #04395e.
   Each breakpoint uses its screen real-estate distinctly.
   ========================================================================== */

:root {
  --yellow:      #fabc41;
  --yellow-soft: #fff4dc;
  --navy:        #04395e;
  --navy-deep:   #032740;
  --navy-soft:   #e7edf2;
  --cream:       #f9f9f9;
  --line:        #e1e4e6;
  --slate:       #8491a3;
  --ink:         #2a3a4a;
  --r:           5px;
  --r-lg:        10px;
  --shadow:      0 8px 28px rgba(4, 57, 94, .08);
  --font-display: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "Lato", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --hero-stage-height: clamp(128px, 26vh, 210px);
}

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}
body {
  font-family: var(--font-body);
  color: var(--navy);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  font-size: 14px;
}
button { font-family: inherit; }
:focus-visible { outline: 2px dashed var(--yellow); outline-offset: 2px; }

/* ─── App grid ─────────────────────────────────────────────────────────
   MOBILE base: topbar / hero / settings / bottom stacked.
   TABLET: same stack, centred, more breathing room.
   DESKTOP: 2-column with always-visible sidebar holding settings+history.
   ──────────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  height: 100dvh;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "topbar"
    "hero"
    "settings"
    "bottom";
  background: var(--cream);
}

/* On mobile/tablet, .sidebar-stack is a transparent wrapper: its children
   participate directly in the .app grid. On desktop we override it. */
.sidebar-stack { display: contents; }

/* ─── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center;
  padding: 12px 16px;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.topbar > * { min-width: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}
.brand img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.topbar .spacer { flex: 1; }
.tab-link {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--slate);
  text-decoration: none;
  display: none;          /* hidden on mobile */
}
.tab-link:hover { color: var(--navy); }
.hist-pill {
  all: unset;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--navy);
  padding: 7px 10px 7px 12px;
  border-radius: 999px;
  background: var(--navy-soft);
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s linear, color .15s linear;
}
.hist-pill:hover { background: var(--yellow); }
.hist-pill .count {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--navy);
  color: var(--yellow);
  padding: 1px 7px;
  border-radius: 999px;
  letter-spacing: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hist-pill:hover .count { background: var(--navy-deep); }

.theme-pill {
  all: unset;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--navy);
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--navy-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s linear, color .15s linear;
}
.theme-pill:hover,
.theme-pill:focus-visible {
  background: var(--yellow);
  color: var(--navy);
}
.lang-pill {
  all: unset;
  cursor: pointer;
  color: var(--navy);
  background: var(--navy-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s linear, color .15s linear;
}
.lang-pill:hover,
.lang-pill:focus-visible {
  background: var(--yellow);
  color: var(--navy);
}
.lang-pill .lang-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1;
}
.icon-pill {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
}
.icon-pill svg {
  width: 16px;
  height: 16px;
}
.icon-pill .count {
  position: absolute;
  top: -4px;
  right: -5px;
  font-size: 9px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Install pill — only rendered when beforeinstallprompt is available. */
.install-pill {
  all: unset;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--navy);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--yellow);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s linear, color .15s linear;
}
.install-pill:hover,
.install-pill:focus-visible { background: var(--navy); color: var(--yellow); }
.install-pill[hidden] { display: none; }

/* ─── Hero ───────────────────────────────────────────────────────── */
.hero {
  grid-area: hero;
  padding: 10px 14px 0;
  background-image: url("assets/bg-shape.jpg");
  background-size: 360px;
  background-position: center;
  background-repeat: repeat;
  display: flex; flex-direction: column;
  min-height: 0;
}
.hero-inner {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 20px 18px 18px;
  display: flex; flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  box-shadow: var(--shadow);
  width: 100%;
  margin: 0 auto;
}
.app,
.hero,
.hero-inner,
.settings,
.settings-inner,
.bottom {
  max-width: 100%;
}

/* Password display */
.pw-stage {
  flex: 0 0 var(--hero-stage-height);
  display: flex; align-items: center; justify-content: center;
  min-height: var(--hero-stage-height);
  position: relative;
}
.pw {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  word-break: break-all;
  line-height: 1.05;
  letter-spacing: -.01em;
  font-size: clamp(26px, 8.2vw, 40px);
  text-align: center;
  cursor: pointer;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--yellow);
  position: relative;
  transition: opacity .12s linear;
  width: 100%;
}
.pw:not(.hidden) { user-select: all; }
.pw.hidden { user-select: none; }
.pw:hover { opacity: .85; }
.pw .s { color: var(--yellow); }
.pw.hidden {
  font-family: var(--font-mono);
  letter-spacing: .12em;
  font-size: clamp(20px, 6vw, 28px);
}
.pw.hidden.regen-pulse {
  animation: hiddenRegenPulse .72s cubic-bezier(.2, .8, .2, 1);
}

@keyframes hiddenRegenPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(250, 188, 65, 0);
    text-shadow: 0 0 0 rgba(250, 188, 65, 0);
  }
  35% {
    box-shadow: 0 0 0 10px rgba(250, 188, 65, .24);
    text-shadow: 0 0 18px rgba(250, 188, 65, .5);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(250, 188, 65, 0);
    text-shadow: 0 0 0 rgba(250, 188, 65, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw.hidden.regen-pulse {
    animation: none;
    border-bottom-color: #ffd780;
  }
}

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "main pips";
  gap: 7px 10px;
  align-items: center;
}
.stat-main {
  grid-area: main;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}
.stat-main .lvl {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--navy);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.stat-main .time {
  font-size: 12px;
  color: var(--slate);
  white-space: nowrap;
  line-height: 1.35;
}
.info-dot {
  all: unset;
  cursor: help;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.info-dot:hover,
.info-dot:focus-visible {
  background: var(--yellow);
}
.pips {
  grid-area: pips;
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  justify-self: end;
}
.pip {
  width: 14px; height: 5px;
  background: var(--line);
  border-radius: 1px;
  transition: background .15s linear;
}

/* QR panel — replaces password when toggled */
.qr-panel { display: none; }
.qr-panel[data-on="1"] {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 0 0 var(--hero-stage-height);
  min-height: var(--hero-stage-height);
  justify-content: center;
  width: 100%;
}
#qr-svg {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-panel svg {
  background: #fff;
  border-radius: var(--r);
  width: min(clamp(120px, 32vw, 200px), calc(var(--hero-stage-height) - 34px));
  height: min(clamp(120px, 32vw, 200px), calc(var(--hero-stage-height) - 34px));
  max-width: 100%;
  max-height: 100%;
  border: 1px solid var(--line);
}
.qr-cap {
  font-size: 12px;
  color: var(--slate);
  text-align: center;
  margin: 0;
}
.qr-cap b { color: var(--navy); }
.hero-inner[data-qr="1"] .pw-stage { display: none; }

/* Action buttons */
.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.btn {
    all: unset;
    cursor: pointer;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 9px 6px;
    background: var(--navy-soft);
    color: var(--navy);
    border-radius: var(--r);
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    white-space: nowrap;
    transition: background .15s linear, color .15s linear;
    flex-wrap: wrap;
    flex-direction: column;
}
.btn:hover, .btn:focus-visible { background: var(--yellow); color: var(--navy); }
.btn.copied { background: var(--yellow); color: var(--navy); }
.btn.on { background: var(--yellow); color: var(--navy); }
.btn.is-disabled,
.btn:disabled {
  background: #eef1f3;
  color: #8a95a6;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.on.is-disabled,
.btn.on:disabled {
  background: #f3e2b1;
  color: #6e6248;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn .lbl { display: none; }
@media (min-width: 380px) {
  .btn .lbl { display: inline; }
}
.btn.gen-btn {
  background: var(--navy);
  color: #fff;
}
.btn.gen-btn:hover,
.btn.gen-btn:focus-visible {
  background: var(--yellow);
  color: var(--navy);
}

/* Inline tooltips */
.has-tip {
  position: relative;
}
.has-tip::before,
.has-tip::after {
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s linear, transform .14s linear;
}
.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translate(-50%, 4px);
  background: var(--navy);
  color: var(--yellow);
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: .01em;
  text-transform: none;
  max-width: min(260px, calc(100vw - 24px));
  white-space: normal;
  text-align: center;
  padding: 7px 9px;
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(3,39,64,.18);
  z-index: 20;
}
.has-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  transform: translate(-50%, 4px);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--navy);
  z-index: 19;
}
.has-tip:hover::before,
.has-tip:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (hover: none), (pointer: coarse) {
  .has-tip:hover::before,
  .has-tip:hover::after {
    opacity: 0;
    transform: translate(-50%, 4px);
  }
}
html[data-input-mode="keyboard"] .has-tip:focus-visible::before,
html[data-input-mode="keyboard"] .has-tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ─── Settings ───────────────────────────────────────────────────── */
.settings {
  grid-area: settings;
  padding: 12px 16px;
}
.settings-inner {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.setting {
  display: flex; align-items: center; gap: 12px;
}
.setting > .label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--slate);
  width: 72px;
  flex-shrink: 0;
}
.length-row input[type="range"] {
  flex: 1;
  accent-color: var(--yellow);
  height: 4px;
  cursor: pointer;
}
.length-row .val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

.toggles {
  display: flex; gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}
.toggle {
  all: unset;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: var(--r);
  color: var(--slate);
  background: var(--navy-soft);
  letter-spacing: .02em;
  transition: background .15s linear, color .15s linear;
  flex: 1;
  text-align: center;
  min-width: 0;
}
.toggle.on { background: var(--yellow); color: var(--navy); }
.toggle:hover:not(.on) { color: var(--navy); }

.excl {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--slate);
  padding-top: 2px;
}
.excl-label {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.excl input { accent-color: var(--yellow); }
.excl code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--navy-soft);
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: .04em;
}

/* ─── History panel (desktop sidebar) ────────────────────────────── */
.history-panel {
  display: none;
  grid-area: history;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.hist-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px 14px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--slate);
}
.hist-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--navy);
  background: var(--yellow);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.hist-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.hist-list::-webkit-scrollbar { width: 6px; }
.hist-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.hist-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  cursor: pointer;
  transition: background .12s linear;
}
.hist-row:hover,
.hist-row:active { background: var(--navy-soft); margin: 0 -10px; padding: 10px 10px; border-radius: var(--r); border-bottom-color: transparent; }
.hist-row:last-child { border-bottom: 0; }
.hist-row .h-pw {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--navy);
  word-break: break-all;
  grid-column: 1 / -1;
  line-height: 1.35;
  font-weight: 600;
}
.hist-row .h-pw .s { color: var(--yellow); }
.hist-row .h-ts {
  font-size: 10px;
  color: var(--slate);
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
}
.hist-row .h-len {
  font-size: 10px;
  color: var(--slate);
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.hist-empty {
  padding: 28px 0;
  text-align: center;
  color: var(--slate);
  font-size: 12px;
}

/* ─── Bottom rail ────────────────────────────────────────────────── */
.bottom {
  grid-area: bottom;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  background: #fff;
  min-height: 36px;
}
.priv {
  font-size: 11px;
  color: var(--slate);
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: .02em;
  min-width: 0;
  line-height: 1.4;
}
.priv-dot {
  color: var(--yellow);
  font-size: 9px;
  line-height: 1;
  flex-shrink: 0;
  transform: translateY(-0.5px);
}
.priv b { color: var(--navy); font-weight: 700; }
.bottom-cta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mini-cta {
  text-decoration: none;
  color: var(--navy);
  background: var(--navy-soft);
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: lowercase;
  white-space: nowrap;
  transition: background .15s linear, color .15s linear;
}
.mini-cta:hover,
.mini-cta:focus-visible {
  background: var(--yellow);
  color: var(--navy);
}
.mini-cta .cta-mark {
  color: var(--yellow);
  font-size: 10px;
}
.mini-cta:hover .cta-mark,
.mini-cta:focus-visible .cta-mark {
  color: var(--navy);
}
.mini-cta .cta-full { display: none; }
.mini-cta .cta-short { display: inline; }

/* Narrow phones: wrap the topbar controls into two rows */
@media (max-width: 390px) {
  .topbar {
    flex-wrap: nowrap;
    padding: 10px 12px;
    min-height: 48px;
  }
  .brand {
    width: 30px;
    height: 30px;
  }
  .theme-pill,
  .lang-pill,
  .install-pill,
  .hist-pill {
    flex: 0 0 auto;
    justify-content: center;
    min-height: 30px;
  }
  .icon-pill {
    flex: 0 0 30px;
    min-width: 30px;
  }
  .icon-pill svg {
    width: 14px;
    height: 14px;
  }
  .lang-pill .lang-code {
    font-size: 9px;
    letter-spacing: .1em;
  }
  .hist-pill .count {
    padding: 1px 6px;
  }
}

/* Mobile/tablet: prevent hero/actions from overlapping settings. */
@media (max-width: 1023px) {
  body {
    overflow: auto;
  }
  .app {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto auto auto auto;
  }
  .hero-inner {
    flex: 0 0 auto;
  }
}

/* Mobile footer: avoid forcing horizontal overflow */
@media (max-width: 520px) {
  .bottom {
    align-items: flex-start;
  }
  .priv {
    width: 100%;
    white-space: normal;
    line-height: 1.35;
  }
  .bottom-cta {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }
}

/* ════════════════════════════════════════════════════════════════════
   TABLET — 600px+
   Same vertical stack, much more breathing room. Larger type. History
   still hidden behind pill (no room for sidebar without compromise).
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  :root { --hero-stage-height: clamp(190px, 30vh, 280px); }
  .topbar { padding: 16px 28px; min-height: 60px; }
  .brand {
    width: 38px;
    height: 38px;
  }
  .tab-link { display: inline-flex; }
  .hist-pill { font-size: 11px; padding: 8px 12px 8px 14px; }
  .theme-pill { font-size: 11px; padding: 8px 12px; }
  .lang-pill .lang-code { font-size: 11px; }
  .icon-pill {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
  }

  .hero {
    padding: 24px 28px 0;
    flex: 1;
    min-height: 0;
  }
  .hero-inner {
    max-width: 640px;
    padding: 36px 40px 32px;
    gap: 24px;
  }
  .pw { font-size: clamp(40px, 7vw, 58px); padding-bottom: 18px; }
  .pw.hidden { font-size: clamp(28px, 5vw, 38px); }

  .stat-main .lvl { font-size: 17px; }
  .stat-main .time { font-size: 13px; }
  .pip { width: 18px; height: 6px; }

  .actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .btn { font-size: 12px; padding: 14px 14px; min-height: 48px; }
  .btn svg { width: 16px; height: 16px; }

  .settings { padding: 16px 28px 20px; }
  .settings-inner {
    max-width: 640px; margin: 0 auto;
    padding: 22px 28px;
    gap: 16px;
  }
  .setting > .label { width: 90px; font-size: 12px; }
  .toggles { gap: 8px; }
  .toggle { font-size: 14px; padding: 9px 14px; }
  .length-row .val { font-size: 17px; }

  .bottom { padding: 12px 28px; }
  .priv { font-size: 12px; }
  .mini-cta { padding: 7px 10px; font-size: 10px; }
  .mini-cta .cta-full { display: inline; }
  .mini-cta .cta-short { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   DESKTOP — 1024px+
   TWO-COLUMN: hero left (password+actions+generate), sidebar right
   (settings on top, history below, both always visible). History pill
   in topbar is hidden (history is right there in the panel).
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  :root { --hero-stage-height: clamp(220px, 34vh, 340px); }
  body {
    font-size: 15px;
    overflow: hidden;
  }

  .app {
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "topbar    topbar"
      "hero      sidebar"
      "bottom    bottom";
    overflow: hidden;
  }

  .topbar {
    padding: 18px 36px;
    min-height: 68px;
  }
  .brand {
    width: 40px;
    height: 40px;
  }
  .hist-pill { display: none; }

  /* Hero column (left): centred, background pattern shows through */
  .hero {
    padding: 36px 36px;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
  }
  .hero-inner {
    max-width: 720px;
    padding: 44px 48px 36px;
    gap: 28px;
  }
  .pw { font-size: clamp(54px, 5.6vw, 76px); padding-bottom: 22px; }
  .pw.hidden { font-size: clamp(36px, 4vw, 50px); }

  .stat-main .lvl { font-size: 19px; }
  .stat-main .time { font-size: 14px; }
  .pip { width: 20px; height: 6px; }

  .actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .btn { font-size: 12px; padding: 14px 18px; min-height: 50px; }
  .btn svg { width: 16px; height: 16px; }

  /* Sidebar (right): always-visible panel containing settings + history */
  .sidebar-stack {
    display: grid;
    grid-area: sidebar;
    background: #fff;
    border-left: 1px solid var(--line);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "settings"
      "history";
    overflow: hidden;
    min-height: 0;
  }
  .settings {
    padding: 0;
    grid-area: settings;
  }
  .settings-inner {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px 28px 22px;
    gap: 16px;
    max-width: none;
  }
  .setting > .label { width: 76px; }
  .toggle { font-size: 13px; padding: 8px 10px; }
  .length-row .val { font-size: 16px; }

  .history-panel {
    display: flex;
    grid-area: history;
  }

  .bottom { padding: 12px 36px; }
}

/* ════════════════════════════════════════════════════════════════════
   WIDE DESKTOP — 1440px+
   Cap the hero column content so the password doesn't sprawl too wide.
   Slightly wider sidebar.
   ══════════════════════════════════════════════════════════════════ */
@media (min-width: 1440px) {
  .app {
    grid-template-columns: minmax(0, 1fr) 440px;
  }
  .hero-inner { max-width: 800px; padding: 56px 56px 42px; gap: 32px; }
  .pw { font-size: clamp(64px, 5.2vw, 92px); }
  .hist-head { padding: 28px 32px 16px; }
  .hist-list { padding: 0 32px 24px; }
  .settings-inner { padding: 28px 32px 24px; }
  .topbar { padding: 22px 44px; }
  .bottom { padding: 14px 44px; }
}

/* ════════════════════════════════════════════════════════════════════
   SHORT VIEWPORTS — landscape phones, etc.
   Prevent the card from being squished.
   ══════════════════════════════════════════════════════════════════ */
@media (max-height: 620px) and (max-width: 1023px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
}
@media (max-height: 760px) and (max-width: 1023px) {
  :root { --hero-stage-height: clamp(112px, 22vh, 170px); }
  .hero { padding-top: 8px; }
  .hero-inner {
    padding: 14px 14px 12px;
    gap: 10px;
  }
  .pw { padding-bottom: 10px; }
  .stats { row-gap: 4px; }
  .actions { gap: 4px; }
  .btn {
    min-height: 36px;
    padding: 7px 5px;
  }
  .gen-btn {
    min-height: 40px;
    padding: 10px 14px;
  }
}

/* ════════════════════════════════════════════════════════════════════
   History sheet (mobile + tablet only — desktop has the side panel)
   ══════════════════════════════════════════════════════════════════ */
.sheet-back {
  position: fixed; inset: 0;
  background: rgba(4, 57, 94, .42);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s linear;
}
.sheet-back.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 81;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  max-height: 78dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -12px 40px rgba(4,57,94,.18);
}
.sheet.show { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 12px;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--navy);
}
.sheet-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--navy);
  background: var(--yellow);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  margin-right: auto;
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
}
.sheet-close {
  all: unset;
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--slate);
  transition: background .15s linear, color .15s linear;
}
.sheet-close:hover { background: var(--navy-soft); color: var(--navy); }
.sheet-body {
  padding: 0 22px 24px;
  overflow-y: auto;
  flex: 1;
}
.sheet-body .hist-row { padding: 12px 0; }
.sheet-body .hist-row:hover { margin: 0; padding: 12px 0; background: transparent; border-radius: 0; border-bottom: 1px solid var(--line); }
.estimator-sheet .sheet-head {
  justify-content: space-between;
}
.estimator-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.estimator-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

/* Tabs inside the info sheet */
.tablist {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--navy-soft);
  border-radius: var(--r);
}
.tab {
  all: unset;
  cursor: pointer;
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--slate);
  padding: 8px 10px;
  border-radius: 3px;
  transition: background .15s linear, color .15s linear;
}
.tab[aria-selected="true"] {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 2px rgba(4, 57, 94, .12);
}
.tab:hover:not([aria-selected="true"]) { color: var(--navy); }

.tabpanel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tabpanel[hidden] { display: none; }

/* Scenario pills (Otpornost tab) — grid layout: name + time on first row, note below */
.scenario-pills {
  display: grid;
  gap: 6px;
}
.scenario-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name time"
    "note time";
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  background: var(--navy-soft);
  color: var(--navy);
  border-radius: var(--r);
  padding: 9px 12px;
}
.scenario-pill .sp-name {
  grid-area: name;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--navy);
}
.scenario-pill .sp-note {
  grid-area: note;
  font-size: 11px;
  color: var(--slate);
  line-height: 1.3;
}
.scenario-pill .sp-time {
  grid-area: time;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  justify-self: end;
}

.advanced-table-wrap summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--navy);
}
.advanced-table-wrap summary::marker { color: var(--yellow); }
.adv-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
}
.adv-table th,
.adv-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 7px 4px;
  vertical-align: top;
}
.adv-table th {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--slate);
}

/* "O aplikaciji" tab — content blocks in kompmajstor.eu voice */
.info-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-eyebrow {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: lowercase;
  color: var(--slate);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.info-eyebrow::before {
  content: "●";
  color: var(--yellow);
  font-size: 8px;
  line-height: 1;
  transform: translateY(-1px);
}
.info-h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  line-height: 1.3;
  color: var(--navy);
  letter-spacing: 0;
  text-transform: none;
}
.info-p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.info-p code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--navy-soft);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--ink);
  letter-spacing: 0;
}
.info-p i {
  font-style: italic;
  color: var(--navy);
}
.info-p b {
  color: var(--navy);
  font-weight: 700;
}
.info-negation {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--navy);
}
.info-negation li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-negation li::before {
  content: "●";
  color: var(--yellow);
  font-size: 7px;
  line-height: 1;
}
.info-bullets {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
}
.info-bullets li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.info-bullets li::before {
  content: "●";
  color: var(--yellow);
  font-size: 8px;
  line-height: 1;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.info-bullets b {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .02em;
}
.info-callout {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 13px 14px 14px;
  border-left: 3px solid var(--yellow);
  background: var(--navy-soft);
  border-radius: var(--r);
}
.info-callout .info-eyebrow { color: var(--navy); }
.info-cta {
  display: flex;
  justify-content: flex-start;
  padding-top: 2px;
}
.info-cta .mini-cta { font-size: 10px; padding: 7px 10px; }
.info-cta .mini-cta .cta-full { display: inline; }
.info-cta .mini-cta .cta-short { display: none; }

@media (min-width: 600px) {
  .sheet {
    left: 50%; right: auto; bottom: 50%;
    transform: translate(-50%, calc(50% + 20px));
    width: min(560px, 92vw);
    max-height: 70dvh;
    border-radius: var(--r-lg);
    opacity: 0;
    transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s linear;
    pointer-events: none;
  }
  .sheet.show {
    transform: translate(-50%, 50%);
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 1024px) {
  #sheet, #sheet-back { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════
   Toast
   ══════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  left: 50%; top: 80px;
  transform: translate(-50%, -16px);
  background: var(--navy);
  color: var(--yellow);
  padding: 11px 20px;
  border-radius: var(--r);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s linear, transform .2s linear;
  z-index: 200;
  box-shadow: 0 8px 22px rgba(0,0,0,.2);
  max-width: calc(100vw - 24px);
  white-space: normal;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 1024px) {
  .toast { top: auto; bottom: 60px; }
}

/* ════════════════════════════════════════════════════════════════════
   Utility
   ══════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
  --cream: #0f1620;
  --line: #2a3d51;
  --navy-soft: #223445;
  --slate: #9ab0c6;
  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] body {
  color: #e4edf6;
}
html[data-theme="dark"] .hero {
  background-image: none;
  background-color: #0f1620;
}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .hero-inner,
html[data-theme="dark"] .settings-inner,
html[data-theme="dark"] .history-panel,
html[data-theme="dark"] .bottom,
html[data-theme="dark"] .sidebar-stack,
html[data-theme="dark"] .sheet {
  background: #172332;
  border-color: var(--line);
}
html[data-theme="dark"] .brand,
html[data-theme="dark"] .hist-pill,
html[data-theme="dark"] .lang-pill,
html[data-theme="dark"] .theme-pill,
html[data-theme="dark"] .pw,
html[data-theme="dark"] .stat-main .lvl,
html[data-theme="dark"] .info-dot,
html[data-theme="dark"] .qr-cap b,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .length-row .val,
html[data-theme="dark"] .toggle:hover:not(.on),
html[data-theme="dark"] .excl code,
html[data-theme="dark"] .hist-row .h-pw,
html[data-theme="dark"] .sheet-head h2,
html[data-theme="dark"] .sheet-head .count,
html[data-theme="dark"] .priv b,
html[data-theme="dark"] .mini-cta {
  color: #e4edf6;
}
html[data-theme="dark"] .tab-link,
html[data-theme="dark"] .stat-main .time,
html[data-theme="dark"] .h-ts,
html[data-theme="dark"] .h-len,
html[data-theme="dark"] .priv,
html[data-theme="dark"] .setting > .label,
html[data-theme="dark"] .excl-label,
html[data-theme="dark"] .qr-cap,
html[data-theme="dark"] .sheet-close {
  color: #9ab0c6;
}
html[data-theme="dark"] .hist-pill,
html[data-theme="dark"] .lang-pill,
html[data-theme="dark"] .theme-pill,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .toggle,
html[data-theme="dark"] .mini-cta,
html[data-theme="dark"] .info-dot,
html[data-theme="dark"] .excl code {
  background: #223445;
}
html[data-theme="dark"] .hist-pill:hover,
html[data-theme="dark"] .lang-pill:hover,
html[data-theme="dark"] .lang-pill:focus-visible,
html[data-theme="dark"] .theme-pill:hover,
html[data-theme="dark"] .theme-pill:focus-visible,
html[data-theme="dark"] .btn:hover,
html[data-theme="dark"] .btn:focus-visible,
html[data-theme="dark"] .toggle.on,
html[data-theme="dark"] .mini-cta:hover,
html[data-theme="dark"] .mini-cta:focus-visible,
html[data-theme="dark"] .info-dot:hover,
html[data-theme="dark"] .info-dot:focus-visible {
  background: var(--yellow);
  color: var(--navy);
}
html[data-theme="dark"] .btn.is-disabled,
html[data-theme="dark"] .btn:disabled {
  background: #273645;
  color: #73889b;
}
html[data-theme="dark"] .btn.on.is-disabled,
html[data-theme="dark"] .btn.on:disabled {
  background: #5c4d28;
  color: #d6c38f;
}
html[data-theme="dark"] .pips .pip {
  background: #2f455a;
}
html[data-theme="dark"] .sheet-close:hover {
  background: #223445;
  color: #e4edf6;
}
html[data-theme="dark"] .sheet-back {
  background: rgba(5, 11, 19, .72);
}
html[data-theme="dark"] .has-tip::after {
  background: #102132;
  color: #f8c960;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
}
html[data-theme="dark"] .has-tip::before {
  border-top-color: #102132;
}
html[data-theme="dark"] .sheet-body .hist-row:hover {
  border-bottom-color: var(--line);
}
html[data-theme="dark"] .qr-panel svg {
  background: #ffffff;
  border-color: #95a6b7;
}
html[data-theme="dark"] .brand {
  background: #172332;
}
html[data-theme="dark"] .scenario-pill {
  background: #223445;
  color: #e4edf6;
}
html[data-theme="dark"] .scenario-pill .sp-name,
html[data-theme="dark"] .scenario-pill .sp-time {
  color: #e4edf6;
}
html[data-theme="dark"] .advanced-table-wrap summary {
  color: #e4edf6;
}
html[data-theme="dark"] .tablist { background: #1a2632; }
html[data-theme="dark"] .tab { color: #9ab0c6; }
html[data-theme="dark"] .tab[aria-selected="true"] {
  background: #2a3d51;
  color: #e4edf6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .info-h3,
html[data-theme="dark"] .info-negation,
html[data-theme="dark"] .info-p b,
html[data-theme="dark"] .info-bullets b { color: #ffffff; }
html[data-theme="dark"] .info-p,
html[data-theme="dark"] .info-bullets { color: #d3dee9; }
html[data-theme="dark"] .info-p i { color: #f8c960; }
html[data-theme="dark"] .info-p code {
  background: #223445;
  color: #e4edf6;
}
html[data-theme="dark"] .info-callout { background: #223445; }
html[data-theme="dark"] .info-callout .info-eyebrow { color: #e4edf6; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
